/** * Returns object instance. Called by WP engine * * @return DbCache_Wpdb */ static function instance() { static $instance = null; if (is_null($instance)) { $processors = array(); $call_default_constructor = true; // no caching during activation $is_installing = defined('WP_INSTALLING') && WP_INSTALLING; $config = Dispatcher::config(); if (!$is_installing && $config->get_boolean('dbcache.enabled')) { $processors[] = new DbCache_WpdbInjection_QueryCaching(); } if (Util_Environment::is_dbcluster()) { $processors[] = new Enterprise_Dbcache_WpdbInjection_Cluster(); } $processors[] = new DbCache_WpdbInjection(); $class = __CLASS__; $o = new $class($processors); $next_injection = new _CallUnderlying($o); foreach ($processors as $processor) { $processor->initialize_injection($o, $next_injection); } // initialize after processors configured $o->initialize(); $instance = $o; } return $instance; }
/** * Database cluster config editor * * @return void */ function dbcluster_config() { $this->_page = 'w3tc_dbcluster_config'; if (Util_Environment::is_dbcluster()) { $content = @file_get_contents(W3TC_FILE_DB_CLUSTER_CONFIG); } else { $content = @file_get_contents(W3TC_DIR . '/ini/dbcluster-config-sample.php'); } include W3TC_INC_OPTIONS_DIR . '/enterprise/dbcluster-config.php'; }
<?php namespace W3TC; if (!defined('W3TC')) { die; } ?> <tr> <th><label for="w3tc_dbcluster_config">Database cluster:</th> <td> <input type="submit" id="w3tc_dbcluster_config" name="w3tc_dbcluster_config" class="button" value="<?php echo Util_Environment::is_dbcluster() ? 'Edit Database Cluster Configuration' : 'Enable database cluster'; ?> " /><br /> <span class="description">Create db-cluster-config.php file with your database cluster configuration to enable it.</span> </td> </tr> <?php