Files
sm-sitemap-plugin/updates/202610110002_create_golem15_sitemap_settings.go
Jakub Zych 4a82240429 feat(17-03): full sitemap generation, settings, hooks and import commands
- generator in Definition::addItemToSet order: 50000 URL cap, lastmod from
  the record or the updates manifest (regular file, 5 MiB cap, fail safe),
  BeforeAddItem (skip) and AddItem (extra XML) festival events, tier or item
  priority, per-alternate expansion of list type children
- priority tiers from golem15.sitemap.priority_tiers, compiled at boot,
  defaults equal to the PHP getPriorityForUrl rules
- frontend_url rewrite of loc, xhtml:link href and the stylesheet href;
  GET /sitemap.xsl serves the PHP stylesheet byte for byte
- golem15_sitemap_settings singleton and Settings model
- sitemap:import (PHP ImportCommand) and sitemap:import-winter with the
  read-only Winter export SQL
- urlto and full goldens generated from PHP; TestSitemapImportSmoke
2026-10-12 17:07:39 +02:00

45 lines
1.2 KiB
Go

package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// createSettings creates the settings singleton golem15_sitemap_settings
// (row id 1). WinterCMS kept these values in system_settings under
// golem15_sitemap_settings; sitemap:import-winter copies them here.
var createSettings = []*gormigrate.Migration{
{
ID: "202610110002_create_golem15_sitemap_settings",
Migrate: func(tx *gorm.DB) error {
for _, stmt := range []string{
`CREATE TABLE golem15_sitemap_settings (
id INTEGER PRIMARY KEY,
frontend_url TEXT NULL,
frontend_default_locale TEXT NULL,
updates_manifest_path TEXT NULL,
enable_priority_tiers BOOLEAN NOT NULL DEFAULT TRUE,
priority_homepage TEXT NULL DEFAULT '1.0',
priority_services TEXT NULL DEFAULT '0.8',
priority_blog TEXT NULL DEFAULT '0.6',
priority_categories TEXT NULL DEFAULT '0.4',
priority_legal TEXT NULL DEFAULT '0.2'
)`,
`INSERT INTO golem15_sitemap_settings (id) VALUES (1)`,
} {
if err := tx.Exec(stmt).Error; err != nil {
return err
}
}
return nil
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec(`DROP TABLE IF EXISTS golem15_sitemap_settings`).Error
},
},
}
func init() {
Register(createSettings...)
}