separate runtime check to a function
This commit is contained in:
parent
2807c3ce6d
commit
94495614c3
|
|
@ -300,3 +300,20 @@ if (! function_exists('delete_sessions')) {
|
|||
Session::save();
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('runtime_check')) {
|
||||
|
||||
function runtime_check(array $requirements)
|
||||
{
|
||||
// check php version
|
||||
if (version_compare(PHP_VERSION, $requirements['php'], '<')) {
|
||||
exit("[Error] Blessing Skin Server needs PHP version >= {$requirements['php']}, you are now using ".PHP_VERSION);
|
||||
}
|
||||
|
||||
foreach ($requirements['extensions'] as $extension) {
|
||||
if (!extension_loaded($extension)) {
|
||||
exit("[Error] You have not installed the $extension extension");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/autoload.php';
|
||||
|
||||
$app = require_once __DIR__.'/app.php';
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
|
||||
|
|
|
|||
17
index.php
17
index.php
|
|
@ -7,18 +7,13 @@
|
|||
* @author printempw <h@prinzeugen.net>
|
||||
*/
|
||||
|
||||
// runtime check
|
||||
if (version_compare(PHP_VERSION, '5.5.9', '<')) {
|
||||
exit('[Error] Blessing Skin Server needs PHP version >= 5.5.9, you are now using '.PHP_VERSION);
|
||||
}
|
||||
require __DIR__.'/bootstrap/autoload.php';
|
||||
|
||||
if (!class_exists('PDO')) {
|
||||
exit('[Error] You have not installed the PDO extension');
|
||||
}
|
||||
|
||||
if (!function_exists('openssl_encrypt')) {
|
||||
exit('[Error] You have not installed the OpenSSL extension');
|
||||
}
|
||||
// check the runtime environment
|
||||
runtime_check([
|
||||
'php' => '5.5.9',
|
||||
'extensions' => ['pdo_mysql', 'openssl', 'gd']
|
||||
]);
|
||||
|
||||
// handle the request
|
||||
require __DIR__.'/bootstrap/handler.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user