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

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2017-03-28 00:39:32 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2017-03-28 00:39:32 +0300
commit8f897b739e5d2a71cc9848b879c4479140f7d410 (patch)
tree87494172a94389dbf0fb3786874fcca9784151ae /core/FileIntegrity.php
parent778899366cc47e93d9fc2836dc1c7741fc818e11 (diff)
split commands after 50 files / directories (#11537)
Diffstat (limited to 'core/FileIntegrity.php')
-rw-r--r--core/FileIntegrity.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/core/FileIntegrity.php b/core/FileIntegrity.php
index c7b1222244..23238e5781 100644
--- a/core/FileIntegrity.php
+++ b/core/FileIntegrity.php
@@ -102,11 +102,17 @@ class FileIntegrity
$messageDirectoriesToDelete .= Piwik::translate('General_ExceptionDirectoryToDelete', $directoryFoundNotExpected) . '<br/>';
}
-
+ $directories = array();
foreach ($directoriesFoundButNotExpected as $directoryFoundNotExpected) {
$directories[] = realpath($directoryFoundNotExpected);
}
- $deleteAllAtOnce = sprintf('rm -Rf %s', implode(' ', $directories));
+
+ $deleteAllAtOnce = array();
+ $chunks = array_chunk($directories, 50);
+
+ foreach ($chunks as $directories) {
+ $deleteAllAtOnce[] = sprintf('rm -Rf %s', implode(' ', $directories));
+ }
$messages[] = Piwik::translate('General_ExceptionUnexpectedDirectory')
. '<br/>'
@@ -116,7 +122,7 @@ class FileIntegrity
. '<br/><br/>'
. Piwik::translate('General_ToDeleteAllDirectoriesRunThisCommand')
. '<br/>'
- . $deleteAllAtOnce
+ . implode('<br />', $deleteAllAtOnce)
. '<br/><br/>';
}
@@ -138,10 +144,17 @@ class FileIntegrity
$messageFilesToDelete .= Piwik::translate('General_ExceptionFileToDelete', $fileFoundNotExpected) . '<br/>';
}
+ $files = array();
foreach ($filesFoundButNotExpected as $fileFoundNotExpected) {
$files[] = '"' . realpath($fileFoundNotExpected) . '"';
}
- $deleteAllAtOnce = sprintf('rm %s', implode(' ', $files));
+
+ $deleteAllAtOnce = array();
+ $chunks = array_chunk($files, 50);
+
+ foreach ($chunks as $files) {
+ $deleteAllAtOnce[] = sprintf('rm %s', implode(' ', $files));
+ }
$messages[] = Piwik::translate('General_ExceptionUnexpectedFile')
. '<br/>'
@@ -151,7 +164,7 @@ class FileIntegrity
. '<br/><br/>'
. Piwik::translate('General_ToDeleteAllFilesRunThisCommand')
. '<br/>'
- . $deleteAllAtOnce
+ . implode('<br />', $deleteAllAtOnce)
. '<br/><br/>';
return $messages;