Prevent fatal error when composer hasn't been run

This commit is contained in:
Matias Griese
2014-08-20 14:51:03 +03:00
parent 77172e7978
commit a6483f0333
2 changed files with 8 additions and 1 deletions

View File

@@ -31,5 +31,8 @@
"Grav\\": "system/src/"
},
"files": ["system/defines.php"]
},
"archive": {
"exclude": ["VERSION"]
}
}

View File

@@ -4,12 +4,16 @@ namespace Grav;
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
exit(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
exit('Please run: <i>composer install -o</i>');
}
use Grav\Common\Grav;
use Grav\Common\Debugger;
// Register the auto-loader.
$loader = require_once __DIR__ . '/vendor/autoload.php';
$loader = require_once $autoload;
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');