| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/wp-content/plugins/wp-rocket/inc/classes/traits/ |
Upload File : |
<?php
namespace WP_Rocket\Traits;
trait Config_Updater {
/**
* Update htaccess and WP Rocket config file if the option was modified.
*
* @since 3.1
* @author Remy Perona
*
* @param string $old_value Option's previous value.
* @param string $value Option's new value.
* @return void
*/
public function after_update_single_option( $old_value, $value ) {
if ( $old_value !== $value ) {
$this->flush_htaccess();
$this->generate_config_file();
}
}
/**
* Sets the htaccess update request
*
* @since 3.1
* @author Remy Perona
*
* @return void
*/
protected function flush_htaccess() {
wp_cache_set( 'rocket_flush_htaccess', 1 );
}
/**
* Sets WP Rocket config file update request
*
* @since 3.1
* @author Remy Perona
*
* @return void
*/
protected function generate_config_file() {
wp_cache_set( 'rocket_generate_config_file', 1 );
}
/**
* Performs the files update if requested
*
* @since 3.1
* @author Remy Perona
*
* @return void
*/
public function maybe_update_config() {
if ( wp_cache_get( 'rocket_flush_htaccess' ) ) {
flush_rocket_htaccess();
wp_cache_delete( 'rocket_flush_htaccess' );
}
if ( wp_cache_get( 'rocket_generate_config_file' ) ) {
\rocket_generate_config_file();
wp_cache_delete( 'rocket_generate_config_file' );
}
}
}