Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Bulk Actions Cron Offload
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
Bulk Actions Cron Offload
Commits
8a1c4896
Commit
8a1c4896
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Don't schedule two of the same move requests
parent
079f67a5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/class-main.php
+9
-0
9 additions, 0 deletions
includes/class-main.php
includes/class-move-to-trash.php
+10
-4
10 additions, 4 deletions
includes/class-move-to-trash.php
with
19 additions
and
4 deletions
includes/class-main.php
+
9
−
0
View file @
8a1c4896
...
...
@@ -220,6 +220,15 @@ class Main {
public
static
function
schedule_processing
(
$vars
)
{
return
false
!==
wp_schedule_single_event
(
time
(),
self
::
CRON_EVENT
,
array
(
$vars
)
);
}
/**
*
* @param object $vars Bulk-request variables.
* @return int
*/
public
static
function
next_scheduled
(
$vars
)
{
return
(
int
)
wp_next_scheduled
(
self
::
CRON_EVENT
,
array
(
$vars
)
);
}
}
Main
::
load
();
This diff is collapsed.
Click to expand it.
includes/class-move-to-trash.php
+
10
−
4
View file @
8a1c4896
...
...
@@ -32,8 +32,14 @@ class Move_To_Trash {
* @param object $vars Bulk-request variables.
*/
public
static
function
process
(
$vars
)
{
Main
::
schedule_processing
(
$vars
);
Main
::
do_admin_redirect
(
self
::
ADMIN_NOTICE_KEY
,
true
);
$action_scheduled
=
Main
::
next_scheduled
(
$vars
);
if
(
empty
(
$action_scheduled
)
)
{
Main
::
schedule_processing
(
$vars
);
Main
::
do_admin_redirect
(
self
::
ADMIN_NOTICE_KEY
,
true
);
}
else
{
Main
::
do_admin_redirect
(
self
::
ADMIN_NOTICE_KEY
,
false
);
}
}
/**
...
...
@@ -99,11 +105,11 @@ class Move_To_Trash {
$message
=
__
(
'Success! The selected posts will be moved to the trash shortly.'
,
'bulk-edit-cron-offload'
);
}
else
{
$class
=
'notice-error'
;
$message
=
__
(
'
An unknown error occurred
.'
,
'bulk-edit-cron-offload'
);
$message
=
__
(
'
The selected posts are already scheduled to be moved to the trash
.'
,
'bulk-edit-cron-offload'
);
}
}
// TODO: show a notice if any move requests are pending for this post type ($screen->post_type).
// TODO: show a notice if
_
any
_
move requests are pending for this post type ($screen->post_type).
// Nothing to display.
if
(
!
isset
(
$class
)
||
!
isset
(
$message
)
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment