コード例 #1
0
 /**
  * Disables WP_CACHE
  *
  * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
  */
 private function wp_config_remove_directive()
 {
     $config_path = Util_Environment::wp_config_path();
     $config_data = @file_get_contents($config_path);
     if ($config_data === false) {
         return;
     }
     $new_config_data = $this->wp_config_remove_from_content($config_data);
     if ($new_config_data != $config_data) {
         try {
             Util_WpFile::write_to_file($config_path, $new_config_data);
         } catch (Util_WpFile_FilesystemOperationException $ex) {
             throw new Util_WpFile_FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), 'Edit file <strong>' . $config_path . '</strong> and remove next lines:', $config_path, $this->wp_config_addon());
         }
     }
 }
コード例 #2
0
 /**
  * Disables COOKIE_DOMAIN
  *
  * @return bool
  */
 function disable_cookie_domain()
 {
     $config_path = Util_Environment::wp_config_path();
     $config_data = @file_get_contents($config_path);
     if ($config_data === false) {
         return false;
     }
     if ($this->is_cookie_domain_define($config_data)) {
         $new_config_data = preg_replace(W3TC_PLUGIN_TOTALCACHE_REGEXP_COOKIEDOMAIN, "define('COOKIE_DOMAIN', false)", $config_data, 1);
         if ($new_config_data != $config_data) {
             if (!@file_put_contents($config_path, $new_config_data)) {
                 return false;
             }
         }
     }
     return true;
 }
コード例 #3
0
 /**
  * Returns server info
  *
  * @return array
  */
 private function get_server_info()
 {
     global $wp_version, $wp_db_version, $wpdb;
     $wordpress_plugins = get_plugins();
     $wordpress_plugins_active = array();
     foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
         if (is_plugin_active($wordpress_plugin_file)) {
             $wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
         }
     }
     $mysql_version = $wpdb->get_var('SELECT VERSION()');
     $mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
     $mysql_variables = array();
     foreach ($mysql_variables_result as $mysql_variables_row) {
         $mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
     }
     $server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => Util_Environment::blog_id(), 'home_domain_root_url' => Util_Environment::home_domain_root_url(), 'home_url_maybe_https' => Util_Environment::home_url_maybe_https(), 'site_path' => Util_Environment::site_path(), 'document_root' => Util_Environment::document_root(), 'site_root' => Util_Environment::site_root(), 'site_url_uri' => Util_Environment::site_url_uri(), 'home_url_host' => Util_Environment::home_url_host(), 'home_url_uri' => Util_Environment::home_url_uri(), 'network_home_url_uri' => Util_Environment::network_home_url_uri(), 'host_port' => Util_Environment::host_port(), 'host' => Util_Environment::host(), 'wp_config_path' => Util_Environment::wp_config_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) Util_Http::upload_info(), 'theme' => Util_Theme::get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
     return $server_info;
 }