/** * Updates the plugin from older version. */ function w3_run_legacy_update() { w3_require_once(W3TC_LIB_W3_DIR . '/ConfigWriter.php'); $writer = new W3_ConfigWriter(w3_get_blog_id(), w3_is_preview_mode()); $writer->import_legacy_config_and_save(); // Only remove folders when master blog is running. if (w3_get_blog_id() == 0) { w3_remove_old_folders(); } }
/** * @return array */ private function get_current_configuration() { $old_config = W3_ConfigWriter::get_config_filename(); $old_configuration_keys = (include $old_config); return $old_configuration_keys; }
<?php define("WP_CONTENT_DIR", "/usr/src/wordpress/wp-content"); $wpRoot = '/usr/src/wordpress'; require_once $wpRoot . '/wp-load.php'; require_once $wpRoot . '/wp-content/plugins/w3-total-cache/inc/define.php'; w3_require_once(W3TC_LIB_W3_DIR . '/ConfigWriter.php'); // Set config values $conf = new W3_ConfigWriter(0, false); $conf->set('cdn.enabled', true); $conf->set('cdn.engine', 'rscf'); $conf->set('cdn.rscf.user', getenv('RS_USERNAME')); $conf->set('cdn.rscf.key', getenv('RS_API_KEY')); $conf->set('cdn.rscf.location', getenv('RS_LOCATION')); $conf->set('cdn.rscf.container', getenv('RS_CONTAINER')); $conf->set('cdn.rscf.cname', getenv('RS_CNAME')); $conf->set('cdn.rscf.ssl', 'enabled'); $conf->save();