diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-02-04 12:01:48 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-02-04 12:01:48 +0100 |
commit | c03455af1161befa404ed8759ca55b63bbf593a2 (patch) | |
tree | 4afdf4b58f17960d0e471a2ae378cda3e8cfae72 /application/Updater.php | |
parent | 6f566b69ba141c29fb3fa1e32a1760a1e8b09840 (diff) | |
download | Shaarli-c03455af1161befa404ed8759ca55b63bbf593a2.tar.gz Shaarli-c03455af1161befa404ed8759ca55b63bbf593a2.tar.zst Shaarli-c03455af1161befa404ed8759ca55b63bbf593a2.zip |
Fixes #775: LinkDB do not access LinkDB before ID system migration
To access LinkDB items with its ArrayAccess implementation, the IDs must be consistent, which isn't the case before `updateMethodDatastoreIds()` execution. v0.6.4 method `updateMethodRenameDashTags()` was accessing it, so an upgrade <0.6.4 to >0.8.x was failing.
This just move the minor update `RenameDashTags` after the IDs update.
Diffstat (limited to 'application/Updater.php')
-rw-r--r-- | application/Updater.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/application/Updater.php b/application/Updater.php index eb03c6d3..90aba745 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -133,21 +133,6 @@ class Updater | |||
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Rename tags starting with a '-' to work with tag exclusion search. | ||
137 | */ | ||
138 | public function updateMethodRenameDashTags() | ||
139 | { | ||
140 | $linklist = $this->linkDB->filterSearch(); | ||
141 | foreach ($linklist as $key => $link) { | ||
142 | $link['tags'] = preg_replace('/(^| )\-/', '$1', $link['tags']); | ||
143 | $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true))); | ||
144 | $this->linkDB[$key] = $link; | ||
145 | } | ||
146 | $this->linkDB->save($this->conf->get('resource.page_cache')); | ||
147 | return true; | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * Move old configuration in PHP to the new config system in JSON format. | 136 | * Move old configuration in PHP to the new config system in JSON format. |
152 | * | 137 | * |
153 | * Will rename 'config.php' into 'config.save.php' and create 'config.json.php'. | 138 | * Will rename 'config.php' into 'config.save.php' and create 'config.json.php'. |
@@ -258,6 +243,21 @@ class Updater | |||
258 | } | 243 | } |
259 | 244 | ||
260 | /** | 245 | /** |
246 | * Rename tags starting with a '-' to work with tag exclusion search. | ||
247 | */ | ||
248 | public function updateMethodRenameDashTags() | ||
249 | { | ||
250 | $linklist = $this->linkDB->filterSearch(); | ||
251 | foreach ($linklist as $key => $link) { | ||
252 | $link['tags'] = preg_replace('/(^| )\-/', '$1', $link['tags']); | ||
253 | $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true))); | ||
254 | $this->linkDB[$key] = $link; | ||
255 | } | ||
256 | $this->linkDB->save($this->conf->get('resource.page_cache')); | ||
257 | return true; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * Initialize API settings: | 261 | * Initialize API settings: |
262 | * - api.enabled: true | 262 | * - api.enabled: true |
263 | * - api.secret: generated secret | 263 | * - api.secret: generated secret |