Exemplo n.º 1
0
function install($argv)
{
    $checkOnly = false;
    $helpOnly = false;
    $quiet = false;
    $installDir = getcwd();
    $version = 'stable';
    $skipNextArg = false;
    foreach ($argv as $i => $arg) {
        if ($skipNextArg) {
            $skipNextArg = false;
            continue;
        }
        if ($arg == '--check') {
            $checkOnly = true;
        } elseif ($arg == '--quiet') {
            $quiet = true;
        } elseif ($arg == '--help' or $arg == '-h') {
            $helpOnly = true;
        } elseif ($arg == '--install-dir') {
            $skipNextArg = true;
            $installDir = trim($argv[$i + 1]);
        } elseif ($arg == '--version') {
            $skipNextArg = true;
            $version = trim($argv[$i + 1]);
            if ($version == 'master') {
                $version = 'default';
            }
        }
    }
    if ($helpOnly) {
        showHelp();
        exit(0);
    }
    $checkResult = checkEnvironment($installDir);
    reportProblems($checkResult, $checkOnly && !$quiet);
    if ($checkOnly || !$checkResult->isOk()) {
        exit($checkResult->getExitCode());
    }
    $exitCode = installPieCrust($version, $installDir, $quiet);
    exit($exitCode);
}
Exemplo n.º 2
0
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 */
function checkEnvironment()
{
    $ENVIRONMENT = $_SERVER["HTTP_HOST"];
    if (substr($ENVIRONMENT, 0, 9) === "localhost") {
        return 'development';
    } else {
        return 'production';
    }
}
define('ENVIRONMENT', checkEnvironment());
/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */
switch (ENVIRONMENT) {
    case 'development':
        error_reporting(-1);
        ini_set('display_errors', 1);
        break;
    case 'testing':
    case 'production':