Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
a0156c9e
Commit
a0156c9e
authored
Dec 05, 2016
by
Erick Hitter
Committed by
GitHub
Dec 05, 2016
Browse files
Merge pull request #26 from Automattic/develop
When an event's timestamp--or other data--is invalid, remove the entry
parents
645747a7
077b7876
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-cron-options-cpt.php
View file @
a0156c9e
...
...
@@ -110,10 +110,29 @@ class Cron_Options_CPT extends Singleton {
// Loop through results and built output Core expects
if
(
!
empty
(
$jobs_posts
)
)
{
foreach
(
$jobs_posts
as
$jobs_post
)
{
// Determine event timestamp
$timestamp
=
strtotime
(
$jobs_post
->
post_date_gmt
);
// When timestamp is invalid, perhaps due to post date being set to `0000-00-00 00:00:00`, attempt to fall back to the original value
if
(
$timestamp
<=
0
)
{
$event_data
=
$jobs_post
->
post_title
;
$event_data
=
explode
(
'|'
,
$event_data
);
if
(
is_numeric
(
$event_data
[
0
]
)
)
{
$timestamp
=
(
int
)
$event_data
[
0
];
}
}
// If timestamp is still invalid, event is removed to let its source fix it
if
(
$timestamp
<=
0
)
{
$this
->
mark_job_post_completed
(
$jobs_post
->
ID
);
continue
;
}
// Retrieve event's remaining data
$job_args
=
maybe_unserialize
(
$jobs_post
->
post_content_filtered
);
if
(
!
is_array
(
$job_args
)
)
{
$this
->
mark_job_post_completed
(
$jobs_post
->
ID
);
continue
;
}
...
...
Write
Preview
Supports
Markdown
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