| Server IP : 87.229.120.60 / Your IP : 216.73.216.245 Web Server : Apache System : Linux outside 5.4.8_Algonet_ZeroMAC_0.9.4.8 #6 SMP Mon Feb 3 20:36:07 CET 2020 x86_64 User : server ( 1002) PHP Version : 8.3.20 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/faktorteam/www/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' );
}
}
}