diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/l10n/sv.js | 2 | ||||
-rw-r--r-- | lib/l10n/sv.json | 2 | ||||
-rw-r--r-- | lib/private/Files/Cache/Propagator.php | 4 | ||||
-rw-r--r-- | lib/private/Files/View.php | 2 | ||||
-rw-r--r-- | lib/private/Repair.php | 2 | ||||
-rw-r--r-- | lib/private/Repair/NC15/SetVcardDatabaseUID.php | 31 |
6 files changed, 28 insertions, 15 deletions
diff --git a/lib/l10n/sv.js b/lib/l10n/sv.js index 2912e855ef3..3d5b8ec3c9a 100644 --- a/lib/l10n/sv.js +++ b/lib/l10n/sv.js @@ -133,7 +133,7 @@ OC.L10N.register( "Can’t set expiration date more than %s days in the future" : "Kan inte sätta utgångsdatum mer än %s dagar framåt", "%1$s shared »%2$s« with you" : "%1$s delade »%2$s« med dig", "%1$s shared »%2$s« with you." : "%1$s delade »%2$s« med dig.", - "Click the button below to open it." : "Klicka knappen nedan för att öppna det.", + "Click the button below to open it." : "Klicka på knappen nedan för att öppna det.", "The requested share does not exist anymore" : "Den begärda delningen finns inte mer", "Could not find category \"%s\"" : "Kunde inte hitta kategorin \"%s\"", "Sunday" : "Söndag", diff --git a/lib/l10n/sv.json b/lib/l10n/sv.json index da2a846c213..5cf82b4b56b 100644 --- a/lib/l10n/sv.json +++ b/lib/l10n/sv.json @@ -131,7 +131,7 @@ "Can’t set expiration date more than %s days in the future" : "Kan inte sätta utgångsdatum mer än %s dagar framåt", "%1$s shared »%2$s« with you" : "%1$s delade »%2$s« med dig", "%1$s shared »%2$s« with you." : "%1$s delade »%2$s« med dig.", - "Click the button below to open it." : "Klicka knappen nedan för att öppna det.", + "Click the button below to open it." : "Klicka på knappen nedan för att öppna det.", "The requested share does not exist anymore" : "Den begärda delningen finns inte mer", "Could not find category \"%s\"" : "Kunde inte hitta kategorin \"%s\"", "Sunday" : "Söndag", diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index 7634029e73f..989a4d0c7d5 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -106,9 +106,9 @@ class Propagator implements IPropagator { ->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT))) ->andWhere($builder->expr()->in('path_hash', $hashParams)) ->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT))); - } - $builder->execute(); + $builder->execute(); + } } protected function getParents($path) { diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 19e38717803..21df67cf557 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1157,7 +1157,7 @@ class View { if ($result && in_array('delete', $hooks) and $result) { $this->removeUpdate($storage, $internalPath); } - if ($result && in_array('write', $hooks) and $operation !== 'fopen') { + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { $this->writeUpdate($storage, $internalPath); } if ($result && in_array('touch', $hooks)) { diff --git a/lib/private/Repair.php b/lib/private/Repair.php index da825c9a7ad..8bb3d3327a6 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -147,7 +147,7 @@ class Repair implements IOutput { new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), - new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()) + new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger()) ]; } diff --git a/lib/private/Repair/NC15/SetVcardDatabaseUID.php b/lib/private/Repair/NC15/SetVcardDatabaseUID.php index 210fc0a862c..cefb1c18111 100644 --- a/lib/private/Repair/NC15/SetVcardDatabaseUID.php +++ b/lib/private/Repair/NC15/SetVcardDatabaseUID.php @@ -25,9 +25,11 @@ namespace OC\Repair\NC15; use OCP\IConfig; use OCP\IDBConnection; +use OCP\ILogger; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; use Sabre\VObject\Reader; +use Sabre\VObject\ParseException; class SetVcardDatabaseUID implements IRepairStep { const MAX_ROWS = 1000; @@ -38,11 +40,15 @@ class SetVcardDatabaseUID implements IRepairStep { /** @var IConfig */ private $config; + /** @var ILogger */ + private $logger; + private $updateQuery; - public function __construct(IDBConnection $connection, IConfig $config) { + public function __construct(IDBConnection $connection, IConfig $config, ILogger $logger) { $this->connection = $connection; $this->config = $config; + $this->logger = $logger; } public function getName() { @@ -75,13 +81,20 @@ class SetVcardDatabaseUID implements IRepairStep { * Extract UID from vcard * * @param string $cardData the vcard raw data + * @param IOutput $output the output logger * @return string the uid or empty if none */ - private function getUID(string $cardData): string { - $vCard = Reader::read($cardData); - if ($vCard->UID) { - $uid = $vCard->UID->getValue(); - return $uid; + private function getUID(string $cardData, IOutput $output): string { + try { + $vCard = Reader::read($cardData); + if ($vCard->UID) { + $uid = $vCard->UID->getValue(); + + return $uid; + } + } catch (ParseException $e) { + $output->warning('One vCard is broken. We logged the exception and will continue the repair.'); + $this->logger->logException($e); } return ''; @@ -106,7 +119,7 @@ class SetVcardDatabaseUID implements IRepairStep { $this->updateQuery->execute(); } - private function repair(): int { + private function repair(IOutput $output): int { $this->connection->beginTransaction(); $entries = $this->getInvalidEntries(); $count = 0; @@ -116,7 +129,7 @@ class SetVcardDatabaseUID implements IRepairStep { if (is_resource($cardData)) { $cardData = stream_get_contents($cardData); } - $uid = $this->getUID($cardData); + $uid = $this->getUID($cardData, $output); $this->update($entry['id'], $uid); } $this->connection->commit(); @@ -133,7 +146,7 @@ class SetVcardDatabaseUID implements IRepairStep { public function run(IOutput $output) { if ($this->shouldRun()) { - $count = $this->repair(); + $count = $this->repair($output); $output->info('Fixed ' . $count . ' vcards'); } |