What a revision is
Every time the module writes a theme file it stores a row in the theme_file_revision table containing the theme name, the file path relative to the theme's view/ directory, the complete file content, its size, a SHA-256 checksum, the ID of the user who made the change, a UTC timestamp and an optional change summary.
Revisions are created by:
- saving in the editor (summary: whatever you typed);
- Copy to Theme (summary:
Copied from apporCopied from module/<Name>); - Copy Theme (one revision per
.phtmlfile in the new theme, summary:Copied from theme: <source>); - rolling back (summary:
Rollback to revision #N).
Changes made outside the module, for example over SSH or by upgrading a theme, are not recorded. The Diff tab can still show you how the file on disk differs from the last revision.
After each save, revisions of that file beyond Revisions to keep per file are deleted, oldest first. Revision rows are kept when the user who made them is deleted.
The Diff tab
Open a theme file and click the Diff tab.
- In Compare revision: choose a revision. The list shows the 50 most recent revisions as
#ID – date – summary. - In the second list choose Current file (the file as it is on disk right now) or another revision.
- Click Load Diff.
The result is a unified diff with three lines of context, with removed lines and added lines highlighted. No differences found. means the two versions are identical.
The Revision History page
Click Revision History in the file header, or go to /admin/theme-file-editor/revisions?theme=<theme>&path=<path>. The button only appears once the file has at least one revision.
The table lists the 50 most recent revisions (add &limit=200 to the URL for more, up to 200) with their ID, Date (UTC), Size and Summary.
To compare two revisions, tick their checkboxes and click Compare selected. Once two are ticked, the other checkboxes are disabled until you untick one. The diff appears below the table.
Back to Editor returns to the file.
Rolling back
- On the Revision History page, click Rollback on the revision you want to restore.
- Confirm the dialog, which names the revision ID and date.
The module writes that revision's content to the file on disk and records a new revision with the summary Rollback to revision #N. The page reloads with the new revision at the top of the list. Because a rollback is just another revision, you can roll back a rollback.
A rollback requires the file's directory to be writable and the file's path to still exist inside the theme. It does not run the syntax check and does not create a .bak copy. It fires the theme_file_editor.file_rollback event; see Events and Integration.