huseyinfiliz / flarum-diff
View post edit histories.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:JavaScript
Type:flarum-extension
pkg:composer/huseyinfiliz/flarum-diff
Requires
- ext-json: *
- flarum/core: ^2.0.0-beta
- jfcherng/php-diff: ^6.11.6
Suggests
- the-turk/flarum-quiet-edits: Recommended if you want to save storage volume
This package is auto-updated.
Last update: 2025-12-09 13:08:44 UTC
README
This extension adds a "post revision history" feature to your Flarum forum.
Note: This is the Flarum 2.x compatible version of the original the-turk/flarum-diff extension (which supports Flarum 1.8.x). This fork has been updated to work with Flarum 2.0 and later versions.
Screenshots:
Features
- Based on jfcherng/php-diff repository (this one is forked from chrisboulton/php-diff since it's no longer maintained).
- Option for line (default), word and char level diffs.
- Three render modes including "Inline", "Side By Side" & "Combined".
- Archive old revisions using cron jobs or manually.
- Delete revisions or rollback to certain revision.
- Supports
the-turk/flarum-quiet-edits. - Supports all browsers which are supporting css-grid.
Also, it won't load (and cache) anything until you click the "Edited" button so no need to worry about loading times.
Requirements
You can check your php version by running php -v and check if iconv is installed by running php --ri iconv (which should display iconv support => enabled).
Installation
composer require huseyinfiliz/flarum-diff:"*"
Updating
composer update huseyinfiliz/flarum-diff php flarum migrate php flarum cache:clear
Upgrading from the-turk/flarum-diff
⚠️ IMPORTANT: Database Backup Required
Before upgrading, you must backup your database. While our tests showed no data loss during migration, there is always a risk when upgrading major versions. Your revision history data is stored in the
post_edit_historiesandpost_edit_histories_archivetables.In our tests, all revision data was preserved successfully after the upgrade.
ℹ️ About Settings Migration
Extension settings from the-turk/flarum-diff (1.8.x) will not be transferred to this version. This is because the settings prefix has changed from
the-turk-diff.*tohuseyinfiliz-diff.*.This is not a critical issue - after installing this extension, you simply need to configure your settings manually in the admin panel. This only affects display preferences (detail level, neighbor lines, merge threshold, archive options, etc.) and does not affect your revision history data in any way. All your stored revisions will continue to work normally with the default settings until you customize them.
To upgrade from the original extension:
- Backup your database (mandatory)
- Disable the old extension in admin panel
- Remove the old extension:
composer remove the-turk/flarum-diff
- Upgrade Flarum to 2.0:
composer require flarum/core:"^2.0" # Follow Flarum's upgrade guide
- Install this extension:
composer require huseyinfiliz/flarum-diff:"*" - Run migrations and clear cache:
php flarum migrate php flarum cache:clear
- Enable the extension in admin panel
- Configure your settings in the admin panel (settings from 1.8.x will not be migrated)
Summary: Your revision history data will be fully preserved. Only extension settings need to be reconfigured manually.
Usage
Enable the extension and set the permissions. You're ready to go!
Archive Old Revisions
If x ≥ A (where the x is post's revision count), first y=mx+b revisions for the post can be stored as merged & compressed BLOB in a new table (which is called post_edit_histories_archive). Specify the A, m and b from the settings modal. Float values of y will be rounded to the next lowest integer value. It's recommended to archive old revisions if you want to save storage volume but not recommended if you don't want to.
If you want to archive old revisions, please consider enabling cron job option from the settings modal. I set a weekly cron job which is working on sundays at 02:00 AM (nothing special) using diff:archive command. Otherwise, it'll try to find & archive old revisions for the post as soon as Post\Revised event fires or wait for your php flarum diff:archive command. See this discussion for setting up the scheduler.
Links
- Flarum Discuss post
- Source code on GitHub
- Changelog
- Report an issue
- Download via Packagist
- Original extension (Flarum 1.x)
Credits
- Original extension by Hasan Özbey (the-turk)
- Flarum 2.x compatibility by Hüseyin Filiz