diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-03-01 19:10:17 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-03-01 19:10:17 +0100 |
commit | 11c680f97aa07b48f33e264effb2975d6ca31a0c (patch) | |
tree | 055cd4834153efa34c545c66075c2e86ddd0f22e /inc/poche/Poche.class.php | |
parent | 223268c2fa34c497d91338e2553bc74bb1b26859 (diff) | |
download | wallabag-11c680f97aa07b48f33e264effb2975d6ca31a0c.tar.gz wallabag-11c680f97aa07b48f33e264effb2975d6ca31a0c.tar.zst wallabag-11c680f97aa07b48f33e264effb2975d6ca31a0c.zip |
[add] display last check of wallabag release
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-x | inc/poche/Poche.class.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 0c4143e1..ba262c98 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -582,8 +582,12 @@ class Poche | |||
582 | switch ($view) | 582 | switch ($view) |
583 | { | 583 | { |
584 | case 'config': | 584 | case 'config': |
585 | $dev = trim($this->getPocheVersion('dev')); | 585 | $dev_infos = $this->getPocheVersion('dev'); |
586 | $prod = trim($this->getPocheVersion('prod')); | 586 | $dev = trim($dev_infos[0]); |
587 | $check_time_dev = date('d-M-Y H:i', $dev_infos[1]); | ||
588 | $prod_infos = $this->getPocheVersion('prod'); | ||
589 | $prod = trim($prod_infos[0]); | ||
590 | $check_time_prod = date('d-M-Y H:i', $prod_infos[1]); | ||
587 | $compare_dev = version_compare(POCHE, $dev); | 591 | $compare_dev = version_compare(POCHE, $dev); |
588 | $compare_prod = version_compare(POCHE, $prod); | 592 | $compare_prod = version_compare(POCHE, $prod); |
589 | $themes = $this->getInstalledThemes(); | 593 | $themes = $this->getInstalledThemes(); |
@@ -595,6 +599,8 @@ class Poche | |||
595 | 'languages' => $languages, | 599 | 'languages' => $languages, |
596 | 'dev' => $dev, | 600 | 'dev' => $dev, |
597 | 'prod' => $prod, | 601 | 'prod' => $prod, |
602 | 'check_time_dev' => $check_time_dev, | ||
603 | 'check_time_prod' => $check_time_prod, | ||
598 | 'compare_dev' => $compare_dev, | 604 | 'compare_dev' => $compare_dev, |
599 | 'compare_prod' => $compare_prod, | 605 | 'compare_prod' => $compare_prod, |
600 | 'token' => $token, | 606 | 'token' => $token, |
@@ -1105,15 +1111,17 @@ class Poche | |||
1105 | private function getPocheVersion($which = 'prod') | 1111 | private function getPocheVersion($which = 'prod') |
1106 | { | 1112 | { |
1107 | $cache_file = CACHE . '/' . $which; | 1113 | $cache_file = CACHE . '/' . $which; |
1114 | $check_time = time(); | ||
1108 | 1115 | ||
1109 | # checks if the cached version file exists | 1116 | # checks if the cached version file exists |
1110 | if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) { | 1117 | if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) { |
1111 | $version = file_get_contents($cache_file); | 1118 | $version = file_get_contents($cache_file); |
1119 | $check_time = filemtime($cache_file); | ||
1112 | } else { | 1120 | } else { |
1113 | $version = file_get_contents('http://static.wallabag.org/versions/' . $which); | 1121 | $version = file_get_contents('http://static.wallabag.org/versions/' . $which); |
1114 | file_put_contents($cache_file, $version, LOCK_EX); | 1122 | file_put_contents($cache_file, $version, LOCK_EX); |
1115 | } | 1123 | } |
1116 | return $version; | 1124 | return array($version, $check_time); |
1117 | } | 1125 | } |
1118 | 1126 | ||
1119 | public function generateToken() | 1127 | public function generateToken() |