public function save() { $data = array('version' => $this->_data['version']); if ($this->is_master()) { foreach ($this->_data as $key => $value) { $data[$key] = $this->_data[$key]; } } else { // write only overwrited keys $master = new ConfigCompiler(0, $this->_preview); $master->load(); foreach ($this->_data as $key => $value) { if (!ConfigCompiler::child_key_sealed($key, $master->_data, $this->_data)) { $data[$key] = $this->_data[$key]; } } } $filename = Config::util_config_filename($this->_blog_id, $this->_preview); if (defined('JSON_PRETTY_PRINT')) { $config = json_encode($data, JSON_PRETTY_PRINT); } else { // for older php versions $config = json_encode($data); } Util_File::file_put_contents_atomic($filename, $config); }
/** * Slower version of loader, used when configs belong to older w3tc version */ private function load_full() { $c = new ConfigCompiler($this->_blog_id, $this->_preview); $c->load(); $this->_data = $c->get_data(); }