Clickalicious\PhpMemAdmin\App::getMemcachedLatestVersion PHP Method

getMemcachedLatestVersion() protected method

Returns the latest version from memcached official website or 1.0.0 as fallback.
Author: Benjamin Carl ([email protected])
protected getMemcachedLatestVersion ( ) : string
return string The latest version of Memcached from website or 1.0.0 as fallback (timeout)
    protected function getMemcachedLatestVersion()
    {
        if (ini_get('allow_url_fopen') !== '1') {
            throw new Exception('URL aware wrappers are disabled! Check "allow_url_fopen" in your systems php.ini ' . 'OR disable update check in your config.');
        }
        $homepage = file_get_contents(self::MEMCACHED_VERSION_URL);
        $result = preg_match('/<div id="ver">v([\\w\\.].*)<\\/div>/miu', $homepage, $matches);
        if ($result > 0) {
            $result = htmlentities(strip_tags($matches[1]));
        } else {
            $result = '1.0.0';
        }
        return $result;
    }