Move generating cache key from files from OC_Minimizer to OC_Cache

This commit is contained in:
Bart Visscher 2012-10-28 17:49:43 +01:00
parent 5aec26a37c
commit a7806076b1
2 changed files with 12 additions and 6 deletions

View File

@ -144,4 +144,13 @@ class OC_Cache {
return self::$isFast; 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);
}
} }

View File

@ -2,14 +2,11 @@
abstract class OC_Minimizer { abstract class OC_Minimizer {
public function generateETag($files) { public function generateETag($files) {
$etag = ''; $fullpath_files = array();
sort($files);
foreach($files as $file_info) { foreach($files as $file_info) {
$file = $file_info[0] . '/' . $file_info[2]; $fullpath_files[] = $file_info[0] . '/' . $file_info[2];
$stat = stat($file);
$etag .= $file.$stat['mtime'].$stat['size'];
} }
return md5($etag); return OC_Cache::generateCacheKeyFromFiles($fullpath_files);
} }
abstract public function minimizeFiles($files); abstract public function minimizeFiles($files);