Grav History Plugin
This product is in beta state.
It is available to registered beta testers only.
Saves a history of all page modifications into an embedded Git repository. Provides pages and commands to view and process the historical data.
The Grav History Plugin creates an embedded Git repository inside of your existing Grav project directory.
Each time a page is created, modified, or deleted, the plugin will commit the changes.
Having a history of all page activity will allow you to view changes, compare revisions, restore previous versions, and recover deleted pages.
The location of the repository is <your-project>/git.
You must have Git installed on your webserver.
The Grav Git Plugin will work even if you are already using Git for your project; A separate repository is created just for page revisions.
Admin Integration
The plugin adds:
- A View History action to the admin pages list.
- A View History action to the admin page editor.
- A History Administration page located at admin/history.
Pages
- /admin/history and /admin/history/admin
- Shows Git plugin actions and status.
Revisions
Shows a revisions report for the selection. Each revision has
- A link to edit or view the page
- An View Diff action that shows the Git diff information.
- /admin/history/git-revisions?target=<slug>
- Shows a revisions report for the selected page.
- /admin/history/git-revisions-list
- Shows all Git revisions.
- /admin/history/git-revisions-last
- Shows the last Git commit.
CLI
The following commands are added to the Grav CLI console.
- sync
- see syncAllPages
bin/plugin history sync
API
- syncAllPages()
- Syncs all pages in the user directory. Use this command if pages were modified outside the admin plugin.
- syncPage($page)
- Syncs the provided page.
- deleteRepo()
- Deletes the repository.
- resetRepo()
- Deletes the Git repo and creates a new one.
- log()
- Shows the Git log.
- diff($rev1, $rev2)
- Show a diff between 2 revisions.
roadmap: Restore deleted pages
release:next