Пример #1
0
function getDiffFiles($unzip_dir, $install_file, $is_install = true, $previous_version = '')
{
    //require_once($unzip_dir . '/manifest.php');
    global $installdefs;
    if (!empty($previous_version)) {
        //check if the upgrade path exists
        if (!empty($upgrade_manifest)) {
            if (!empty($upgrade_manifest['upgrade_paths'])) {
                if (!empty($upgrade_manifest['upgrade_paths'][$previous_version])) {
                    $installdefs = $upgrade_manifest['upgrade_paths'][$previous_version];
                }
            }
            //fi
        }
        //fi
    }
    //fi
    $modified_files = array();
    if (!empty($installdefs['copy'])) {
        foreach ($installdefs['copy'] as $cp) {
            $cp['to'] = clean_path(str_replace('<basepath>', $unzip_dir, $cp['to']));
            $restore_path = remove_file_extension(urldecode($install_file)) . "-restore/";
            $backup_path = clean_path($restore_path . $cp['to']);
            //check if this file exists in the -restore directory
            if (file_exists($backup_path)) {
                //since the file exists, then we want do an md5 of the install version and the file system version
                $from = $backup_path;
                $needle = $restore_path;
                if (!$is_install) {
                    $from = str_replace('<basepath>', $unzip_dir, $cp['from']);
                    $needle = $unzip_dir;
                }
                $files_found = md5DirCompare($from . '/', $cp['to'] . '/', array('.svn'), false);
                if (count($files_found > 0)) {
                    foreach ($files_found as $key => $value) {
                        $modified_files[] = str_replace($needle, '', $key);
                    }
                }
            }
            //fi
        }
        //rof
    }
    //fi
    return $modified_files;
}
Пример #2
0
 public function testmd5DirCompare()
 {
     //execute the method and test if it returns expected values
     $expected = array();
     $actual = md5DirCompare('include/MVC/', 'include/MVC/', array('views'));
     $this->assertSame($expected, $actual);
 }