| #
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 ...
|
| #
90fb952c |
| 31-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
code style: operator spacing
|
| #
7d34963b |
| 31-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
coding style: control flow line breaks
|
| #
8c7c53b0 |
| 30-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
codestyle adjustments: class declaration braces
|
| #
445164b2 |
| 29-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
Apply rector fixes to inc/File
|
| #
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
|
| #
97b27cd4 |
| 29-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
fix undefined variable
|
| #
7fba736b |
| 28-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
update metadata of changed page in PageFile class
|
| #
36454bb5 |
| 27-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
remove page key from event data prior to return
$data['page'] is object $this, it is not possible to access the object after destructed.
|
| #
666bc21d |
| 27-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
fix Undefined variable $id
|
| #
b24e9c4a |
| 27-Nov-2021 |
Satoshi Sahara <sahara.satoshi@gmail.com> |
implement PageFile class
PageFile class handles wiki text file and its change management for specific page, main part comes from `function saveWikiText()`. This ensures and enables to use one **Pag
implement PageFile class
PageFile class handles wiki text file and its change management for specific page, main part comes from `function saveWikiText()`. This ensures and enables to use one **PageChangeLog** instance during a page save process among class methods and relevant plugins.
show more ...
|