From 72b30e3e453bb6500278391861d52a084e96e988 Mon Sep 17 00:00:00 2001
From: Frank Karlitschek <frank@owncloud.org>
Date: Sat, 5 Oct 2013 12:50:36 +0200
Subject: [PATCH] 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 */
-- 
GitLab