From: Markus Goetz Date: Thu, 15 Aug 2013 09:58:09 +0000 (+0200) Subject: Cache OC_Util::checkServer() result in session X-Git-Tag: v6.0.0alpha2~321^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3972198b61957ccefecd1a9840c9a46fb4e07ae9;p=nextcloud-server.git Cache OC_Util::checkServer() result in session The return value almost never changes but this function is called for every request. --- diff --git a/lib/util.php b/lib/util.php index b7dc2207e6c..25632ac1ea2 100755 --- a/lib/util.php +++ b/lib/util.php @@ -168,6 +168,10 @@ class OC_Util { * @return array arrays with error messages and hints */ public static function checkServer() { + // Assume that if checkServer() succeeded before in this session, then all is fine. + if(\OC::$session->exists('checkServer_suceeded') && \OC::$session->get('checkServer_suceeded')) + return array(); + $errors=array(); $defaults = new \OC_Defaults(); @@ -309,6 +313,9 @@ class OC_Util { 'hint'=>'Please ask your server administrator to restart the web server.'); } + // Cache the result of this function + \OC::$session->set('checkServer_suceeded', count($errors) == 0); + return $errors; }