* Moved locks on tag and tag_hub tables to corresponding SQL scripts
* Renamed write() method to msg()
This commit is contained in:
parent
a7b9e0b668
commit
b9e3311486
3 changed files with 10 additions and 11 deletions
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue