set proper revinfo when media meta file is not available

MediaChangelog::getRevision() may return false when media changes meta file is missing, cause error unsupported operand types.
This commit is contained in:
Satoshi Sahara 2020-11-22 16:51:30 +09:00
parent 6b6d27d965
commit 5525369fbf
1 changed files with 13 additions and 1 deletions

View File

@ -193,6 +193,7 @@ class Revisions extends Ui
* @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)
{
@ -220,7 +221,18 @@ class Revisions extends Ui
// add current page or media as revision[0]
if ($this->media_id) {
$rev = filemtime(fullpath(mediaFN($this->media_id)));
$revisions[] = $changelog->getRevisionInfo($rev) + array(
$changelog->setChunkSize(1024);
$revinfo = $changelog->getRevisionInfo($rev) ?: array(
'date' => $rev,
'ip' => null,
'type' => null,
'id' => $this->media_id,
'user' => null,
'sum' => null,
'extra' => null,
'sizechange' => null,
);
$revisions[] = $revinfo + array(
'media' => true,
'current' => true,
);