Geo3010 Posted July 29, 2015 Share Posted July 29, 2015 I need to temporary disable the cache for the time needed for a script to run. At the moment I just manually disable the cache via admin pannel -> Advanced parameters -> Performance: Use cache yes/no, before to run the script and then reenable it when it's done. I want to automate this disabling the cache at the beginning of the script and reenabling it at the end. (the script must run in cron) I've tried something I've found in AdminPerformanceController: /* DISABLE CACHE */ $prev_settings = file_get_contents(_PS_ROOT_DIR_.'/config/settings.inc.php'); $new_settings = $prev_settings; $cache_active = 0; // 1 to enable $new_settings = preg_replace('/define\(\'_PS_CACHE_ENABLED_\', \'([01]?)\'\);/Ui', 'define(\'_PS_CACHE_ENABLED_\', \''.(int)$cache_active.'\');', $new_settings); if(copy(_PS_ROOT_DIR_.'/config/settings.inc.php', _PS_ROOT_DIR_.'/config/settings.old.php') && (bool)file_put_contents(_PS_ROOT_DIR_.'/config/settings.inc.php', $new_settings)) { error_log("Cache disabled"); } else { error_log("Seems that the settings file cannot be overwritten"); exit; } But it's not enough, I think it's missing some kind of settings reload action or similar... Any idea? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now