CLISetup:
- access setup via 'php aowow' - index.php is now strictly for page display
This commit is contained in:
parent
b3441b6e84
commit
72c4cb2e8b
5 changed files with 42 additions and 33 deletions
12
aowow
Normal file
12
aowow
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
require 'includes/shared.php';
|
||||
|
||||
if (!CLI)
|
||||
die("this script must be run from CLI\n");
|
||||
if (CLI && getcwd().DIRECTORY_SEPARATOR.'aowow' != __FILE__)
|
||||
die("this script must be run from root directory\n");
|
||||
else
|
||||
require 'setup/setup.php';
|
||||
|
||||
?>
|
||||
26
includes/shared.php
Normal file
26
includes/shared.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
define('AOWOW_REVISION', 1);
|
||||
define('CLI', PHP_SAPI === 'cli');
|
||||
|
||||
|
||||
$reqExt = ['SimpleXML', 'gd', 'mysqli', 'mbstring'];
|
||||
$error = '';
|
||||
foreach ($reqExt as $r)
|
||||
if (!extension_loaded($r))
|
||||
$error .= 'Required Extension <b>'.$r."</b> was not found. Please check if it should exist, using \"<i>php -m</i>\"\n\n";
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.5.0') < 0)
|
||||
$error .= 'PHP Version <b>5.5.0</b> or higher required! Your version is <b>'.PHP_VERSION."</b>.\nCore functions are unavailable!\n";
|
||||
|
||||
if ($error)
|
||||
{
|
||||
echo CLI ? strip_tags($error) : $error;
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
// include all necessities, set up basics
|
||||
require_once 'includes/kernel.php';
|
||||
|
||||
?>
|
||||
33
index.php
33
index.php
|
|
@ -1,38 +1,9 @@
|
|||
<?php
|
||||
|
||||
define('AOWOW_REVISION', 1);
|
||||
define('CLI', PHP_SAPI === 'cli');
|
||||
|
||||
|
||||
$reqExt = ['SimpleXML', 'gd', 'mysqli', 'mbstring'];
|
||||
$error = '';
|
||||
foreach ($reqExt as $r)
|
||||
if (!extension_loaded($r))
|
||||
$error .= 'Required Extension <b>'.$r."</b> was not found. Please check if it should exist, using \"<i>php -m</i>\"\n\n";
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.5.0') < 0)
|
||||
$error .= 'PHP Version <b>5.5.0</b> or higher required! Your version is <b>'.PHP_VERSION."</b>.\nCore functions are unavailable!\n";
|
||||
|
||||
// not in root dir
|
||||
if (CLI && getcwd().DIRECTORY_SEPARATOR.'index.php' != __FILE__)
|
||||
$error .= "Aowow must be used from root directory\n";
|
||||
|
||||
if ($error)
|
||||
{
|
||||
echo CLI ? strip_tags($error) : $error;
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
// include all necessities, set up basics
|
||||
require_once 'includes/kernel.php';
|
||||
|
||||
require 'includes/shared.php';
|
||||
|
||||
if (CLI)
|
||||
{
|
||||
require 'setup/setup.php';
|
||||
die();
|
||||
}
|
||||
die("this script must not be run from CLI.\nto setup aowow use 'php aowow'\n");
|
||||
|
||||
|
||||
// maybe add additional setup checks?
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class FileGen
|
|||
|
||||
public static function printCLIHelp()
|
||||
{
|
||||
echo "\nusage: php index.php --build=<subScriptList,> [-h --help] [-f --force]\n\n";
|
||||
echo "\nusage: php aowow --build=<subScriptList,> [-h --help] [-f --force]\n\n";
|
||||
echo "--build : available subScripts:\n";
|
||||
foreach (array_merge(array_keys(self::$tplFiles), array_keys(self::$datasets)) as $s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class SqlGen
|
|||
|
||||
public static function printCLIHelp()
|
||||
{
|
||||
echo "\nusage: php index.php --sql=<tableList,> [-h --help]\n\n";
|
||||
echo "\nusage: php aowow --sql=<tableList,> [-h --help]\n\n";
|
||||
echo "--sql : available tables:\n";
|
||||
foreach (self::$tables as $t => $info)
|
||||
echo " * ".str_pad($t, 24).(isset($info[3]) ? ' - TC deps: '.implode(', ', $info[3]) : '').(isset($info[2]) ? ' - Aowow deps: '.implode(', ', $info[2]) : '')."\n";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue