/** * Get the current content of the page. This is basically similar to * WikiPage::getContent( Revision::RAW ) except that when the page doesn't exist an empty * content object is returned instead of null. * * @since 1.21 * @return Content */ protected function getCurrentContent() { $rev = $this->mArticle->getRevision(); $content = $rev ? $rev->getContent(Revision::RAW) : null; if ($content === false || $content === null) { if (!$this->contentModel) { $this->contentModel = $this->getTitle()->getContentModel(); } $handler = ContentHandler::getForModelID($this->contentModel); return $handler->makeEmptyContent(); } else { # nasty side-effect, but needed for consistency $this->contentModel = $rev->getContentModel(); $this->contentFormat = $rev->getContentFormat(); return $content; } }
/** * Remove redirect link (last revision) * @param Article $article * @return Status $status */ public function removeRedirectLink($article) { wfProfileIn(__METHOD__); $lastRevision = $article->getRevision(); $previousRevision = $lastRevision->getPrevious(); if ($previousRevision instanceof Revision) { $baseRevId = $previousRevision->getId(); $previousText = $previousRevision->getText(); } else { $baseRevId = false; $previousText = ''; } $summary = wfMessage('lvs-log-removed-redirected-link')->inContentLanguage()->text(); $status = $article->doEdit($previousText, $summary, EDIT_UPDATE, $baseRevId); wfProfileOut(__METHOD__); return $status; }