From 72b30e3e453bb6500278391861d52a084e96e988 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 5 Oct 2013 12:50:36 +0200 Subject: [PATCH 1/2] correctly expire cache if version file changed. Fixes problem that ownCloud only starts upgrading during login --- lib/private/util.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/private/util.php b/lib/private/util.php index ae9aef69b4..1718ae6a04 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -182,9 +182,12 @@ class OC_Util { * @description load the version.php into the session as cache */ private static function loadVersion() { - if(!\OC::$server->getSession()->exists('OC_Version')) { + $timestamp=filemtime(OC::$SERVERROOT.'/version.php'); + if(!\OC::$server->getSession()->exists('OC_Version') or OC::$server->getSession()->get('OC_Version_Timestamp')<>$timestamp) { require 'version.php'; $session = \OC::$server->getSession(); + /** @var $timestamp int */ + $session->set('OC_Version_Timestamp', $timestamp); /** @var $OC_Version string */ $session->set('OC_Version', $OC_Version); /** @var $OC_VersionString string */ From 3f29e4ebeab9fee22ca16656388080e3be92cc12 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 7 Oct 2013 12:27:02 +0200 Subject: [PATCH 2/2] a few styleguide fixes --- lib/private/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/util.php b/lib/private/util.php index 1718ae6a04..e2093a230c 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -182,8 +182,8 @@ class OC_Util { * @description load the version.php into the session as cache */ private static function loadVersion() { - $timestamp=filemtime(OC::$SERVERROOT.'/version.php'); - if(!\OC::$server->getSession()->exists('OC_Version') or OC::$server->getSession()->get('OC_Version_Timestamp')<>$timestamp) { + $timestamp = filemtime(OC::$SERVERROOT.'/version.php'); + if(!\OC::$server->getSession()->exists('OC_Version') or OC::$server->getSession()->get('OC_Version_Timestamp') != $timestamp) { require 'version.php'; $session = \OC::$server->getSession(); /** @var $timestamp int */