id = $id; $this->file = wikiFN($this->id, $revision); $this->revision = $revision ?: $mtime ?: @filemtime($this->file); $this->size = $size ?? @filesize($this->file); $this->permission = $perms ?? auth_quickaclcheck($this->id); $this->hash = $hash; $this->author = $author; $this->title = $title ?: $this->retrieveTitle(); } /** * Get the title for the page * * Honors $conf['useheading'] * * @return string */ protected function retrieveTitle() { global $conf; if ($conf['useheading']) { $title = p_get_first_heading($this->id); if ($title) { return $title; } } return $this->id; } /** * Calculate the hash for this page * * This is a heavy operation and should only be called when needed. */ public function calculateHash() { $this->hash = md5(trim(io_readFile($this->file))); } /** * Retrieve the author of this page */ public function retrieveAuthor() { $pagelog = new PageChangeLog($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; } }