Checks if $CFG->behat_wwwroot is available and using same versions for cli and web.

@return void
545302
public static function check_server_status() {
        global $CFG;

        $url = $CFG->behat_wwwroot . '/admin/tool/behat/tests/behat/fixtures/environment.php';

        // Get web versions used by behat site.
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        $statuscode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        if ($statuscode !== 200 || empty($result) || (!$result = json_decode($result, true))) {

            behat_error (BEHAT_EXITCODE_REQUIREMENT, $CFG->behat_wwwroot . ' is not available, ensure you specified ' .
                'correct url and that the server is set up and started.' . PHP_EOL . ' More info in ' .
                behat_command::DOCS_URL . PHP_EOL);
        }

        // Check if cli version is same as web version.
        $clienv = self::get_environment();
        if ($result != $clienv) {
            $output = 'Differences detected between cli and webserver...'.PHP_EOL;
            foreach ($result as $key => $version) {
                if ($clienv[$key] != $version) {
                    $output .= ' ' . $key . ': ' . PHP_EOL;
                    $output .= ' - web server: ' . $version . PHP_EOL;
                    $output .= ' - cli: ' . $clienv[$key] . PHP_EOL;
                }
            }
            echo $output;
            ob_flush();
        }
    }
1106635
private static function checkEnvironment()
    {
        if (version_compare(PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION, '5.6.99', '<')) {
            echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION . PHP_RELEASE_VERSION;
            require __DIR__ . '/ClientException.php';
            throw new ClientException('Incompatible PHP environment. Expecting PHP 7.0 or higher');
        }
    }
112338
public function isAvailable()
    {
        // check if apache module is installed
        if (function_exists('apache_get_modules')) {
            foreach (apache_get_modules() as $name) {
                if (strpos($name, 'geoip') !== false) {
                    return true;
                }
            }
        }

        $available = !empty($_SERVER[self::TEST_SERVER_VAR])
            || !empty($_SERVER[self::TEST_SERVER_VAR_ALT])
            || !empty($_SERVER[self::TEST_SERVER_VAR_ALT_IPV6])
        ;

        if ($available) {
            return true;
        }

        // if not available return message w/ extra info
        if (!function_exists('apache_get_modules')) {
            return Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_AssumingNonApache');
        }

        $message = "<strong>" . Piwik::translate('General_Note') . ':&nbsp;'
            . Piwik::translate('UserCountry_FoundApacheModules')
            . "</strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n";
        foreach (apache_get_modules() as $name) {
            $message .= "<li>$name</li>\n";
        }
        $message .= "</ul>";
        return $message;
    }
639813
public function sure()
    {
        return !(substr($this->args[0], 0, 4) == 'http'
            || substr($this->args[0], 0, 3) == '../'
            || substr($this->args[0], 0, 3) == '\./'
            || substr($this->args[0], 0, 2) == './'
            || substr($this->args[0], 0, 1) == '/'
        );
    }
632401
public static function initialise_cfg() {
        global $DB;
        $dbhash = false;
        try {
            $dbhash = $DB->get_field('config', 'value', array('name'=>'phpunittest'));
        } catch (Exception $e) {
            // not installed yet
            initialise_cfg();
            return;
        }
        if ($dbhash !== core_component::get_all_versions_hash()) {
            // do not set CFG - the only way forward is to drop and reinstall
            return;
        }
        // standard CFG init
        initialise_cfg();
    }
994498
public function isPreferred()
    {
        if (($host = $this->export()) === null) {
            return $this->base === $this->effective;
        }
        $parsed = parse_url($host);
        $new = [
            'scheme' => isset($parsed['scheme']) ? $parsed['scheme'] : parse_url($this->base, PHP_URL_SCHEME),
            'host' => isset($parsed['host']) ? $parsed['host'] : $parsed['path'],
        ];
        $new['port'] = isset($parsed['port']) ? $parsed['port'] : getservbyname($new['scheme'], 'tcp');
        return $this->base == $new['scheme'] . '://' . $new['host'] . ':' . $new['port'];
    }
310387
public static function isSupportedShell()
        {
            if (isset($_ENV['TERM'])) {
                if (isset(self::$_supportedShells[$_ENV['TERM']])) {
                    return true;
                }
            } elseif (isset($_SERVER['TERM'])) {
                if (isset(self::$_supportedShells[$_SERVER['TERM']])) {
                    return true;
                }
            } elseif (isset($_SERVER['ConEmuANSI']) && $_SERVER['ConEmuANSI'] == 'ON') {
                return true;
            }

            return isAke($_SERVER, 'CLI', false);
        }
485255
public static function phpini()
    {
        // disabled
        if (!static::_debug()) {
            return false;
        }

        if (!is_readable(get_cfg_var('cfg_file_path'))) {
            return false;
        }

        // render it
        static::heading("This is a list of the configuration settings read from ", get_cfg_var('cfg_file_path'), ".");

        return static::dump(parse_ini_file(get_cfg_var('cfg_file_path'), true));
    }
1307807
public function isAvailable()
    {
        if (function_exists('apache_get_modules')) {
            foreach (apache_get_modules() as $name) {
                if (strpos($name, 'maxminddb') !== false) {
                    return true;
                }
            }
        }

        $settings = self::getGeoIpServerVars();

        $available = array_key_exists($settings[self::CONTINENT_CODE_KEY], $_SERVER)
            || array_key_exists($settings[self::COUNTRY_CODE_KEY], $_SERVER)
            || array_key_exists($settings[self::REGION_CODE_KEY], $_SERVER)
            || array_key_exists($settings[self::CITY_NAME_KEY], $_SERVER);

        if ($available) {
            return true;
        }

        // if not available return message w/ extra info
        if (!function_exists('apache_get_modules')) {
            return Piwik::translate('General_Note') . ':&nbsp;' . Piwik::translate('UserCountry_AssumingNonApache');
        }

        $message = "<strong>" . Piwik::translate('General_Note') . ':&nbsp;'
            . Piwik::translate('UserCountry_FoundApacheModules')
            . "</strong>:<br/><br/>\n<ul style=\"list-style:disc;margin-left:24px\">\n";
        foreach (apache_get_modules() as $name) {
            $message .= "<li>$name</li>\n";
        }
        $message .= "</ul>";
        return $message;
    }
1195242
public function check_config()
    {
        $this->load_config();

        if (!$this->configured) {
            return;
        }

        $out = $seen = array();

        // iterate over the current configuration
        foreach (array_keys($this->config) as $prop) {
            if ($replacement = $this->replaced_config[$prop]) {
                $out['replaced'][]  = array('prop' => $prop, 'replacement' => $replacement);
                $seen[$replacement] = true;
            }
            else if (!$seen[$prop] && in_array($prop, $this->obsolete_config)) {
                $out['obsolete'][] = array('prop' => $prop);
                $seen[$prop]       = true;
            }
        }

        // the old default mime_magic reference is obsolete
        if ($this->config['mime_magic'] == '/usr/share/misc/magic') {
            $out['obsolete'][] = array(
                'prop'    => 'mime_magic',
                'explain' => "Set value to null in order to use system default"
            );
        }

        // check config dependencies and contradictions
        if ($this->config['enable_spellcheck'] && $this->config['spellcheck_engine'] == 'pspell') {
            if (!extension_loaded('pspell')) {
                $out['dependencies'][] = array(
                    'prop'    => 'spellcheck_engine',
                    'explain' => "This requires the <tt>pspell</tt> extension which could not be loaded."
                );
            }
            else if (!empty($this->config['spellcheck_languages'])) {
                foreach ($this->config['spellcheck_languages'] as $lang => $descr) {
                    if (!@pspell_new($lang)) {
                        $out['dependencies'][] = array(
                            'prop'    => 'spellcheck_languages',
                            'explain' => "You are missing pspell support for language $lang ($descr)"
                        );
                    }
                }
            }
        }

        if ($this->config['log_driver'] == 'syslog') {
            if (!function_exists('openlog')) {
                $out['dependencies'][] = array(
                    'prop'    => 'log_driver',
                    'explain' => "This requires the <tt>syslog</tt> extension which could not be loaded."
                );
            }

            if (empty($this->config['syslog_id'])) {
                $out['dependencies'][] = array(
                    'prop'    => 'syslog_id',
                    'explain' => "Using <tt>syslog</tt> for logging requires a syslog ID to be configured"
                );
            }
        }

        // check ldap_public sources having global_search enabled
        if (is_array($this->config['ldap_public']) && !is_array($this->config['autocomplete_addressbooks'])) {
            foreach ($this->config['ldap_public'] as $ldap_public) {
                if ($ldap_public['global_search']) {
                    $out['replaced'][] = array(
                        'prop'        => 'ldap_public::global_search',
                        'replacement' => 'autocomplete_addressbooks'
                    );
                    break;
                }
            }
        }

        return $out;
    }
554209
public function checkForDCA()
    {
        $binaries = [
            'Darwin' => [
                32 => 'dca-v0.1.0-darwin-10.6-386',
                64 => 'dca-v0.1.0-darwin-10.6-amd64',
            ],
            'Linux' => [
                32 => 'dca-v0.1.0-linux-386',
                64 => 'dca-v0.1.0-linux-amd64',
            ],
        ];

        if (array_key_exists(PHP_OS, $binaries)) {
            $binary = realpath(__DIR__.'/../../../bin/'.$binaries[PHP_OS][PHP_INT_SIZE * 8]);

            $this->dca = $binary;

            return true;
        }

        $this->emit('error', [new DCANotFoundException('No DCA binary was found that is compatible with your operating system and arch.')]);

        return false;
    }
537790
public static function apply_version_and_release() {
        global $CFG;

        if ($CFG->backup_version < backup::VERSION) {
            set_config('backup_version', backup::VERSION);
            set_config('backup_release', backup::RELEASE);
        }
    }
886132
public function check()
    {
        if (!$this->isEnabled()) {
            return;
        }

        $host = $this->container->get('request_stack')->getCurrentRequest()->getHttpHost();
        $console = realpath($this->container->get('kernel')->getProjectDir().'/bin/console');
        $installed = filectime($console);
        $bundles = $this->parseComposer();
        $title = $this->container->getParameter('kunstmaan_admin.website_title');

        $jsonData = json_encode(array(
            'host' => $host,
            'installed' => $installed,
            'bundles' => $bundles,
            'project' => $title,
        ));

        try {
            $client = $this->getClient();
            $response = $client->post($this->webserviceUrl, ['body' => $jsonData]);
            $contents = $response->getBody()->getContents();
            $data = json_decode($contents);

            if (null === $data) {
                return false;
            }

            // Save the result in the cache to make sure we don't do the check too often
            $this->cache->save('version_check', $data, $this->cacheTimeframe);

            return $data;
        } catch (Exception $e) {
            // We did not receive valid json
            return false;
        }
    }
364427
protected function checkBrowserSafari()
    {
        if (stripos($this->_agent, 'Safari') !== false
            && stripos($this->_agent, 'iPhone') === false
            && stripos($this->_agent, 'iPod') === false
        ) {

            $aresult = explode('/', stristr($this->_agent, 'Version'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                $this->setVersion($aversion[0]);
            } else {
                $this->setVersion(self::VERSION_UNKNOWN);
            }
            $this->setBrowser(self::BROWSER_SAFARI);
            return true;
        }
        return false;
    }
417292
private function checkTusVersion() {
        $tusVersion = $this->getRequest()->getHeader('Tus-Resumable');
        if ($tusVersion instanceof \Zend\Http\Header\HeaderInterface) {
            return $tusVersion->getFieldValue() === self::TUS_VERSION;
        }
        return false;
    }
996365
public static function check()
    {
        $route = isset($_GET['_framework_url_']) ? $_GET['_framework_url_'] : '';

        $out = config('maintenance.out', []);

        $out[] = config('panel.route', 'vinala');

        if (config('panel.setup', true)) {
            if (config('maintenance.enabled', false) && !in_array($route, $out)) {
                return static::$enabled = true;
            }
        }

        return static::$enabled = false;
    }
1178356
protected function checkBrowserDooble() {
        if( stripos($this->_agent,'Dooble') !== false ) {
            $aresult  = explode('/',stristr($this->_agent,'Dooble'));
            $aversion = explode(' ',$aresult[1]);
            $this->setVersion($aversion[0]);
            $this->setBrowser(self::BROWSER_DOOBLE);
            return true;
        }
        return false;
    }