X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConsole%2FDatabaseStructure.php;h=4b607c1e6a36918c07d1957536c9c1da36dedd37;hb=a8d3a4d218b9c844b7a5d4134fb7f27d64be559d;hp=ee8370dfa154c190c095b2dfd649da273c8d1f5b;hpb=4f2ae8868431952bd3acda1537ee899740cbf205;p=friendica.git diff --git a/src/Core/Console/DatabaseStructure.php b/src/Core/Console/DatabaseStructure.php index ee8370dfa1..4b607c1e6a 100644 --- a/src/Core/Console/DatabaseStructure.php +++ b/src/Core/Console/DatabaseStructure.php @@ -11,9 +11,9 @@ require_once 'boot.php'; require_once 'include/dba.php'; /** - * @brief Does database updates from the command line + * @brief Performs database updates from the command line * - * @author Hypolite Petovan + * @author Hypolite Petovan */ class DatabaseStructure extends \Asika\SimpleConsole\Console { @@ -22,7 +22,7 @@ class DatabaseStructure extends \Asika\SimpleConsole\Console protected function getHelp() { $help = << [-h|--help|-?] [-v] @@ -69,8 +69,6 @@ HELP; $output = DBStructure::update(true, false); break; case "update": - $output = DBStructure::update(true, true); - $build = Core\Config::get('system', 'build'); if (empty($build)) { Core\Config::set('system', 'build', DB_UPDATE_VERSION); @@ -80,9 +78,19 @@ HELP; $stored = intval($build); $current = intval(DB_UPDATE_VERSION); - // run any left update_nnnn functions in update.php + // run the pre_update_nnnn functions in update.php + for ($x = $stored; $x < $current; $x ++) { + $r = run_update_function($x, 'pre_update'); + if (!$r) { + break; + } + } + + $output = DBStructure::update(true, true); + + // run the update_nnnn functions in update.php for ($x = $stored; $x < $current; $x ++) { - $r = run_update_function($x); + $r = run_update_function($x, 'update'); if (!$r) { break; }