|
|
@ -1757,73 +1757,3 @@ function db_definition() { |
|
|
|
|
|
|
|
return($database); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
* run from command line |
|
|
|
*/ |
|
|
|
function dbstructure_run(&$argv, &$argc) { |
|
|
|
global $a; |
|
|
|
|
|
|
|
if (empty($a)) { |
|
|
|
$a = new App(dirname(__DIR__)); |
|
|
|
} |
|
|
|
|
|
|
|
@include ".htconfig.php"; |
|
|
|
require_once "include/dba.php"; |
|
|
|
dba::connect($db_host, $db_user, $db_pass, $db_data); |
|
|
|
unset($db_host, $db_user, $db_pass, $db_data); |
|
|
|
|
|
|
|
if ($argc == 2) { |
|
|
|
switch ($argv[1]) { |
|
|
|
case "dryrun": |
|
|
|
update_structure(true, false); |
|
|
|
return; |
|
|
|
case "update": |
|
|
|
update_structure(true, true); |
|
|
|
|
|
|
|
$build = Config::get('system','build'); |
|
|
|
if (!x($build)) { |
|
|
|
Config::set('system', 'build', DB_UPDATE_VERSION); |
|
|
|
$build = DB_UPDATE_VERSION; |
|
|
|
} |
|
|
|
|
|
|
|
$stored = intval($build); |
|
|
|
$current = intval(DB_UPDATE_VERSION); |
|
|
|
|
|
|
|
// run any left update_nnnn functions in update.php
|
|
|
|
for ($x = $stored; $x < $current; $x ++) { |
|
|
|
$r = run_update_function($x); |
|
|
|
if (!$r) { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Config::set('system','build',DB_UPDATE_VERSION); |
|
|
|
return; |
|
|
|
case "dumpsql": |
|
|
|
print_structure(db_definition()); |
|
|
|
return; |
|
|
|
case "toinnodb": |
|
|
|
convert_to_innodb(); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// print help
|
|
|
|
echo $argv[0]." <command>\n"; |
|
|
|
echo "\n"; |
|
|
|
echo "Commands:\n"; |
|
|
|
echo "dryrun show database update schema queries without running them\n"; |
|
|
|
echo "update update database schema\n"; |
|
|
|
echo "dumpsql dump database schema\n"; |
|
|
|
echo "toinnodb convert all tables from MyISAM to InnoDB\n"; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (array_search(__FILE__,get_included_files())===0) { |
|
|
|
dbstructure_run($_SERVER["argv"],$_SERVER["argc"]); |
|
|
|
killme(); |
|
|
|
} |