]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cache OC_Util::checkServer() result in session
authorMarkus Goetz <markus@woboq.com>
Thu, 15 Aug 2013 09:58:09 +0000 (11:58 +0200)
committerMarkus Goetz <markus@woboq.com>
Thu, 15 Aug 2013 09:58:09 +0000 (11:58 +0200)
The return value almost never changes but this function
is called for every request.

lib/util.php

index b7dc2207e6c17a8a768a605c540754fe150a4f0a..25632ac1ea229ec8a31e8aea0b463dfa434266d5 100755 (executable)
@@ -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;
        }