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
927a3dd5
Commit
927a3dd5
authored
Feb 17, 2017
by
Erick Hitter
Browse files
Updating for new events store
parent
c2e2b16e
Changes
2
Hide whitespace changes
Inline
Side-by-side
includes/wp-cli/class-events.php
View file @
927a3dd5
...
...
@@ -363,9 +363,9 @@ class Events extends \WP_CLI_Command {
\
WP_CLI
::
confirm
(
sprintf
(
__
(
'Are you sure you want to delete this event?'
,
'automattic-cron-control'
)
)
);
// Try to delete the item and provide some relevant output
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
suspend_event_creation
();
\
Automattic\WP\Cron_Control\suspend_event_creation
();
$trashed
=
wp_delete_post
(
$event_post
->
ID
,
true
);
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
resume_event_creation
();
\
Automattic\WP\Cron_Control\resume_event_creation
();
if
(
false
===
$trashed
)
{
\
WP_CLI
::
error
(
sprintf
(
__
(
'Failed to delete event %d'
,
'automattic-cron-control'
),
$jid
)
);
...
...
@@ -477,7 +477,7 @@ class Events extends \WP_CLI_Command {
$events_deleted_count
=
$events_failed_delete
=
0
;
// Don't create new events while deleting events
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
suspend_event_creation
();
\
Automattic\WP\Cron_Control\suspend_event_creation
();
foreach
(
$events_to_delete
as
$event_to_delete
)
{
$deleted
=
wp_delete_post
(
$event_to_delete
[
'ID'
],
true
);
...
...
@@ -504,7 +504,7 @@ class Events extends \WP_CLI_Command {
}
// New events can be created now that removal is complete
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
resume_event_creation
();
\
Automattic\WP\Cron_Control\resume_event_creation
();
// List the removed items
\
WP_CLI
::
line
(
"
\n
"
.
__
(
'RESULTS:'
,
'automattic-cron-control'
)
);
...
...
includes/wp-cli/class-one-time-fixers.php
View file @
927a3dd5
...
...
@@ -26,7 +26,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
\
WP_CLI
::
line
(
__
(
'CRON CONTROL'
,
'automattic-cron-control'
)
.
"
\n
"
);
// Don't create new events while deleting events
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
suspend_event_creation
();
\
Automattic\WP\Cron_Control\suspend_event_creation
();
$count
=
$wpdb
->
get_var
(
$wpdb
->
prepare
(
"SELECT COUNT(ID) FROM
{
$wpdb
->
posts
}
WHERE post_type = %s;"
,
'a8c_cron_ctrl_event'
)
);
...
...
@@ -106,7 +106,7 @@ class One_Time_Fixers extends \WP_CLI_Command {
}
// Let event creation resume
\
Automattic\WP\Cron_Control\
Cron_Options_CPT
::
instance
()
->
resume_event_creation
();
\
Automattic\WP\Cron_Control\resume_event_creation
();
// Fin
\
WP_CLI
::
success
(
__
(
'All done.'
,
'automattic-cron-control'
)
);
...
...
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