Habari\InstallHandler::meets_all_requirements PHP Метод

meets_all_requirements() приватный Метод

Gathers information about the system in order to make sure requirements for install are met
    private function meets_all_requirements()
    {
        // Required extensions, this list will augment with time
        // Even if they are enabled by default, it seems some install turn them off
        // We use the URL in the Installer template to link to the installation page
        $required_extensions = array('date' => 'http://php.net/datetime', 'pdo' => 'http://php.net/pdo', 'hash' => 'http://php.net/hash', 'json' => 'http://php.net/json', 'mbstring' => 'http://php.net/mbstring', 'pcre' => 'http://php.net/pcre', 'session' => 'http://php.net/session', 'simplexml' => 'http://php.net/simplexml', 'spl' => 'http://php.net/spl', 'tokenizer' => 'http://php.net/tokenizer');
        $requirements_met = true;
        /* Check versions of PHP */
        $php_version_ok = version_compare(phpversion(), MIN_PHP_VERSION, '>=');
        $this->theme->assign('php_version_ok', $php_version_ok);
        $this->theme->assign('PHP_OS', PHP_OS);
        $this->theme->assign('PHP_VERSION', phpversion());
        if (!$php_version_ok) {
            $requirements_met = false;
        }
        /* Check for mod_rewrite on Apache */
        $mod_rewrite = true;
        if (function_exists('apache_get_modules') && !in_array('mod_rewrite', apache_get_modules())) {
            $requirements_met = false;
            $mod_rewrite = false;
        }
        $this->theme->assign('mod_rewrite', $mod_rewrite);
        /* Check for required extensions */
        $missing_extensions = array();
        foreach ($required_extensions as $ext_name => $ext_url) {
            if (!extension_loaded($ext_name)) {
                $missing_extensions[$ext_name] = $ext_url;
                $requirements_met = false;
            }
        }
        $this->theme->assign('missing_extensions', $missing_extensions);
        if (extension_loaded('pdo')) {
            /* Check for PDO drivers */
            $pdo_drivers = \PDO::getAvailableDrivers();
            if (!empty($pdo_drivers)) {
                $pdo_drivers = array_combine($pdo_drivers, $pdo_drivers);
                // Include only those drivers that we include database support for
                $pdo_schemas = array_map('basename', Utils::glob(HABARI_PATH . '/system/schema/*', GLOB_ONLYDIR));
                $pdo_schemas = array_combine($pdo_schemas, $pdo_schemas);
                $pdo_drivers = array_intersect_key($pdo_drivers, $pdo_schemas);
                $pdo_missing_drivers = array_diff($pdo_schemas, $pdo_drivers);
                $pdo_drivers_ok = count($pdo_drivers);
                $this->theme->assign('pdo_drivers_ok', $pdo_drivers_ok);
                $this->theme->assign('pdo_drivers', $pdo_drivers);
                $this->theme->assign('pdo_missing_drivers', $pdo_missing_drivers);
            } else {
                $pdo_drivers_ok = false;
                $this->theme->assign('pdo_drivers_ok', $pdo_drivers_ok);
            }
            if (!$pdo_drivers_ok) {
                $requirements_met = false;
            }
        } else {
            $this->theme->assign('pdo_drivers_ok', false);
            $this->theme->assign('pdo_drivers', array());
            $requirements_met = false;
        }
        if ($requirements_met && !@preg_match('/\\p{L}/u', 'a')) {
            $requirements_met = false;
        }
        /**
         * $local_writable is used in the template, but never set in Habari
         * Won't remove the template code since it looks like it should be there
         *
         * This will only meet the requirement so there's no "undefined variable" exception
         */
        $this->theme->assign('local_writable', true);
        return $requirements_met;
    }