Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-08-07 11:34:55 +0300
committerMorris Jobke <hey@morrisjobke.de>2020-08-07 11:42:09 +0300
commit545f806666a08fc88ce79380f64571e51e683fd5 (patch)
treecf0bbe064643c593f81d1998a61fdcfd223d257f /core/Command
parent97c49b0b15ab580074a85c8ba82f6d6ab2ee4abf (diff)
Use array_filter instead
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/Preview/Repair.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/Command/Preview/Repair.php b/core/Command/Preview/Repair.php
index 26760cb0e34..852eaeca1d4 100644
--- a/core/Command/Preview/Repair.php
+++ b/core/Command/Preview/Repair.php
@@ -112,30 +112,29 @@ class Repair extends Command {
* by default there could be 0-9 a-f and the old-multibucket folder which are all fine
*/
if ($total < 18) {
- foreach ($directoryListing as $index => $dir) {
+ $directoryListing = array_filter($directoryListing, function ($dir) {
if ($dir->getName() === 'old-multibucket') {
- unset($directoryListing[$index]);
+ return false;
}
+
// a-f can't be a file ID -> removing from migration
if (preg_match('!^[a-f]$!', $dir->getName())) {
- unset($directoryListing[$index]);
+ return false;
}
+
if (preg_match('!^[0-9]$!', $dir->getName())) {
// ignore folders that only has folders in them
if ($dir instanceof Folder) {
- $hasFile = false;
foreach ($dir->getDirectoryListing() as $entry) {
if (!$entry instanceof Folder) {
- $hasFile = true;
- break;
+ return true;
}
}
- if (!$hasFile) {
- unset($directoryListing[$index]);
- }
+ return false;
}
}
- }
+ return true;
+ });
$total = count($directoryListing);
}