aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/LinkDB.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r--application/LinkDB.php16
1 files changed, 8 insertions, 8 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 }