History log of /dokuwiki/inc/ChangeLog/MediaChangeLog.php (Results 1 – 12 of 12)
Revision Date Author Comments
# 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


# 07869ee7 28-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

fix typo


# 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.