From b4d37577b9a6464c2599f73f086186aaed9851db Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Tue, 8 May 2007 09:09:46 +0000 Subject: [PATCH] Removing or commenting out unused variables or globals, and adding declarations for two arrays. --- docs/memcached.txt | 2 +- includes/Block.php | 3 --- includes/Database.php | 2 +- includes/EditPage.php | 2 +- includes/Image.php | 4 +--- includes/Linker.php | 2 -- includes/OutputPage.php | 2 +- includes/Parser.php | 1 + includes/PatrolLog.php | 2 +- includes/ProtectionForm.php | 2 +- includes/QueryPage.php | 1 - includes/SearchPostgres.php | 1 + includes/SpecialContributions.php | 2 -- includes/SpecialListusers.php | 1 - includes/SpecialProtectedpages.php | 5 +++-- includes/Title.php | 2 +- includes/media/Bitmap.php | 2 +- includes/media/DjVu.php | 1 - includes/media/Generic.php | 1 - includes/media/SVG.php | 2 -- 20 files changed, 14 insertions(+), 26 deletions(-) diff --git a/docs/memcached.txt b/docs/memcached.txt index d4e2915fe2..3addd965c2 100644 --- a/docs/memcached.txt +++ b/docs/memcached.txt @@ -53,7 +53,7 @@ on port 11000, using up to 64MB of memory) In your LocalSettings.php file, set: - $wgMainCacheType = CACHE_MEMCACHED;; + $wgMainCacheType = CACHE_MEMCACHED; $wgMemCachedServers = array( "127.0.0.1:11000" ); The wiki should then use memcached to cache various data. To use diff --git a/includes/Block.php b/includes/Block.php index 94bfa5b452..fa98692c83 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -438,9 +438,6 @@ class Block * @return bool Whether or not an autoblock was inserted. */ function doAutoblock( $autoblockip, $justInserted = false ) { - # Check if this IP address is already blocked - $dbw = wfGetDB( DB_MASTER ); - # If autoblocks are disabled, go away. if ( !$this->mEnableAutoblock ) { return; diff --git a/includes/Database.php b/includes/Database.php index 21e38ba98d..fa6ba419f3 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -582,7 +582,7 @@ class Database { @/**/$this->mConn = mysql_connect( $server, $user, $password, true ); } if ($this->mConn === false) { - $iplus = $i + 1; + #$iplus = $i + 1; #wfLogDBError("Connect loop error $iplus of $max ($server): " . mysql_errno() . " - " . mysql_error()."\n"); } } diff --git a/includes/EditPage.php b/includes/EditPage.php index 4e6c3e8bb3..6493698a62 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1002,7 +1002,7 @@ class EditPage { } if ( $this->mTitle->isCascadeProtected() ) { # Is this page under cascading protection from some source pages? - list($cascadeSources, $restrictions) = $this->mTitle->getCascadeProtectionSources(); + list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources(); if ( count($cascadeSources) > 0 ) { # Explain, and list the titles responsible $notice = wfMsgExt( 'cascadeprotectedwarning', array('parsemag'), count($cascadeSources) ) . "\n"; diff --git a/includes/Image.php b/includes/Image.php index a898f9b31c..0ea6d9294f 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -831,7 +831,7 @@ class Image if ( !$handler ) { return null; } - list( $thumbExt, $thumbMime ) = self::getThumbType( $this->extension, $this->mime ); + list( $thumbExt, /* $thumbMime */ ) = self::getThumbType( $this->extension, $this->mime ); $thumbName = $handler->makeParamString( $params ) . '-' . $this->name; if ( $thumbExt != $this->extension ) { $thumbName .= ".$thumbExt"; @@ -1070,7 +1070,6 @@ class Image $dir = wfImageThumbDir( $this->name, $shared ); $urls = array(); foreach ( $files as $file ) { - $m = array(); # Check that the base image name is part of the thumb name # This is a basic sanity check to avoid erasing unrelated directories if ( strpos( $file, $this->name ) !== false ) { @@ -1404,7 +1403,6 @@ class Image } function getExifData() { - global $wgRequest; $handler = $this->getHandler(); if ( !$handler || $handler->getMetadataType( $this ) != 'exif' ) { return array(); diff --git a/includes/Linker.php b/includes/Linker.php index 82dca04fd6..2cfaafc097 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -511,8 +511,6 @@ class Linker { */ function makeThumbLinkObj( $img, $label = '', $alt, $align = 'right', $params = array(), $framed=false , $manual_thumb = "" ) { global $wgStylePath, $wgContLang; - $thumbUrl = ''; - $error = ''; $page = isset( $params['page'] ) ? $params['page'] : false; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 18a5be4893..baf9f3e590 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -937,7 +937,7 @@ class OutputPage { $this->setPageTitle( wfMsg( 'viewsource' ) ); $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) ); - list( $cascadeSources, $restrictions ) = $wgTitle->getCascadeProtectionSources(); + list( $cascadeSources, /* $restrictions */ ) = $wgTitle->getCascadeProtectionSources(); # Determine if protection is due to the page being a system message # and show an appropriate explanation diff --git a/includes/Parser.php b/includes/Parser.php index 30a416953a..3a52f24e69 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1929,6 +1929,7 @@ class Parser # Look at the first character if( $target != '' && $target{0} == '/' ) { # / at end means we don't want the slash to be shown + $m = array(); $trailingSlashes = preg_match_all( '%(/+)$%', $target, $m ); if( $trailingSlashes ) { $noslash = $target = substr( $target, 1, -strlen($m[0][0]) ); diff --git a/includes/PatrolLog.php b/includes/PatrolLog.php index a22839ff7c..157dcbddde 100644 --- a/includes/PatrolLog.php +++ b/includes/PatrolLog.php @@ -46,7 +46,7 @@ class PatrolLog { # these conditions would have gone into recentchanges, which we aren't # supposed to be updating if( is_object( $skin ) ) { - list( $cur, $prev, $auto ) = $params; + list( $cur, /* $prev */, $auto ) = $params; # Standard link to the page in question $link = $skin->makeLinkObj( $title ); # Generate a diff link diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 3cafbd559c..54ac3a2913 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -99,7 +99,7 @@ class ProtectionForm { return; } - list( $cascadeSources, $restrictions ) = $this->mTitle->getCascadeProtectionSources(); + list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources(); if ( "" != $err ) { $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 143c8be6c2..537410447d 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -332,7 +332,6 @@ class QueryPage { $num = $dbr->numRows($res); $this->preprocessResults( $dbr, $res ); - $sk = $wgUser->getSkin(); # Top header and navigation if( $shownavigation ) { diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index 3a624cede3..a7c7c3da6b 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -64,6 +64,7 @@ class SearchPostgres extends SearchEngine { $term = preg_replace('/:/', ' ', $term); $searchstring = ''; + $m = array(); if( preg_match_all('/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) { foreach( $m as $terms ) { if (strlen($terms[1])) { diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 82c8d60862..c3db78bd9a 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -10,8 +10,6 @@ class ContribsPager extends IndexPager { var $namespace = '', $mDb; function __construct( $target, $namespace = false ) { - global $wgUser; - parent::__construct(); foreach( explode( ' ', 'uctop diff newarticle rollbacklink diff hist minoreditletter' ) as $msg ) { $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') ); diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 42498430c7..3ff087b490 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -103,7 +103,6 @@ class UsersPager extends AlphabeticPager { $this->doQuery(); } $batch = new LinkBatch; - $db = $this->mDb; $this->mResult->rewind(); diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php index e9fb0797a4..ae3b528b16 100644 --- a/includes/SpecialProtectedpages.php +++ b/includes/SpecialProtectedpages.php @@ -239,10 +239,11 @@ class ProtectedPagesPager extends AlphabeticPager { $conds[] = 'page_id=pr_page'; $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type ); - if( $this->sizetype=='min' ) + if( $this->sizetype=='min' ) { $conds[] = 'page_len>=' . $this->size; - else if( $this->sizetype=='max' ) + } else if( $this->sizetype=='max' ) { $conds[] = 'page_len<=' . $this->size; + } if( $this->level ) $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level ); diff --git a/includes/Title.php b/includes/Title.php index 0ff2e8073b..b108e66dfd 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -40,7 +40,7 @@ class Title { * Please use the accessor functions */ - /**#@+ + /**#@+ * @private */ diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php index 3f3aabbf58..8024cb3611 100644 --- a/includes/media/Bitmap.php +++ b/includes/media/Bitmap.php @@ -154,7 +154,7 @@ class BitmapHandler extends ImageHandler { wfDebug( "$err\n" ); return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err ); } - list( $loader, $colorStyle, $saveType ) = $typemap[$mimeType]; + list( $loader, /* $colorStyle */, $saveType ) = $typemap[$mimeType]; if( !function_exists( $loader ) ) { $err = "Incomplete GD library configuration: missing function $loader"; diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php index 3c053a0c38..00a1b516cf 100644 --- a/includes/media/DjVu.php +++ b/includes/media/DjVu.php @@ -71,7 +71,6 @@ class DjVuHandler extends ImageHandler { $height = $params['height']; $srcPath = $image->getImagePath(); $page = $params['page']; - $pageCount = $this->pageCount( $image ); if ( $page > $this->pageCount( $image ) ) { return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'djvu_page_error' ) ); } diff --git a/includes/media/Generic.php b/includes/media/Generic.php index d588a7868c..189045a932 100644 --- a/includes/media/Generic.php +++ b/includes/media/Generic.php @@ -275,7 +275,6 @@ abstract class ImageHandler extends MediaHandler { * @return true if removed, false otherwise */ function removeBadFile( $dstPath, $retval = 0 ) { - $removed = false; if( file_exists( $dstPath ) ) { $thumbstat = stat( $dstPath ); if( $thumbstat['size'] == 0 || $retval != 0 ) { diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 5307e269af..2dfbd02e24 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -46,8 +46,6 @@ class SvgHandler extends ImageHandler { $clientHeight = $params['height']; $physicalWidth = $params['physicalWidth']; $physicalHeight = $params['physicalHeight']; - $srcWidth = $image->getWidth(); - $srcHeight = $image->getHeight(); $srcPath = $image->getImagePath(); if ( $flags & self::TRANSFORM_LATER ) { -- 2.20.1