/**
* Get the title object of the article
+ *
* @return Title object of this page
*/
public function getTitle() {
return $this->mPage->getTitle();
}
+ /**
+ * Get the WikiPage object of this instance
+ *
+ * @since 1.19
+ * @return WikiPage
+ */
+ public function getPage() {
+ return $this->mPage;
+ }
+
/**
* Clear the object
*/
wfProfileIn( __METHOD__ );
- $request = $this->context->getRequest();
$title = $this->context->getTitle();
-
- $action = $request->getVal( 'action', 'view' );
$article = Article::newFromTitle( $title, $this->context );
+ $this->context->setWikiPage( $article->getPage() );
// NS_MEDIAWIKI has no redirects.
// It is also used for CSS/JS, so performance matters here...
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
wfProfileOut( __METHOD__ );
return $article;
}
+
+ $request = $this->context->getRequest();
+
// Namespace might change when using redirects
// Check for redirects ...
+ $action = $request->getVal( 'action', 'view' );
$file = ( $title->getNamespace() == NS_FILE ) ? $article->getFile() : null;
if ( ( $action == 'view' || $action == 'render' ) // ... for actions that show content
&& !$request->getVal( 'oldid' ) && // ... and are not old revisions
$rarticle->setRedirectedFrom( $title );
$article = $rarticle;
$this->context->setTitle( $target );
+ $this->context->setWikiPage( $article->getPage() );
}
}
} else {
$this->context->setTitle( $article->getTitle() );
+ $this->context->setWikiPage( $article->getPage() );
}
}
$cache->loadFromFileCache( $this->context );
}
# Do any stats increment/watchlist stuff
- $page = WikiPage::factory( $this->getTitle() );
- $page->doViewUpdates( $this->context->getUser() );
+ $this->context->getWikiPage()->doViewUpdates( $this->context->getUser() );
# Tell OutputPage that output is taken care of
$this->context->getOutput()->disable();
wfProfileOut( 'main-try-filecache' );
*/
private $title;
+ /**
+ * @var WikiPage
+ */
+ private $wikipage;
+
/**
* @var OutputPage
*/
}
/**
+ * Set the WikiPage object
+ *
+ * @since 1.19
+ * @param $p WikiPage object
+ */
+ public function setWikiPage( WikiPage $p ) {
+ $this->wikipage = $p;
+ }
+
+ /**
+ * Get the WikiPage object
+ *
+ * @since 1.19
+ * @return WikiPage
+ */
+ public function getWikiPage() {
+ if ( !is_null( $this->wikipage ) ) {
+ return $this->wikipage;
+ } else {
+ return $this->getContext()->getWikiPage();
+ }
+ }
+
+ /**
+ * Set the OutputPage object
+ *
* @param $o OutputPage
*/
public function setOutput( OutputPage $o ) {
*/
private $title;
+ /**
+ * @var WikiPage
+ */
+ private $wikipage;
+
/**
* @var OutputPage
*/
return $this->title;
}
+ /**
+ * Set the WikiPage object
+ *
+ * @since 1.19
+ * @param $p WikiPage object
+ */
+ public function setWikiPage( WikiPage $p ) {
+ $this->wikipage = $p;
+ }
+
+ /**
+ * Get the WikiPage object
+ *
+ * @since 1.19
+ * @return WikiPage
+ */
+ public function getWikiPage() {
+ if ( $this->wikipage === null ) {
+ $title = $this->getTitle();
+ if ( $title === null ) {
+ throw new MWException( __METHOD__ . ' called without Title object set' );
+ }
+ $this->wikipage = WikiPage::factory( $title );
+ }
+ return $this->wikipage;
+ }
+
/**
* @param $o OutputPage
*/