Lines Matching +full:- +full:- +full:date
10 * Media files differ from pages in one way that matters to external-change detection: media
13 * base-class logic that reads it - the unchanged-content guard and the old-size lookup for
14 * the size change - has to be handled specially for media.
22 …protected function seedMedia($image, $content, $date, $type = DOKU_CHANGE_TYPE_CREATE, $sizechange… argument
25 touch(mediaFN($image), $date);
28 $date,
39 * A media file whose mtime is bumped without any content change (a touch, an rsync --times,
43 * to the recorded revision date and no changelog entry is added.
48 $lastRev = time() - 1000;
49 $this->seedMedia($image, str_repeat('x', 100), $lastRev);
56 $currentRev = $changelog->currentRevision();
57 $currentInfo = $changelog->getRevisionInfo($currentRev);
59 …$this->assertEquals($lastRev, $currentRev, 'unchanged content must not create an external revision…
60 …$this->assertArrayNotHasKey('timestamp', $currentInfo, 'should not be a synthesized external edit'…
61 …$this->assertCount(1, $changelog->getRevisions(-1, 200), 'no external edit entry should be added');
62 …$this->assertFileDoesNotExist(mediaFN($image, $lastRev + 500), 'no attic snapshot should be writte…
65 …$this->assertEquals($lastRev, filemtime(mediaFN($image)), 'file mtime should be reset to the chang…
78 $lastRev = time() - 1000;
79 $this->seedMedia($image, str_repeat('a', 100), $lastRev);
81 // replace the file externally with a differently-sized one, newer mtime
88 $currentRev = $changelog->currentRevision();
89 $currentInfo = $changelog->getRevisionInfo($currentRev);
91 $this->assertEquals($extRev, $currentRev, 'external edit detected at the file mtime');
92 … $this->assertEquals(DOKU_CHANGE_TYPE_EDIT, $currentInfo['type'], 'should be an external edit');
93 $this->assertEquals(
94 250 - 100,
98 $this->assertFileDoesNotExist(
107 * multi-revision media file still yields the correct external-edit size change.
112 $rev1 = time() - 2000;
113 $this->seedMedia($image, str_repeat('a', 100), $rev1);
119 $this->seedMedia($image, str_repeat('b', 300), $rev2, DOKU_CHANGE_TYPE_EDIT, 300 - 100);
128 $currentRev = $changelog->currentRevision();
129 $currentInfo = $changelog->getRevisionInfo($currentRev);
131 $this->assertEquals($rev3, $currentRev);
132 $this->assertEquals(DOKU_CHANGE_TYPE_EDIT, $currentInfo['type']);
133 $this->assertEquals(
134 120 - 300,
142 * mtime as its date, so it is dated just after the last revision. The current file's mtime
143 * is then repaired forward to that date (media does not archive, but the base class still
144 * fixes the mtime) so the same change is not re-detected on the next read.
149 $lastRev = time() - 1000;
150 $this->seedMedia($image, str_repeat('a', 100), $lastRev);
154 touch(mediaFN($image), $lastRev - 100);
157 $this->expectLogMessage('current file modification time is older than last revision date');
160 $currentRev = $changelog->currentRevision();
161 $currentInfo = $changelog->getRevisionInfo($currentRev);
163 $this->assertEquals(DOKU_CHANGE_TYPE_EDIT, $currentInfo['type']);
164 …$this->assertFalse($currentInfo['timestamp'], 'an older-than-last mtime cannot be trusted as the d…
165 … $this->assertEquals($lastRev + 1, $currentRev, 'the edit is dated just after the last revision');
167 // the file mtime is repaired forward, so a fresh read does not re-detect the change
169 …$this->assertEquals($lastRev + 1, filemtime(mediaFN($image)), 'file mtime repaired to the synthesi…
171 … $this->assertEquals($lastRev + 1, $fresh->currentRevision(), 'no re-detection on the next read');
172 … $this->assertCount(2, $fresh->getRevisions(-1, 200), 'exactly one external edit was recorded');