summaryrefslogtreecommitdiffstats
path: root/inc/taskmanagercallback.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2015-01-21 17:06:23 +0100
committerSimon Rettberg2015-01-21 17:06:23 +0100
commit5f7f8ed2f53ef73a6e350f5a0f1301ede68d505f (patch)
treec0341e12aad950c8894f35a08667cf44d06ee47e /inc/taskmanagercallback.inc.php
parentconfig module structure completed. Many other fixes. Hidden pw field support. (diff)
downloadslx-admin-5f7f8ed2f53ef73a6e350f5a0f1301ede68d505f.tar.gz
slx-admin-5f7f8ed2f53ef73a6e350f5a0f1301ede68d505f.tar.xz
slx-admin-5f7f8ed2f53ef73a6e350f5a0f1301ede68d505f.zip
Fix stupid bug in update query, check DB version before handling callbacks
Diffstat (limited to 'inc/taskmanagercallback.inc.php')
-rw-r--r--inc/taskmanagercallback.inc.php20
1 files changed, 13 insertions, 7 deletions
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)) {