| #
5a285deb
|
| 06-Jul-2026 |
Andreas Gohr <gohr@cosmocode.de> |
fix(changelog): stop media mtime bumps from recording bogus external edits
Commit 01e8d739c ("persist external-edit detection on first read") began writing detected external edits to the changelog a
fix(changelog): stop media mtime bumps from recording bogus external edits
Commit 01e8d739c ("persist external-edit detection on first read") began writing detected external edits to the changelog and snapshotting the new content to the attic via saveExternalAttic(). That is correct for pages, which archive every revision, but wrong for media: a media file's current revision is never archived (media only copies content to the attic on replace or delete, to save space).
So getCurrentRevisionInfo()'s external-change detection had no attic copy of the current revision to work with: the unchanged-content guard always failed and the old-size lookup returned 0. A mere mtime bump (touch, rsync --times, unzip) of an unchanged media file was therefore recorded as an external edit sized as the whole file, and since detection is now persisted, that bogus entry (plus a redundant attic copy) became permanent.
The "before" size of an external change is now taken through a lastRevisionSize() seam: the base reads it from the last revision's attic copy (unchanged for pages), and MediaChangeLog reconstructs it from the previous revision's archived size plus the size change logged for the last revision. currentContentMatchesRevision() compares the current file size against that reconstructed size, so an unchanged size is treated as a mere touch (mtime reset, no entry) and a changed size is a real external edit with the correct size change.
Media no longer snapshots an external edit to the attic at all, consistent with not archiving the current revision: it will be archived if and when the file is later replaced. The mtime repair for an unreliable external date moved to a base repairExternalMtime() shared by pages and media.
show more ...
|
| #
0a245329
|
| 07-Jun-2026 |
Andreas Gohr <andi@splitbrain.org> |
fix(changelog): don't record an external edit when the content is unchanged (#4634)
A current revision's file mtime can change without its content changing — a backup restore, a git checkout, an in-
fix(changelog): don't record an external edit when the content is unchanged (#4634)
A current revision's file mtime can change without its content changing — a backup restore, a git checkout, an in-place rewrite. Such a bump was detected as an external edit and logged with a 0-byte size change, cluttering history.
getCurrentRevisionInfo() now compares the current content against the last recorded revision before treating an mtime change as an external edit. When the content is identical no external edit happened: the file mtime is reset to the recorded revision date and the last revision is returned. The comparison is an abstract currentContentMatchesRevision() — pages compare the decompressed text, media compare file size then md5_file().
show more ...
|
| #
01e8d739
|
| 25-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
refactor(changelog): persist external-edit detection on first read
This addresses the flaky test that makes tests randomly fail (mostly on windows runners).
The flake in common_saveWikiText_test::t
refactor(changelog): persist external-edit detection on first read
This addresses the flaky test that makes tests randomly fail (mostly on windows runners).
The flake in common_saveWikiText_test::test_savesequence5 came from this line in ChangeLog::getCurrentRevisionInfo():
'date' => max($lastRev + 1, time() - 1)
The synthesized "external delete" entry was kept in memory only and only persisted later, when saveWikiText next called detectExternalEdit. That meant the formula was evaluated twice on different ChangeLog instances — once during the test's inspection, and again during the following saveWikiText — and the two evaluations could pick different seconds depending on how long the surrounding I/O took. The test cached the first result in $expectExternal and asserted it against the on-disk entry written during the second call. On the slower Windows runner the second call sometimes crossed a second boundary, producing the off-by-one date mismatch.
The questions I had was, why are we persisting external file deletions (or edits) only when a page is saved when we are obviously already detecting it earlier during the changelog read already?
Instead of recording the external delete at the time a new page is written, it makes sense to record it as soon as we detect it (when the changelog is requested by a user or a bot). This will make the recoded timestamp closer to the actual deletion.
This patch refactors the changelog accordingly, but still tries to be minimal invasive (I think the changelog handling would need much more refactoring, but that's beyond the scope of this change).
To enable proper locking (when logging an external edit and copying the attic file), locking had to be moved to the Changelog class, duplicating some code of io_saveFile.
PageFile::detectExternalEdit() and the deprecated procedural wrapper detectExternalEdit() in inc/common.php are removed. A codesearch.dokuwiki.org check confirmed no plugin calls the method directly; the only external caller of the procedural function is the farmsync plugin, which needs a parallel update.
show more ...
|
| #
a835c93a
|
| 24-Sep-2023 |
Gerrit Uitslag <klapinklapin@gmail.com> |
Let ChangeLog set the mode(media/page) for a revision log entry
|
| #
d4f83172
|
| 31-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
code style: line breaks
|
| #
8c7c53b0
|
| 30-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
codestyle adjustments: class declaration braces
|
| #
c1482d1c
|
| 30-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
codestyle adjustments: function argument spacing
|
| #
0603e565
|
| 29-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
Apply rector fixes to inc/ChangeLog
|
| #
eeda7ada
|
| 23-Jan-2022 |
Gerrit Uitslag <klapinklapin@gmail.com> |
some spelling
|
| #
79a2d784
|
| 05-Jan-2022 |
Gerrit Uitslag <klapinklapin@gmail.com> |
import classes, replace dbglog, simplify, remove unused statements, and other warnings from IntelliJ
update phpdocs, rename dokuwiki/Ui/Draft to PageDraft
|
| #
1d11f1d3
|
| 06-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
ChangeLogTrait
- move ChangeLog low level methods into trait - static ChangeLog::parseLogLine() replaces parseChangeLogLine() - new ChangeLog::buildLogLine()
|
| #
c7192766
|
| 04-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
new method ChangeLog::addLogEntry()
rewrite `detectExternalEdit()` in inc/common.php
|
| #
e49fa56b
|
| 20-Sep-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
use getFilename() method instead of wikiFN()
|
| #
0c3a5702
|
| 15-Jun-2018 |
Andreas Gohr <andi@splitbrain.org> |
split changelog classes into their own namespace
The remaining functions in inc/changelog.php should be moved into a utility class.
|