コード例 #1
0
ファイル: bootloader.php プロジェクト: Superbeest/Core
/**
* This function checks the requirements for the system. Should not be called manually.
*/
function __requirements()
{
    \System\Version::registerRequiredConfigDirective('DATABASE_HOST');
    \System\Version::registerRequiredConfigDirective('DATABASE_USER');
    \System\Version::registerRequiredConfigDirective('DATABASE_PASS');
    \System\Version::registerRequiredConfigDirective('DATABASE_NAME');
    \System\Version::registerRequiredConfigDirective('DATABASE_PORT');
    \System\Version::registerRequiredConfigDirective('DATABASE_PERSISTANT');
    \System\Version::registerRequiredConfigDirective('PERMABAN_HOST');
    \System\Version::registerRequiredConfigDirective('PERMABAN_USER');
    \System\Version::registerRequiredConfigDirective('PERMABAN_PASS');
    \System\Version::registerRequiredConfigDirective('PERMABAN_NAME');
    \System\Version::registerRequiredConfigDirective('PERMABAN_PORT');
    \System\Version::registerRequiredConfigDirective('SITE_IDENTIFIER');
    \System\Version::registerRequiredConfigDirective('SITE_EMAIL');
    \System\Version::registerRequiredConfigDirective('SITE_NAMESPACE');
    \System\Version::registerRequiredConfigDirective('PUBLIC_ROOT');
    \System\Version::registerRequiredConfigDirective('DEFAULT_MODULES');
    \System\Version::registerRequiredConfigDirective('MINIFY_ENABLE');
    \System\Version::registerRequiredConfigDirective('AVAILABLE_LANGUAGES');
    \System\Version::registerRequiredConfigDirective('DEFAULT_LANGUAGE');
    if (version_compare(PHP_VERSION, SYSTEM_MINIMUM_PHP_VERSION) < 0) {
        throw new \System\Error\Exception\SystemException('The configuration is invalid: We need at least PHP ' . SYSTEM_MINIMUM_PHP_VERSION . ' in order to run.');
    }
    if (mb_strlen(SITE_IDENTIFIER) < 3 || mb_strlen(SITE_IDENTIFIER) > 4) {
        throw new \System\Error\Exception\SystemException('The configuration is invalid: SITE_IDENTIFIER must be 3 or 4 chars.');
    }
    if (!defined('LUTCACHE_CACHE')) {
        define('LUTCACHE_CACHE', \System\Cache\LUTCache\Types::CACHE_NONE);
    } else {
        if (LUTCACHE_CACHE != \System\Cache\LUTCache\Types::CACHE_NONE && LUTCACHE_CACHE != \System\Cache\LUTCache\Types::CACHE_MEMCACHE && LUTCACHE_CACHE != \System\Cache\LUTCache\Types::CACHE_APC) {
            throw new \System\Error\Exception\SystemException('The configuration is invalid: LUTCACHE_CACHE is invalid.');
        }
    }
    if (!function_exists('curl_init')) {
        throw new \System\Error\Exception\SystemException('This system requires the cURL PHP module to be present. Please reconfigure your PHP.');
    }
    if (!class_exists('\\XSLTProcessor')) {
        throw new \System\Error\Exception\SystemException('This system required the XSL PHP module to be present. Please reconfigure your PHP.');
    }
    //load the modules from the config file
    $defaultModules = unserialize(DEFAULT_MODULES);
    if (\System\Type::getType($defaultModules) != \System\Type::TYPE_ARRAY) {
        throw new \System\Error\Exception\SystemException('The configuration is invalid: DEFAULT_MODULES not set or invalid.');
    }
    foreach ($defaultModules as $defaultModule) {
        \System\Module\Module::load($defaultModule);
    }
}