From 53bb89824deaf97095acf6bcc2997aa7141dd573 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 12 Aug 2013 17:25:27 +0200 Subject: check if some encrypted files are left after the app was disabled and warn the user --- lib/util.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 2586ad28320..cc432af62af 100755 --- a/lib/util.php +++ b/lib/util.php @@ -312,6 +312,23 @@ class OC_Util { return $errors; } + /** + * @brief check if there are still some encrypted files stored + * @return boolean + */ + public static function encryptedFiles() { + //check if encryption was enabled in the past + $encryptedFiles = false; + if (OC_App::isEnabled('files_encryption') === false) { + $view = new OC\Files\View('/' . OCP\User::getUser()); + if ($view->file_exists('/files_encryption/keyfiles')) { + $encryptedFiles = true; + } + } + + return $encryptedFiles; + } + /** * Check for correct file permissions of data directory * @return array arrays with error messages and hints -- cgit v1.2.3 From 3972198b61957ccefecd1a9840c9a46fb4e07ae9 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Thu, 15 Aug 2013 11:58:09 +0200 Subject: Cache OC_Util::checkServer() result in session The return value almost never changes but this function is called for every request. --- lib/util.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/util.php') 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; } -- cgit v1.2.3