]> BookStack Code Mirror - hacks/blob - content/prune-revisions-command/index.md
Added prune revisions command hack
[hacks] / content / prune-revisions-command / index.md
1 +++
2 title = "Prune Revisions Command"
3 author = "@ssddanbrown"
4 date = 2024-05-23T13:00:00Z
5 updated = 2024-05-23T13:00:00Z
6 tested = "v24.05.1"
7 +++
8
9 This hack registers a custom command using the logical theme system, which will prune the revisions of a specific page
10 to just those with a changelog provided (in addition to the current revision), before resetting the revision numbers
11 across the remaining versions to be sequential without gaps. This will also reset the overall revision count on the page.
12
13 Once added, the command can be called like so from your BookStack install directory:
14
15 ```bash
16 # Format
17 php artisan bookstack:prune-revisions {book-slug} {page-slug}
18
19 # Example
20 php artisan bookstack:prune-revisions team-notes code-snippets
21 ```
22
23 #### Considerations
24
25 - The changes here will not be reflected in activity/audit logs, and existing related activity/audit logs will not be modified.
26 - This can delete data with no option to restore without resorting to backups.
27 - This could affect other features or processes that may potentially reference specific page revisions or numbers.
28
29 #### Code
30
31 {{<hack file="functions.php" type="logical">}}