vqmod为所有文件生成缓存

Joh*_*lia 1 opencart

是否可以一次为vqmod生成所有vqcache文件?

我希望在服务器负载较低时运行此脚本一次,它将遍历所有qmod文件并应用所有更改,准备好并等待高负载.

这也会提醒我任何vqmod错误,而不必等待它们发生.

E,g当我安装/卸载扩展时我还需要卸载vqmod扩展:

/**
 * install/uninstall vqmod files for extension
 *
 * @param string $action = install/uninstall
 */
private function _vqmodAction($action){

    $vqmod_path = str_replace("system", "vqmod", DIR_SYSTEM);

    // Clear vqmod cache
    $files = glob($vqmod_path.'vqcache/vq*');
    if ($files) {
        foreach ($files as $file) {
            if (file_exists($file)) {
                @unlink($file);
                clearstatcache();
            }
        }
    }

    // Force vqmod to re-generate cache
    global $vqmod;
    $vqmod->modCheck(DIR_SYSTEM . 'startup.php');

    // Re-name vqmod files
    $vqmod_xml_path = $vqmod_path . "xml/";
    $vqmod_files = array('file', 'file_languages', 'file_admin');
    foreach($vqmod_files as $filename){
        if($action == "uninstall"){
            $from = '.xml';
            $to = '.xml_';
        } else {
            $from = '.xml_';
            $to = '.xml';
        }
        if (file_exists($vqmod_xml_path.$filename.$from)) {
            rename($vqmod_xml_path.$filename.$from, $vqmod_xml_path.$filename.$to);
        }
    }

    return true;
}
Run Code Online (Sandbox Code Playgroud)

modCheck startup.php的原因是因为这包括必需的文件和通过vqmod进行的更改.这是处理这种情况的正确方法吗?

Jay*_*ord 7

vQmod只需要您删除/vqmod/mods.cache最新版本的文件以使其刷新.它也将在最新版本(2.3.X +)中重新命名/删除/添加文件进行重新生成,因此除非您有旧版本,否则这不是问题.ErdinçÇorbacı对于httrack工具是正确的,但有一个例外 - 它不会为任何管理页面生成vqcache文件,除非它已登录到管理区域.当然,只删除/vqmod/vqcache/vq2-*文件和/vqmod/mods.cache(如果存在)足以强制重新生成