Skip to content

Commit

Permalink
[FEATURE] Show offline storages as warning in UniqueStorageTest or er…
Browse files Browse the repository at this point in the history
…ror, if only offline on foreign
  • Loading branch information
vertexvaar committed Nov 11, 2016
1 parent d4fcb7b commit de9f9cd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Classes/Testing/Tests/Fal/UniqueStorageTargetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ public function run()
$affectedStorages = array();
$failedUploads = array();

$skippedStorages = array();
$foreignOffline = array();

foreach ($keys as $key) {
$storageObject = $resourceFactory->getStorageObject($key, $storages['local'][$key]);
if (!$storageObject->isOnline()) {
$skippedStorages[] = $storageObject->getName();
continue;
}
$driverProperty = new PropertyReflection(get_class($storageObject), 'driver');
Expand All @@ -82,6 +86,7 @@ public function run()
$foreignDriver->setStorageUid($storages['foreign'][$key]['uid']);
$foreignDriver->initialize();
if (!$foreignDriver->isOnline()) {
$foreignOffline[] = $storageObject->getName();
continue;
}

Expand Down Expand Up @@ -117,12 +122,27 @@ public function run()
$messages = array_merge($messages, $affectedStorages);
}

if (!empty($foreignOffline)) {
$messages[] = 'fal.foreign_offline_storages';
$messages = array_merge($messages, $foreignOffline);
}

if (!empty($messages)) {
if (!empty($skippedStorages)) {
$messages[] = 'fal.offline_storage_names';
$messages = array_merge($messages, $skippedStorages);
}
return new TestResult(
'fal.storage_targets_test_error',
TestResult::ERROR,
$messages
);
} elseif (!empty($skippedStorages)) {
return new TestResult(
'fal.storage_targets_test_skipped',
TestResult::WARNING,
array_merge(array('fal.offline_storage_names'), $skippedStorages)
);
}

return new TestResult('fal.storage_targets_okay');
Expand Down
12 changes: 12 additions & 0 deletions Resources/Private/Language/de.locallang.testing.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@
<source>The unique storage target test failed.</source>
<target state="translated">Der Zieldateisystemtest schlug fehl.</target>
</trans-unit>
<trans-unit id="fal.storage_targets_test_skipped">
<source>The unique storage target has skipped one or more storages, because they are offline.</source>
<target state="translated">Der Zieldateisystemtest konnte nicht auf alle Storages angewendet werden, weil mindestens eine offline ist.</target>
</trans-unit>
<trans-unit id="fal.offline_storage_names">
<source>Following Storages are offline:</source>
<target state="translated">Folgende Storages sind offline:</target>
</trans-unit>
<trans-unit id="fal.foreign_offline_storages">
<source>Following Storages are offline only on foreign:</source>
<target state="translated">Folgende Storages sind auf dem entfernten System offline:</target>
</trans-unit>
<trans-unit id="fal.storage_targets_same">
<source>One or more storages on local have the same file system target as the corresponding storage on foreign.</source>
<target state="translated">Eine oder mehrere lokale FAL Storages haben das selbe Dateisystem zum Ziel wie die dazugehörige entfernte FAL Storage(s).</target>
Expand Down
9 changes: 9 additions & 0 deletions Resources/Private/Language/locallang.testing.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@
<trans-unit id="fal.storage_targets_test_error">
<source>The unique storage target test failed.</source>
</trans-unit>
<trans-unit id="fal.storage_targets_test_skipped">
<source>The unique storage target has skipped one or more storages, because they are offline.</source>
</trans-unit>
<trans-unit id="fal.offline_storage_names">
<source>Following Storages are offline:</source>
</trans-unit>
<trans-unit id="fal.foreign_offline_storages">
<source>Following Storages are offline only on foreign:</source>
</trans-unit>
<trans-unit id="fal.storage_targets_same">
<source>One or more storages on local have the same file system target as the corresponding storage on foreign.</source>
</trans-unit>
Expand Down

0 comments on commit de9f9cd

Please sign in to comment.