From 86fd539c323a046f0328c96129587d3cc899abf5 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 20 Sep 2010 14:32:38 +0000 Subject: [PATCH] Remove some unused variables Add some braces --- includes/ProfilerStub.php | 9 ++++++--- includes/api/ApiProtect.php | 2 -- includes/api/ApiQueryAllmessages.php | 1 - includes/api/ApiQueryUserInfo.php | 2 +- includes/api/ApiUndelete.php | 2 -- includes/specials/SpecialNewimages.php | 3 +-- includes/specials/SpecialTags.php | 1 - maintenance/convertLinks.php | 2 +- maintenance/reassignEdits.php | 3 ++- maintenance/storage/storageTypeStats.php | 1 - 10 files changed, 11 insertions(+), 15 deletions(-) diff --git a/includes/ProfilerStub.php b/includes/ProfilerStub.php index 575fa7e8ef..e624e6f019 100644 --- a/includes/ProfilerStub.php +++ b/includes/ProfilerStub.php @@ -30,12 +30,15 @@ function wfProfileIn( $fn = '' ) { */ function wfProfileOut( $fn = '' ) { global $hackwhere, $wgDBname, $haveProctitle; - if( !$haveProctitle ) + if( !$haveProctitle ) { return; - if( count( $hackwhere ) ) + } + if( count( $hackwhere ) ) { array_pop( $hackwhere ); - if( count( $hackwhere ) ) + } + if( count( $hackwhere ) ) { setproctitle( $hackwhere[count( $hackwhere )-1] . " [$wgDBname]" ); + } } /** diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index 1841db6188..7617ae0b84 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -42,8 +42,6 @@ class ApiProtect extends ApiBase { global $wgUser, $wgRestrictionLevels; $params = $this->extractRequestParams(); - $titleObj = null; - $titleObj = Title::newFromText( $params['title'] ); if ( !$titleObj ) { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index 33f3c1cb8f..9159685f35 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -54,7 +54,6 @@ class ApiQueryAllmessages extends ApiQueryBase { $prop = array_flip( (array)$params['prop'] ); // Determine which messages should we print - $messages_target = array(); if ( in_array( '*', $params['messages'] ) ) { $message_names = array_keys( Language::getMessagesFor( 'en' ) ); sort( $message_names ); diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 3eb7e7e7ad..a6b2713341 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -43,13 +43,13 @@ class ApiQueryUserInfo extends ApiQueryBase { public function execute() { $params = $this->extractRequestParams(); $result = $this->getResult(); - $r = array(); if ( !is_null( $params['prop'] ) ) { $this->prop = array_flip( $params['prop'] ); } else { $this->prop = array(); } + $r = $this->getCurrentUserInfo(); $result->addValue( 'query', $this->getModuleName(), $r ); } diff --git a/includes/api/ApiUndelete.php b/includes/api/ApiUndelete.php index 83c3fbe59a..98c06d0722 100644 --- a/includes/api/ApiUndelete.php +++ b/includes/api/ApiUndelete.php @@ -42,8 +42,6 @@ class ApiUndelete extends ApiBase { global $wgUser; $params = $this->extractRequestParams(); - $titleObj = null; - if ( !$wgUser->isAllowed( 'undelete' ) ) { $this->dieUsageMsg( array( 'permdenied-undelete' ) ); } diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 898f2e2579..53a92fc181 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -68,7 +68,6 @@ function wfSpecialNewimages( $par, $specialPage ) { } else { $ts = false; } - $sql = ''; # If we were clever, we'd use this to cache. $latestTimestamp = wfTimestamp( TS_MW, $ts ); @@ -100,7 +99,7 @@ function wfSpecialNewimages( $par, $specialPage ) { $where[] = "img_timestamp >= '" . $dbr->timestamp( $from ) . "'"; $invertSort = true; } - $sql='SELECT img_size, img_name, img_user, img_user_text,'. + $sql = 'SELECT img_size, img_name, img_user, img_user_text,'. "img_description,img_timestamp FROM $image"; if( $hidebotsql ) { diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index eee1664460..b0368c7ccf 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -42,7 +42,6 @@ class SpecialTags extends SpecialPage { $wgOut->wrapWikiMsg( "
\n$1\n
", 'tags-intro' ); // Write the headers - $html = ''; $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, wfMsgExt( 'tags-tag', 'parseinline' ) ) . Xml::tags( 'th', null, wfMsgExt( 'tags-display-header', 'parseinline' ) ) . Xml::tags( 'th', null, wfMsgExt( 'tags-description-header', 'parseinline' ) ) . diff --git a/maintenance/convertLinks.php b/maintenance/convertLinks.php index c2d3bd8454..1c2bd56a71 100644 --- a/maintenance/convertLinks.php +++ b/maintenance/convertLinks.php @@ -53,7 +53,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM global $wgContLang; - $tuplesAdded = $numBadLinks = $curRowsRead = 0; # counters etc + $numBadLinks = $curRowsRead = 0; # counters etc $totalTuplesInserted = 0; # total tuples INSERTed into links_temp $reportCurReadProgress = true; # whether or not to give progress reports while reading IDs from cur table diff --git a/maintenance/reassignEdits.php b/maintenance/reassignEdits.php index 0613c7596d..e59c654a3d 100644 --- a/maintenance/reassignEdits.php +++ b/maintenance/reassignEdits.php @@ -47,8 +47,9 @@ class ReassignEdits extends Maintenance { $report = $this->hasOption( 'report' ); $count = $this->doReassignEdits( $from, $to, !$this->hasOption( 'norc' ), $report ); # If reporting, and there were items, advise the user to run without --report - if ( $report ) + if ( $report ) { $this->output( "Run the script again without --report to update.\n" ); + } } else { $ton = $to->getName(); $this->error( "User '{$ton}' not found." ); diff --git a/maintenance/storage/storageTypeStats.php b/maintenance/storage/storageTypeStats.php index 337a2bb535..5608d15ca5 100644 --- a/maintenance/storage/storageTypeStats.php +++ b/maintenance/storage/storageTypeStats.php @@ -12,7 +12,6 @@ class StorageTypeStats extends Maintenance { exit( 1 ); } - $rangeStart = 0; $binSize = intval( pow( 10, floor( log10( $endId ) ) - 3 ) ); if ( $binSize < 100 ) { $binSize = 100; -- 2.20.1