id = $id; $this->file = mediaFN($this->id, $revision); $this->revision = $revision ?: $mtime ?: filemtime($this->file); $this->size = $size ?? filesize($this->file); $this->permission = $perms ?? auth_quickaclcheck($this->id); ; $this->isimage = (bool)($isimage ?? preg_match("/\.(jpe?g|gif|png)$/", $id)); $this->hash = $hash; $this->author = $author; } /** * Calculate the hash for this page * * This is a heavy operation and should only be called when needed. */ public function calculateHash() { $this->hash = md5(io_readFile($this->file, false)); } /** * Retrieve the author of this page */ public function retrieveAuthor() { $pagelog = new MediaChangeLog($this->id, 1024); $info = $pagelog->getRevisionInfo($this->revision); $this->author = is_array($info) ? ($info['user'] ?: $info['ip']) : ''; } /** @inheritdoc */ public function __toString() { return $this->id . '@' . $this->revision; } }