Files
aowow/setup/setup.php
Sarjuuk bc71ae762c Setup/Data
* move custom data from setup scripts to DB
 * move strings from DB to locale files
 * use common function to calculate coordinates of dungeon entrances instead of inline sql
 * fixed manual data zones and itemset
 * fixed typos across the board
2022-02-21 23:31:14 +01:00

76 lines
2.0 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':
foreach (CLISetup::getOpt('dbc') as $n)
{
if (empty($n))
continue;
$dbc = new DBC(trim($n), ['temporary' => false]);
if ($dbc->error)
{
CLI::write('CLISetup::loadDBC() - required DBC '.$n.'.dbc not found!', CLI::LOG_ERROR);
return false;
}
if (!$dbc->readFile())
{
CLI::write('CLISetup::loadDBC() - DBC '.$n.'.dbc could not be written to DB!', CLI::LOG_ERROR);
return false;
}
}
break;
}
?>