}
} else if ( $rt = Title::newFromRedirect( $text ) ) {
# Don't append the subtitle if this was an old revision
- $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() );
+ $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) );
$parseout = $wgParser->parse($text, $this->mTitle, ParserOptions::newFromUser($wgUser));
$wgOut->addParserOutputNoText( $parseout );
} else if ( $pcache ) {
&& !$this->mTitle->isCssJsSubpage();
}
- protected function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
+ /**
+ * View redirect
+ * @param Title $target Title of destination to redirect
+ * @param Bool $appendSubtitle Object[optional]
+ * @param Bool $forceKnown Should the image be shown as a bluelink regardless of existence?
+ */
+ public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser;
# Display redirect
else
$link = $sk->makeLinkObj( $target, htmlspecialchars( $target->getFullText() ) );
- $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
- '<span class="redirectText">'.$link.'</span>' );
+ return '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
+ '<span class="redirectText">'.$link.'</span>';
}
# If nothing's changed, do nothing
if( $changed ) {
- global $wgGroupPermissions;
if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) {
$dbw = wfGetDB( DB_MASTER );
$nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true );
$nullRevId = $nullRevision->insertOn( $dbw );
+ $latest = $this->getLatest();
# Update page record
$dbw->update( 'page',
array( /* SET */
), 'Article::protect'
);
- wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, false) );
+ wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, $latest) );
wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) );
# Update the protection log
$row = $dbw->fetchObject($res);
$onlyAuthor = $row->rev_user_text;
// Try to find a second contributor
- while( $row = $dbw->fetchObject($res) ) {
+ foreach( $res as $row ) {
if($row->rev_user_text != $onlyAuthor) {
$onlyAuthor = false;
break;
array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $id ),
__METHOD__ );
- if ( false !== $res ) {
- if ( $dbr->numRows( $res ) ) {
- while ( $row = $dbr->fetchObject( $res ) ) {
- $result[] = Title::makeTitle( $row->tl_namespace, $row->tl_title );
- }
+ if( false !== $res ) {
+ foreach( $res as $row ) {
+ $result[] = Title::makeTitle( $row->tl_namespace, $row->tl_title );
}
}
$dbr->freeResult( $res );
'page_namespace' => NS_CATEGORY, 'page_title=cl_to'),
__METHOD__ );
if ( false !== $res ) {
- if ( $dbr->numRows( $res ) ) {
- while ( $row = $dbr->fetchObject( $res ) ) {
- $result[] = Title::makeTitle( NS_CATEGORY, $row->cl_to );
- }
+ foreach( $res as $row ) {
+ $result[] = Title::makeTitle( NS_CATEGORY, $row->cl_to );
}
}
$dbr->freeResult( $res );
global $wgContLang;
if ( false !== $res ) {
- if ( $dbr->numRows( $res ) ) {
- while ( $row = $dbr->fetchObject( $res ) ) {
- $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ;
- }
+ foreach( $res as $row ) {
+ $tlTemplates[] = $wgContLang->getNsText( $row->tl_namespace ) . ':' . $row->tl_title ;
}
}