fix: the definitions migration keeps and logs every url item

Migration 202610280002 converts the Phase 17 url items through
models.ConvertLegacyItems: a relative path gets its leading slash,
spaces and the bytes " < > \ are percent-encoded, and a malformed item
no longer drops the whole definition. Each url item that cannot be
copied is logged at warn level with its label, value and reason.
This commit is contained in:
Jakub Zych
2026-11-04 23:05:45 +01:00
parent 2200e46d98
commit b37b2265ed
5 changed files with 193 additions and 22 deletions

View File

@@ -25,7 +25,7 @@ v0.1 served one `/sitemap.xml` in the WinterCMS byte format from a definition of
- `/sitemap.xml` is now a sitemap index; its URL is unchanged, so robots.txt `Sitemap:` lines and Search Console submissions keep working.
- The files are `/sitemap-<slug>-<n>.xml` at the site root. Go serves them at `/_sitemap/files/{file}`; the site's SEO layer (vue-seo-layer) or its proxy maps the root names there.
- `/sitemap.xsl` answers 404, and no `<priority>` or `<changefreq>` is written.
- The definitions screen and the old settings tile are one settings singleton. The url items of the definition move to the additional addresses, `frontend_url` to the site address and `frontend_default_locale` to the default locale (migration `202610280002`). Reference items are dropped: the content types list their records. The `golem15_sitemap_definitions` table and the Phase 17 settings columns stay in the database, unread, so a rollback loses nothing.
- The definitions screen and the old settings tile are one settings singleton. The url items of the definition move to the additional addresses (`models.ConvertLegacyItems`): a relative path such as `o-nas` gets its leading slash, as v0.1 resolved it against the site root, spaces and the characters `"`, `<`, `>` and `\` are percent-encoded, and a duplicate is copied once. An item that still cannot be an additional address (an absolute URL with `&`, another scheme, a malformed item) is not copied and logged at startup as `golem15.sitemap: definition url item not copied` with the item, its value and the reason; the other items are copied. `frontend_url` moves to the site address and `frontend_default_locale` to the default locale (migration `202610280002`). Reference items are dropped: the content types list their records. The `golem15_sitemap_definitions` table and the Phase 17 settings columns stay in the database, unread, so a rollback loses nothing.
- The config keys `golem15.sitemap.cache_seconds` and `golem15.sitemap.priority_tiers` and the festival events `BeforeAddItem` and `AddItem` are gone.
## Features
@@ -270,6 +270,7 @@ The files table lists the image and News files too. A save refuses an invalid si
| `models.TypeSetting` | A row of `golem15_sitemap_types`. |
| `models.AllowedFrontendURL`, `models.AllowedAddress`, `models.ParseDate`, `models.ValidDate` | The value checks. |
| `models.LegacyItem`, `models.ParseLegacyItems`, `models.ParseLegacyItem`, `models.LegacyEntries`, `models.LegacyJSON`, `models.DecodeText`, `models.Text` | Reading Phase 17 and WinterCMS definition data. |
| `models.ConvertLegacyItems`, `models.DroppedItem` | The url items of a Phase 17 definition as additional addresses, and the items that could not be copied with their reasons. |
| `controllers.SettingsControllerID`, `controllers.PermissionAccessDefinitions` | `golem15.sitemap.settings` and `golem15.sitemap.access_definitions`. |
| `console.Rebuild`, `console.Import`, `console.ImportFile`, `console.ImportWinter`, `console.ImportWinterFiles`, `console.WinterOptions`, `console.WinterReport` | The commands. |
| `api.KeyFile`, `api.KeyFilePattern` | The IndexNow key file handler (package `controllers/api`). |