aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Updater.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Updater.php')
-rw-r--r--application/Updater.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/application/Updater.php b/application/Updater.php
index 40a15906..8d2bd577 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -73,7 +73,7 @@ class Updater
73 } 73 }
74 74
75 if ($this->methods === null) { 75 if ($this->methods === null) {
76 throw new UpdaterException('Couldn\'t retrieve Updater class methods.'); 76 throw new UpdaterException(t('Couldn\'t retrieve Updater class methods.'));
77 } 77 }
78 78
79 foreach ($this->methods as $method) { 79 foreach ($this->methods as $method) {
@@ -398,7 +398,7 @@ class Updater
398 */ 398 */
399 public function updateMethodCheckUpdateRemoteBranch() 399 public function updateMethodCheckUpdateRemoteBranch()
400 { 400 {
401 if (shaarli_version === 'dev' || $this->conf->get('updates.check_updates_branch') === 'latest') { 401 if (SHAARLI_VERSION === 'dev' || $this->conf->get('updates.check_updates_branch') === 'latest') {
402 return true; 402 return true;
403 } 403 }
404 404
@@ -413,7 +413,7 @@ class Updater
413 $latestMajor = $matches[1]; 413 $latestMajor = $matches[1];
414 414
415 // Get current major version digit 415 // Get current major version digit
416 preg_match('/(\d+)\.\d+$/', shaarli_version, $matches); 416 preg_match('/(\d+)\.\d+$/', SHAARLI_VERSION, $matches);
417 $currentMajor = $matches[1]; 417 $currentMajor = $matches[1];
418 418
419 if ($currentMajor === $latestMajor) { 419 if ($currentMajor === $latestMajor) {
@@ -436,6 +436,15 @@ class Updater
436 } 436 }
437 return true; 437 return true;
438 } 438 }
439
440 /**
441 * Save the datastore -> the link order is now applied when links are saved.
442 */
443 public function updateMethodReorderDatastore()
444 {
445 $this->linkDB->save($this->conf->get('resource.page_cache'));
446 return true;
447 }
439} 448}
440 449
441/** 450/**
@@ -482,7 +491,7 @@ class UpdaterException extends Exception
482 } 491 }
483 492
484 if (! empty($this->method)) { 493 if (! empty($this->method)) {
485 $out .= 'An error occurred while running the update '. $this->method . PHP_EOL; 494 $out .= t('An error occurred while running the update ') . $this->method . PHP_EOL;
486 } 495 }
487 496
488 if (! empty($this->previous)) { 497 if (! empty($this->previous)) {
@@ -522,11 +531,11 @@ function read_updates_file($updatesFilepath)
522function write_updates_file($updatesFilepath, $updates) 531function write_updates_file($updatesFilepath, $updates)
523{ 532{
524 if (empty($updatesFilepath)) { 533 if (empty($updatesFilepath)) {
525 throw new Exception('Updates file path is not set, can\'t write updates.'); 534 throw new Exception(t('Updates file path is not set, can\'t write updates.'));
526 } 535 }
527 536
528 $res = file_put_contents($updatesFilepath, implode(';', $updates)); 537 $res = file_put_contents($updatesFilepath, implode(';', $updates));
529 if ($res === false) { 538 if ($res === false) {
530 throw new Exception('Unable to write updates in '. $updatesFilepath . '.'); 539 throw new Exception(t('Unable to write updates in '. $updatesFilepath . '.'));
531 } 540 }
532} 541}