define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
define('FRIENDICA_VERSION', '2018.08-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
-define('DB_UPDATE_VERSION', 1278);
+define('DB_UPDATE_VERSION', 1279);
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/**
* log levels
* @{
*/
-define('LOGGER_NORMAL', 0);
-define('LOGGER_TRACE', 1);
-define('LOGGER_DEBUG', 2);
-define('LOGGER_DATA', 3);
-define('LOGGER_ALL', 4);
+define('LOGGER_WARNING', 0);
+define('LOGGER_INFO', 1);
+define('LOGGER_TRACE', 2);
+define('LOGGER_DEBUG', 3);
+define('LOGGER_DATA', 4);
+define('LOGGER_ALL', 5);
/* @}*/
/**
return;
}
+ // run the pre_update_nnnn functions in update.php
+ for ($x = $stored + 1; $x <= $current; $x++) {
+ $r = run_update_function($x, 'pre_update');
+ if (!$r) {
+ break;
+ }
+ }
+
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
- // run update routine
- // it update the structure in one call
+ // update the structure in one call
$retval = DBStructure::update(false, true);
if ($retval) {
DBStructure::updateFail(
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
}
- // run any left update_nnnn functions in update.php
+ // run the update_nnnn functions in update.php
for ($x = $stored + 1; $x <= $current; $x++) {
- $r = run_update_function($x);
+ $r = run_update_function($x, 'update');
if (!$r) {
break;
}
return;
}
-function run_update_function($x)
+function run_update_function($x, $prefix)
{
- if (function_exists('update_' . $x)) {
+ $funcname = $prefix . '_' . $x;
+
+ if (function_exists($funcname)) {
// There could be a lot of processes running or about to run.
// We want exactly one process to run the update command.
// So store the fact that we're taking responsibility
// If the update fails or times-out completely you may need to
// delete the config entry to try again.
- $t = Config::get('database', 'update_' . $x);
+ $t = Config::get('database', $funcname);
if (!is_null($t)) {
return false;
}
- Config::set('database', 'update_' . $x, time());
+ Config::set('database', $funcname, time());
// call the specific update
-
- $func = 'update_' . $x;
- $retval = $func();
+ $retval = $funcname();
if ($retval) {
//send the administrator an e-mail
);
return false;
} else {
- Config::set('database', 'update_' . $x, 'success');
- Config::set('system', 'build', $x);
+ Config::set('database', $funcname, 'success');
+
+ if ($prefix == 'update') {
+ Config::set('system', 'build', $x);
+ }
+
return true;
}
} else {
- Config::set('database', 'update_' . $x, 'success');
- Config::set('system', 'build', $x);
+ Config::set('database', $funcname, 'success');
+
+ if ($prefix == 'update') {
+ Config::set('system', 'build', $x);
+ }
+
return true;
}
}