Verified Commit b994eb26 authored by Erick Hitter's avatar Erick Hitter
Browse files

Remove dependence on the VIP CLI class

parent dc93d48e
<?php
namespace Automattic\WP\Cron_Control;
namespace Automattic\WP\Cron_Control\CLI;
if ( defined( '\WP_CLI' ) && \WP_CLI ) {
require __DIR__ . '/wp-cli/class-one-time-fixers.php';
if ( ! defined( '\WP_CLI' ) || ! \WP_CLI ) {
return;
}
/**
* Clear all of the caches for memory management
*/
function stop_the_insanity() {
global $wpdb, $wp_object_cache;
$wpdb->queries = array(); // or define( 'WP_IMPORTING', true );
if ( ! is_object( $wp_object_cache ) )
return;
$wp_object_cache->group_ops = array();
$wp_object_cache->stats = array();
$wp_object_cache->memcache_debug = array();
$wp_object_cache->cache = array();
if ( is_callable( $wp_object_cache, '__remoteset' ) ) {
$wp_object_cache->__remoteset(); // important
}
}
/**
* Load commands
*/
require __DIR__ . '/wp-cli/class-one-time-fixers.php';
......@@ -2,7 +2,7 @@
namespace Automattic\WP\Cron_Control\CLI;
class One_Time_Fixers extends \WPCOM_VIP_CLI_Command {
class One_Time_Fixers extends \WP_CLI_Command {
/**
* Remove corrupt Cron Control data resulting from initial plugin deployment
......@@ -79,7 +79,7 @@ class One_Time_Fixers extends \WPCOM_VIP_CLI_Command {
// Some cleanup
unset( $items );
$this->stop_the_insanity();
stop_the_insanity();
// Prepare for the next batch
$page++;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment