Lines Matching +full:runs +full:- +full:on
31 $this->cache =& $cache_revinfo;
32 if (!isset($this->cache[$id])) {
33 $this->cache[$id] = [];
36 $this->id = $id;
37 $this->setChunkSize($chunk_size);
56 * Returns path to the global changelog file (the cross-page recent-changes feed)
70 return $rev == $this->currentRevision();
81 return $rev === $this->lastRevision();
88 * identical with or newer than the "last" revision, that depends on whether the file
97 if (!isset($this->currentRevision)) {
99 $this->getCurrentRevisionInfo();
101 return $this->currentRevision;
111 $revs = $this->getRevisions(-1, 1);
125 $info['mode'] = $this->getMode();
126 $this->cache[$this->id][$info['date']] ??= $info;
143 * - date: unix timestamp
144 * - ip: IPv4 address (127.0.0.1)
145 * - type: log line type
146 * - id: page id
147 * - user: user name
148 * - sum: edit summary (or action reason)
149 * - extra: extra data (varies by line type)
150 * - sizechange: change of filesize
152 * - mode: page or media
163 if (!isset($this->currentRevision) && $retrieveCurrentRevInfo) {
164 $this->getCurrentRevisionInfo();
168 if (isset($this->cache[$this->id][$rev])) {
169 return $this->cache[$this->id][$rev];
173 $result = $this->readloglines($rev);
183 $this->parseAndCacheLogLine($line);
186 return $this->cache[$this->id][$rev] ?? false;
218 $logfile = $this->getChangelogFilename();
229 $fileLastMod = $this->getFilename();
230 if (file_exists($fileLastMod) && $this->isLastRevision(filemtime($fileLastMod))) {
236 if (filesize($logfile) < $this->chunk_size || $this->chunk_size == 0) {
252 $finger = max($tail - $this->chunk_size, 0);
254 $nl = $this->getNewlinepointer($fp, $finger);
258 $finger = max($finger - $this->chunk_size, 0);
266 $read_size = max($tail - $finger, 0); // found chunk size
269 $tmp = @fread($fp, max(min($this->chunk_size, $read_size - $got), 0));
288 $finger = max($tail - $this->chunk_size, 0);
295 $num = max(min(count($lines) - $first, $num), 0);
297 $lines = array_slice($lines, max(count($lines) - $first - $num, 0), $num);
299 $lines = array_slice($lines, 0, max(count($lines) - $first, 0));
301 $lines = array_slice($lines, max(count($lines) - $num, 0));
305 for ($i = count($lines) - 1; $i >= 0; $i--) {
306 $info = $this->parseAndCacheLogLine($lines[$i]);
316 * Get the nth revision left or right-hand side for a specific page id and revision (timestamp)
337 //no direction given or last rev, so no follow-up
338 if (!$direction || ($direction > 0 && $this->isCurrentRevision($rev))) {
343 $result = $this->readloglines($rev);
352 $checkOtherChunk = true; //always runs once
361 $start = $count - 1;
362 $step = -1;
365 $info = $this->parseAndCacheLogLine($lines[$i]);
367 //look for revs older/earlier then reference $rev and select $direction-th one
377 //true when $rev is found, but not the wanted follow-up.
383 [$lines, $head, $tail] = $this->readAdjacentChunk($fp, $head, $tail, $direction);
418 $rev2 = $this->currentRevision();
421 $result2 = $this->retrieveRevisionsAround($rev2, $max);
431 $result1 = $this->retrieveRevisionsAround($rev1, $max);
443 for ($i = count($lines) - 1; $i >= 0; $i--) {
444 $info = $this->parseAndCacheLogLine($lines[$i]);
455 [$lines, $head, $tail] = $this->readAdjacentChunk($fp, $head, $tail, -1);
461 $revs1 = array_slice($revs1, max($index - (int) ($max / 2), 0), $max);
476 $fileLastMod = $this->getFilename();
477 … //requested date_at(timestamp) younger or equal then modified_time($this->id) => load current
480 } elseif ($rev = $this->getRelativeRevision($date_at + 1, -1)) {
499 * - $requestedRevs: array of with $max revision timestamps
500 * - $revs: all parsed revision timestamps
501 * - $fp: file pointer only defined for chuck reading, needs closing.
502 * - $lines: non-parsed changelog lines before the parsed revisions
503 * - $head: position of first read changelog line
504 * - $lastTail: position of end of last read changelog line
514 $result = $this->readloglines($rev);
524 $info = $this->parseAndCacheLogLine($line);
541 [$lines, $head, $tail] = $this->readAdjacentChunk($fp, $head, $tail, 1);
548 count($revs) && !$this->isCurrentRevision($revs[count($revs) - 1])
550 $revs[] = $this->currentRevision;
565 [$lines, $head, $tail] = $this->readAdjacentChunk($fp, $head, $tail, -1);
567 for ($i = count($lines) - 1; $i >= 0; $i--) {
568 $info = $this->parseAndCacheLogLine($lines[$i]);
573 if ($beforeCount > max((int) ($max / 2), $max - $afterCount)) {
579 //keep only non-parsed lines
585 $requestedRevs = array_slice($revs, -$max, $max);
598 * External revisions are persisted to the changelog (and, for non-delete cases, copied
599 * to the attic) on first detection so subsequent reads see one canonical entry instead
601 * writable in the current process context), the in-memory synthesized entry is still
605 * - date: revision identifier (timestamp or last revision +1)
606 * - ip: IPv4 address (127.0.0.1)
607 * - type: log line type
608 * - id: id of page or media
609 * - user: user name
610 * - sum: edit summary (or action reason)
611 * - extra: extra data (varies by line type)
612 * - sizechange: change of filesize
613 * - timestamp: unix timestamp or false (key set only for external edit occurred)
615 * - mode: page or media
623 if (isset($this->currentRevision)) {
624 return $this->getRevisionInfo($this->currentRevision);
628 $fileLastMod = $this->getFilename();
630 $lastRev = $this->lastRevision(); // false when no changelog
633 $this->currentRevision = false;
636 $this->currentRevision = $lastRev;
637 return $this->getRevisionInfo($lastRev);
642 $revInfo = $this->getRevisionInfo($lastRev, false);
644 $this->currentRevision = $lastRev;
650 'date' => max($lastRev + 1, time() - 1), // 1 sec before now or last revision +1
653 'id' => $this->id,
655 … 'sum' => $lang['deleted'] . ' - ' . $lang['external_edit'] . ' (' . $lang['unknowndate'] . ')',
657 'sizechange' => -io_getSizeFile($this->getFilename($lastRev)),
659 'mode' => $this->getMode()
665 $this->getRevisionInfo($lastRev, false)['type'] == DOKU_CHANGE_TYPE_DELETE
667 $filesize_new = filesize($this->getFilename());
668 $filesize_old = $isJustCreated ? 0 : io_getSizeFile($this->getFilename($lastRev));
669 $sizechange = $filesize_new - $filesize_old;
673 $sum = $lang['created'] . ' - ' . $lang['external_edit'];
680 … $details = 'File revision: ' . $fileRev . ' ' . dformat($fileRev, "%Y-%m-%d %H:%M:%S") . "\n"
681 … . 'Last revision: ' . $lastRev . ' ' . dformat($lastRev, "%Y-%m-%d %H:%M:%S");
682 Logger::error($msg, $details, $this->getFilename());
692 'id' => $this->id,
698 'mode' => $this->getMode()
703 $this->persistCurrentRevisionInfo($revInfo);
706 $this->currentRevision = $revInfo['date'];
707 $this->cache[$this->id][$this->currentRevision] = $revInfo;
708 return $this->getRevisionInfo($this->currentRevision);
717 * the lock without re-entering it.
719 * Best-effort: if writeLogEntry() throws, surfaces the error via msg() and still
728 $logfile = $this->getChangelogFilename();
731 return $this->writeLogEntry($info, $timestamp);
733 msg($e->getMessage(), -1);
734 $info['mode'] = $this->getMode();
742 * Append a log entry to the changelog files and update the in-memory cache.
744 * The caller MUST hold io_lock() on the local changelog file. The global changelog
746 * addLogEntry() runs under its lock, and what persistCurrentRevisionInfo() calls
747 * directly while it's holding the same lock for the detect-and-write critical section.
758 if (isset($timestamp)) unset($this->cache[$this->id][$info['date']]);
762 // append to local changelog without re-locking (caller holds the lock)
763 $localFile = $this->getChangelogFilename();
775 io_saveFile($this->getGlobalChangelogFilename(), $logline, true);
777 $this->currentRevision = $info['date'];
778 $info['mode'] = $this->getMode();
779 $this->cache[$this->id][$this->currentRevision] = $info;
784 * Persist a synthesized external-revision entry to the changelog
786 * Holds the local changelog lock around the entire detect-and-write critical section
789 * re-entering the lock we already hold.
792 * already persisted the entry. The caller falls back to the in-memory synthesized
803 $logfile = $this->getChangelogFilename();
806 // re-read lastRev under the lock — another request may have just persisted
807 $lastRev = $this->lastRevision();
813 if (!$this->saveExternalAttic($revInfo)) return false;
816 $this->writeLogEntry($revInfo);
819 // silent fallback to in-memory synthesis
827 * Save the externally-modified file to the attic before the synthesized log entry is
832 * @return bool true on success or no-op, false to abort persistence
837 * Mechanism to trace no-actual external current revision
842 if ($rev > $this->lastRevision()) {
843 $rev = $this->currentRevision();