From 39c005ca7948d4935aa26539121ed9c13fe82363 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 1 Nov 2010 00:07:17 +0000 Subject: [PATCH] bug 25517 Assignment in conditions should be avoided/ http://www.mediawiki.org/wiki/Manual:Coding_conventions#Assignment_expressions --- includes/Article.php | 21 ++++---- includes/ChangeTags.php | 4 +- includes/EditPage.php | 50 ++++++++++--------- includes/Exception.php | 6 ++- includes/Metadata.php | 11 ++-- includes/SkinTemplate.php | 3 +- includes/Title.php | 3 +- includes/Wiki.php | 7 +-- includes/db/DatabaseMssql.php | 3 +- includes/diff/DifferenceEngine.php | 5 +- includes/filerepo/File.php | 3 +- includes/filerepo/ForeignAPIRepo.php | 3 +- includes/normal/UtfNormal.php | 3 +- .../ResourceLoaderWikiModule.php | 9 ++-- includes/specials/SpecialAllpages.php | 6 ++- includes/specials/SpecialExport.php | 4 +- includes/specials/SpecialNewimages.php | 10 ++-- .../specials/SpecialRecentchangeslinked.php | 3 +- includes/specials/SpecialVersion.php | 5 +- maintenance/checkSyntax.php | 4 +- maintenance/findhooks.php | 6 ++- maintenance/importImages.inc | 3 +- maintenance/namespaceDupes.php | 5 +- maintenance/rebuildrecentchanges.php | 3 +- skins/Standard.php | 3 +- skins/Vector.php | 3 +- 26 files changed, 112 insertions(+), 74 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index c2ac338768..53abef098c 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -984,15 +984,18 @@ class Article { wfDebug( __METHOD__ . ": showing CSS/JS source\n" ); $this->showCssOrJsPage(); $outputDone = true; - } else if ( $rt = Title::newFromRedirectArray( $text ) ) { - wfDebug( __METHOD__ . ": showing redirect=no page\n" ); - # Viewing a redirect page (e.g. with parameter redirect=no) - # Don't append the subtitle if this was an old revision - $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) ); - # Parse just to get categories, displaytitle, etc. - $this->mParserOutput = $wgParser->parse( $text, $this->mTitle, $parserOptions ); - $wgOut->addParserOutputNoText( $this->mParserOutput ); - $outputDone = true; + } else { + $rt = Title::newFromRedirectArray( $text ); + if ( $rt ) { + wfDebug( __METHOD__ . ": showing redirect=no page\n" ); + # Viewing a redirect page (e.g. with parameter redirect=no) + # Don't append the subtitle if this was an old revision + $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) ); + # Parse just to get categories, displaytitle, etc. + $this->mParserOutput = $wgParser->parse( $text, $this->mTitle, $parserOptions ); + $wgOut->addParserOutputNoText( $this->mParserOutput ); + $outputDone = true; + } } break; case 4: diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 4d433d4e65..4a1ad801b4 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -180,8 +180,8 @@ class ChangeTags { // Caching... global $wgMemc; $key = wfMemcKey( 'valid-tags' ); - - if ( $tags = $wgMemc->get( $key ) ) { + $tags = $wgMemc->get( $key ); + if ( $tags ) { return $tags; } diff --git a/includes/EditPage.php b/includes/EditPage.php index 386dc807fc..2150656e39 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1867,38 +1867,40 @@ HTML $parserOptions->setTidy( true ); $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); $previewHTML = $parserOutput->mText; - } elseif ( $rt = Title::newFromRedirectArray( $this->textbox1 ) ) { - $previewHTML = $this->mArticle->viewRedirect( $rt, false ); } else { - $toparse = $this->textbox1; + $rt = Title::newFromRedirectArray( $this->textbox1 ); + if ( $rt ) { + $previewHTML = $this->mArticle->viewRedirect( $rt, false ); + } else { + $toparse = $this->textbox1; - # If we're adding a comment, we need to show the - # summary as the headline - if ( $this->section == "new" && $this->summary != "" ) { - $toparse = "== {$this->summary} ==\n\n" . $toparse; - } + # If we're adding a comment, we need to show the + # summary as the headline + if ( $this->section == "new" && $this->summary != "" ) { + $toparse = "== {$this->summary} ==\n\n" . $toparse; + } - wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) ); - - // Parse mediawiki messages with correct target language - if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { - list( /* $unused */, $lang ) = $wgMessageCache->figureMessage( $this->mTitle->getText() ); - $obj = wfGetLangObj( $lang ); - $parserOptions->setTargetLanguage( $obj ); - } + wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) ); + // Parse mediawiki messages with correct target language + if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { + list( /* $unused */, $lang ) = $wgMessageCache->figureMessage( $this->mTitle->getText() ); + $obj = wfGetLangObj( $lang ); + $parserOptions->setTargetLanguage( $obj ); + } - $parserOptions->setTidy( true ); - $parserOptions->enableLimitReport(); - $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ), + $parserOptions->setTidy( true ); + $parserOptions->enableLimitReport(); + $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ), $this->mTitle, $parserOptions ); - $previewHTML = $parserOutput->getText(); - $this->mParserOutput = $parserOutput; - $wgOut->addParserOutputNoText( $parserOutput ); + $previewHTML = $parserOutput->getText(); + $this->mParserOutput = $parserOutput; + $wgOut->addParserOutputNoText( $parserOutput ); - if ( count( $parserOutput->getWarnings() ) ) { - $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() ); + if ( count( $parserOutput->getWarnings() ) ) { + $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() ); + } } } diff --git a/includes/Exception.php b/includes/Exception.php index a5e86cdc05..ac336bf5a3 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -179,7 +179,8 @@ class MWException extends Exception { $wgOut->redirect( '' ); $wgOut->clearHTML(); - if ( $hookResult = $this->runHooks( get_class( $this ) ) ) { + $hookResult = $this->runHooks( get_class( $this ) ); + if ( $hookResult ) { $wgOut->addHTML( $hookResult ); } else { $wgOut->addHTML( $this->getHTML() ); @@ -187,7 +188,8 @@ class MWException extends Exception { $wgOut->output(); } else { - if ( $hookResult = $this->runHooks( get_class( $this ) . "Raw" ) ) { + $hookResult = $this->runHooks( get_class( $this ) . "Raw" ); + if ( $hookResult ) { die( $hookResult ); } diff --git a/includes/Metadata.php b/includes/Metadata.php index 508afb6d49..aff103f517 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -119,11 +119,14 @@ abstract class RdfMetaData { protected function person($name, User $user ){ if( $user->isAnon() ){ $this->element( $name, wfMsgExt( 'anonymous', array( 'parsemag' ), 1 ) ); - } else if( $real = $user->getRealName() ) { - $this->element( $name, $real ); } else { - $userName = $user->getName(); - $this->pageOrString( $name, $user->getUserPage(), wfMsgExt( 'siteuser', 'parsemag', $userName, $userName ) ); + $real = $user->getRealName(); + if( $real ) { + $this->element( $name, $real ); + } else { + $userName = $user->getName(); + $this->pageOrString( $name, $user->getUserPage(), wfMsgExt( 'siteuser', 'parsemag', $userName, $userName ) ); + } } } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index b2cfd0cd1b..360918fbef 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -793,7 +793,8 @@ class SkinTemplate extends Skin { } else { //article doesn't exist or is deleted if( $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'deletedtext' ) ) { - if( $n = $this->mTitle->isDeleted() ) { + $n = $this->mTitle->isDeleted(); + if( $n ) { $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); $content_actions['undelete'] = array( 'class' => false, diff --git a/includes/Title.php b/includes/Title.php index cec0067f37..02bf964a4f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2794,7 +2794,8 @@ class Title { $retVal = array(); if ( $db->numRows( $res ) ) { foreach ( $res as $row ) { - if ( $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ) ) { + $titleObj = Title::makeTitle( $row->page_namespace, $row->page_title ) + if ( $titleObj ) { $linkCache->addGoodLinkObj( $row->page_id, $titleObj, $row->page_len, $row->page_is_redirect, $row->page_latest ); $retVal[] = $titleObj; } diff --git a/includes/Wiki.php b/includes/Wiki.php index aaced4802e..c31a6ab28e 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -108,8 +108,8 @@ class MediaWiki { if( $wgRequest->getVal( 'printable' ) === 'yes' ) { $wgOut->setPrintable(); } - - if( $curid = $wgRequest->getInt( 'curid' ) ) { + $curid = $wgRequest->getInt( 'curid' ); + if( $curid ) { // URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); } elseif( $title == '' && $action != 'delete' ) { @@ -191,7 +191,8 @@ class MediaWiki { // Interwiki redirects } else if( $title->getInterwiki() != '' ) { - if( $rdfrom = $request->getVal( 'rdfrom' ) ) { + $rdfrom = $request->getVal( 'rdfrom' ); + if( $rdfrom ) { $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); } else { $query = $request->getValues(); diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 9c9bbd1784..0087e7407e 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -780,7 +780,8 @@ class DatabaseMssql extends DatabaseBase { print( "Error in fieldInfo query: " . $this->getErrors() ); return false; } - if ( $meta = $this->fetchRow( $res ) ) { + $meta = $this->fetchRow( $res ); + if ( $meta ) { return new MssqlField( $meta ); } return false; diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 512f3fbc24..f46705c523 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -308,8 +308,9 @@ class _DiffEngine { $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks); for ( ; $x < $x1; $x++) { $line = $flip ? $this->yv[$x] : $this->xv[$x]; - if (empty($ymatches[$line])) - continue; + if (empty($ymatches[$line])) { + continue; + } $matches = $ymatches[$line]; reset($matches); while ( list( $junk, $y ) = each( $matches ) ) { diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 063fb169da..28929b72c1 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -906,7 +906,8 @@ abstract class File { $retVal = array(); if ( $db->numRows( $res ) ) { foreach ( $res as $row ) { - if ( $titleObj = Title::newFromRow( $row ) ) { + $titleObj = Title::newFromRow( $row ) + if ( $titleObj ) { $linkCache->addGoodLinkObj( $row->page_id, $titleObj, $row->page_len, $row->page_is_redirect, $row->page_latest ); $retVal[] = $titleObj; } diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index c75d15eee8..f6b21ee99d 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -201,7 +201,8 @@ class ForeignAPIRepo extends FileRepo { } $key = $this->getLocalCacheKey( 'ForeignAPIRepo', 'ThumbUrl', $name ); - if ( $thumbUrl = $wgMemc->get($key) ) { + $thumbUrl = $wgMemc->get($key); + if ( $thumbUrl ) { wfDebug("Got thumb from local cache. $thumbUrl \n"); return $thumbUrl; } diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 1d94d724cb..8390d08e3b 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -308,7 +308,8 @@ class UtfNormal { $len = $chunk + 1; # Counting down is faster. I'm *so* sorry. for( $i = -1; --$len; ) { - if( $remaining = $tailBytes[$c = $str{++$i}] ) { + $remaining = $tailBytes[$c = $str{++$i}] + if( $remaining ) { # UTF-8 head byte! $sequence = $head = $c; do { diff --git a/includes/resourceloader/ResourceLoaderWikiModule.php b/includes/resourceloader/ResourceLoaderWikiModule.php index f0e42310ad..a395cf055c 100644 --- a/includes/resourceloader/ResourceLoaderWikiModule.php +++ b/includes/resourceloader/ResourceLoaderWikiModule.php @@ -45,7 +45,8 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { if ( $ns === NS_MEDIAWIKI ) { return wfEmptyMsg( $page ) ? '' : wfMsgExt( $page, 'content' ); } - if ( $title = Title::newFromText( $page, $ns ) ) { + $title = Title::newFromText( $page, $ns ); + if ( $title ) { if ( $title->isValidCssJsSubpage() && $revision = Revision::newFromTitle( $title ) ) { return $revision->getRawText(); } @@ -59,7 +60,8 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { $scripts = ''; foreach ( $this->getPages( $context ) as $page => $options ) { if ( $options['type'] === 'script' ) { - if ( $script = $this->getContent( $page, $options['ns'] ) ) { + $script = $this->getContent( $page, $options['ns'] ); + if ( $script ) { $ns = MWNamespace::getCanonicalName( $options['ns'] ); $scripts .= "/*$ns:$page */\n$script\n"; } @@ -74,7 +76,8 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { foreach ( $this->getPages( $context ) as $page => $options ) { if ( $options['type'] === 'style' ) { $media = isset( $options['media'] ) ? $options['media'] : 'all'; - if ( $style = $this->getContent( $page, $options['ns'] ) ) { + $style = $this->getContent( $page, $options['ns'] ); + if ( $style ) { if ( !isset( $styles[$media] ) ) { $styles[$media] = ''; } diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index e0fbe024cc..487d44d3b8 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -188,7 +188,8 @@ class SpecialAllpages extends IncludableSpecialPage { array ('LIMIT' => 2, 'OFFSET' => $maxPerSubpage - 1, 'ORDER BY' => 'page_title ASC') ); - if( $s = $dbr->fetchObject( $res ) ) { + $s = $dbr->fetchObject( $res ); + if( $s ) { array_push( $lines, $s->page_title ); } else { // Final chunk, but ended prematurely. Go back and find the end. @@ -198,7 +199,8 @@ class SpecialAllpages extends IncludableSpecialPage { array_push( $lines, $endTitle ); $done = true; } - if( $s = $res->fetchObject() ) { + $s = $res->fetchObject(); + if( $s ) { array_push( $lines, $s->page_title ); $lastTitle = $s->page_title; } else { diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 5f56befd89..eaed23931e 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -229,8 +229,8 @@ class SpecialExport extends SpecialPage { if( $this->templates ) { $pageSet = $this->getTemplates( $inputPages, $pageSet ); } - - if( $linkDepth = $this->pageLinkDepth ) { + $linkDepth = $this->pageLinkDepth; + if( $linkDepth ) { $pageSet = $this->getPageLinks( $inputPages, $pageSet, $linkDepth ); } diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 596221501a..cecd7dfdef 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -74,8 +74,8 @@ function wfSpecialNewimages( $par, $specialPage ) { # Hardcode this for now. $limit = 48; - - if ( $parval = intval( $par ) ) { + $parval = intval( $par ); + if ( $parval ) { if ( $parval <= $limit && $parval > 0 ) { $limit = $parval; } @@ -92,10 +92,12 @@ function wfSpecialNewimages( $par, $specialPage ) { } $invertSort = false; - if( $until = $wgRequest->getVal( 'until' ) ) { + $until = $wgRequest->getVal( 'until' ); + if( $until ) { $where[] = "img_timestamp < '" . $dbr->timestamp( $until ) . "'"; } - if( $from = $wgRequest->getVal( 'from' ) ) { + $from = $wgRequest->getVal( 'from' ); + if( $from ) { $where[] = "img_timestamp >= '" . $dbr->timestamp( $from ) . "'"; $invertSort = true; } diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index b929a7920b..db0f554d02 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -99,7 +99,8 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { $query_options = array(); // left join with watchlist table to highlight watched rows - if( $uid = $wgUser->getId() ) { + $uid = $wgUser->getId(); + if( $uid ) { $tables[] = 'watchlist'; $select[] = 'wl_user'; $join_conds['watchlist'] = array( 'LEFT JOIN', "wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace" ); diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 700d10fe68..a62c248f2b 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -293,7 +293,10 @@ class SpecialVersion extends SpecialPage { $out .= '' . $this->listToText( $wgExtensionFunctions ) . "\n"; } - if ( $cnt = count( $tags = $wgParser->getTags() ) ) { + $tags = $wgParser->getTags(); + $cnt = count( $tags ); + + if ( $cnt ) { for ( $i = 0; $i < $cnt; ++$i ) { $tags[$i] = "<{$tags[$i]}>"; } diff --git a/maintenance/checkSyntax.php b/maintenance/checkSyntax.php index c0966aef24..53e4209f92 100644 --- a/maintenance/checkSyntax.php +++ b/maintenance/checkSyntax.php @@ -105,7 +105,8 @@ class CheckSyntax extends Maintenance { if ( !$f ) { $this->error( "Can't open file $file\n", true ); } - while ( $path = trim( fgets( $f ) ) ) { + $path = trim( fgets( $f ) ); + while ( $path ) { $this->addPath( $path ); } fclose( $f ); @@ -113,6 +114,7 @@ class CheckSyntax extends Maintenance { } elseif ( $this->hasOption( 'modified' ) ) { $this->output( "Retrieving list from Subversion... " ); $parentDir = wfEscapeShellArg( dirname( __FILE__ ) . '/..' ); + $retval = null; $output = wfShellExec( "svn status --ignore-externals $parentDir", $retval ); if ( $retval ) { $this->error( "Error retrieving list from Subversion!\n", true ); diff --git a/maintenance/findhooks.php b/maintenance/findhooks.php index cca1b7015a..431f50d371 100644 --- a/maintenance/findhooks.php +++ b/maintenance/findhooks.php @@ -145,7 +145,8 @@ class FindHooks extends Maintenance { */ private function getHooksFromPath( $path ) { $hooks = array(); - if ( $dh = opendir( $path ) ) { + $dh = opendir( $path ); + if ( $dh ) { while ( ( $file = readdir( $dh ) ) !== false ) { if ( filetype( $path . $file ) == 'file' ) { $hooks = array_merge( $hooks, $this->getHooksFromFile( $path . $file ) ); @@ -180,7 +181,8 @@ class FindHooks extends Maintenance { */ private function getBadHooksFromPath( $path ) { $hooks = array(); - if ( $dh = opendir( $path ) ) { + $dh = opendir( $path ); + if ( $dh ) { while ( ( $file = readdir( $dh ) ) !== false ) { # We don't want to read this file as it contains bad calls to wfRunHooks() if ( filetype( $path . $file ) == 'file' && !$path . $file == __FILE__ ) { diff --git a/maintenance/importImages.inc b/maintenance/importImages.inc index 29a7fbcb59..e0001f9b3f 100644 --- a/maintenance/importImages.inc +++ b/maintenance/importImages.inc @@ -18,7 +18,8 @@ */ function findFiles( $dir, $exts ) { if ( is_dir( $dir ) ) { - if ( $dhl = opendir( $dir ) ) { + $dhl = opendir( $dir ); + if ( $dhl ) { $files = array(); while ( ( $file = readdir( $dhl ) ) !== false ) { if ( is_file( $dir . '/' . $file ) ) { diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 13dfd9fb95..ce12f61dc4 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -263,11 +263,12 @@ class NamespaceConflictChecker extends Maintenance { $row->title .= $suffix; $this->output( "... *** new title {$row->title}\n" ); $title = Title::makeTitleSafe( $row->namespace, $row->title ); - if ( ! $title ) { + if ( !$title ) { $this->output( "... !!! invalid title\n" ); return false; } - if ( $id = $title->getArticleId() ) { + $id = $title->getArticleId(); + if ( $id ) { $this->output( "... *** page exists with ID $id ***\n" ); } else { break; diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index 2b96645455..357718b7b0 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -119,7 +119,8 @@ class RebuildRecentchanges extends Maintenance { "AND rev_timestamp<'{$emit}' ORDER BY rev_timestamp DESC"; $sql2 = $dbw->limitResult( $sql2, 1, false ); $res2 = $dbw->query( $sql2 ); - if ( $row = $dbw->fetchObject( $res2 ) ) { + $row = $dbw->fetchObject( $res2 ); + if ( $row ) { $lastOldId = intval( $row->rev_id ); # Grab the last text size if available $lastSize = !is_null( $row->rev_len ) ? intval( $row->rev_len ) : 'NULL'; diff --git a/skins/Standard.php b/skins/Standard.php index f9309faae5..e9920dc0d5 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -186,7 +186,8 @@ class SkinStandard extends Skin { } $link = $this->mTitle->getText(); - if( $nstext = $wgContLang->getNsText( $tns ) ) { # add namespace if necessary + $nstext = $wgContLang->getNsText( $tns ); + if( $nstext ) { # add namespace if necessary $link = $nstext . ':' . $link; } diff --git a/skins/Vector.php b/skins/Vector.php index 679d244af8..479d06db06 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -226,7 +226,8 @@ class SkinVector extends SkinTemplate { $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'undelete' ) ) { - if( $n = $this->mTitle->isDeleted() ) { + $n = $this->mTitle->isDeleted(); + if( $n ) { $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); $links['actions']['undelete'] = array( 'class' => false, -- 2.20.1