From a7806076b1c20b80c0f1d1ee72e9050c8bda9715 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Sun, 28 Oct 2012 17:49:43 +0100
Subject: [PATCH] Move generating cache key from files from OC_Minimizer to
 OC_Cache

---
 lib/cache.php     | 9 +++++++++
 lib/minimizer.php | 9 +++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/cache.php b/lib/cache.php
index 62003793d5..bc74ed83f8 100644
--- a/lib/cache.php
+++ b/lib/cache.php
@@ -144,4 +144,13 @@ class OC_Cache {
 		return self::$isFast;
 	}
 
+	static public function generateCacheKeyFromFiles($files) {
+		$key = '';
+		sort($files);
+		foreach($files as $file) {
+			$stat = stat($file);
+			$key .= $file.$stat['mtime'].$stat['size'];
+		}
+		return md5($key);
+	}
 }
diff --git a/lib/minimizer.php b/lib/minimizer.php
index d50ab0d239..deffa8e65d 100644
--- a/lib/minimizer.php
+++ b/lib/minimizer.php
@@ -2,14 +2,11 @@
 
 abstract class OC_Minimizer {
 	public function generateETag($files) {
-		$etag = '';
-		sort($files);
+		$fullpath_files = array();
 		foreach($files as $file_info) {
-			$file = $file_info[0] . '/' . $file_info[2];
-			$stat = stat($file);
-			$etag .= $file.$stat['mtime'].$stat['size'];
+			$fullpath_files[] = $file_info[0] . '/' . $file_info[2];
 		}
-		return md5($etag);
+		return OC_Cache::generateCacheKeyFromFiles($fullpath_files);
 	}
 
 	abstract public function minimizeFiles($files);
-- 
GitLab