$message = $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon';
$content = new MessageContent( $message, null, 'parsemag' );
}
- wfProfileOut( __METHOD__ );
-
- return $content;
} else {
$this->fetchContentObject();
- wfProfileOut( __METHOD__ );
-
- return $this->mContentObject;
+ $content = $this->mContentObject;
}
+
+ wfProfileOut( __METHOD__ );
+ return $content;
}
/**
*
* @note code that wants to retrieve page content from the database should use WikiPage::getContent().
*
- * @return Content|null
+ * @return Content|null|boolean false
*
* @since 1.21
*/
* page of the given title.
*/
public function view() {
- global $wgParser, $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
+ global $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
wfProfileIn( __METHOD__ );
$ns = $this->getTitle()->getNamespace();
- if ( $ns == NS_USER || $ns == NS_USER_TALK ) {
- # Don't index user and user talk pages for blocked users (bug 11443)
- if ( !$this->getTitle()->isSubpage() ) {
- if ( Block::newFromTarget( null, $this->getTitle()->getText() ) instanceof Block ) {
- return array(
- 'index' => 'noindex',
- 'follow' => 'nofollow'
- );
- }
+ # Don't index user and user talk pages for blocked users (bug 11443)
+ if ( ( $ns == NS_USER || $ns == NS_USER_TALK ) && !$this->getTitle()->isSubpage() ) {
+ $specificTarget = null;
+ $vagueTarget = null;
+ $titleText = $this->getTitle()->getText();
+ if ( IP::isValid( $titleText ) ) {
+ $vagueTarget = $titleText;
+ } else {
+ $specificTarget = $titleText;
+ }
+ if ( Block::newFromTarget( $specificTarget, $vagueTarget ) instanceof Block ) {
+ return array(
+ 'index' => 'noindex',
+ 'follow' => 'nofollow'
+ );
}
}
}
// Add a <link rel="canonical"> tag
- $outputPage->addLink( array( 'rel' => 'canonical',
- 'href' => $this->getTitle()->getLocalURL() )
- );
+ $outputPage->setCanonicalUrl( $this->getTitle()->getLocalURL() );
// Tell the output object that the user arrived at this article through a redirect
$outputPage->setRedirectedFrom( $this->mRedirectedFrom );
* If patrol is possible, output a patrol UI box. This is called from the
* footer section of ordinary page views. If patrol is not possible or not
* desired, does nothing.
+ * Side effect: When the patrol link is build, this method will call
+ * OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
*/
public function showPatrolFooter() {
$request = $this->getContext()->getRequest();
}
$token = $user->getEditToken( $rcid );
+
$outputPage->preventClickjacking();
+ $outputPage->addModules( 'mediawiki.page.patrol.ajax' );
$link = Linker::linkKnown(
$this->getTitle(),