aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-05 12:34:16 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-05 12:34:16 +0200
commit32520785018e3ec3a2ce200689e863099e9646f8 (patch)
tree81eb4dc79b0a36f935f7a31516d84575c3b47766 /inc/poche
parent21e0af98eb28e46345ecb947c48af29e8f1c6234 (diff)
downloadwallabag-32520785018e3ec3a2ce200689e863099e9646f8.tar.gz
wallabag-32520785018e3ec3a2ce200689e863099e9646f8.tar.zst
wallabag-32520785018e3ec3a2ce200689e863099e9646f8.zip
close #69: in the config page, you are notified of the release of a new version
Diffstat (limited to 'inc/poche')
-rw-r--r--inc/poche/Poche.class.php22
-rw-r--r--inc/poche/config.inc.php2
2 files changed, 23 insertions, 1 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 12cb1b42..f9bcf85b 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -130,6 +130,16 @@ class Poche
130 switch ($view) 130 switch ($view)
131 { 131 {
132 case 'config': 132 case 'config':
133 $dev = $this->getPocheVersion('dev');
134 $prod = $this->getPocheVersion('prod');
135 $compare_dev = version_compare(POCHE_VERSION, $dev);
136 $compare_prod = version_compare(POCHE_VERSION, $prod);
137 $tpl_vars = array(
138 'dev' => $dev,
139 'prod' => $prod,
140 'compare_dev' => $compare_dev,
141 'compare_prod' => $compare_prod,
142 );
133 Tools::logm('config view'); 143 Tools::logm('config view');
134 break; 144 break;
135 case 'view': 145 case 'view':
@@ -315,4 +325,16 @@ class Poche
315 )); 325 ));
316 Tools::logm('export view'); 326 Tools::logm('export view');
317 } 327 }
328
329 private function getPocheVersion($which = 'prod')
330 {
331 $cache_file = CACHE . '/' . $which;
332 if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) {
333 $version = file_get_contents($cache_file);
334 } else {
335 $version = file_get_contents('http://www.inthepoche.com/' . $which);
336 file_put_contents($cache_file, $version, LOCK_EX);
337 }
338 return $version;
339 }
318} \ No newline at end of file 340} \ No newline at end of file
diff --git a/inc/poche/config.inc.php b/inc/poche/config.inc.php
index eb0c1bb5..27be1857 100644
--- a/inc/poche/config.inc.php
+++ b/inc/poche/config.inc.php
@@ -36,7 +36,7 @@ require_once './vendor/autoload.php';
36require_once './inc/3rdparty/simple_html_dom.php'; 36require_once './inc/3rdparty/simple_html_dom.php';
37 37
38if (DOWNLOAD_PICTURES) { 38if (DOWNLOAD_PICTURES) {
39 require_once './inc/poche/pochePicture.php'; 39 require_once './inc/poche/pochePictures.php';
40} 40}
41 41
42$poche = new Poche($storage_type); \ No newline at end of file 42$poche = new Poche($storage_type); \ No newline at end of file