remove_subcommand('redis'); WP_CLI::add_command('redis', \RedisCachePro\Console\Commands::class); } }); add_action('activated_plugin', function ($plugin) { global $wp_filesystem; if ($plugin !== plugin_basename(__FILE__)) { return; } if (defined('WP_CLI') && WP_CLI) { WP_CLI::log(WP_CLI::colorize('Be sure to set up the `%gWP_REDIS_CONFIG%n` constant before running `%gwp redis enable%n`.')); } else { set_transient('objectcache_activated', wp_create_nonce('objectcache-activated'), 30); } deactivate_plugins('redis-cache/redis-cache.php', true, is_multisite()); if (WP_Filesystem()) { $dropin = WP_CONTENT_DIR . '/object-cache.php'; if ($wp_filesystem->exists($dropin)) { $data = get_plugin_data($dropin, false, false); if (strpos($data['PluginURI'], 'wordpress.org/plugins/redis-cache')) { $wp_filesystem->delete($dropin); if (function_exists('wp_opcache_invalidate')) { wp_opcache_invalidate($dropin, true); } } } } });