Hard94 / vqmod

Automatically exported from code.google.com/p/vqmod
0 stars 0 forks source link

performance of VQMOD propose #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
vQmod Version: '2.4.1'
Everything is working well

To significantly increase the performance of VQMOD propose making the cache 
file names for which you want to search patches. (Parse of xml). And further 
processing only those files. Now, try to find patches made ​​for each file.

Thank you for your product

Original issue reported on code.google.com by yula.f...@gmail.com on 20 Aug 2013 at 10:59

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
    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