]> source.dussan.org Git - nextcloud-server.git/commitdiff
check php version, the encryption app needs php >= 5.3.3
authorBjörn Schießle <schiessle@owncloud.com>
Mon, 1 Jul 2013 10:16:36 +0000 (12:16 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Mon, 1 Jul 2013 10:16:36 +0000 (12:16 +0200)
apps/files_encryption/appinfo/app.php
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/helper.php

index d97811bb791e503052c8a85594d12555772b8920..78b226be0134f8c5d04a80464bdb4a80345bd9b1 100644 (file)
@@ -34,10 +34,9 @@ if (!OC_Config::getValue('maintenance', false)) {
 
                $view = new OC_FilesystemView('/');
 
-               $sessionReady = false;
-               if(extension_loaded("openssl")) {
+               $sessionReady = OCA\Encryption\Helper::checkRequirements();
+               if($sessionReady) {
                        $session = new \OCA\Encryption\Session($view);
-                       $sessionReady = true;
                }
 
                $user = \OCP\USER::getUser();
index e39e068cc5d341897c5621a142262c8e8974e767..786de177e89e27c0d99b70d987023d5d29710b18 100644 (file)
@@ -39,10 +39,10 @@ class Hooks {
         */\r
        public static function login($params) {\r
                $l = new \OC_L10N('files_encryption');\r
-               //check if openssl is available\r
-               if(!extension_loaded("openssl") ) {\r
-                       $error_msg = $l->t("PHP module OpenSSL is not installed.");\r
-                       $hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');\r
+               //check if all requirements are met\r
+               if(!Helper::checkRequirements() ) {\r
+                       $error_msg = $l->t("Missing requirements.");\r
+                       $hint = $l->t('Please make sure that the OpenSSL module and PHP >0 5.3.3 is installed. For now the encryption app was disabled.');\r
                        \OC_App::disable('files_encryption');\r
                        \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);\r
                        \OCP\Template::printErrorPage($error_msg, $hint);\r
index a22c139c503cb694f859e5efec633f3f9d8423c5..f6201c7e5ffcaf5920c541ec9e7fc9c2b2cc434e 100755 (executable)
@@ -208,4 +208,20 @@ class Helper {
                header('Location: ' . $location . '?p=' . $post);
                exit();
        }
+
+
+       /**
+        * check requirements for encryptoin app.
+        * @return bool true if requirements are met
+        */
+       public static function checkRequirements() {
+               $result = true;
+
+               //openssl extension needs to be loaded
+               $result &= extension_loaded("openssl");
+               // we need php >= 5.3.3
+               $result &= version_compare(phpversion(), '5.3.11', '>=');
+
+               return $result;
+       }
 }
\ No newline at end of file