diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-22 15:35:39 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-25 15:01:13 +0200 |
commit | c7542c02dbc997d818e984dae23bdf1780843559 (patch) | |
tree | eaa5e6b7230b531a4e5f494544be41449a0100f5 /lib/private/Repair/RepairInvalidShares.php | |
parent | a4b1d9feee79218268abcb0c20ed16bec82c993c (diff) | |
download | nextcloud-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/RepairInvalidShares.php')
-rw-r--r-- | lib/private/Repair/RepairInvalidShares.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/private/Repair/RepairInvalidShares.php b/lib/private/Repair/RepairInvalidShares.php index beef5e37798..e30b4ab0d31 100644 --- a/lib/private/Repair/RepairInvalidShares.php +++ b/lib/private/Repair/RepairInvalidShares.php @@ -23,23 +23,20 @@ namespace OC\Repair; -use OC\Hooks\BasicEmitter; +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; /** * Repairs shares with invalid data */ -class RepairInvalidShares extends BasicEmitter implements \OC\RepairStep { +class RepairInvalidShares implements IRepairStep { const CHUNK_SIZE = 200; - /** - * @var \OCP\IConfig - */ + /** @var \OCP\IConfig */ protected $config; - /** - * @var \OCP\IDBConnection - */ + /** @var \OCP\IDBConnection */ protected $connection; /** @@ -59,7 +56,7 @@ class RepairInvalidShares extends BasicEmitter implements \OC\RepairStep { * Past bugs would make it possible to set an expiration date on user shares even * though it is not supported. This functions removes the expiration date from such entries. */ - private function removeExpirationDateFromNonLinkShares() { + private function removeExpirationDateFromNonLinkShares(IOutput $out) { $builder = $this->connection->getQueryBuilder(); $builder ->update('share') @@ -69,14 +66,14 @@ class RepairInvalidShares extends BasicEmitter implements \OC\RepairStep { $updatedEntries = $builder->execute(); if ($updatedEntries > 0) { - $this->emit('\OC\Repair', 'info', array('Removed invalid expiration date from ' . $updatedEntries . ' shares')); + $out->info('Removed invalid expiration date from ' . $updatedEntries . ' shares'); } } /** * Remove shares where the parent share does not exist anymore */ - private function removeSharesNonExistingParent() { + private function removeSharesNonExistingParent(IOutput $out) { $deletedEntries = 0; $query = $this->connection->getQueryBuilder(); @@ -105,17 +102,17 @@ class RepairInvalidShares extends BasicEmitter implements \OC\RepairStep { } if ($deletedEntries) { - $this->emit('\OC\Repair', 'info', array('Removed ' . $deletedEntries . ' shares where the parent did not exist')); + $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist'); } } - public function run() { + public function run(IOutput $out) { $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0'); if (version_compare($ocVersionFromBeforeUpdate, '8.2.0.7', '<')) { // this situation was only possible before 8.2 - $this->removeExpirationDateFromNonLinkShares(); + $this->removeExpirationDateFromNonLinkShares($out); } - $this->removeSharesNonExistingParent(); + $this->removeSharesNonExistingParent($out); } } |