wp-cli.php 940 Bytes
Newer Older
1
2
<?php

3
namespace Automattic\WP\Cron_Control\CLI;
4

5
6
if ( ! defined( '\WP_CLI' ) || ! \WP_CLI ) {
	return;
7
}
8

Erick Hitter's avatar
Erick Hitter committed
9
10
11
12
13
/**
 * Consistent time format across commands
 */
const TIME_FORMAT = 'Y-m-d H:i:s';

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
 *  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
 */
38
39
require __DIR__ . '/wp-cli/class-cache.php';
require __DIR__ . '/wp-cli/class-events.php';
40
require __DIR__ . '/wp-cli/class-lock.php';
41
require __DIR__ . '/wp-cli/class-one-time-fixers.php';