diff options
author | Philipp Kapfer <philipp.kapfer@gmx.at> | 2013-05-30 17:37:47 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-03 16:31:54 +0200 |
commit | 46379113a118e8c4c8ed26026f2d2a610380a368 (patch) | |
tree | 3cae129dd6c4d48222166dfdf3173a2ebc2b8a28 | |
parent | 8ca897df76d2a93f66dbe097984eb1e8752410ce (diff) | |
download | nextcloud-server-46379113a118e8c4c8ed26026f2d2a610380a368.tar.gz nextcloud-server-46379113a118e8c4c8ed26026f2d2a610380a368.zip |
Changed dependency check messages from warnings to notes
Added check for duplicate dependency check messages to display only the first
-rwxr-xr-x | apps/files_external/lib/config.php | 41 | ||||
-rw-r--r-- | apps/files_external/lib/ftp.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/google.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/smb.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/webdav.php | 2 |
5 files changed, 41 insertions, 8 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index ebc83c7af84..2112266efc4 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -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; } /** diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php index 43635f7f94e..a6a775ff6d1 100644 --- a/apps/files_external/lib/ftp.php +++ b/apps/files_external/lib/ftp.php @@ -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.'); } } diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index 936153b35a5..cfb7005c4c7 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -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.'); } } diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index bfe494e867e..6fb262323ff 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -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) { diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index ac6663133d0..0ea7a085041 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -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.'); } } |