mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Misc
* squash some more php warnings during setup * automaticly sync if required by updates
This commit is contained in:
@@ -31,7 +31,7 @@ function dbconfig() : void
|
|||||||
DB::test($dbInfo, $errStr);
|
DB::test($dbInfo, $errStr);
|
||||||
|
|
||||||
$buff .= $errStr ? CLI::red('ERR ') : CLI::green('OK ');
|
$buff .= $errStr ? CLI::red('ERR ') : CLI::green('OK ');
|
||||||
$buff .= 'mysqli://'.$dbInfo['user'].':'.str_pad('', mb_strlen($dbInfo['pass']), '*').'@'.$dbInfo['host'].($port ? ':'.$port : null).'/'.$dbInfo['db'];
|
$buff .= 'mysqli://'.$dbInfo['user'].':'.str_pad('', mb_strlen($dbInfo['pass']), '*').'@'.$dbInfo['host'].'/'.$dbInfo['db'];
|
||||||
$buff .= ($dbInfo['prefix'] ? ' table prefix: '.$dbInfo['prefix'] : null).' '.$errStr;
|
$buff .= ($dbInfo['prefix'] ? ' table prefix: '.$dbInfo['prefix'] : null).' '.$errStr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ function setup() : void
|
|||||||
/* define steps */
|
/* define steps */
|
||||||
/****************/
|
/****************/
|
||||||
|
|
||||||
|
$upd = [[], []]; // ref to pass commands from 'update' to 'sync'
|
||||||
$steps = array(
|
$steps = array(
|
||||||
// clisetup, params, test function, introText, errorText
|
// clisetup, params, test function, introText, errorText
|
||||||
['dbconfig', null, 'testDB', 'Please enter your database credentials.', 'could not establish connection to:'],
|
['dbconfig', [null], 'testDB', 'Please enter your database credentials.', 'could not establish connection to:'],
|
||||||
['siteconfig', null, 'testSelf', 'SITE_HOST and STATIC_HOST '.CLI::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT or LOCALES.', 'could not access:'],
|
['siteconfig', [null], 'testSelf', 'SITE_HOST and STATIC_HOST '.CLI::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT or LOCALES.', 'could not access:'],
|
||||||
// sql- and build- stuff here
|
// sql- and build- stuff here
|
||||||
['SqlGen::generate', 'areatrigger', null, null, null],
|
['SqlGen::generate', 'areatrigger', null, null, null],
|
||||||
['SqlGen::generate', 'achievementcriteria', null, null, null],
|
['SqlGen::generate', 'achievementcriteria', null, null, null],
|
||||||
@@ -98,8 +99,9 @@ function setup() : void
|
|||||||
['FileGen::generate', 'profiler', null, null, null],
|
['FileGen::generate', 'profiler', null, null, null],
|
||||||
['FileGen::generate', 'weightPresets', null, null, null],
|
['FileGen::generate', 'weightPresets', null, null, null],
|
||||||
// apply sql-updates from repository
|
// apply sql-updates from repository
|
||||||
['update', null, null, null, null],
|
['update', &$upd, null, null, null],
|
||||||
['account', null, 'testAcc', 'Please create your admin account.', 'There is no user with administrator privileges in the DB.']
|
['sync', &$upd, null, null, null],
|
||||||
|
['account', [null], 'testAcc', 'Please create your admin account.', 'There is no user with administrator privileges in the DB.']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -244,7 +246,7 @@ function setup() : void
|
|||||||
if ($startStep)
|
if ($startStep)
|
||||||
{
|
{
|
||||||
|
|
||||||
CLI::write('Found firstrun progression info. (Halted on subscript '.($steps[$startStep][1] ?: $steps[$startStep][0]).')', CLI::LOG_INFO);
|
CLI::write('Found firstrun progression info. (Halted on subscript '.($steps[$startStep][1][0] ? $steps[$startStep][1] : $steps[$startStep][0]).')', CLI::LOG_INFO);
|
||||||
$inp = ['x' => ['continue setup? (y/n)', true, '/y|n/i']];
|
$inp = ['x' => ['continue setup? (y/n)', true, '/y|n/i']];
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (!CLI::read($inp, true) || !$inp || strtolower($inp['x']) == 'n')
|
if (!CLI::read($inp, true) || !$inp || strtolower($inp['x']) == 'n')
|
||||||
@@ -286,7 +288,10 @@ function setup() : void
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$res = call_user_func($step[0], $step[1]);
|
if (strpos($step[0], '::'))
|
||||||
|
$res = call_user_func($step[0], $step[1]);
|
||||||
|
else
|
||||||
|
$res = $step[0](...$step[1]);
|
||||||
|
|
||||||
// check script result
|
// check script result
|
||||||
if ($step[2])
|
if ($step[2])
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ require_once 'setup/tools/clisetup/build.func.php';
|
|||||||
|
|
||||||
function sync(array $s = [], array $b = []) : void
|
function sync(array $s = [], array $b = []) : void
|
||||||
{
|
{
|
||||||
if ((!$s && !$b && !CLISetup::getOpt('sync')) || CLISetup::getOpt('help'))
|
if ((!$s && !$b && !CLISetup::getOpt('sync') && !CLISetup::getOpt('setup')) || CLISetup::getOpt('help'))
|
||||||
{
|
{
|
||||||
CLI::write();
|
CLI::write();
|
||||||
CLI::write(' usage: php aowow --sync=<tableList,> [--locales: --mpqDataDir: --force -f]', -1, false);
|
CLI::write(' usage: php aowow --sync=<tableList,> [--locales: --mpqDataDir: --force -f]', -1, false);
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ if (!CLI)
|
|||||||
if (!isset($setOut['setbonus'][$set['bonus'.$i]]))
|
if (!isset($setOut['setbonus'][$set['bonus'.$i]]))
|
||||||
$setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
|
$setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
|
||||||
else
|
else
|
||||||
foreach ($jsonBonus[$set['spell'.$i]] as $k => $v)
|
Util::arraySumByKey($setOut['setbonus'][$set['bonus'.$i]], $jsonBonus[$set['spell'.$i]]);
|
||||||
@$setOut['setbonus'][$set['bonus'.$i]][$k] += $v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($setOut['setbonus'] as $k => $v)
|
foreach ($setOut['setbonus'] as $k => $v)
|
||||||
|
|||||||
@@ -315,7 +315,8 @@ if (!CLI)
|
|||||||
ini_set('max_execution_time', 30); // max 30sec per image (loading takes the most time)
|
ini_set('max_execution_time', 30); // max 30sec per image (loading takes the most time)
|
||||||
|
|
||||||
$src = null;
|
$src = null;
|
||||||
$img = explode('.', array_pop(explode('/', $f)));
|
$na = explode('/', $f);
|
||||||
|
$img = explode('.', array_pop($na));
|
||||||
array_pop($img); // there are a hand full of images with multiple file endings or random dots in the name
|
array_pop($img); // there are a hand full of images with multiple file endings or random dots in the name
|
||||||
$img = implode('.', $img);
|
$img = implode('.', $img);
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ if (!CLI)
|
|||||||
if (!isset($tNums[$talents[$talentIdx]['reqTalent']]))
|
if (!isset($tNums[$talents[$talentIdx]['reqTalent']]))
|
||||||
$depLinks[$talents[$talentIdx]['reqTalent']] = $talentIdx;
|
$depLinks[$talents[$talentIdx]['reqTalent']] = $talentIdx;
|
||||||
|
|
||||||
$r = @[$tNums[$talents[$talentIdx]['reqTalent']], $talents[$talentIdx]['reqRank'] + 1];
|
$r = [$tNums[$talents[$talentIdx]['reqTalent']] ?? 0, $talents[$talentIdx]['reqRank'] + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[$tabIdx]['t'][$talentIdx] = array(
|
$result[$tabIdx]['t'][$talentIdx] = array(
|
||||||
|
|||||||
@@ -230,9 +230,9 @@ SqlGen::register(new class extends SetupScript
|
|||||||
|
|
||||||
$row['bonusParsed'] = serialize($gains);
|
$row['bonusParsed'] = serialize($gains);
|
||||||
foreach (array_column($spells, 0) as $idx => $spellId)
|
foreach (array_column($spells, 0) as $idx => $spellId)
|
||||||
$row['spell'.$idx+1] = $spellId;
|
$row['spell'.($idx+1)] = $spellId;
|
||||||
foreach (array_column($spells, 1) as $idx => $nItems)
|
foreach (array_column($spells, 1) as $idx => $nItems)
|
||||||
$row['bonus'.$idx+1] = $nItems;
|
$row['bonus'.($idx+1)] = $nItems;
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user