From ae8554c45b2b5766d4ad59f9a7b12c58198d2142 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Wed, 29 Nov 2006 11:43:58 +0000 Subject: [PATCH] Completing code housekeeping stuff for rest of includes/ directory: removing unused local vars, removing unused globals, replacing extract() where simple to do, declaring output arrays before calling preg_match(), and so forth. --- includes/AjaxResponse.php | 4 ++-- includes/Article.php | 8 +++++--- includes/Block.php | 3 --- includes/ChangesList.php | 6 ++---- includes/Database.php | 16 ++++++++-------- includes/DatabasePostgres.php | 14 +++++++------- includes/DifferenceEngine.php | 5 ++--- includes/DjVuImage.php | 2 +- includes/EditPage.php | 8 ++++---- includes/FileStore.php | 2 +- includes/HTMLCacheUpdate.php | 1 - includes/HistoryBlob.php | 2 +- includes/Hooks.php | 1 - includes/IP.php | 3 ++- includes/Image.php | 7 ++++--- includes/ImageFunctions.php | 3 +++ includes/ImageGallery.php | 3 +-- includes/MagicWord.php | 2 +- includes/Math.php | 16 +++++++++------- includes/Metadata.php | 7 ++++--- includes/PageHistory.php | 1 - includes/Pager.php | 2 +- includes/ParserCache.php | 2 -- includes/ProfilerSimple.php | 4 +--- includes/Revision.php | 2 +- includes/SearchMySQL4.php | 3 ++- includes/SearchTsearch2.php | 3 ++- includes/Skin.php | 13 ++++++------- includes/SkinTemplate.php | 7 ++----- includes/SpecialAllmessages.php | 5 +---- includes/SpecialAllpages.php | 2 -- includes/SpecialBooksources.php | 2 -- includes/SpecialDisambiguations.php | 2 +- includes/SpecialExport.php | 5 ----- includes/SpecialImagelist.php | 2 +- includes/SpecialIpblocklist.php | 3 ++- includes/SpecialLog.php | 2 -- includes/SpecialPreferences.php | 5 +---- includes/SpecialPrefixindex.php | 1 - includes/SpecialRandompage.php | 2 +- includes/SpecialSearch.php | 13 ++++--------- includes/SpecialSpecialpages.php | 2 +- includes/SpecialUndelete.php | 6 ++---- includes/SpecialVersion.php | 2 -- includes/SquidUpdate.php | 2 -- includes/StringUtils.php | 3 ++- includes/Title.php | 18 ++++++++---------- includes/User.php | 1 + includes/WikiError.php | 2 +- includes/memcached-client.php | 10 +++++++--- 50 files changed, 105 insertions(+), 135 deletions(-) diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 40f508763a..a59c73bb14 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -61,7 +61,7 @@ class AjaxResponse { } function sendHeaders() { - global $wgUseSquid, $wgUseESI, $wgSquidMaxage; + global $wgUseSquid, $wgUseESI; if ( $this->mResponseCode ) { $n = preg_replace( '/^ *(\d+)/', '\1', $this->mResponseCode ); @@ -122,7 +122,7 @@ class AjaxResponse { * returns true iff the response code was set to 304 Not Modified. */ function checkLastModified ( $timestamp ) { - global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest; + global $wgCachePages, $wgCacheEpoch, $wgUser; $fname = 'AjaxResponse::checkLastModified'; if ( !$timestamp || $timestamp == '19700101000000' ) { diff --git a/includes/Article.php b/includes/Article.php index 86028dedf6..f998147644 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2330,7 +2330,11 @@ class Article { */ function isFileCacheable() { global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest; - extract( $wgRequest->getValues( 'action', 'oldid', 'diff', 'redirect', 'printable' ) ); + $action = $wgRequest->getVal( 'action' ); + $oldid = $wgRequest->getVal( 'oldid' ); + $diff = $wgRequest->getVal( 'diff' ); + $redirect = $wgRequest->getVal( 'redirect' ); + $printable = $wgRequest->getVal( 'printable' ); return $wgUseFileCache and (!$wgShowIPinHeader) @@ -2700,8 +2704,6 @@ class Article { # This code is UGLY UGLY UGLY. # Somebody PLEASE come up with a more elegant way to do it. - $summary = ''; - #Redirect autosummaries $summary = self::getRedirectAutosummary( $newtext ); diff --git a/includes/Block.php b/includes/Block.php index 15b397283d..29709d2728 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -113,9 +113,6 @@ class Block $options = array(); $db =& $this->getDBOptions( $options ); - $ret = false; - $killed = false; - if ( 0 == $user && $address == '' ) { # Invalid user specification, not blocked $this->clear(); diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 80b8cf7d76..ab27295dc4 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -184,7 +184,7 @@ class ChangesList { $s .= ' '.$articlelink; } - function insertTimestamp(&$s, &$rc) { + function insertTimestamp(&$s, $rc) { global $wgLang; # Timestamp $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . '; @@ -233,7 +233,6 @@ class OldChangesList extends ChangesList { # Extract DB fields into local scope extract( $rc->mAttribs ); - $curIdEq = 'curid=' . $rc_cur_id; # Should patrol-related stuff be shown? $unpatrolled = $this->usePatrol() && $rc_patrolled == 0; @@ -413,7 +412,6 @@ class EnhancedChangesList extends ChangesList { $userlinks = array(); foreach( $block as $rcObj ) { $oldid = $rcObj->mAttribs['rc_last_oldid']; - $newid = $rcObj->mAttribs['rc_this_oldid']; if( $rcObj->mAttribs['rc_new'] ) { $isnew = true; } @@ -643,7 +641,7 @@ class EnhancedChangesList extends ChangesList { return ''; } $blockOut = ''; - foreach( $this->rc_cache as $secureName => $block ) { + foreach( $this->rc_cache as $block ) { if( count( $block ) < 2 ) { $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) ); } else { diff --git a/includes/Database.php b/includes/Database.php index fb4449b4a0..525022159e 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -90,8 +90,8 @@ class DBConnectionError extends DBError { } function getHTML() { - global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding; - global $wgSitename, $wgServer, $wgMessageCache, $wgLogo; + global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding; + global $wgSitename, $wgServer, $wgMessageCache; # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky. # Hard coding strings instead. @@ -621,7 +621,7 @@ class Database { # Add a comment for easy SHOW PROCESSLIST interpretation if ( $fname ) { - $commentedSql = preg_replace("/\s/", " /* $fname */ ", $sql, 1); + $commentedSql = preg_replace('/\s/', " /* $fname */ ", $sql, 1); } else { $commentedSql = $sql; } @@ -687,7 +687,7 @@ class Database { * @param bool $tempIgnore */ function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) { - global $wgCommandLineMode, $wgFullyInitialised, $wgColorErrors; + global $wgCommandLineMode; # Ignore errors during error handling to avoid infinite recursion $ignore = $this->ignoreErrors( true ); ++$this->mErrorCount; @@ -786,7 +786,7 @@ class Database { case '\\!': return '!'; case '\\&': return '&'; } - list( $n, $arg ) = each( $this->preparedArgs ); + list( /* $n */ , $arg ) = each( $this->preparedArgs ); switch( $matches[1] ) { case '?': return $this->addQuotes( $arg ); case '!': return $arg; @@ -1091,7 +1091,7 @@ class Database { $sql = preg_replace ('/".*"/s', "'X'", $sql); # All newlines, tabs, etc replaced by single space - $sql = preg_replace ( "/\s+/", ' ', $sql); + $sql = preg_replace ( '/\s+/', ' ', $sql); # All numbers => N $sql = preg_replace ('/-?[0-9]+/s', 'N', $sql); @@ -1558,7 +1558,8 @@ class Database { $row = $this->fetchObject( $res ); $this->freeResult( $res ); - if ( preg_match( "/\((.*)\)/", $row->Type, $m ) ) { + $m = array(); + if ( preg_match( '/\((.*)\)/', $row->Type, $m ) ) { $size = $m[1]; } else { $size = -1; @@ -1882,7 +1883,6 @@ class Database { $res = $this->query( 'SHOW PROCESSLIST' ); # Find slave SQL thread. Assumed to be the second one running, which is a bit # dubious, but unfortunately there's no easy rigorous way - $slaveThreads = 0; while ( $row = $this->fetchObject( $res ) ) { /* This should work for most situations - when default db * for thread is not specified, it had no events executed, diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 805313dab9..2adc90e8e5 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -18,7 +18,7 @@ class DatabasePostgres extends Database { $failFunction = false, $flags = 0 ) { - global $wgOut, $wgDBprefix, $wgCommandLineMode; + global $wgOut; # Can't get a reference if it hasn't been set yet if ( !isset( $wgOut ) ) { $wgOut = NULL; @@ -60,7 +60,6 @@ class DatabasePostgres extends Database { $this->mPassword = $password; $this->mDBname = $dbName; - $success = false; $hstring=""; if ($server!=false && $server!="") { $hstring="host=$server "; @@ -87,12 +86,13 @@ class DatabasePostgres extends Database { ## If this is the initial connection, setup the schema stuff and possibly create the user if (defined('MEDIAWIKI_INSTALL')) { global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBsuperuser, $wgDBmwschema, - $wgDBts2schema, $wgDBts2locale; + $wgDBts2schema; print "OK\n"; print "
  • Checking the version of Postgres..."; $version = pg_fetch_result($this->doQuery("SELECT version()"),0,0); - if (!preg_match("/PostgreSQL (\d+\.\d+)(\S+)/", $version, $thisver)) { + $thisver = array(); + if (!preg_match('/PostgreSQL (\d+\.\d+)(\S+)/', $version, $thisver)) { print "FAILED (could not determine the version)
  • \n"; dieout(""); } @@ -804,10 +804,10 @@ class DatabasePostgres extends Database { $SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES "; while ( ! feof( $f ) ) { $line = fgets($f,1024); - if (!preg_match("/^\s*(\(.+?),(\d)\)/", $line, $matches)) { + $matches = array(); + if (!preg_match('/^\s*(\(.+?),(\d)\)/', $line, $matches)) { continue; } - $yesno = $matches[2]; ## ? "'true'" : "'false'"; $this->query("$SQL $matches[1],$matches[2])"); } print " (table interwiki successfully populated)...\n"; @@ -831,7 +831,7 @@ class DatabasePostgres extends Database { return "E'$s[1]'"; } return "'" . pg_escape_string($s) . "'"; - return "E'" . pg_escape_string($s) . "'"; + // Unreachable: return "E'" . pg_escape_string($s) . "'"; } function quote_ident( $s ) { diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index fc6d7259f9..682b425130 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -144,8 +144,6 @@ CONTROL; } $sk = $wgUser->getSkin(); - $talk = $wgContLang->getNsText( NS_TALK ); - $contribs = wfMsg( 'contribslink' ); if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) { $rollback = '   ' . $sk->generateRollback( $this->mNewRev ); @@ -901,7 +899,7 @@ class _DiffEngine $ymids[$k] = $ymids[$k-1]; break; } - while (list ($junk, $y) = each($matches)) { + while (list ( /* $junk */, $y) = each($matches)) { if ($y > $this->seq[$k-1]) { USE_ASSERTS && assert($y < $this->seq[$k]); // Optimization: this is a common case: @@ -1619,6 +1617,7 @@ class WordLevelDiff extends MappedDiff $words[] = $line; $stripped[] = $line; } else { + $m = array(); if (preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', $line, $m)) { diff --git a/includes/DjVuImage.php b/includes/DjVuImage.php index 871c563bf8..f7297dc20c 100644 --- a/includes/DjVuImage.php +++ b/includes/DjVuImage.php @@ -217,7 +217,7 @@ class DjVuImage { global $wgDjvuToXML; if ( isset( $wgDjvuToXML ) ) { $cmd = $wgDjvuToXML . ' --without-anno --without-text ' . $this->mFilename; - $xml = wfShellExec( $cmd, $retval ); + $xml = wfShellExec( $cmd ); } else { $xml = null; } diff --git a/includes/EditPage.php b/includes/EditPage.php index 8cad492656..d2eeb73078 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1625,15 +1625,15 @@ END */ $toolarray=array( array( 'image'=>'button_bold.png', - 'open' => "\'\'\'", - 'close' => "\'\'\'", + 'open' => '\\\'\\\'\\\'', + 'close' => '\\\'\\\'\\\'', 'sample'=> wfMsg('bold_sample'), 'tip' => wfMsg('bold_tip'), 'key' => 'B' ), array( 'image'=>'button_italic.png', - 'open' => "\'\'", - 'close' => "\'\'", + 'open' => '\\\'\\\'', + 'close' => '\\\'\\\'', 'sample'=> wfMsg('italic_sample'), 'tip' => wfMsg('italic_tip'), 'key' => 'I' diff --git a/includes/FileStore.php b/includes/FileStore.php index 35ebd55433..294bf990b0 100644 --- a/includes/FileStore.php +++ b/includes/FileStore.php @@ -57,7 +57,7 @@ class FileStore { $dbw = wfGetDB( DB_MASTER ); $lockname = $dbw->addQuotes( FileStore::lockName() ); $result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", __METHOD__ ); - $row = $dbw->fetchObject( $result ); + $dbw->fetchObject( $result ); $dbw->freeResult( $result ); } diff --git a/includes/HTMLCacheUpdate.php b/includes/HTMLCacheUpdate.php index f76bcd6874..bda4720d06 100644 --- a/includes/HTMLCacheUpdate.php +++ b/includes/HTMLCacheUpdate.php @@ -55,7 +55,6 @@ class HTMLCacheUpdate $numRows = $res->numRows(); $numBatches = ceil( $numRows / $this->mRowsPerJob ); $realBatchSize = $numRows / $numBatches; - $boundaries = array(); $start = false; $jobs = array(); do { diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 357c1d48c6..a06b620d5a 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -226,7 +226,7 @@ class HistoryBlobStub { $flags = explode( ',', $row->old_flags ); if( in_array( 'external', $flags ) ) { $url=$row->old_text; - @list($proto,$path)=explode('://',$url,2); + @list( /* $proto */ ,$path)=explode('://',$url,2); if ($path=="") { wfProfileOut( $fname ); return false; diff --git a/includes/Hooks.php b/includes/Hooks.php index 575a28c54c..2eecfd72f2 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -31,7 +31,6 @@ function wfRunHooks($event, $args = null) { global $wgHooks; - $fname = 'wfRunHooks'; if (!is_array($wgHooks)) { throw new MWException("Global hooks array is not an array!\n"); diff --git a/includes/IP.php b/includes/IP.php index 713780432d..b34cc78508 100644 --- a/includes/IP.php +++ b/includes/IP.php @@ -27,7 +27,7 @@ class IP { * @return boolean True if it is valid. */ public static function isValid( $ip ) { - return preg_match( '/^' . RE_IP_ADD . '$/', $ip, $matches) ; + return preg_match( '/^' . RE_IP_ADD . '$/', $ip) ; } /** @@ -84,6 +84,7 @@ class IP { * @return array */ public static function toArray( $ipblock ) { + $matches = array(); if(! preg_match( '/^' . RE_IP_ADD . '(?:\/(?:'.RE_IP_PREFIX.'))?' . '$/', $ipblock, $matches ) ) { return false; } else { diff --git a/includes/Image.php b/includes/Image.php index 5e85602a00..1f3895c600 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -235,7 +235,7 @@ class Image * Load metadata from the file itself */ function loadFromFile() { - global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang, $wgShowEXIF; + global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang; wfProfileIn( __METHOD__ ); $this->imagePath = $this->getFullPath(); $this->fileExists = file_exists( $this->imagePath ); @@ -925,7 +925,7 @@ class Image if ( !$this->mustRender() && $width == $this->width && $height == $this->height ) { $url = $this->getURL(); } else { - list( $isScriptUrl, $url ) = $this->thumbUrl( $width ); + list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $width ); } $thumb = new ThumbnailImage( $url, $width, $height ); } else { @@ -1360,8 +1360,9 @@ class Image $dir = wfImageThumbDir( $this->name, $shared ); $urls = array(); foreach ( $files as $file ) { + $m = array(); if ( preg_match( '/^(\d+)px/', $file, $m ) ) { - list( $isScriptUrl, $url ) = $this->thumbUrl( $m[1] ); + list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $m[1] ); $urls[] = $url; @unlink( "$dir/$file" ); } diff --git a/includes/ImageFunctions.php b/includes/ImageFunctions.php index 75755588ac..931fdff177 100644 --- a/includes/ImageFunctions.php +++ b/includes/ImageFunctions.php @@ -126,6 +126,7 @@ function wfScaleSVGUnit( $length ) { '' => 1.0, // "User units" pixels by default '%' => 2.0, // Fake it! ); + $matches = array(); if( preg_match( '/^(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) { $length = floatval( $matches[1] ); $unit = $matches[2]; @@ -156,6 +157,7 @@ function wfGetSVGsize( $filename ) { fclose( $f ); // Uber-crappy hack! Run through a real XML parser. + $matches = array(); if( !preg_match( '/]*)\s*>/s', $chunk, $matches ) ) { return false; } @@ -206,6 +208,7 @@ function wfIsBadImage( $name, $contextTitle = false ) { } # Find all links + $m = array(); if ( !preg_match_all( '/\[\[:?(.*?)\]\]/', $line, $m ) ) { continue; } diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index dfd5a98b04..e88ab8be99 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -134,7 +134,7 @@ class ImageGallery * */ function toHTML() { - global $wgLang, $wgIgnoreImageErrors, $wgGenerateThumbnailOnParse; + global $wgLang, $wgGenerateThumbnailOnParse; $sk = $this->getSkin(); @@ -147,7 +147,6 @@ class ImageGallery $img =& $pair[0]; $text = $pair[1]; - $name = $img->getName(); $nt = $img->getTitle(); if( $nt->getNamespace() != NS_IMAGE ) { diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 350fb8ed16..0b6065d049 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -289,7 +289,7 @@ class MagicWord { * Used in matchAndRemove() * @private **/ - function pregRemoveAndRecord( $match ) { + function pregRemoveAndRecord( ) { $this->mFound = true; return ''; } diff --git a/includes/Math.php b/includes/Math.php index a8b339840f..30b4bfe669 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -75,12 +75,13 @@ class MathRenderer { $retval = substr ($contents, 0, 1); $errmsg = ''; if (($retval == 'C') || ($retval == 'M') || ($retval == 'L')) { - if ($retval == 'C') + if ($retval == 'C') { $this->conservativeness = 2; - else if ($retval == 'M') + } else if ($retval == 'M') { $this->conservativeness = 1; - else + } else { $this->conservativeness = 0; + } $outdata = substr ($contents, 33); $i = strpos($outdata, "\000"); @@ -89,12 +90,13 @@ class MathRenderer { $this->mathml = substr($outdata, $i+1); } else if (($retval == 'c') || ($retval == 'm') || ($retval == 'l')) { $this->html = substr ($contents, 33); - if ($retval == 'c') + if ($retval == 'c') { $this->conservativeness = 2; - else if ($retval == 'm') + } else if ($retval == 'm') { $this->conservativeness = 1; - else + } else { $this->conservativeness = 0; + } $this->mathml = NULL; } else if ($retval == 'X') { $this->html = NULL; @@ -118,7 +120,7 @@ class MathRenderer { $this->hash = substr ($contents, 1, 32); } - $res = wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) ); + wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) ); if ( $errmsg ) { return $errmsg; diff --git a/includes/Metadata.php b/includes/Metadata.php index af40ab212d..4f3c7b15e0 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -22,7 +22,8 @@ */ /** - * + * TODO: Perhaps make this file into a Metadata class, with static methods (declared + * as private where indicated), to move these functions out of the global namespace? */ define('RDF_TYPE_PREFS', "application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1"); @@ -142,7 +143,7 @@ function dcBasics($article) { dcPerson('contributor', $user_parts[0], $user_parts[1], $user_parts[2]); } - dcRights($article); + dcRights(); } /** @@ -291,7 +292,7 @@ function dcPerson($name, $id, $user_name='', $user_real_name='') { * different pages. * @private */ -function dcRights($article) { +function dcRights() { global $wgRightsPage, $wgRightsUrl, $wgRightsText; diff --git a/includes/PageHistory.php b/includes/PageHistory.php index fd6a6d2748..aea0f0ed22 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -106,7 +106,6 @@ class PageHistory { * Do the list */ $pager = new PageHistoryPager( $this ); - $navbar = $pager->getNavigationBar(); $this->linesonpage = $pager->getNumRows(); $wgOut->addHTML( $pager->getNavigationBar() . diff --git a/includes/Pager.php b/includes/Pager.php index b14aa8ca6e..b97462d989 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -323,7 +323,7 @@ abstract class IndexPager implements Pager { $next = array( 'offset' => $this->mLastShown, 'limit' => $urlLimit ); $last = array( 'dir' => 'prev', 'limit' => $urlLimit ); } - return compact( 'prev', 'next', 'first', 'last' ); + return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last ); } /** diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 1f2e2aaf09..37a42b7f5c 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -56,8 +56,6 @@ class ParserCache { $fname = 'ParserCache::get'; wfProfileIn( $fname ); - $hash = $user->getPageRenderingHash(); - $pageid = intval( $article->getID() ); $key = $this->getKey( $article, $user ); wfDebug( "Trying parser cache $key\n" ); diff --git a/includes/ProfilerSimple.php b/includes/ProfilerSimple.php index 2d0d01ba1c..eb2985ccae 100644 --- a/includes/ProfilerSimple.php +++ b/includes/ProfilerSimple.php @@ -61,15 +61,13 @@ class ProfilerSimple extends Profiler { } function profileOut($functionname) { - $memory = memory_get_usage(); - global $wgDebugFunctionEntry; if ($wgDebugFunctionEntry) { $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n"); } - list($ofname,$ocount,$ortime,$octime) = array_pop($this->mWorkStack); + list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack); if (!$ofname) { $this->debug("Profiling error: $functionname\n"); diff --git a/includes/Revision.php b/includes/Revision.php index 6ef9ede33d..49fc32f2f1 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -532,7 +532,7 @@ class Revision { # Use external methods for external objects, text in table is URL-only then if ( in_array( 'external', $flags ) ) { $url=$text; - @list($proto,$path)=explode('://',$url,2); + @list(/* $proto */,$path)=explode('://',$url,2); if ($path=="") { wfProfileOut( $fname ); return false; diff --git a/includes/SearchMySQL4.php b/includes/SearchMySQL4.php index dcc1f685c1..c20e3f8e64 100644 --- a/includes/SearchMySQL4.php +++ b/includes/SearchMySQL4.php @@ -43,6 +43,7 @@ class SearchMySQL4 extends SearchMySQL { $this->searchTerms = array(); # FIXME: This doesn't handle parenthetical expressions. + $m = array(); if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/', $filteredText, $m, PREG_SET_ORDER ) ) { foreach( $m as $terms ) { @@ -60,7 +61,7 @@ class SearchMySQL4 extends SearchMySQL { $this->searchTerms[] = $regexp; } wfDebug( "Would search with '$searchon'\n" ); - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); + wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); } else { wfDebug( "Can't understand search query '{$filteredText}'\n" ); } diff --git a/includes/SearchTsearch2.php b/includes/SearchTsearch2.php index a8f354b3f9..e4c94c7e98 100644 --- a/includes/SearchTsearch2.php +++ b/includes/SearchTsearch2.php @@ -47,6 +47,7 @@ class SearchTsearch2 extends SearchEngine { $this->searchTerms = array(); # FIXME: This doesn't handle parenthetical expressions. + $m = array(); if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/', $filteredText, $m, PREG_SET_ORDER ) ) { foreach( $m as $terms ) { @@ -64,7 +65,7 @@ class SearchTsearch2 extends SearchEngine { $this->searchTerms[] = $regexp; } wfDebug( "Would search with '$searchon'\n" ); - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); + wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); } else { wfDebug( "Can't understand search query '{$this->filteredText}'\n" ); } diff --git a/includes/Skin.php b/includes/Skin.php index 9900ff4b14..924deef726 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -48,6 +48,7 @@ class Skin extends Linker { # while code from www.php.net while (false !== ($file = $skinDir->read())) { // Skip non-PHP files, hidden files, and '.dep' includes + $matches = array(); if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { $aSkin = $matches[1]; $wgValidSkinNames[strtolower($aSkin)] = $aSkin; @@ -369,7 +370,6 @@ class Skin extends Linker { function getUserStylesheet() { global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion; $sheet = $this->getStylesheet(); - $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/common/common.css?$wgStyleVersion\";\n"; $s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n"; if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n"; @@ -490,7 +490,6 @@ END; else $a = array( 'bgcolor' => '#FFFFFF' ); if($wgOut->isArticle() && $wgUser->getOption('editondblclick') && $wgTitle->userCanEdit() ) { - $t = wfMsg( 'editthispage' ); $s = $wgTitle->getFullURL( $this->editUrlOptions() ); $s = 'document.location = "' .wfEscapeJSString( $s ) .'";'; $a += array ('ondblclick' => $s); @@ -696,7 +695,8 @@ END; function pageTitleLinks() { global $wgOut, $wgTitle, $wgUser, $wgRequest; - extract( $wgRequest->getValues( 'oldid', 'diff' ) ); + $oldid = $wgRequest->getVal( 'oldid' ); + $diff = $wgRequest->getVal( 'diff' ); $action = $wgRequest->getText( 'action' ); $s = $this->printableLink(); @@ -838,7 +838,6 @@ END; function nameAndLogin() { global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader; - $li = $wgContLang->specialPage( 'Userlogin' ); $lo = $wgContLang->specialPage( 'Userlogout' ); $s = ''; @@ -1011,7 +1010,8 @@ END; global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser; global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers; - extract( $wgRequest->getValues( 'oldid', 'diff' ) ); + $oldid = $wgRequest->getVal( 'oldid' ); + $diff = $wgRequest->getVal( 'diff' ); if ( ! $wgOut->isArticle() ) { return ''; } if ( isset( $oldid ) || isset( $diff ) ) { return ''; } if ( 0 == $wgArticle->getID() ) { return ''; } @@ -1144,7 +1144,6 @@ END; */ function specialPagesList() { global $wgUser, $wgContLang, $wgServer, $wgRedirectScript; - $a = array(); $pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() ); foreach ( $pages as $name => $page ) { $pages[$name] = $page->getDescription(); @@ -1629,7 +1628,7 @@ END; } } if ($cacheSidebar) - $cachednotice = $parserMemc->set( $key, $bar, 86400 ); + $parserMemc->set( $key, $bar, 86400 ); wfProfileOut( $fname ); return $bar; } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index c47e619ffb..ca3546d1f5 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -148,7 +148,8 @@ class SkinTemplate extends Skin { // adding of CSS or Javascript by extensions. wfRunHooks( 'BeforePageDisplay', array( &$out ) ); - extract( $wgRequest->getValues( 'oldid', 'diff' ) ); + $oldid = $wgRequest->getVal( 'oldid' ); + $diff = $wgRequest->getVal( 'diff' ); wfProfileIn( "$fname-init" ); $this->initPage( $out ); @@ -768,9 +769,6 @@ class SkinTemplate extends Skin { $variants = $wgContLang->getVariants(); if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) { $preferred = $wgContLang->getPreferredVariant(); - $actstr = ''; - if( $action ) - $actstr = 'action=' . $action . '&'; $vcount=0; foreach( $variants as $code ) { $varname = $wgContLang->getVariantname( $code ); @@ -810,7 +808,6 @@ class SkinTemplate extends Skin { $action = $wgRequest->getText( 'action' ); $oldid = $wgRequest->getVal( 'oldid' ); - $diff = $wgRequest->getVal( 'diff' ); $nav_urls = array(); $nav_urls['mainpage'] = array( 'href' => self::makeI18nUrl( 'mainpage') ); diff --git a/includes/SpecialAllmessages.php b/includes/SpecialAllmessages.php index d6126da236..a28ab3c2ed 100644 --- a/includes/SpecialAllmessages.php +++ b/includes/SpecialAllmessages.php @@ -28,7 +28,6 @@ function wfSpecialAllmessages() { # Make sure all extension messages are available MessageCache::loadAllMessages(); - $first = true; $sortedArray = array_merge( Language::getMessagesFor( 'en' ), $wgMessageCache->getExtensionMessagesFor( 'en' ) ); ksort( $sortedArray ); $messages = array(); @@ -75,7 +74,7 @@ function makePhp( $messages ) { } else { $comment = ''; } - $txt .= "'$key' => '" . preg_replace( "/(? '" . preg_replace( '/(?getSkin(); $talk = $wgLang->getNsText( NS_TALK ); - $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI ); - $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK ); $input = wfElement( 'input', array( 'type' => 'text', diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index 1fc4815adc..cfe8cb578c 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -184,8 +184,6 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) { * @param integer $namespace (Default NS_MAIN) */ function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { - global $wgUser; - $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); $queryparams = ($namespace ? "namespace=$namespace" : ''); diff --git a/includes/SpecialBooksources.php b/includes/SpecialBooksources.php index 960f622469..40b5a10ba3 100644 --- a/includes/SpecialBooksources.php +++ b/includes/SpecialBooksources.php @@ -48,7 +48,6 @@ class BookSourceList { function showList() { global $wgOut, $wgContLang; - $fname = "BookSourceList::showList()"; # First, see if we have a custom list setup in # [[Wikipedia:Book sources]] or equivalent. @@ -93,7 +92,6 @@ class BookSourceList { function askForm() { global $wgOut, $wgTitle; - $fname = "BookSourceList::askForm()"; $action = $wgTitle->escapeLocalUrl(); $isbn = htmlspecialchars( wfMsg( "isbn" ) ); diff --git a/includes/SpecialDisambiguations.php b/includes/SpecialDisambiguations.php index 0355c85b72..626b967c2a 100644 --- a/includes/SpecialDisambiguations.php +++ b/includes/SpecialDisambiguations.php @@ -32,7 +32,7 @@ class DisambiguationsPage extends PageQueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) ); + list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' ); $dMsgText = wfMsgForContent('disambiguationspage'); diff --git a/includes/SpecialExport.php b/includes/SpecialExport.php index d387f3d497..26ca7effab 100644 --- a/includes/SpecialExport.php +++ b/includes/SpecialExport.php @@ -30,11 +30,6 @@ function wfSpecialExport( $page = '' ) { global $wgExportAllowHistory, $wgExportMaxHistory; $curonly = true; - $fullHistory = array( - 'dir' => 'asc', - 'offset' => false, - 'limit' => $wgExportMaxHistory, - ); if( $wgRequest->wasPosted() ) { $page = $wgRequest->getText( 'pages' ); $curonly = $wgRequest->getCheck( 'curonly' ); diff --git a/includes/SpecialImagelist.php b/includes/SpecialImagelist.php index 54ee83e5f1..69004be049 100644 --- a/includes/SpecialImagelist.php +++ b/includes/SpecialImagelist.php @@ -9,7 +9,7 @@ * */ function wfSpecialImagelist() { - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgMiserMode; + global $wgOut; $pager = new ImageListPager; diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index 84f0a9c2f7..84d07ace93 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -167,6 +167,7 @@ class IPUnblockForm { } $conds = array(); + $matches = array(); if ( $this->ip == '' ) { // No extra conditions } elseif ( substr( $this->ip, 0, 1 ) == '#' ) { @@ -174,7 +175,7 @@ class IPUnblockForm { } elseif ( IP::toUnsigned( $this->ip ) !== false ) { $conds['ipb_address'] = $this->ip; $conds['ipb_auto'] = 0; - } elseif( preg_match( "/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/", $this->ip, $matches ) ) { + } elseif( preg_match( '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/', $this->ip, $matches ) ) { $conds['ipb_address'] = Block::normaliseRange( $this->ip ); $conds['ipb_auto'] = 0; } else { diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 10d1d89cb6..7076d81978 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -151,7 +151,6 @@ class LogReader { */ function getQuery() { $logging = $this->db->tableName( "logging" ); - $user = $this->db->tableName( 'user' ); $sql = "SELECT /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp, log_user, user_name, log_namespace, log_title, page_id, @@ -304,7 +303,6 @@ class LogViewer { function logLine( $s ) { global $wgLang; $title = Title::makeTitle( $s->log_namespace, $s->log_title ); - $user = Title::makeTitleSafe( NS_USER, $s->user_name ); $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true ); // Enter the existence or non-existence of this page into the link cache, diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index b7f275d364..a06bf793fb 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -34,7 +34,7 @@ class PreferencesForm { * Load some values */ function PreferencesForm( &$request ) { - global $wgLang, $wgContLang, $wgUser, $wgAllowRealName; + global $wgContLang, $wgUser, $wgAllowRealName; $this->mQuickbar = $request->getVal( 'wpQuickbar' ); $this->mOldpass = $request->getVal( 'wpOldpass' ); @@ -378,7 +378,6 @@ class PreferencesForm { $togs = User::getToggles(); foreach ( $togs as $tname ) { - $ttext = wfMsg('tog-'.$tname); $this->mToggles[$tname] = $wgUser->getOption( $tname ); } @@ -526,8 +525,6 @@ class PreferencesForm { $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : ''; $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : ''; $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : ''; - $prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : ''; - $prefs_help_realname = ''; # diff --git a/includes/SpecialPrefixindex.php b/includes/SpecialPrefixindex.php index 86880d2f04..ce296b4b07 100644 --- a/includes/SpecialPrefixindex.php +++ b/includes/SpecialPrefixindex.php @@ -97,7 +97,6 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n $n = 0; $out = ''; - $namespaces = $wgContLang->getFormattedNamespaces(); while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { $t = Title::makeTitle( $s->page_namespace, $s->page_title ); if( $t ) { diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php index 9d38abcb39..aa77f2d375 100644 --- a/includes/SpecialRandompage.php +++ b/includes/SpecialRandompage.php @@ -11,7 +11,7 @@ * used as e.g. Special:Randompage/Category */ function wfSpecialRandompage( $par = NS_MAIN ) { - global $wgOut, $wgExtraRandompageSQL, $wgContLang, $wgLang; + global $wgOut, $wgExtraRandompageSQL; $fname = 'wfSpecialRandompage'; # Determine namespace diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index d28f059c8e..ac39f292d3 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -77,7 +77,6 @@ class SpecialSearch { function goResult( $term ) { global $wgOut; global $wgGoToEdit; - global $wgContLang; $this->setupPage( $term ); @@ -98,17 +97,13 @@ class SpecialSearch { # No match, generate an edit URL $t = Title::newFromText( $term ); - if( is_null( $t ) ) { - $editurl = ''; # hrm... - } else { + if( ! is_null( $t ) ) { wfRunHooks( 'SpecialSearchNogomatch', array( &$t ) ); # If the feature is enabled, go straight to the edit page if ( $wgGoToEdit ) { $wgOut->redirect( $t->getFullURL( 'action=edit' ) ); return; - } else { - $editurl = $t->escapeLocalURL( 'action=edit' ); - } + } } $wgOut->addWikiText( wfMsg( 'noexactmatch', wfEscapeWikiText( $term ) ) ); @@ -125,8 +120,7 @@ class SpecialSearch { $this->setupPage( $term ); - global $wgUser, $wgOut; - $sk = $wgUser->getSkin(); + global $wgOut; $wgOut->addWikiText( wfMsg( 'searchresulttext' ) ); #if ( !$this->parseQuery() ) { @@ -347,6 +341,7 @@ class SpecialSearch { break; } ++$lineno; + $m = array(); if ( ! preg_match( $pat1, $line, $m ) ) { continue; } diff --git a/includes/SpecialSpecialpages.php b/includes/SpecialSpecialpages.php index 6a01cd0829..78f9dee51f 100644 --- a/includes/SpecialSpecialpages.php +++ b/includes/SpecialSpecialpages.php @@ -37,7 +37,7 @@ function wfSpecialSpecialpages_gen($pages,$heading,$sk) { /** Put them into a sortable array */ $sortedPages = array(); - foreach ( $pages as $name => $page ) { + foreach ( $pages as $page ) { if ( $page->isListed() ) { $sortedPages[$page->getDescription()] = $page->getTitle(); } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index c78cae299b..f152f64d64 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -348,7 +348,6 @@ class PageArchive { } $revision = null; - $newRevId = $previousRevId; $restored = 0; while( $row = $dbw->fetchObject( $result ) ) { @@ -375,7 +374,7 @@ class PageArchive { 'minor_edit' => $row->ar_minor_edit, 'text_id' => $row->ar_text_id, ) ); - $newRevId = $revision->insertOn( $dbw ); + $revision->insertOn( $dbw ); $restored++; } @@ -594,8 +593,8 @@ class UndeleteForm { } $archive = new PageArchive( $this->mTargetObj ); - $text = $archive->getLastRevisionText(); /* + $text = $archive->getLastRevisionText(); if( is_null( $text ) ) { $wgOut->addWikiText( wfMsg( "nohistory" ) ); return; @@ -739,7 +738,6 @@ class UndeleteForm { global $wgOut, $wgUser; if( !is_null( $this->mTargetObj ) ) { $archive = new PageArchive( $this->mTargetObj ); - $ok = true; $ok = $archive->undelete( $this->mTargetTimestamp, diff --git a/includes/SpecialVersion.php b/includes/SpecialVersion.php index 8744597adf..58fc65e141 100644 --- a/includes/SpecialVersion.php +++ b/includes/SpecialVersion.php @@ -281,8 +281,6 @@ class SpecialVersion { // subversion is release 1.4 return intval( $content[3] ); } - - return false; } /**#@-*/ diff --git a/includes/SquidUpdate.php b/includes/SquidUpdate.php index 25dd1cf9e5..2e2a4a5d86 100644 --- a/includes/SquidUpdate.php +++ b/includes/SquidUpdate.php @@ -29,8 +29,6 @@ class SquidUpdate { wfProfileIn( $fname ); # Get a list of URLs linking to this page - $id = $title->getArticleID(); - $dbr =& wfGetDB( DB_SLAVE ); $res = $dbr->select( array( 'links', 'page' ), array( 'page_namespace', 'page_title' ), diff --git a/includes/StringUtils.php b/includes/StringUtils.php index 4c4d219d8e..0090604dd5 100644 --- a/includes/StringUtils.php +++ b/includes/StringUtils.php @@ -50,7 +50,8 @@ class StringUtils { $encEnd = preg_quote( $endDelim, '!' ); $strcmp = strpos( $flags, 'i' ) === false ? 'strcmp' : 'strcasecmp'; $endLength = strlen( $endDelim ); - + $m = array(); + while ( $inputPos < strlen( $subject ) && preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) ) { diff --git a/includes/Title.php b/includes/Title.php index 76cf0eba29..65458a07c4 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -109,8 +109,6 @@ class Title { * @access public */ public static function newFromText( $text, $defaultNamespace = NS_MAIN ) { - $fname = 'Title::newFromText'; - if( is_object( $text ) ) { throw new MWException( 'Title::newFromText given an object' ); } @@ -289,6 +287,7 @@ class Title { $mwRedir = MagicWord::get( 'redirect' ); $rt = NULL; if ( $mwRedir->matchStart( $text ) ) { + $m = array(); if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) { # categories are escaped using : for example one can enter: # #REDIRECT [[:Category:Music]]. Need to remove it. @@ -859,6 +858,7 @@ class Title { } else { global $wgActionPaths; $url = false; + $matches = array(); if( !empty( $wgActionPaths ) && preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) ) { @@ -1429,7 +1429,6 @@ class Title { */ /* private */ function secureAndSplit() { global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks; - $fname = 'Title::secureAndSplit'; # Initialisation static $rxTc = false; @@ -1467,6 +1466,7 @@ class Title { # Namespace or interwiki prefix $firstPass = true; do { + $m = array(); if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $t, $m ) ) { $p = $m[1]; $lowerNs = $wgContLang->lc( $p ); @@ -1628,7 +1628,6 @@ class Title { */ function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) { $linkCache =& LinkCache::singleton(); - $id = $this->getArticleID(); if ( $options ) { $db =& wfGetDB( DB_MASTER ); @@ -1899,7 +1898,6 @@ class Title { } $now = wfTimestampNow(); - $rand = wfRandom(); $newid = $nt->getArticleID(); $oldid = $this->getArticleID(); $dbw =& wfGetDB( DB_MASTER ); @@ -1937,7 +1935,7 @@ class Title { 'page' => $newid, 'comment' => $comment, 'text' => $redirectText ) ); - $revid = $redirectRevision->insertOn( $dbw ); + $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); $linkCache->clearLink( $this->getPrefixedDBkey() ); @@ -1980,7 +1978,6 @@ class Title { $oldid = $this->getArticleID(); $dbw =& wfGetDB( DB_MASTER ); $now = $dbw->timestamp(); - $rand = wfRandom(); $linkCache =& LinkCache::singleton(); # Save a null revision in the page's history notifying of the move @@ -2010,7 +2007,7 @@ class Title { 'page' => $newid, 'comment' => $comment, 'text' => $redirectText ) ); - $revid = $redirectRevision->insertOn( $dbw ); + $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); $linkCache->clearLink( $this->getPrefixedDBkey() ); @@ -2062,6 +2059,7 @@ class Title { # Does the redirect point to the source? # Or is it a broken self-redirect, usually caused by namespace collisions? + $m = array(); if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) { $redirTitle = Title::newFromText( $m[1] ); if( !is_object( $redirTitle ) || @@ -2113,7 +2111,7 @@ class Title { 'comment' => $comment, 'text' => "#REDIRECT [[" . $dest->getPrefixedText() . "]]\n", ) ); - $revisionId = $revision->insertOn( $dbw ); + $revision->insertOn( $dbw ); $article->updateRevisionOn( $dbw, $revision, 0 ); # Link table @@ -2372,7 +2370,7 @@ class Title { */ function isSpecial( $name ) { if ( $this->getNamespace() == NS_SPECIAL ) { - list( $thisName, $subpage ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() ); + list( $thisName, /* $subpage */ ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() ); if ( $name == $thisName ) { return true; } diff --git a/includes/User.php b/includes/User.php index 8d402efd2a..ea05f6af47 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2133,6 +2133,7 @@ class User { */ function sendConfirmationMail() { global $wgContLang; + $expiration = null; // gets passed-by-ref and defined in next line. $url = $this->confirmationTokenUrl( $expiration ); return $this->sendMail( wfMsg( 'confirmemail_subject' ), wfMsg( 'confirmemail_body', diff --git a/includes/WikiError.php b/includes/WikiError.php index 6986b1ce45..029184d465 100644 --- a/includes/WikiError.php +++ b/includes/WikiError.php @@ -59,7 +59,7 @@ class WikiError { * @return bool * @static */ - public static function isError( &$object ) { + public static function isError( $object ) { return $object instanceof WikiError; } } diff --git a/includes/memcached-client.php b/includes/memcached-client.php index b1ba778a1c..2c5cc6be77 100644 --- a/includes/memcached-client.php +++ b/includes/memcached-client.php @@ -451,7 +451,8 @@ class memcached return false; $this->stats['get_multi']++; - + $sock_keys = array(); + foreach ($keys as $key) { $sock = $this->get_sock($key); @@ -697,6 +698,7 @@ class memcached list ($ip, $port) = explode(":", $host); $sock = false; $timeout = $this->_connect_timeout; + $errno = $errstr = null; for ($i = 0; !$sock && $i < $this->_connect_attempts; $i++) { if ($i > 0) { # Sleep until the timeout, in case it failed fast @@ -740,7 +742,7 @@ class memcached function _dead_sock ($sock) { $host = array_search($sock, $this->_cache_sock); - @list ($ip, $port) = explode(":", $host); + @list ($ip, /* $port */) = explode(":", $host); $this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10)); $this->_host_dead[$host] = $this->_host_dead[$ip]; unset($this->_cache_sock[$host]); @@ -849,6 +851,7 @@ class memcached stream_set_timeout($sock, 1, 0); $line = fgets($sock); + $match = array(); if (!preg_match('/^(\d+)/', $line, $match)) return null; return $match[1]; @@ -1001,8 +1004,9 @@ class memcached if (isset($this->_cache_sock[$host])) return $this->_cache_sock[$host]; + $sock = null; $now = time(); - list ($ip, $port) = explode (":", $host); + list ($ip, /* $port */) = explode (":", $host); if (isset($this->_host_dead[$host]) && $this->_host_dead[$host] > $now || isset($this->_host_dead[$ip]) && $this->_host_dead[$ip] > $now) return null; -- 2.20.1