various improvements to make release 1 complete
This commit is contained in:
@@ -35,6 +35,15 @@ class Swiss_Football_Matchdata {
|
||||
}
|
||||
|
||||
public function init() {
|
||||
// Detect version updates and flush REST API routes cache if needed
|
||||
$stored_version = get_option('swi_foot_plugin_version');
|
||||
if ($stored_version !== SWI_FOOT_PLUGIN_VERSION) {
|
||||
// Plugin was updated, clear REST endpoints cache
|
||||
delete_transient('rest_endpoints_data');
|
||||
wp_cache_delete('rest_endpoints', 'swi-foot/v1');
|
||||
update_option('swi_foot_plugin_version', SWI_FOOT_PLUGIN_VERSION);
|
||||
}
|
||||
|
||||
// Register post meta to store per-post context (season/team/match) for posts and pages
|
||||
$meta_args = array(
|
||||
'type' => 'object',
|
||||
@@ -80,9 +89,14 @@ class Swiss_Football_Matchdata {
|
||||
add_option('swi_foot_verein_id', '');
|
||||
add_option('swi_foot_season_id', date('Y')); // Current year as default
|
||||
add_option('swi_foot_match_cache_duration', 30);
|
||||
add_option('swi_foot_plugin_version', SWI_FOOT_PLUGIN_VERSION);
|
||||
|
||||
// Flush rewrite rules
|
||||
flush_rewrite_rules();
|
||||
|
||||
// Clear REST API route caches
|
||||
delete_transient('rest_endpoints_data');
|
||||
wp_cache_delete('rest_endpoints', 'swi-foot/v1');
|
||||
}
|
||||
|
||||
public function deactivate() {
|
||||
|
||||
Reference in New Issue
Block a user