Cache OC_Util::checkServer() result in session

The return value almost never changes but this function
is called for every request.
This commit is contained in:
Markus Goetz 2013-08-15 11:58:09 +02:00
parent 680ac48856
commit 3972198b61

View File

@ -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;
}