Esempio n. 1
0
 public function processFileChanges($install = true, $files = null)
 {
     global $messageStack;
     $success = parent::processFileChanges($install, $files);
     // Handle the case where query_factory has not been patched to fix the
     // handling of Zen Cart's SQL Cache and Zen Cart's SQL Cache is enabled.
     // Note: the patches are now included with Zen Cart >= 1.5.2
     $zcversion = PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR;
     if (version_compare($zcversion, '1.5.2', '<') && defined('SQL_CACHE_METHOD') && SQL_CACHE_METHOD != 'none') {
         $file = @file_get_contents(DIR_FS_CATALOG . DIR_WS_CLASSES . 'db/mysql/query_factory.php');
         if ($file === false) {
             $success = false;
             $messageStack->add(sprintf(USU_PLUGIN_INSTALL_ERROR_CORE_FILE_NOT_FOUND, DIR_FS_CATALOG . DIR_WS_CLASSES . 'db/mysql/query_factory.php', 'DIR_FS_CATALOG . DIR_WS_CLASSES'), 'warning');
         } else {
             if (!preg_match('~function\\sRecordCount\\(\\)\\s?\\{\\s+if\\s?\\(\\$this->is_cached\\).+?\\}~s', $file)) {
                 if ($install) {
                     $success = false;
                 }
                 $messageStack->add(sprintf(USU_PLUGIN_INSTALL_ERROR_QUERY_FACTORY, DIR_FS_CATALOG . DIR_WS_CLASSES . 'db/mysql/query_factory.php', 'DIR_FS_CATALOG . DIR_WS_CLASSES'), 'warning');
             }
         }
     }
     return $success;
 }