Files
aowow/setup/setup.php
Sarjuuk e164023b8a Setup/DBC
* move dbc structures to separate files and allow loading a specific build
 * handle localized single string fields
 * add cli option for output table name
 * add cli option for wowbuild
2024-06-17 19:59:51 +02:00

66 lines
1.6 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
require_once 'setup/tools/CLISetup.class.php';
require_once 'setup/tools/setupScript.class.php';
require_once 'setup/tools/dbc.class.php';
require_once 'setup/tools/imagecreatefromblp.func.php';
function finish() : void
{
if (CLISetup::getOpt('delete')) // generated with TEMPORARY keyword. Manual deletion is not needed
CLI::write('generated dbc_* - tables have been deleted.', CLI::LOG_INFO);
die("\n");
}
CLISetup::init();
if (!CLISetup::getOpt(0x3))
die(CLISetup::optHelp(0x7));
$cmd = CLISetup::getOpt(0x3)[0]; // get arguments present in argGroup 1 or 2, if set. Pick first.
$s = [];
$b = [];
switch ($cmd) // we accept only one main parameter
{
case 'setup':
case 'sql':
case 'build':
case 'account':
case 'dbconfig':
case 'siteconfig':
require_once 'setup/tools/clisetup/'.$cmd.'.func.php';
$cmd();
finish();
case 'update':
require_once 'setup/tools/clisetup/update.func.php';
update($s, $b); // return true if we do not rebuild stuff
if (!$s && !$b)
finish();
case 'sync':
require_once 'setup/tools/clisetup/sync.func.php';
sync($s, $b);
finish();
case 'dbc':
require_once 'setup/tools/clisetup/dbc.func.php';
$args = [];
foreach ($argv as $i => $str)
if ($i && $str[0] != '-')
$args[] = $str;
dbc($args);
break;
}
?>