diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-02-27 12:44:04 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-02-27 12:44:04 +0100 |
commit | 22bc37cb82368fba912a9e5a5ef0e87017d04b1e (patch) | |
tree | 42a7a13fff923c1df9703300ee830110c40656c4 /lib/private/repair | |
parent | e6abe96374d31ba4c44103b822ee826ea6e5a927 (diff) | |
download | nextcloud-server-22bc37cb82368fba912a9e5a5ef0e87017d04b1e.tar.gz nextcloud-server-22bc37cb82368fba912a9e5a5ef0e87017d04b1e.zip |
Properly forward repair errors and warnings
This makes repair errors and warnings visible for the user when
upgrading on the command line or in the web UI.
Diffstat (limited to 'lib/private/repair')
-rw-r--r-- | lib/private/repair/repairlegacystorages.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/private/repair/repairlegacystorages.php b/lib/private/repair/repairlegacystorages.php index f09ca2b5cdd..027cb68eb1b 100644 --- a/lib/private/repair/repairlegacystorages.php +++ b/lib/private/repair/repairlegacystorages.php @@ -143,6 +143,7 @@ class RepairLegacyStorages extends BasicEmitter { $dataDirId = 'local::' . $dataDir; $count = 0; + $hasWarnings = false; $this->connection->beginTransaction(); @@ -167,6 +168,7 @@ class RepairLegacyStorages extends BasicEmitter { } } catch (\OC\RepairException $e) { + $hasWarnings = true; $this->emit( '\OC\Repair', 'warning', @@ -180,6 +182,7 @@ class RepairLegacyStorages extends BasicEmitter { . ' WHERE `id` NOT LIKE \'%::%\''; $result = $this->connection->executeQuery($sql); $row = $result->fetch(); + // find at least one to make sure it's worth // querying the user list if ((int)$row['c'] > 0) { @@ -213,6 +216,7 @@ class RepairLegacyStorages extends BasicEmitter { } } catch (\OC\RepairException $e) { + $hasWarnings = true; $this->emit( '\OC\Repair', 'warning', @@ -229,6 +233,15 @@ class RepairLegacyStorages extends BasicEmitter { $this->connection->commit(); - $this->config->setAppValue('core', 'repairlegacystoragesdone', 'yes'); + 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') + ); + } else { + // if all were done, no need to redo the repair during next upgrade + $this->config->setAppValue('core', 'repairlegacystoragesdone', 'yes'); + } } } |