diff options
-rw-r--r-- | apis/update.inc.php | 2 | ||||
-rw-r--r-- | inc/taskmanagercallback.inc.php | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/apis/update.inc.php b/apis/update.inc.php index d478c14a..13a5f593 100644 --- a/apis/update.inc.php +++ b/apis/update.inc.php @@ -206,7 +206,7 @@ function update_8() if (!tableHasColumn('configtgz_module', 'version')) Database::exec("ALTER TABLE `configtgz_module` ADD `version` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); if (!tableHasColumn('configtgz_module', 'status')) - Database::exec("ADD `status` ENUM( 'OK', 'MISSING', 'OUTDATED' ) NOT NULL DEFAULT 'MISSING'"); + Database::exec("ALTER TABLE `configtgz_module` ADD `status` ENUM( 'OK', 'MISSING', 'OUTDATED' ) NOT NULL DEFAULT 'MISSING'"); if (!tableHasColumn('callback', 'args')) Database::exec("ALTER TABLE `callback` ADD `args` TEXT NOT NULL DEFAULT ''"); return true; diff --git a/inc/taskmanagercallback.inc.php b/inc/taskmanagercallback.inc.php index a42f4819..8550d845 100644 --- a/inc/taskmanagercallback.inc.php +++ b/inc/taskmanagercallback.inc.php @@ -25,15 +25,19 @@ class TaskmanagerCallback EventLog::warning("addCallback: Not a valid task id: $task"); return; } - if (is_null($args)) - $args = ''; - else - $args = serialize($args); - Database::exec("INSERT INTO callback (taskid, dateline, cbfunction, args) VALUES (:task, UNIX_TIMESTAMP(), :callback, :args)", array( + $data = array( 'task' => $task, 'callback' => $callback, - 'args' => $args - )); + ); + if (Property::getCurrentSchemaVersion() >= 9) { + if (is_null($args)) + $data['args'] = ''; + else + $data['args'] = serialize($args); + Database::exec("INSERT INTO callback (taskid, dateline, cbfunction, args) VALUES (:task, UNIX_TIMESTAMP(), :callback, :args)", $data); + } else { + Database::exec("INSERT INTO callback (taskid, dateline, cbfunction) VALUES (:task, UNIX_TIMESTAMP(), :callback)", $data); + } Property::setNeedsCallback(1); } @@ -44,6 +48,8 @@ class TaskmanagerCallback */ public static function getPendingCallbacks() { + if (Property::getCurrentSchemaVersion() < 9) + return array(); $retval = array(); $res = Database::simpleQuery("SELECT taskid, cbfunction, args FROM callback"); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { |