aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-rw-r--r--inc/poche/Poche.class.php22
1 files changed, 22 insertions, 0 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