$build = DB_UPDATE_VERSION;
}
if ($build != DB_UPDATE_VERSION) {
- proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php');
+ // When we cannot execute the database update via the worker, we will do it directly
+ if (!proc_run(PRIORITY_CRITICAL, 'include/dbupdate.php')) {
+ update_db(get_app());
+ }
}
}
*
* @hooks 'proc_run'
* array $arr
+ *
+ * @return boolean "false" if proc_run couldn't be executed
*/
function proc_run($cmd) {
$args = array();
if (!count($proc_args)) {
- return;
+ return false;
}
// Preserve the first parameter
call_hooks("proc_run", $arr);
if (!$arr['run_cmd'] || ! count($args)) {
- return;
+ return true;
}
$priority = PRIORITY_MEDIUM;
// Quit if there was a database error - a precaution for the update process to 3.5.3
if (dba::errorNo() != 0) {
- return;
+ return false;
}
if (!$found) {
// Should we quit and wait for the poller to be called as a cronjob?
if ($dont_fork) {
- return;
+ return true;
}
// If there is a lock then we don't have to check for too much worker
if (!Lock::set('poller_worker', 0)) {
- return;
+ return true;
}
// If there are already enough workers running, don't fork another one
Lock::remove('poller_worker');
if ($quit) {
- return;
+ return true;
}
// Now call the poller to execute the jobs that we just added to the queue
$args = array("include/poller.php", "no_cron");
$a->proc_run($args);
+
+ return true;
}
function current_theme() {
$r = q("UPDATE `user` SET `account-type` = %d WHERE `page-flags` IN (%d, %d)",
dbesc(ACCOUNT_TYPE_COMMUNITY), dbesc(PAGE_COMMUNITY), dbesc(PAGE_PRVGROUP));
}
-
-function update_1231() {
- // For this special case we have to use the old update routine
- $r = q("ALTER TABLE `workerqueue` ADD `done` tinyint(1) NOT NULL DEFAULT 0");
-}