| @@ -40,8 +40,36 @@ | ||
| 40 | 40 | */ |
| 41 | 41 | class Site_Identity_Manager extends Abstract_SEO_Manager { |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | + * The per-context title formats as ThinkRank ships them. | |
| 45 | + * | |
| 46 | + * These are not in get_default_settings(): the admin screen seeds them on | |
| 47 | + * first save, so on a real install they are stored values, indistinguishable | |
| 48 | + * from a template the user typed. The migration needs to tell those two | |
| 49 | + * apart — it may overwrite a shipped default with an imported template, and | |
| 50 | + * must never overwrite a choice the user made — so this is the record of | |
| 51 | + * what "untouched" looks like. | |
| 52 | + * | |
| 53 | + * Keep in step with getDefaultSettings() in | |
| 54 | + * src/admin/components/essential-seo/SiteIdentityTab.js. SiteIdentityTitleFormatDefaultsTest | |
| 55 | + * fails when the two drift. | |
| 56 | + * | |
| 57 | + * @since 2.8.0 | |
| 58 | + * @var array<string, string> | |
| 59 | + */ | |
| 60 | + public const TITLE_FORMAT_DEFAULTS = [ | |
| 61 | + 'homepage_title' => '%site_title% %sep% %site_description%', | |
| 62 | + 'post_title' => '%post_title% %sep% %site_title%', | |
| 63 | + 'page_title' => '%page_title% %sep% %site_title%', | |
| 64 | + 'category_title' => '%category_title% %sep% %site_title%', | |
| 65 | + 'tag_title' => '%tag_title% %sep% %site_title%', | |
| 66 | + 'author_title' => '%author_name% %sep% %site_title%', | |
| 67 | + 'search_title' => 'Search Results for "%search_term%" %sep% %site_title%', | |
| 68 | + 'archive_title' => '%archive_title% %sep% %site_title%', | |
| 69 | + ]; | |
| 70 | + | |
| 71 | + /** | |
| 44 | 72 | * WordPress filesystem instance |
| 45 | 73 | * |
| 46 | 74 | * @since 1.0.0 |
| 47 | 75 | * @var \WP_Filesystem_Base|null |
| @@ -3675,9 +3703,22 @@ | ||
| 3675 | 3703 | // business sitemap and the sitemaps other plugins register both land |
| 3676 | 3704 | // here for the same reason, so they go through one list (#104). |
| 3677 | 3705 | $extra = []; |
| 3678 | 3706 | |
| 3679 | - if (file_exists(ABSPATH . 'local-sitemap.xml')) { | |
| 3707 | + // Not a file test. Under dynamic delivery the local sitemap is | |
| 3708 | + // served from PHP and no file is ever written, so file_exists() | |
| 3709 | + // silently dropped a sitemap the site really does publish (#752). | |
| 3710 | + // On static sites the file is still what proves it, so both count. | |
| 3711 | + $local_sitemap_published = file_exists(ABSPATH . 'local-sitemap.xml'); | |
| 3712 | + | |
| 3713 | + if (!$local_sitemap_published && class_exists('ThinkRank\\SEO\\Sitemap_Generator')) { | |
| 3714 | + $generator = new \ThinkRank\SEO\Sitemap_Generator(false); | |
| 3715 | + | |
| 3716 | + $local_sitemap_published = 'dynamic' === $generator->resolve_delivery_mode() | |
| 3717 | + && $generator->publishes_local_sitemap(); | |
| 3718 | + } | |
| 3719 | + | |
| 3720 | + if ($local_sitemap_published) { | |
| 3680 | 3721 | $extra[] = '/local-sitemap.xml'; |
| 3681 | 3722 | } |
| 3682 | 3723 | |
| 3683 | 3724 | foreach (\ThinkRank\SEO\Sitemap_Generator::additional_sitemaps() as $path) { |