Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
dfac3343
Verified
Commit
dfac3343
authored
Dec 06, 2016
by
Erick Hitter
Browse files
Reorganize before additional commands are introduced
parent
d8581842
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/wp-cli.php
View file @
dfac3343
...
...
@@ -35,5 +35,6 @@ function stop_the_insanity() {
/**
* Load commands
*/
require
__DIR__
.
'/wp-cli/class-data.php'
;
require
__DIR__
.
'/wp-cli/class-cache.php'
;
require
__DIR__
.
'/wp-cli/class-events.php'
;
require
__DIR__
.
'/wp-cli/class-one-time-fixers.php'
;
includes/wp-cli/class-cache.php
0 → 100644
View file @
dfac3343
<?php
namespace
Automattic\WP\Cron_Control\CLI
;
/**
* Manage Cron Control's internal caches
*/
class
Cache
extends
\
WP_CLI_Command
{
/**
* Flush the cache
*
* @subcommand flush
*/
public
function
flush_internal_caches
(
$args
,
$assoc_args
)
{
$flushed
=
\
Automattic\WP\Cron_Control\flush_internal_caches
();
if
(
$flushed
)
{
\
WP_CLI
::
success
(
__
(
'Internal caches cleared'
,
'automattic-cron-control'
)
);
}
else
{
\
WP_CLI
::
warning
(
__
(
'No caches to clear'
,
'automattic-cron-control'
)
);
}
}
}
\
WP_CLI
::
add_command
(
'cron-control cache'
,
'Automattic\WP\Cron_Control\CLI\Cache'
);
includes/wp-cli/class-
data
.php
→
includes/wp-cli/class-
events
.php
View file @
dfac3343
...
...
@@ -3,30 +3,15 @@
namespace
Automattic\WP\Cron_Control\CLI
;
/**
* Manage Cron Control's data
, including internal caches
* Manage Cron Control's data
*/
class
Data
extends
\
WP_CLI_Command
{
/**
* Flush Cron Control's internal caches
*
* @subcommand flush-caches
*/
public
function
flush_internal_caches
(
$args
,
$assoc_args
)
{
$flushed
=
\
Automattic\WP\Cron_Control\flush_internal_caches
();
if
(
$flushed
)
{
\
WP_CLI
::
success
(
__
(
'Internal caches cleared'
,
'automattic-cron-control'
)
);
}
else
{
\
WP_CLI
::
warning
(
__
(
'No caches to clear'
,
'automattic-cron-control'
)
);
}
}
class
Events
extends
\
WP_CLI_Command
{
/**
* List cron events
*
* Intentionally bypasses caching to ensure latest data is shown
*
* @subcommand list
-events
* @subcommand list
*/
public
function
list_events
(
$args
,
$assoc_args
)
{
$events
=
$this
->
get_events
(
$args
,
$assoc_args
);
...
...
@@ -42,7 +27,7 @@ class Data extends \WP_CLI_Command {
// Not much to do
if
(
0
===
$events
[
'total_items'
]
)
{
\
WP_CLI
::
success
(
__
(
'No
thing
to display'
,
'automattic-cron-control'
)
);
\
WP_CLI
::
success
(
__
(
'No
events
to display'
,
'automattic-cron-control'
)
);
return
;
}
...
...
@@ -256,4 +241,4 @@ class Data extends \WP_CLI_Command {
}
}
\
WP_CLI
::
add_command
(
'cron-control
-data
'
,
'Automattic\WP\Cron_Control\CLI\
Data
'
);
\
WP_CLI
::
add_command
(
'cron-control
events
'
,
'Automattic\WP\Cron_Control\CLI\
Events
'
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment