, 'redis.password' ); $this->_set_if_exists( $file_data, 'fragmentcache.redis.dbid', 'fragmentcache', 'redis.dbid' ); $this->_set_if_exists( $file_data, 'fragmentcache.lifetime', 'fragmentcache', 'lifetime' ); // new options, separated old one. implemented in 0.9.5.3. if ( isset( $file_data['browsercache.cssjs.replace'] ) && ! isset( $file_data['browsercache.cssjs.querystring'] ) ) { $file_data['browsercache.cssjs.querystring'] = $file_data['browsercache.cssjs.replace']; } if ( isset( $file_data['browsercache.other.replace'] ) && ! isset( $file_data['browsercache.other.querystring'] ) ) { $file_data['browsercache.other.querystring'] = $file_data['browsercache.other.replace']; } // changes in 0.9.5.4. if ( isset( $file_data['cdn.engine'] ) ) { if ( 'cloudfront_fsd' === $file_data['cdn.engine'] ) { $file_data['cdnfsd.engine'] = 'cloudfront'; $file_data['cdnfsd.enabled'] = $file_data['cdn.enabled']; if ( isset( $file_data['cdn.cloudfront_fsd.access_key'] ) ) { $file_data['cdnfsd.cloudfront.access_key'] = $file_data['cdn.cloudfront_fsd.access_key']; $file_data['cdnfsd.cloudfront.distribution_domain'] = $file_data['cdn.cloudfront_fsd.distribution_domain']; $file_data['cdnfsd.cloudfront.secret_key'] = $file_data['cdn.cloudfront_fsd.secret_key']; $file_data['cdnfsd.cloudfront.distribution_id'] = $file_data['cdn.cloudfront_fsd.distribution_id']; } } } $file_data['version'] = W3TC_VERSION; return $file_data; } /** * Sets an extension configuration if it exists in the provided data array. * * This method migrates extension-specific settings to the proper structure * within the configuration data. * * @param array $w3tc_a Reference to the configuration data array. * @param string $w3tc_extension The extension key to check and migrate. * * @return void */ private function _set_if_exists_extension( &$w3tc_a, $w3tc_extension ) { if ( isset( $w3tc_a['extensions.settings'] ) && isset( $w3tc_a['extensions.settings'][ $w3tc_extension ] ) ) { $w3tc_a[ $w3tc_extension ] = $w3tc_a['extensions.settings'][ $w3tc_extension ]; unset( $w3tc_a['extensions.settings'][ $w3tc_extension ] ); } } /** * Migrates an existing key to a nested configuration structure. * * This method checks if the specified key exists in the data array and, if so, * moves its value to the designated nested configuration structure. * * @param array $w3tc_a Reference to the configuration data array. * @param string $old_key The existing key to check in the data array. * @param string $new_key0 The primary key for the new nested structure. * @param string $new_key1 The secondary key for the new nested structure. * * @return void */ private function _set_if_exists( &$w3tc_a, $old_key, $new_key0, $new_key1 ) { if ( isset( $w3tc_a[ $old_key ] ) ) { $w3tc_a[ $new_key0 ][ $new_key1 ] = $w3tc_a[ $old_key ]; unset( $w3tc_a[ $old_key ] ); } } }