* added parameter --firstrun to use for initial setup. Runs almost by itself..
 * added 'ping home' for statistical purpose
Spell:
 * fixed copy/paste error
This commit is contained in:
Sarjuuk 2015-06-27 18:01:22 +02:00
parent b3f26d9d9d
commit ea538b0040
8 changed files with 387 additions and 90 deletions

View file

@ -23,25 +23,19 @@ require_once 'setup/tools/imagecreatefromblp.func.php';
function finish()
{
if (!getopt('d', ['delete'])) // generated with TEMPORARY keyword. Manual deletion is not needed
CLISetup::log('generated dbc_* - tables kept available', CLISetup::LOG_WARN);
CLISetup::log('generated dbc_* - tables kept available');
// send "i'm in use @" - ping
$u = !empty($_SERVER['USER']) ? $_SERVER['USER'] : 'NULL';
$s = !empty($_SERVER['SSH_CONNECTION']) ? explode(' ', $_SERVER['SSH_CONNECTION'])[2] : 'NULL';
if ($h = @fopen('http://aowow.meedns.com/ref?u='.$u.'&s='.$s, 'r'))
fclose($h);
/* send "i'm in use @" - ping
if ($ch = curl_init('http://aowow.meedns.com/pingback'))
{
$u = !empty($_SERVER['USER']) ? $_SERVER['USER'] : 'NULL';
$s = !empty($_SERVER['SSH_CONNECTION']) ? explode(' ', $_SERVER['SSH_CONNECTION'])[2] : 'NULL';
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "u=".$u."&s=".$s);
curl_exec($ch);
curl_close($ch);
}
*/
die("\n");
}
$scriptOpt = getopt('', ['account', 'dbconfig', 'siteconfig', 'sql', 'build', 'sync', 'update']);
if (!$scriptOpt)
$opt = getopt('h', ['help', 'account', 'dbconfig', 'siteconfig', 'sql', 'build', 'sync', 'update', 'firstrun', 'resume']);
if (!$opt || ((isset($opt['help']) || isset($opt['h'])) && (isset($opt['firstrun']) || isset($opt['resume']))))
{
echo "\nAowow Setup\n";
echo "--dbconfig : set up db connection\n";
@ -51,11 +45,11 @@ if (!$scriptOpt)
echo "--build : create server specific files\n";
echo "--sync=<tabelList,> : regenerate tables/files that depend on given world-table\n";
echo "--update : apply new sql updates fetched from github\n";
// echo "--firstrun : goes through the nessecary hoops of the initial setup. Can be interrupted and --resume'd";
echo "--firstrun : goes through the nessecary hoops of the initial setup. Can be interrupted and --resume'd\n";
echo "additional options\n";
echo "--log logfile : write ouput to file\n";
echo "--locales=<regionCodes,> : limit setup to enUS, frFR, deDE, esES and/or ruRU (does not override config settings)\n";
echo "--mpqDataDir=path/ : manually point to directory with extracted mpq files (default: setup/mpqData/)\n";
echo "--mpqDataDir=path/ : manually point to directory with extracted mpq files; is limited to setup/ (default: setup/mpqData/)\n";
echo "--delete | -d : delete generated dbc_* tables when script finishes\n";
echo "--help | -h : contextual help\n";
die("\n");
@ -63,7 +57,7 @@ if (!$scriptOpt)
else
CLISetup::init();
$cmd = array_pop(array_keys($scriptOpt));
$cmd = array_pop(array_keys($opt));
switch ($cmd) // we accept only one main parameter
{
case 'update':
@ -71,6 +65,12 @@ switch ($cmd) // we accept only one main parameter
update();
return;
case 'firstrun':
case 'resume':
require_once 'setup/tools/clisetup/firstrun.func.php';
firstrun($cmd == 'resume');
finish();
case 'account':
case 'dbconfig':
case 'siteconfig':