[PR #3656] [MERGED] Link reference tracking & updating #6244

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

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/3656
Author: @ssddanbrown
Created: 8/16/2022
Status: Merged
Merged: 8/29/2022
Merged by: @ssddanbrown

Base: developmentHead: x_linking


📝 Commits (10+)

  • 344b3a3 Added system to extract model references from HTML content
  • 5d29d0c Added reference storage system, and command to re-index
  • 3290ab3 Added regenerate-references command test
  • bbe504c Added reference handling on page actions
  • d546572 Added inbound references listing for pages
  • d198332 Rolled out reference pages to all entities, added testing
  • f634b4e Added entity meta link to reference page
  • 26ccb7b Started work on reference on-change-updates
  • 0dbf084 Built out cross link replacer, not yet tested
  • b86ee6d Rolled out reference link updating logic usage

📊 Changes

48 files changed (+1421 additions, -140 deletions)

View changed files

📝 .env.example.complete (+1 -1)
📝 app/Config/app.php (+1 -1)
📝 app/Console/Commands/RegenerateCommentContent.php (+5 -3)
📝 app/Console/Commands/RegeneratePermissions.php (+1 -0)
app/Console/Commands/RegenerateReferences.php (+58 -0)
📝 app/Entities/Models/BookChild.php (+7 -0)
📝 app/Entities/Models/Entity.php (+17 -0)
📝 app/Entities/Repos/BaseRepo.php (+10 -1)
📝 app/Entities/Repos/PageRepo.php (+35 -107)
app/Entities/Repos/RevisionRepo.php (+131 -0)
📝 app/Entities/Tools/TrashCan.php (+2 -0)
📝 app/Http/Controllers/BookController.php (+10 -6)
📝 app/Http/Controllers/BookshelfController.php (+5 -1)
📝 app/Http/Controllers/ChapterController.php (+14 -12)
📝 app/Http/Controllers/MaintenanceController.php (+20 -1)
📝 app/Http/Controllers/PageController.php (+5 -1)
app/Http/Controllers/ReferenceController.php (+77 -0)
app/References/CrossLinkParser.php (+103 -0)
app/References/ModelResolvers/BookLinkModelResolver.php (+26 -0)
app/References/ModelResolvers/BookshelfLinkModelResolver.php (+26 -0)

...and 28 more files

📄 Description

This PR tracks efforts to index, display & handle links across BookStack items.

Todo

  • Storage of linked references
  • Rebuild index command
  • Index build on page content update/create/clone/restore.
  • Index handling entity deletion.
  • Page references page.
  • Chapter references page.
  • Book references page.
  • Shelf references page.
  • References indicator/link, to lead to references page.
  • Update of remote references upon entity URL changes.
  • Testing
    • Test references page core functionality.
    • Test references page has permissions applied to listed items.
  • Maintenance action to regen reference? (Same as command but easier access).
  • Increase default revision limit? Would need to note in docs.

Questionables

  • Do we log remote reference updates as their own revision?
    • Yes, Think that's the safest and most transparent approach here.
  • Any issues in doing this to content a user may not have permission to access? Since the activity would be logged to them.
    • Should be fine, although might look a little odd, but the summary comment on the revision should explain the cause.
  • Does this update trigger activities? Could cause webhook mass spam.
    • No, we'll keep to activities being user-events rather than content events.
  • Do we touch content in old revisions? If not, what happens to old links in that revision? Accept as broken?
    • We will not touch old revisions, to respect content history. We will accept old links as broken, since that's the current state of things right now anyway.

Docs

  • Add bookstack:regenerate-references command to commands list.
  • Advise running of the above command upon update.
  • Note change of REVISION_LIMIT default value, update docs for this value.

🔄 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/3656 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 8/16/2022 **Status:** ✅ Merged **Merged:** 8/29/2022 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `x_linking` --- ### 📝 Commits (10+) - [`344b3a3`](https://github.com/BookStackApp/BookStack/commit/344b3a3615f1f39f92ebae9c791dccc423baf61d) Added system to extract model references from HTML content - [`5d29d0c`](https://github.com/BookStackApp/BookStack/commit/5d29d0cc7bb47cad7a662f1e6afc10cb97fe3ddd) Added reference storage system, and command to re-index - [`3290ab3`](https://github.com/BookStackApp/BookStack/commit/3290ab3ac939cfdbc374163bd34566f93d9d8df6) Added regenerate-references command test - [`bbe504c`](https://github.com/BookStackApp/BookStack/commit/bbe504c559dc8b540ce4c56d23423bdf10d69e5a) Added reference handling on page actions - [`d546572`](https://github.com/BookStackApp/BookStack/commit/d5465726e2ef5f0cf129943abd3701bbc643cb28) Added inbound references listing for pages - [`d198332`](https://github.com/BookStackApp/BookStack/commit/d198332d3c7866d5eb807b9e07a4b95fd67b97c2) Rolled out reference pages to all entities, added testing - [`f634b4e`](https://github.com/BookStackApp/BookStack/commit/f634b4ea5767e6d823088c512872f9114322f7d0) Added entity meta link to reference page - [`26ccb7b`](https://github.com/BookStackApp/BookStack/commit/26ccb7b644d339da156f96ff53486a1ef500a61f) Started work on reference on-change-updates - [`0dbf084`](https://github.com/BookStackApp/BookStack/commit/0dbf08453fcb79efc9aae21f5fa55f4547083456) Built out cross link replacer, not yet tested - [`b86ee6d`](https://github.com/BookStackApp/BookStack/commit/b86ee6d252b301a94796043f333abdb6603c304c) Rolled out reference link updating logic usage ### 📊 Changes **48 files changed** (+1421 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `.env.example.complete` (+1 -1) 📝 `app/Config/app.php` (+1 -1) 📝 `app/Console/Commands/RegenerateCommentContent.php` (+5 -3) 📝 `app/Console/Commands/RegeneratePermissions.php` (+1 -0) ➕ `app/Console/Commands/RegenerateReferences.php` (+58 -0) 📝 `app/Entities/Models/BookChild.php` (+7 -0) 📝 `app/Entities/Models/Entity.php` (+17 -0) 📝 `app/Entities/Repos/BaseRepo.php` (+10 -1) 📝 `app/Entities/Repos/PageRepo.php` (+35 -107) ➕ `app/Entities/Repos/RevisionRepo.php` (+131 -0) 📝 `app/Entities/Tools/TrashCan.php` (+2 -0) 📝 `app/Http/Controllers/BookController.php` (+10 -6) 📝 `app/Http/Controllers/BookshelfController.php` (+5 -1) 📝 `app/Http/Controllers/ChapterController.php` (+14 -12) 📝 `app/Http/Controllers/MaintenanceController.php` (+20 -1) 📝 `app/Http/Controllers/PageController.php` (+5 -1) ➕ `app/Http/Controllers/ReferenceController.php` (+77 -0) ➕ `app/References/CrossLinkParser.php` (+103 -0) ➕ `app/References/ModelResolvers/BookLinkModelResolver.php` (+26 -0) ➕ `app/References/ModelResolvers/BookshelfLinkModelResolver.php` (+26 -0) _...and 28 more files_ </details> ### 📄 Description This PR tracks efforts to index, display & handle links across BookStack items. ### Todo - [x] Storage of linked references - [x] Rebuild index command - [x] Index build on page content update/create/clone/restore. - [x] Index handling entity deletion. - [x] Page references page. - [x] Chapter references page. - [x] Book references page. - [x] Shelf references page. - [x] References indicator/link, to lead to references page. - [x] Update of remote references upon entity URL changes. - [x] Testing - [x] Test references page core functionality. - [x] Test references page has permissions applied to listed items. - [x] Maintenance action to regen reference? (Same as command but easier access). - [x] Increase default revision limit? Would need to note in docs. ### Questionables - Do we log remote reference updates as their own revision? - Yes, Think that's the safest and most transparent approach here. - Any issues in doing this to content a user may not have permission to access? Since the activity would be logged to them. - Should be fine, although might look a little odd, but the summary comment on the revision should explain the cause. - Does this update trigger activities? Could cause webhook mass spam. - No, we'll keep to activities being user-events rather than content events. - Do we touch content in old revisions? If not, what happens to old links in that revision? Accept as broken? - We will not touch old revisions, to respect content history. We will accept old links as broken, since that's the current state of things right now anyway. ### Docs - Add `bookstack:regenerate-references` command to commands list. - Advise running of the above command upon update. - Note change of `REVISION_LIMIT` default value, update docs for this value. --- <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:27:36 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6244