[PR #5913] [MERGED] Slug History Tracking & Usage #6593

Closed
opened 2026-02-05 10:36:19 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5913
Author: @ssddanbrown
Created: 11/23/2025
Status: Merged
Merged: 11/24/2025
Merged by: @ssddanbrown

Base: developmentHead: slug_history


📝 Commits (6)

  • e64fc60 Slugs: Created history table to track changes
  • 291a807 Slugs: Added slug recording at points of generation
  • dd5375f Slugs: Fixed storage bugs, added testing coverage
  • dd39369 Slugs: Added lookup system using history
  • c908169 Slugs: Rolled out history lookup to other types
  • cdd164e Slugs: Added test to cover history lookup permission usage

📊 Changes

25 files changed (+585 additions, -120 deletions)

View changed files

📝 app/App/SluggableInterface.php (+2 -4)
📝 app/Entities/Controllers/BookController.php (+12 -1)
📝 app/Entities/Controllers/BookshelfController.php (+12 -1)
📝 app/Entities/Controllers/ChapterController.php (+9 -1)
📝 app/Entities/Controllers/PageController.php (+1 -4)
📝 app/Entities/Models/BookChild.php (+1 -26)
📝 app/Entities/Models/Entity.php (+8 -11)
app/Entities/Models/SlugHistory.php (+28 -0)
📝 app/Entities/Queries/EntityQueries.php (+25 -2)
📝 app/Entities/Repos/BaseRepo.php (+15 -2)
📝 app/Entities/Repos/ChapterRepo.php (+3 -1)
📝 app/Entities/Repos/PageRepo.php (+4 -2)
📝 app/Entities/Tools/HierarchyTransformer.php (+3 -2)
app/Entities/Tools/ParentChanger.php (+40 -0)
📝 app/Entities/Tools/SlugGenerator.php (+23 -1)
app/Entities/Tools/SlugHistory.php (+97 -0)
📝 app/Entities/Tools/TrashCan.php (+2 -1)
📝 app/Sorting/BookSorter.php (+3 -1)
📝 app/Users/Models/User.php (+0 -11)
📝 app/Users/UserRepo.php (+5 -3)

...and 5 more files

📄 Description

Adds a purpose-built slug tracking system to note old slugs on changes, so that they can be used for lookup.
We're already doing something similar via page revisions, but this will be a more robust implementation which works for all core content types.

For #5411

Todo

  • Create new table & migrate revision slug data.
  • Log shelf slug changes
  • Log book slug changes
  • Log chapter slug changes
  • Log page slug changes
  • Add shelf slug handling fallback
  • Add book slug handling fallback
  • Add chapter slug handling fallback
  • Update page slug handling fallback to use this
  • Ensure child items can be looked up after parent slug change
  • Add testing coverage

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/5913 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 11/23/2025 **Status:** ✅ Merged **Merged:** 11/24/2025 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `slug_history` --- ### 📝 Commits (6) - [`e64fc60`](https://github.com/BookStackApp/BookStack/commit/e64fc60bdf56360604c57395447c8c4b2fd330ae) Slugs: Created history table to track changes - [`291a807`](https://github.com/BookStackApp/BookStack/commit/291a807d98989804256f41c82ad297b789cf28e8) Slugs: Added slug recording at points of generation - [`dd5375f`](https://github.com/BookStackApp/BookStack/commit/dd5375f480bc7f8ee48e376d8fff1bee9f6bc542) Slugs: Fixed storage bugs, added testing coverage - [`dd39369`](https://github.com/BookStackApp/BookStack/commit/dd393691b17370f3967980b19daf95b206beac15) Slugs: Added lookup system using history - [`c908169`](https://github.com/BookStackApp/BookStack/commit/c90816987c088e72a98f3ddb45d0cd6decff1b66) Slugs: Rolled out history lookup to other types - [`cdd164e`](https://github.com/BookStackApp/BookStack/commit/cdd164e3e3e0fb1bcd40329043503b1bea849cab) Slugs: Added test to cover history lookup permission usage ### 📊 Changes **25 files changed** (+585 additions, -120 deletions) <details> <summary>View changed files</summary> 📝 `app/App/SluggableInterface.php` (+2 -4) 📝 `app/Entities/Controllers/BookController.php` (+12 -1) 📝 `app/Entities/Controllers/BookshelfController.php` (+12 -1) 📝 `app/Entities/Controllers/ChapterController.php` (+9 -1) 📝 `app/Entities/Controllers/PageController.php` (+1 -4) 📝 `app/Entities/Models/BookChild.php` (+1 -26) 📝 `app/Entities/Models/Entity.php` (+8 -11) ➕ `app/Entities/Models/SlugHistory.php` (+28 -0) 📝 `app/Entities/Queries/EntityQueries.php` (+25 -2) 📝 `app/Entities/Repos/BaseRepo.php` (+15 -2) 📝 `app/Entities/Repos/ChapterRepo.php` (+3 -1) 📝 `app/Entities/Repos/PageRepo.php` (+4 -2) 📝 `app/Entities/Tools/HierarchyTransformer.php` (+3 -2) ➕ `app/Entities/Tools/ParentChanger.php` (+40 -0) 📝 `app/Entities/Tools/SlugGenerator.php` (+23 -1) ➕ `app/Entities/Tools/SlugHistory.php` (+97 -0) 📝 `app/Entities/Tools/TrashCan.php` (+2 -1) 📝 `app/Sorting/BookSorter.php` (+3 -1) 📝 `app/Users/Models/User.php` (+0 -11) 📝 `app/Users/UserRepo.php` (+5 -3) _...and 5 more files_ </details> ### 📄 Description Adds a purpose-built slug tracking system to note old slugs on changes, so that they can be used for lookup. We're already doing something similar via page revisions, but this will be a more robust implementation which works for all core content types. For #5411 ### Todo - [x] Create new table & migrate revision slug data. - [x] Log shelf slug changes - [x] Log book slug changes - [x] Log chapter slug changes - [x] Log page slug changes - [x] Add shelf slug handling fallback - [x] Add book slug handling fallback - [x] Add chapter slug handling fallback - [x] Update page slug handling fallback to use this - [x] Ensure child items can be looked up after parent slug change - [x] Add testing coverage --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:36:19 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6593