Closed GoogleCodeExporter closed 9 years ago
not a bug. vQmod already has caching in place
Original comment by DJG6...@gmail.com
on 20 Aug 2013 at 11:22
You did not understand me
public static function modCheck($sourceFile) {
....................
if(file_exists($cacheFile) && filemtime($cacheFile) >= self::$_lastModifiedTime && filemtime($cacheFile) >= $file_last_modified) {
return $cacheFile;
}
if(isset(self::$_filesModded[$sourcePath])) {
return self::$_filesModded[$sourcePath]['cached'] ? $cacheFile : $sourceFile;
}
//Performed on all files that are not found in the cache
// propose making the cache file names for which you want to search patches. (Parse of xml).
//----------------------->
$changed = false;
$fileHash = sha1_file($sourcePath);
$fileData = file_get_contents($sourcePath);
foreach(self::$_mods as $modObject) {
foreach($modObject->mods as $path => $mods) {
if(self::_checkMatch($path, $sourcePath)) {
$modObject->applyMod($mods, $fileData);
}
}
}
if (sha1($fileData) != $fileHash) {
$writePath = $cacheFile;
if(!file_exists($writePath) || is_writable($writePath)) {
file_put_contents($writePath, $fileData);
$changed = true;
}
}
self::$_filesModded[$sourcePath] = array('cached' => $changed);
return $changed ? $writePath : $sourcePath;
//---------------------------->
}
Original comment by yula.f...@gmail.com
on 20 Aug 2013 at 12:27
Original issue reported on code.google.com by
yula.f...@gmail.com
on 20 Aug 2013 at 10:59