Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
7d783975
Commit
7d783975
authored
Mar 24, 2017
by
Erick Hitter
Browse files
Also create table when event-list endpoint is called
parent
a6484b9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-events-store.php
View file @
7d783975
...
...
@@ -58,9 +58,7 @@ class Events_Store extends Singleton {
add_filter
(
'schedule_event'
,
'__return_false'
);
// In limited circumstances, try creating the table
if
(
is_admin
()
)
{
add_action
(
'shutdown'
,
array
(
$this
,
'prepare_table'
)
);
}
add_action
(
'shutdown'
,
array
(
$this
,
'maybe_create_table_on_shutdown'
)
);
}
}
...
...
@@ -118,6 +116,18 @@ class Events_Store extends Singleton {
restore_current_blog
();
}
/**
* For certain requests, create the table on shutdown
* Does not include front-end requests
*/
public
function
maybe_create_table_on_shutdown
()
{
if
(
!
is_admin
()
&&
!
is_rest_endpoint_request
(
'list'
)
)
{
return
;
}
$this
->
prepare_table
();
}
/**
* Create table in non-setup contexts, with some protections
*/
...
...
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