| @@ -60,8 +60,17 @@ | ||
| 60 | 60 | // Keep the cached URL list fresh on content changes. |
| 61 | 61 | foreach (['yatra_trip_created', 'yatra_trip_updated', 'yatra_trip_deleted'] as $hook) { |
| 62 | 62 | add_action($hook, [SitemapService::class, 'flushCache']); |
| 63 | 63 | } |
| 64 | + | |
| 65 | + // ...and when the operator changes which types are published. Without | |
| 66 | + // this the entry list is cached for an hour, so the setting would look | |
| 67 | + // as though it had done nothing. | |
| 68 | + foreach (['yatra_sitemap_types', 'yatra_enable_sitemap'] as $option) { | |
| 69 | + add_action('update_option_' . $option, [SitemapService::class, 'flushCache']); | |
| 70 | + add_action('add_option_' . $option, [SitemapService::class, 'flushCache']); | |
| 71 | + add_action('delete_option_' . $option, [SitemapService::class, 'flushCache']); | |
| 72 | + } | |
| 64 | 73 | } |
| 65 | 74 | |
| 66 | 75 | private static function registerActiveIntegration( |
| 67 | 76 | SitemapService $service, |