Setup/Update

* get files/tables, which need to be regenerated after! applying sql updates
 * small wording change, to make exiting dbConfig feel less like an error occured
This commit is contained in:
Sarjuuk 2016-01-16 10:34:57 +01:00
parent 432223264e
commit c3fe4b0224
2 changed files with 15 additions and 4 deletions

View file

@ -146,7 +146,7 @@ function dbconfig()
else
{
CLISetup::log();
CLISetup::log("db setup aborted", CLISetup::LOG_INFO);
CLISetup::log("leaving db setup...", CLISetup::LOG_INFO);
break 2;
}
}

View file

@ -13,7 +13,7 @@ if (!CLI)
function update()
{
list($date, $part, $sql, $build) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part`, `sql`, `build` FROM ?_dbversion'));
list($date, $part) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part` FROM ?_dbversion'));
CLISetup::log('checking sql updates');
@ -56,8 +56,19 @@ function update()
CLISetup::log($nFiles ? 'applied '.$nFiles.' update(s)' : 'db is already up to date', CLISetup::LOG_OK);
$sql = trim($sql) ? explode(' ', trim($sql)) : [];
$build = trim($build) ? explode(' ', trim($build)) : [];
// fetch sql/build after applying updates, as they may contain sync-prompts
list($sql, $build) = array_values(DB::Aowow()->selectRow('SELECT `sql`, `build` FROM ?_dbversion'));
sleep(1);
$sql = array_unique(explode(' ', trim($sql)));
$build = array_unique(explode(' ', trim($build)));
if ($sql)
CLISetup::log('The following table(s) require syncing: '.implode(', ', $sql));
if ($build)
CLISetup::log('The following file(s) require syncing: '.implode(', ', $build));
return [$sql, $build];
}