aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2016-10-20 21:19:51 +0200
committerVirtualTam <virtualtam@flibidi.net>2016-10-20 21:33:40 +0200
commitf21abf329234ae4d5a1d56c5a9dd0bc11f80bac8 (patch)
tree452d965ce383fde4672ecd1ac5613e38c57623cb /application
parent628b97cbdf276785eb9ff4f7a124e81e67d2f76c (diff)
downloadShaarli-f21abf329234ae4d5a1d56c5a9dd0bc11f80bac8.tar.gz
Shaarli-f21abf329234ae4d5a1d56c5a9dd0bc11f80bac8.tar.zst
Shaarli-f21abf329234ae4d5a1d56c5a9dd0bc11f80bac8.zip
LinkDB: update datastore method names
Relates to https://github.com/shaarli/Shaarli/issues/95 Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'application')
-rw-r--r--application/LinkDB.php16
-rw-r--r--application/NetscapeBookmarkUtils.php2
-rw-r--r--application/Updater.php2
3 files changed, 10 insertions, 10 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index 2d42c514..f5f209f6 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -100,8 +100,8 @@ class LinkDB implements Iterator, Countable, ArrayAccess
100 $this->hidePublicLinks = $hidePublicLinks; 100 $this->hidePublicLinks = $hidePublicLinks;
101 $this->redirector = $redirector; 101 $this->redirector = $redirector;
102 $this->redirectorEncode = $redirectorEncode === true; 102 $this->redirectorEncode = $redirectorEncode === true;
103 $this->checkDB(); 103 $this->check();
104 $this->readDB(); 104 $this->read();
105 } 105 }
106 106
107 /** 107 /**
@@ -210,7 +210,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess
210 * 210 *
211 * If no DB file is found, creates a dummy DB. 211 * If no DB file is found, creates a dummy DB.
212 */ 212 */
213 private function checkDB() 213 private function check()
214 { 214 {
215 if (file_exists($this->datastore)) { 215 if (file_exists($this->datastore)) {
216 return; 216 return;
@@ -243,13 +243,13 @@ You use the community supported version of the original Shaarli project, by Seba
243 $this->links[$link['linkdate']] = $link; 243 $this->links[$link['linkdate']] = $link;
244 244
245 // Write database to disk 245 // Write database to disk
246 $this->writeDB(); 246 $this->write();
247 } 247 }
248 248
249 /** 249 /**
250 * Reads database from disk to memory 250 * Reads database from disk to memory
251 */ 251 */
252 private function readDB() 252 private function read()
253 { 253 {
254 254
255 // Public links are hidden and user not logged in => nothing to show 255 // Public links are hidden and user not logged in => nothing to show
@@ -315,7 +315,7 @@ You use the community supported version of the original Shaarli project, by Seba
315 * 315 *
316 * @throws IOException the datastore is not writable 316 * @throws IOException the datastore is not writable
317 */ 317 */
318 private function writeDB() 318 private function write()
319 { 319 {
320 if (is_file($this->datastore) && !is_writeable($this->datastore)) { 320 if (is_file($this->datastore) && !is_writeable($this->datastore)) {
321 // The datastore exists but is not writeable 321 // The datastore exists but is not writeable
@@ -337,14 +337,14 @@ You use the community supported version of the original Shaarli project, by Seba
337 * 337 *
338 * @param string $pageCacheDir page cache directory 338 * @param string $pageCacheDir page cache directory
339 */ 339 */
340 public function savedb($pageCacheDir) 340 public function save($pageCacheDir)
341 { 341 {
342 if (!$this->loggedIn) { 342 if (!$this->loggedIn) {
343 // TODO: raise an Exception instead 343 // TODO: raise an Exception instead
344 die('You are not authorized to change the database.'); 344 die('You are not authorized to change the database.');
345 } 345 }
346 346
347 $this->writeDB(); 347 $this->write();
348 348
349 invalidateCaches($pageCacheDir); 349 invalidateCaches($pageCacheDir);
350 } 350 }
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php
index d6840d37..dd21f05b 100644
--- a/application/NetscapeBookmarkUtils.php
+++ b/application/NetscapeBookmarkUtils.php
@@ -183,7 +183,7 @@ class NetscapeBookmarkUtils
183 $importCount++; 183 $importCount++;
184 } 184 }
185 185
186 $linkDb->savedb($pagecache); 186 $linkDb->save($pagecache);
187 return self::importStatus( 187 return self::importStatus(
188 $filename, 188 $filename,
189 $filesize, 189 $filesize,
diff --git a/application/Updater.php b/application/Updater.php
index 90913235..36eddd4f 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -143,7 +143,7 @@ class Updater
143 $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true))); 143 $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true)));
144 $this->linkDB[$link['linkdate']] = $link; 144 $this->linkDB[$link['linkdate']] = $link;
145 } 145 }
146 $this->linkDB->savedb($this->conf->get('resource.page_cache')); 146 $this->linkDB->save($this->conf->get('resource.page_cache'));
147 return true; 147 return true;
148 } 148 }
149 149