Changed dependency check messages from warnings to notes
Added check for duplicate dependency check messages to display only the first
This commit is contained in:
parent
8ca897df76
commit
46379113a1
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue