public function load() { // apply data from master config $master_filename = Config::util_config_filename(0, $this->_preview); $data = Config::util_array_from_file($master_filename); if (is_null($data) && $this->_preview) { // try to read production data when preview not available $master_filename = Config::util_config_filename(0, false); $data = Config::util_array_from_file($master_filename); } // try to get legacy data if (is_null($data)) { $master_filename = Config::util_config_filename_legacy(0, $this->_preview); $data = self::util_array_from_file_legacy($master_filename); } if (is_array($data)) { $data = $this->upgrade($data); foreach ($data as $key => $value) { $this->_data[$key] = $value; } } if ($this->is_master()) { return; } // apply child config $child_filename = Config::util_config_filename($this->_blog_id, $this->_preview); $data = Config::util_array_from_file($child_filename); if (is_null($data) && $this->_preview) { // try to read production data when preview not available $child_filename = Config::util_config_filename($this->_blog_id, false); $data = Config::util_array_from_file($child_filename); } // try to get legacy data if (is_null($data)) { $child_filename = Config::util_config_filename_legacy($this->_blog_id, $this->_preview); $data = self::util_array_from_file_legacy($child_filename); } if (is_array($data)) { $data = $this->upgrade($data); foreach ($data as $key => $value) { if (!ConfigCompiler::child_key_sealed($key, $this->_data, $data)) { $this->_data[$key] = $value; } } } }
/** * Check config file * * @param Config $config * @param Util_Environment_Exceptions $exs */ private function notify_no_config_present($config, $exs) { if ((file_exists(Config::util_config_filename(0, false)) || file_exists(Config::util_config_filename_legacy(0, false))) && $config->get_integer('common.instance_id', 0) != 0) { return; } $onclick = 'document.location.href=\'' . addslashes(wp_nonce_url('admin.php?page=w3tc_general&w3tc_save_options', 'w3tc')) . '\';'; $button = '<input type="button" class="button w3tc" ' . 'value="save the settings" onclick="' . $onclick . '" />'; $exs->push(new Util_Environment_Exception('<strong>W3 Total Cache:</strong> ' . 'Default settings are in use. The configuration file could ' . 'not be read or doesn\'t exist. Please ' . $button . ' to create the file.')); }