summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-11-19 20:26:53 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2016-11-19 20:26:53 +0100
commit78a318d388bfe82e1a3adebeb75ac195cb1334d7 (patch)
tree5815fe69df96b1963c5774a4b40a052abbf58300 /lib
parentccb05dbb170475870e755573f91da6e1914698d5 (diff)
downloadnextcloud-server-78a318d388bfe82e1a3adebeb75ac195cb1334d7.tar.gz
nextcloud-server-78a318d388bfe82e1a3adebeb75ac195cb1334d7.zip
Add test if repair step is already done
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Repair.php3
-rw-r--r--lib/private/Repair/NC11/CleanPreviews.php18
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index c9f8dbfff69..5efbb9f8e2e 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -158,7 +158,8 @@ class Repair implements IOutput{
),
new CleanPreviews(
\OC::$server->getJobList(),
- \OC::$server->getUserManager()
+ \OC::$server->getUserManager(),
+ \OC::$server->getConfig()
),
];
}
diff --git a/lib/private/Repair/NC11/CleanPreviews.php b/lib/private/Repair/NC11/CleanPreviews.php
index 0c6be0165fc..94f5d19b795 100644
--- a/lib/private/Repair/NC11/CleanPreviews.php
+++ b/lib/private/Repair/NC11/CleanPreviews.php
@@ -23,6 +23,7 @@
namespace OC\Repair\NC11;
use OCP\BackgroundJob\IJobList;
+use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Migration\IOutput;
@@ -36,16 +37,22 @@ class CleanPreviews implements IRepairStep {
/** @var IUserManager */
private $userManager;
+ /** @var IConfig */
+ private $config;
+
/**
* MoveAvatars constructor.
*
* @param IJobList $jobList
* @param IUserManager $userManager
+ * @param IConfig $config
*/
public function __construct(IJobList $jobList,
- IUserManager $userManager) {
+ IUserManager $userManager,
+ IConfig $config) {
$this->jobList = $jobList;
$this->userManager = $userManager;
+ $this->config = $config;
}
/**
@@ -56,8 +63,11 @@ class CleanPreviews implements IRepairStep {
}
public function run(IOutput $output) {
- $this->userManager->callForSeenUsers(function(IUser $user) {
- $this->jobList->add(CleanPreviewsBackgroundJob::class, ['uid' => $user->getUID()]);
- });
+ if (!$this->config->getAppValue('core', 'previewsCleanedUp', false)) {
+ $this->userManager->callForSeenUsers(function (IUser $user) {
+ $this->jobList->add(CleanPreviewsBackgroundJob::class, ['uid' => $user->getUID()]);
+ });
+ $this->config->setAppValue('core', 'previewsCleanedUp', 1);
+ }
}
}