CLISetup:

- access setup via 'php aowow'
 - index.php is now strictly for page display
This commit is contained in:
Sarjuuk 2015-06-02 22:32:58 +02:00
parent b3441b6e84
commit 72c4cb2e8b
5 changed files with 42 additions and 33 deletions

View file

@ -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?