X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fupdater%2FUpdater.php;h=4f557d0f58fabca7429684eadbf3dfcc82bb1f7c;hb=9ef8555ad298668bcb8537ccdd2ab6560f44177f;hp=4c5785281044c7a69ebd790846dca7caed597a1e;hpb=c4ad3d4f061d05a01db25aa54dda830ba776792d;p=github%2Fshaarli%2FShaarli.git diff --git a/application/updater/Updater.php b/application/updater/Updater.php index 4c578528..4f557d0f 100644 --- a/application/updater/Updater.php +++ b/application/updater/Updater.php @@ -88,7 +88,8 @@ class Updater foreach ($this->methods as $method) { // Not an update method or already done, pass. - if (! startsWith($method->getName(), 'updateMethod') + if ( + ! startsWith($method->getName(), 'updateMethod') || in_array($method->getName(), $this->doneUpdates) ) { continue; @@ -121,12 +122,12 @@ class Updater public function readUpdates(string $updatesFilepath): array { - return UpdaterUtils::read_updates_file($updatesFilepath); + return UpdaterUtils::readUpdatesFile($updatesFilepath); } public function writeUpdates(string $updatesFilepath, array $updates): void { - UpdaterUtils::write_updates_file($updatesFilepath, $updates); + UpdaterUtils::writeUpdatesFile($updatesFilepath, $updates); } /** @@ -152,12 +153,13 @@ class Updater $updated = false; foreach ($this->bookmarkService->search() as $bookmark) { - if ($bookmark->isNote() + if ( + $bookmark->isNote() && startsWith($bookmark->getUrl(), '?') && 1 === preg_match('/^\?([a-zA-Z0-9-_@]{6})($|&|#)/', $bookmark->getUrl(), $match) ) { $updated = true; - $bookmark = $bookmark->setUrl($this->basePath . '/shaare/' . $match[1]); + $bookmark = $bookmark->setUrl('/shaare/' . $match[1]); $this->bookmarkService->set($bookmark, false); }