id = $id; $this->setChangeLog(); } /** * set class property changelog */ abstract protected function setChangeLog(); /** * item filename resolver * * @param string $id page id or media id * @param int|string $rev revision timestamp, or empty string for current one * @return string full path */ abstract protected function itemFN($id, $rev = ''); /** * Get revisions, and set correct pagenation parameters (first, hasNext) * * @param int $first * @param bool $hasNext * @return array revisions to be shown in a pagenated list * @see also https://www.dokuwiki.org/devel:changelog */ protected function getRevisions(&$first, &$hasNext) { global $conf; $changelog =& $this->changelog; $revisions = array(); /* we need to get one additional log entry to be able to * decide if this is the last page or is there another one. * see also Ui\Recent::getRecents() */ $revlist = $changelog->getRevisions($first, $conf['recent'] +1); if (count($revlist) == 0 && $first != 0) { $first = 0; $revlist = $changelog->getRevisions($first, $conf['recent'] +1); } // add current page or media as revision[0] when necessary if ($first === 0 && file_exists($this->itemFN($this->id))) { $rev = filemtime(fullpath($this->itemFN($this->id))); $changelog->setChunkSize(1024); //FIXME why does chunksize change wanted? $revinfo = $changelog->getRevisionInfo($rev) ?: array( 'date' => $rev, 'ip' => null, 'type' => null, 'id' => $this->id, 'user' => null, 'sum' => null, 'extra' => null, 'sizechange' => null, ); $revisions[] = $revinfo + array( 'item' => $this->item, 'current' => true, ); } // decide if this is the last page or is there another one $hasNext = false; if (count($revlist) > $conf['recent']) { $hasNext = true; array_pop($revlist); // remove one additional log entry } // append each revison info array to the revisions foreach ($revlist as $rev) { $revisions[] = $changelog->getRevisionInfo($rev) + array('item' => $this->item); } return $revisions; } /** * Navigation buttons for Pagenation (prev/next) * * @param int $first * @param bool $hasNext * @param callable $callback returns array of hidden fields for the form button * @return array html */ protected function navigation($first, $hasNext, $callback) { global $conf; $html = '