Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
49c1b142
Commit
49c1b142
authored
Feb 17, 2017
by
Erick Hitter
Browse files
CLI should support all statuses the Event Store provides
parent
216a91e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/wp-cli/class-events.php
View file @
49c1b142
...
...
@@ -145,28 +145,34 @@ class Events extends \WP_CLI_Command {
private
function
get_events
(
$args
,
$assoc_args
)
{
global
$wpdb
;
//
Validate status
, with a default
//
Accept a status argument
, with a default
$status
=
'pending'
;
if
(
isset
(
$assoc_args
[
'status'
]
)
)
{
$status
=
$assoc_args
[
'status'
];
}
if
(
'pending'
!==
$status
&&
'completed'
!==
$status
)
{
\
WP_CLI
::
error
(
__
(
'Invalid status requested'
,
'automattic-cron-control'
)
);
}
// Convert to post status
// Convert to status used by Event Store
$event_status
=
null
;
switch
(
$status
)
{
case
'pending'
:
$event_status
=
\
Automattic\WP\Cron_Control\Events_Store
::
STATUS_PENDING
;
break
;
case
'running'
:
$event_status
=
\
Automattic\WP\Cron_Control\Events_Store
::
STATUS_RUNNING
;
break
;
case
'completed'
:
$event_status
=
\
Automattic\WP\Cron_Control\Events_Store
::
STATUS_COMPLETED
;
break
;
}
if
(
is_null
(
$event_status
)
)
{
\
WP_CLI
::
error
(
__
(
'Invalid status specified'
,
'automattic-cron-control'
)
);
}
unset
(
$status
);
// Total to show
$limit
=
25
;
if
(
isset
(
$assoc_args
[
'limit'
]
)
&&
is_numeric
(
$assoc_args
[
'limit'
]
)
)
{
...
...
Write
Preview
Markdown
is supported
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