예제 #1
0
파일: setup.php 프로젝트: apodgorny/minimum
 public static function acceptParameters()
 {
     global $argv;
     if (!isset($argv[1])) {
         die('Please supply path to document root as first parameter' . PHP_EOL);
     }
     if (!file_exists($argv[1]) || !is_dir($argv[1])) {
         die($argv[1] . ' is not a valid directory' . PHP_EOL);
     }
     if (!isset($argv[2])) {
         die('Please (1 or 0) as second parameter to specify if environment is production' . PHP_EOL);
     }
     if (!isset($argv[3])) {
         die('Please supply path to USER_DATA folder as third parameter' . PHP_EOL);
     }
     if (isset($argv[4])) {
         self::$HOST = $argv[4];
     }
     self::$PRODUCTION = (bool) $argv[2];
     self::$DOCUMENT_ROOT = realpath($argv[1]);
     self::$PROJECT_ROOT = implode('/', array_slice(explode('/', __FILE__), 0, -3));
     self::$SITE_PATH = str_replace(self::$DOCUMENT_ROOT, '', self::$PROJECT_ROOT);
     self::$DATA_PATH = $argv[3];
     self::$aDirectories[] = self::$DATA_PATH;
 }