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
61597bc5
Commit
61597bc5
authored
Feb 17, 2017
by
Erick Hitter
Browse files
Block duplicates
Fixes #91
parent
b16774ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-events-store.php
View file @
61597bc5
...
...
@@ -36,6 +36,9 @@ class Events_Store extends Singleton {
// Option interception
add_filter
(
'pre_option_cron'
,
array
(
$this
,
'get_option'
)
);
add_filter
(
'pre_update_option_cron'
,
array
(
$this
,
'update_option'
),
10
,
2
);
// Disallow duplicates
add_filter
(
'schedule_event'
,
array
(
$this
,
'block_creation_if_job_exists'
)
);
}
/**
...
...
@@ -271,6 +274,18 @@ class Events_Store extends Singleton {
}
}
/**
* When an entry exists, don't try to create it again
*/
public
function
block_creation_if_job_exists
(
$job
)
{
$instance
=
md5
(
maybe_serialize
(
$job
->
args
)
);
if
(
$this
->
job_exists
(
$job
->
timestamp
,
$job
->
hook
,
$instance
)
)
{
return
false
;
}
return
$job
;
}
/**
* PLUGIN UTILITY METHODS
*/
...
...
Erick Hitter
@ethitter
mentioned in commit
f285e3a9
·
Jul 13, 2017
mentioned in commit
f285e3a9
mentioned in commit f285e3a9cfd104e458478fd7c18edb64e82d01e1
Toggle commit list
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