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
15582049
Commit
15582049
authored
Mar 24, 2017
by
Erick Hitter
Browse files
CLI: when running `cron-control` commands, create the table if necessary
parent
9751ac77
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/wp-cli.php
View file @
15582049
...
...
@@ -6,6 +6,27 @@ if ( ! defined( '\WP_CLI' ) || ! \WP_CLI ) {
return
;
}
/**
* Prepare environment
*/
if
(
!
\
Automattic\WP\Cron_Control\Events_Store
::
is_installed
()
)
{
// Only interfere with `cron-control` commands
$cmd
=
\
WP_CLI
::
get_runner
()
->
arguments
;
if
(
!
is_array
(
$cmd
)
||
!
isset
(
$cmd
[
'0'
]
)
)
{
return
;
}
$cmd
=
$cmd
[
0
];
if
(
false
===
strpos
(
$cmd
,
'cron-control'
)
)
{
return
;
}
// Create table and die, to ensure command runs with proper state
\
Automattic\WP\Cron_Control\Events_Store
::
instance
()
->
cli_create_tables
();
\
WP_CLI
::
error
(
__
(
'Cron Control installation completed. Please try again.'
,
'automattic-cron-control'
)
);
}
/**
* Consistent time format across commands
*/
...
...
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