History log of /dokuwiki/_test/tests/inc/changelog_getrelativerevision.test.php (Results 1 – 11 of 11)
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 ...


# 72d8810b 24-Sep-2023 Gerrit Uitslag <klapinklapin@gmail.com>

Fix unit test, little refactor


# 71951841 24-Sep-2023 Gerrit Uitslag <klapinklapin@gmail.com>

deprecate parseChangelogLine()

It was already replace in code, replaced in unit test as well.


# fb285245 23-Oct-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

UnitTest around changelog, set correct time of page source

ChangeLog constructor will check the date of current page/media file to detect external edits via getCurrentRevisionInfo()


# 1c33cec3 04-Feb-2021 Andreas Gohr <andi@splitbrain.org>

add needed type hints for phpunit8

This will break a lot of plugin tests, but can't be avoided


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


# 59cce2d9 22-Nov-2013 Gerrit Uitslag <klapinklapin@gmail.com>

Improve changelog reading. Inclusive unittests for chunks smaller than changelog lines.


# 332817fc 21-Nov-2013 Gerrit Uitslag <klapinklapin@gmail.com>

improve unittests getrelativerevision. Bit code reformatting unit tests


# 047bad06 21-Nov-2013 Gerrit Uitslag <klapinklapin@gmail.com>

refactor PageRevisionLog into Media- and PageChangelog extending Changelog


# 0f13c836 21-Nov-2013 Gerrit Uitslag <klapinklapin@gmail.com>

Improved isCurrentRevision(), tests included


# 55545bcc 20-Nov-2013 Gerrit Uitslag <klapinklapin@gmail.com>

Add unit tests for getRelativerevision