diff --git a/updater/Global/Global.js b/updater/Global/Global.js index c69b5b14..675b3b94 100644 --- a/updater/Global/Global.js +++ b/updater/Global/Global.js @@ -68,14 +68,14 @@ var version = function() { var init = function() { var currentVersion = version(); if (app.data.status === "running") { - write("Updater is already running"); + msg("Updater is already running"); return false; } else if (getProperty("version.to") == currentVersion) { - write("Antville installation is already up-to-date"); + msg("Antville installation is already up-to-date"); app.data.status = "finished"; return false; } else if (getProperty("version.from") != currentVersion) { - write("Updater cannot upgrade version " + currentVersion); + msg("Updater cannot upgrade version " + currentVersion); app.data.status = "failed"; return false; } else { @@ -111,7 +111,7 @@ var log = function(str) { return; } -var write = function(str) { +var msg = function(str) { if (str !== undefined) { var now = "[" + new Date + "] "; //app.data.out.insert(0, now + encodeForm(str) + "\n"); @@ -125,7 +125,7 @@ var error = function(exception) { exception && log(exception); var error = db().getLastError(); if (error) { - write(error); + msg(error); app.data.status = "failed"; res.abort(); } @@ -145,7 +145,7 @@ var query = function(type) { } var update = function(tableName) { - write("Updating table " + tableName); + msg("Updating table " + tableName); var sql = renderSkinAsString("convert#" + tableName); sql.split(/\n|\r|\n\r/).forEach(function(line) { if (!line) { @@ -172,6 +172,7 @@ var count = function(sql) { result = db().executeRetrieval(sql); if (result.next()) { count = result.getColumnItem("count(*)"); + msg("Converting " + count + " records"); } result.release(); return count; @@ -202,7 +203,7 @@ var traverse = function(callback) { sql = app.data.query + " limit " + STEP + " offset " + offset; result = db().executeRetrieval(sql); error(); - write(sql); + msg(sql); // FIXME: The hasMoreRows() method does not work as expected rows = result.next(); if (!rows) { diff --git a/updater/Global/convert.js b/updater/Global/convert.js index db132818..4ece73f1 100644 --- a/updater/Global/convert.js +++ b/updater/Global/convert.js @@ -177,7 +177,6 @@ convert.tags = function(table) { case "content": prototype = "Story"; break; } - execute("lock tables tag, tag_hub, content, image write"); retrieve("select site_id, topic from " + table + " where topic is not null group by topic"); traverse(function() { @@ -196,7 +195,6 @@ convert.tags = function(table) { ", tagged_type = " + quote(prototype) + ", user_id = " + this.modifier_id || this.creator_id); }); - execute("unlock tables"); } convert.skins = function() { diff --git a/updater/Global/convert.skin b/updater/Global/convert.skin index 799c5907..d624e0d3 100644 --- a/updater/Global/convert.skin +++ b/updater/Global/convert.skin @@ -141,7 +141,7 @@ FILE_DESCRIPTION as description from file order by id <% #AV_IMAGE %> alter table AV_IMAGE rename image; -lock tables image write; +lock tables image, tag, tag_hub write; alter table image drop index IDX_IMAGE_F_USER_CREATOR; alter table image drop index IDX_IMAGE_MIXED; alter table image add column `parent_id` varchar(20) default NULL; @@ -359,7 +359,7 @@ unlock tables; <% #AV_TEXT %> alter table AV_TEXT rename content; -lock tables content write; +lock tables content, tag, tag_hub write; alter table content drop index IDX_TEXT_F_TEXT_PARENT; alter table content drop index IDX_TEXT_F_USER_CREATOR; alter table content drop index IDX_TEXT_MIXED_ALL;