cache version number parsed from changelog for 5min on tree level

This commit is contained in:
Ralf Becker 2015-11-05 14:18:17 +00:00
parent aa7666baac
commit b0de2d57a6

View File

@ -1167,10 +1167,13 @@ abstract class egw_framework
* @return string
*/
public static function api_version(&$changelog=null)
{
$changelog = EGW_SERVER_ROOT.'/doc/rpm-build/debian.changes';
return egw_cache::getTree(__CLASS__, 'api_version', function() use ($changelog)
{
$version = preg_replace('/[^0-9.]/', '', $GLOBALS['egw_info']['server']['versions']['phpgwapi']);
// parse version from changelog
$changelog = EGW_SERVER_ROOT.'/doc/rpm-build/debian.changes';
$matches = null;
if (($f = fopen($changelog, 'r')) && preg_match('/egroupware-epl \(([0-9.]+)/', fread($f, 80), $matches) &&
version_compare($version, $matches[1], '<'))
@ -1179,6 +1182,7 @@ abstract class egw_framework
fclose($f);
}
return $version;
}, array(), 300);
}
/**