summaryrefslogtreecommitdiffstats
path: root/lib/private/Repair/RepairLegacyStorages.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-04-22 15:35:39 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-04-25 15:01:13 +0200
commitc7542c02dbc997d818e984dae23bdf1780843559 (patch)
treeeaa5e6b7230b531a4e5f494544be41449a0100f5 /lib/private/Repair/RepairLegacyStorages.php
parenta4b1d9feee79218268abcb0c20ed16bec82c993c (diff)
downloadnextcloud-server-c7542c02dbc997d818e984dae23bdf1780843559.tar.gz
nextcloud-server-c7542c02dbc997d818e984dae23bdf1780843559.zip
Introduce OCP\Migration\IRepairStep and adopt all repair steps to this new interface - refs #24198
Diffstat (limited to 'lib/private/Repair/RepairLegacyStorages.php')
-rw-r--r--lib/private/Repair/RepairLegacyStorages.php27
1 files changed, 8 insertions, 19 deletions
diff --git a/lib/private/Repair/RepairLegacyStorages.php b/lib/private/Repair/RepairLegacyStorages.php
index ee189110a87..9582629b1a3 100644
--- a/lib/private/Repair/RepairLegacyStorages.php
+++ b/lib/private/Repair/RepairLegacyStorages.php
@@ -24,10 +24,11 @@
namespace OC\Repair;
use OC\Files\Cache\Storage;
-use OC\Hooks\BasicEmitter;
use OC\RepairException;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
-class RepairLegacyStorages extends BasicEmitter {
+class RepairLegacyStorages implements IRepairStep{
/**
* @var \OCP\IConfig
*/
@@ -149,7 +150,7 @@ class RepairLegacyStorages extends BasicEmitter {
* Converts legacy home storage ids in the format
* "local::/data/dir/path/userid/" to the new format "home::userid"
*/
- public function run() {
+ public function run(IOutput $out) {
// only run once
if ($this->config->getAppValue('core', 'repairlegacystoragesdone') === 'yes') {
return;
@@ -186,11 +187,7 @@ class RepairLegacyStorages extends BasicEmitter {
}
catch (RepairException $e) {
$hasWarnings = true;
- $this->emit(
- '\OC\Repair',
- 'warning',
- array('Could not repair legacy storage ' . $currentId . ' automatically.')
- );
+ $out->warning('Could not repair legacy storage ' . $currentId . ' automatically.');
}
}
@@ -233,11 +230,7 @@ class RepairLegacyStorages extends BasicEmitter {
}
catch (RepairException $e) {
$hasWarnings = true;
- $this->emit(
- '\OC\Repair',
- 'warning',
- array('Could not repair legacy storage ' . $storageId . ' automatically.')
- );
+ $out->warning('Could not repair legacy storage ' . $storageId . ' automatically.');
}
}
}
@@ -245,16 +238,12 @@ class RepairLegacyStorages extends BasicEmitter {
} while (count($results) >= $limit);
}
- $this->emit('\OC\Repair', 'info', array('Updated ' . $count . ' legacy home storage ids'));
+ $out->info('Updated ' . $count . ' legacy home storage ids');
$this->connection->commit();
if ($hasWarnings) {
- $this->emit(
- '\OC\Repair',
- 'warning',
- array('Some legacy storages could not be repaired. Please manually fix them then re-run ./occ maintenance:repair')
- );
+ $out->warning('Some legacy storages could not be repaired. Please manually fix them then re-run ./occ maintenance:repair');
} else {
// if all were done, no need to redo the repair during next upgrade
$this->config->setAppValue('core', 'repairlegacystoragesdone', 'yes');