]> source.dussan.org Git - nextcloud-server.git/commitdiff
Changed dependency check messages from warnings to notes
authorPhilipp Kapfer <philipp.kapfer@gmx.at>
Thu, 30 May 2013 15:37:47 +0000 (17:37 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Thu, 3 Apr 2014 14:31:54 +0000 (16:31 +0200)
Added check for duplicate dependency check messages to display only the first

apps/files_external/lib/config.php
apps/files_external/lib/ftp.php
apps/files_external/lib/google.php
apps/files_external/lib/smb.php
apps/files_external/lib/webdav.php

index ebc83c7af842f671cb25e116fed08542970da30e..2112266efc42668bccf7068d7d4c4566b1511b89 100755 (executable)
@@ -524,17 +524,50 @@ class OC_Mount_Config {
         * check dependencies
         */
        public static function checkDependencies() {
-               $txt='';
+               $dependencyMessages = array();
                foreach (OC_Mount_Config::$backends as $class => $backend) {
                        if (isset($backend['has_dependencies']) and $backend['has_dependencies'] === true) {
                                $result = $class::checkDependencies();
-                               if ($result !== true) {
-                                       $txt.=$result.'<br />';
+                               if ($result !== true and OC_Mount_Config::findFirstSentence($dependencyMessages, $result) < 0) {
+                                       $dependencyMessages[] = $result;
                                }
                        }
                }
 
-               return $txt;
+               if (count($dependencyMessages) > 0) {
+                       return implode('<br />', $dependencyMessages);
+               }
+               return '';
+       }
+
+       /**
+        * Finds the first string in an array that has the same first sentence (or part thereof)
+        * as a given comparison string
+        * @param $arr array An array of strings
+        * @param $str string The string to find
+        * @return int The position of the first occurrence or -1 if not found
+        */
+       private static function findFirstSentence($arr, $str) {
+               foreach ($arr as $i => $item) {
+                       $itemPos = strpos($item, '.');
+                       $strPos = strpos($str, '.');
+
+                       if ($itemPos < 0 && $strPos < 0) {
+                               $itemPos = strpos($item, ',');
+                               $strPos = strpos($str, ',');
+
+                               if ($itemPos < 0 && $strPos < 0) {
+                                       $itemPos = strlen($item);
+                                       $strPos = strlen($str);
+                               }
+                       }
+
+                       if ($itemPos === $strPos and strncasecmp($item, $str, $itemPos) === 0) {
+                               return $i;
+                       }
+               }
+
+               return -1;
        }
 
        /**
index 43635f7f94e35da0104518d5df350ec25a86ac13..a6a775ff6d121f005f2bc05a45c74b92cc2f1767 100644 (file)
@@ -25,7 +25,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
                        return(true);
                } else {
                        $l = new \OC_L10N('files_external');
-                       return $l->t('<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it.');
+                       return $l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it.');
                }
        }
 
index 936153b35a5b737f172ac7aa0a9c9f9afbda4893..cfb7005c4c72f402d4e41ebf8aa6795a4858b7a0 100644 (file)
@@ -49,7 +49,7 @@ class Google extends \OC\Files\Storage\Common {
                        return true;
                } else {
                        $l = new \OC_L10N('files_external');
-                       return $l->t('<b>Warning:</b> The cURL support in PHP is not enabled or installed. Mounting of Google Drive is not possible. Please ask your system administrator to install it.');
+                       return $l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of Google Drive is not possible. Please ask your system administrator to install it.');
                }
        }
 
index bfe494e867e2a0f6d66c70af5821ecbaadb83c6d..6fb262323ff52623ebc1aa5ca347eb849953d303 100644 (file)
@@ -28,7 +28,7 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
                        }
                }
                $l = new \OC_L10N('files_external');
-               return $l->t('<b>Warning:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.');
+               return $l->t('<b>Note:</b> "smbclient" is not installed. Mounting of CIFS/SMB shares is not possible. Please ask your system administrator to install it.');
        }
 
        public function __construct($params) {
index ac6663133d015f081556cdbe37ba13ffd6bd92e3..0ea7a085041258a1e46c4386ab8188233594ef3b 100644 (file)
@@ -31,7 +31,7 @@ class DAV extends \OC\Files\Storage\Common {
                        return true;
                } else {
                        $l = new \OC_L10N('files_external');
-                       return $l->t('<b>Warning:</b> The cURL support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV is not possible. Please ask your system administrator to install it.');
+                       return $l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV is not possible. Please ask your system administrator to install it.');
                }
        }