r17991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17990‎ | r17991 | r17992 >
Date:11:43, 29 November 2006
Author:nickj
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/AjaxResponse.php (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/ChangesList.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/includes/DjVuImage.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/FileStore.php (modified) (history)
  • /trunk/phase3/includes/HTMLCacheUpdate.php (modified) (history)
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/Hooks.php (modified) (history)
  • /trunk/phase3/includes/IP.php (modified) (history)
  • /trunk/phase3/includes/Image.php (modified) (history)
  • /trunk/phase3/includes/ImageFunctions.php (modified) (history)
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/Math.php (modified) (history)
  • /trunk/phase3/includes/Metadata.php (modified) (history)
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/Pager.php (modified) (history)
  • /trunk/phase3/includes/ParserCache.php (modified) (history)
  • /trunk/phase3/includes/ProfilerSimple.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SearchMySQL4.php (modified) (history)
  • /trunk/phase3/includes/SearchTsearch2.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialBooksources.php (modified) (history)
  • /trunk/phase3/includes/SpecialDisambiguations.php (modified) (history)
  • /trunk/phase3/includes/SpecialExport.php (modified) (history)
  • /trunk/phase3/includes/SpecialImagelist.php (modified) (history)
  • /trunk/phase3/includes/SpecialIpblocklist.php (modified) (history)
  • /trunk/phase3/includes/SpecialLog.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/SpecialPrefixindex.php (modified) (history)
  • /trunk/phase3/includes/SpecialRandompage.php (modified) (history)
  • /trunk/phase3/includes/SpecialSearch.php (modified) (history)
  • /trunk/phase3/includes/SpecialSpecialpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/SpecialVersion.php (modified) (history)
  • /trunk/phase3/includes/SquidUpdate.php (modified) (history)
  • /trunk/phase3/includes/StringUtils.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/includes/WikiError.php (modified) (history)
  • /trunk/phase3/includes/memcached-client.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBooksources.php
@@ -48,7 +48,6 @@
4949
5050 function showList() {
5151 global $wgOut, $wgContLang;
52 - $fname = "BookSourceList::showList()";
5352
5453 # First, see if we have a custom list setup in
5554 # [[Wikipedia:Book sources]] or equivalent.
@@ -93,7 +92,6 @@
9493
9594 function askForm() {
9695 global $wgOut, $wgTitle;
97 - $fname = "BookSourceList::askForm()";
9896
9997 $action = $wgTitle->escapeLocalUrl();
10098 $isbn = htmlspecialchars( wfMsg( "isbn" ) );
Index: trunk/phase3/includes/ChangesList.php
@@ -184,7 +184,7 @@
185185 $s .= ' '.$articlelink;
186186 }
187187
188 - function insertTimestamp(&$s, &$rc) {
 188+ function insertTimestamp(&$s, $rc) {
189189 global $wgLang;
190190 # Timestamp
191191 $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
@@ -233,7 +233,6 @@
234234
235235 # Extract DB fields into local scope
236236 extract( $rc->mAttribs );
237 - $curIdEq = 'curid=' . $rc_cur_id;
238237
239238 # Should patrol-related stuff be shown?
240239 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
@@ -413,7 +412,6 @@
414413 $userlinks = array();
415414 foreach( $block as $rcObj ) {
416415 $oldid = $rcObj->mAttribs['rc_last_oldid'];
417 - $newid = $rcObj->mAttribs['rc_this_oldid'];
418416 if( $rcObj->mAttribs['rc_new'] ) {
419417 $isnew = true;
420418 }
@@ -643,7 +641,7 @@
644642 return '';
645643 }
646644 $blockOut = '';
647 - foreach( $this->rc_cache as $secureName => $block ) {
 645+ foreach( $this->rc_cache as $block ) {
648646 if( count( $block ) < 2 ) {
649647 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
650648 } else {
Index: trunk/phase3/includes/IP.php
@@ -27,7 +27,7 @@
2828 * @return boolean True if it is valid.
2929 */
3030 public static function isValid( $ip ) {
31 - return preg_match( '/^' . RE_IP_ADD . '$/', $ip, $matches) ;
 31+ return preg_match( '/^' . RE_IP_ADD . '$/', $ip) ;
3232 }
3333
3434 /**
@@ -84,6 +84,7 @@
8585 * @return array
8686 */
8787 public static function toArray( $ipblock ) {
 88+ $matches = array();
8889 if(! preg_match( '/^' . RE_IP_ADD . '(?:\/(?:'.RE_IP_PREFIX.'))?' . '$/', $ipblock, $matches ) ) {
8990 return false;
9091 } else {
Index: trunk/phase3/includes/Metadata.php
@@ -22,7 +22,8 @@
2323 */
2424
2525 /**
26 - *
 26+ * TODO: Perhaps make this file into a Metadata class, with static methods (declared
 27+ * as private where indicated), to move these functions out of the global namespace?
2728 */
2829 define('RDF_TYPE_PREFS', "application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1");
2930
@@ -142,7 +143,7 @@
143144 dcPerson('contributor', $user_parts[0], $user_parts[1], $user_parts[2]);
144145 }
145146
146 - dcRights($article);
 147+ dcRights();
147148 }
148149
149150 /**
@@ -291,7 +292,7 @@
292293 * different pages.
293294 * @private
294295 */
295 -function dcRights($article) {
 296+function dcRights() {
296297
297298 global $wgRightsPage, $wgRightsUrl, $wgRightsText;
298299
Index: trunk/phase3/includes/Article.php
@@ -2330,7 +2330,11 @@
23312331 */
23322332 function isFileCacheable() {
23332333 global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest;
2334 - extract( $wgRequest->getValues( 'action', 'oldid', 'diff', 'redirect', 'printable' ) );
 2334+ $action = $wgRequest->getVal( 'action' );
 2335+ $oldid = $wgRequest->getVal( 'oldid' );
 2336+ $diff = $wgRequest->getVal( 'diff' );
 2337+ $redirect = $wgRequest->getVal( 'redirect' );
 2338+ $printable = $wgRequest->getVal( 'printable' );
23352339
23362340 return $wgUseFileCache
23372341 and (!$wgShowIPinHeader)
@@ -2700,8 +2704,6 @@
27012705 # This code is UGLY UGLY UGLY.
27022706 # Somebody PLEASE come up with a more elegant way to do it.
27032707
2704 - $summary = '';
2705 -
27062708 #Redirect autosummaries
27072709 $summary = self::getRedirectAutosummary( $newtext );
27082710
Index: trunk/phase3/includes/Pager.php
@@ -323,7 +323,7 @@
324324 $next = array( 'offset' => $this->mLastShown, 'limit' => $urlLimit );
325325 $last = array( 'dir' => 'prev', 'limit' => $urlLimit );
326326 }
327 - return compact( 'prev', 'next', 'first', 'last' );
 327+ return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last );
328328 }
329329
330330 /**
Index: trunk/phase3/includes/SearchTsearch2.php
@@ -47,6 +47,7 @@
4848 $this->searchTerms = array();
4949
5050 # FIXME: This doesn't handle parenthetical expressions.
 51+ $m = array();
5152 if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
5253 $filteredText, $m, PREG_SET_ORDER ) ) {
5354 foreach( $m as $terms ) {
@@ -64,7 +65,7 @@
6566 $this->searchTerms[] = $regexp;
6667 }
6768 wfDebug( "Would search with '$searchon'\n" );
68 - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
 69+ wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
6970 } else {
7071 wfDebug( "Can't understand search query '{$this->filteredText}'\n" );
7172 }
Index: trunk/phase3/includes/SpecialSpecialpages.php
@@ -37,7 +37,7 @@
3838
3939 /** Put them into a sortable array */
4040 $sortedPages = array();
41 - foreach ( $pages as $name => $page ) {
 41+ foreach ( $pages as $page ) {
4242 if ( $page->isListed() ) {
4343 $sortedPages[$page->getDescription()] = $page->getTitle();
4444 }
Index: trunk/phase3/includes/SpecialSearch.php
@@ -77,7 +77,6 @@
7878 function goResult( $term ) {
7979 global $wgOut;
8080 global $wgGoToEdit;
81 - global $wgContLang;
8281
8382 $this->setupPage( $term );
8483
@@ -98,17 +97,13 @@
9998
10099 # No match, generate an edit URL
101100 $t = Title::newFromText( $term );
102 - if( is_null( $t ) ) {
103 - $editurl = ''; # hrm...
104 - } else {
 101+ if( ! is_null( $t ) ) {
105102 wfRunHooks( 'SpecialSearchNogomatch', array( &$t ) );
106103 # If the feature is enabled, go straight to the edit page
107104 if ( $wgGoToEdit ) {
108105 $wgOut->redirect( $t->getFullURL( 'action=edit' ) );
109106 return;
110 - } else {
111 - $editurl = $t->escapeLocalURL( 'action=edit' );
112 - }
 107+ }
113108 }
114109 $wgOut->addWikiText( wfMsg( 'noexactmatch', wfEscapeWikiText( $term ) ) );
115110
@@ -125,8 +120,7 @@
126121
127122 $this->setupPage( $term );
128123
129 - global $wgUser, $wgOut;
130 - $sk = $wgUser->getSkin();
 124+ global $wgOut;
131125 $wgOut->addWikiText( wfMsg( 'searchresulttext' ) );
132126
133127 #if ( !$this->parseQuery() ) {
@@ -347,6 +341,7 @@
348342 break;
349343 }
350344 ++$lineno;
 345+ $m = array();
351346 if ( ! preg_match( $pat1, $line, $m ) ) {
352347 continue;
353348 }
Index: trunk/phase3/includes/memcached-client.php
@@ -451,7 +451,8 @@
452452 return false;
453453
454454 $this->stats['get_multi']++;
455 -
 455+ $sock_keys = array();
 456+
456457 foreach ($keys as $key)
457458 {
458459 $sock = $this->get_sock($key);
@@ -697,6 +698,7 @@
698699 list ($ip, $port) = explode(":", $host);
699700 $sock = false;
700701 $timeout = $this->_connect_timeout;
 702+ $errno = $errstr = null;
701703 for ($i = 0; !$sock && $i < $this->_connect_attempts; $i++) {
702704 if ($i > 0) {
703705 # Sleep until the timeout, in case it failed fast
@@ -740,7 +742,7 @@
741743 function _dead_sock ($sock)
742744 {
743745 $host = array_search($sock, $this->_cache_sock);
744 - @list ($ip, $port) = explode(":", $host);
 746+ @list ($ip, /* $port */) = explode(":", $host);
745747 $this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10));
746748 $this->_host_dead[$host] = $this->_host_dead[$ip];
747749 unset($this->_cache_sock[$host]);
@@ -849,6 +851,7 @@
850852
851853 stream_set_timeout($sock, 1, 0);
852854 $line = fgets($sock);
 855+ $match = array();
853856 if (!preg_match('/^(\d+)/', $line, $match))
854857 return null;
855858 return $match[1];
@@ -1001,8 +1004,9 @@
10021005 if (isset($this->_cache_sock[$host]))
10031006 return $this->_cache_sock[$host];
10041007
 1008+ $sock = null;
10051009 $now = time();
1006 - list ($ip, $port) = explode (":", $host);
 1010+ list ($ip, /* $port */) = explode (":", $host);
10071011 if (isset($this->_host_dead[$host]) && $this->_host_dead[$host] > $now ||
10081012 isset($this->_host_dead[$ip]) && $this->_host_dead[$ip] > $now)
10091013 return null;
Index: trunk/phase3/includes/SquidUpdate.php
@@ -29,8 +29,6 @@
3030 wfProfileIn( $fname );
3131
3232 # Get a list of URLs linking to this page
33 - $id = $title->getArticleID();
34 -
3533 $dbr =& wfGetDB( DB_SLAVE );
3634 $res = $dbr->select( array( 'links', 'page' ),
3735 array( 'page_namespace', 'page_title' ),
Index: trunk/phase3/includes/PageHistory.php
@@ -106,7 +106,6 @@
107107 * Do the list
108108 */
109109 $pager = new PageHistoryPager( $this );
110 - $navbar = $pager->getNavigationBar();
111110 $this->linesonpage = $pager->getNumRows();
112111 $wgOut->addHTML(
113112 $pager->getNavigationBar() .
Index: trunk/phase3/includes/Database.php
@@ -90,8 +90,8 @@
9191 }
9292
9393 function getHTML() {
94 - global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
95 - global $wgSitename, $wgServer, $wgMessageCache, $wgLogo;
 94+ global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding;
 95+ global $wgSitename, $wgServer, $wgMessageCache;
9696
9797 # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
9898 # Hard coding strings instead.
@@ -621,7 +621,7 @@
622622
623623 # Add a comment for easy SHOW PROCESSLIST interpretation
624624 if ( $fname ) {
625 - $commentedSql = preg_replace("/\s/", " /* $fname */ ", $sql, 1);
 625+ $commentedSql = preg_replace('/\s/', " /* $fname */ ", $sql, 1);
626626 } else {
627627 $commentedSql = $sql;
628628 }
@@ -687,7 +687,7 @@
688688 * @param bool $tempIgnore
689689 */
690690 function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
691 - global $wgCommandLineMode, $wgFullyInitialised, $wgColorErrors;
 691+ global $wgCommandLineMode;
692692 # Ignore errors during error handling to avoid infinite recursion
693693 $ignore = $this->ignoreErrors( true );
694694 ++$this->mErrorCount;
@@ -786,7 +786,7 @@
787787 case '\\!': return '!';
788788 case '\\&': return '&';
789789 }
790 - list( $n, $arg ) = each( $this->preparedArgs );
 790+ list( /* $n */ , $arg ) = each( $this->preparedArgs );
791791 switch( $matches[1] ) {
792792 case '?': return $this->addQuotes( $arg );
793793 case '!': return $arg;
@@ -1091,7 +1091,7 @@
10921092 $sql = preg_replace ('/".*"/s', "'X'", $sql);
10931093
10941094 # All newlines, tabs, etc replaced by single space
1095 - $sql = preg_replace ( "/\s+/", ' ', $sql);
 1095+ $sql = preg_replace ( '/\s+/', ' ', $sql);
10961096
10971097 # All numbers => N
10981098 $sql = preg_replace ('/-?[0-9]+/s', 'N', $sql);
@@ -1558,7 +1558,8 @@
15591559 $row = $this->fetchObject( $res );
15601560 $this->freeResult( $res );
15611561
1562 - if ( preg_match( "/\((.*)\)/", $row->Type, $m ) ) {
 1562+ $m = array();
 1563+ if ( preg_match( '/\((.*)\)/', $row->Type, $m ) ) {
15631564 $size = $m[1];
15641565 } else {
15651566 $size = -1;
@@ -1882,7 +1883,6 @@
18831884 $res = $this->query( 'SHOW PROCESSLIST' );
18841885 # Find slave SQL thread. Assumed to be the second one running, which is a bit
18851886 # dubious, but unfortunately there's no easy rigorous way
1886 - $slaveThreads = 0;
18871887 while ( $row = $this->fetchObject( $res ) ) {
18881888 /* This should work for most situations - when default db
18891889 * for thread is not specified, it had no events executed,
Index: trunk/phase3/includes/MagicWord.php
@@ -289,7 +289,7 @@
290290 * Used in matchAndRemove()
291291 * @private
292292 **/
293 - function pregRemoveAndRecord( $match ) {
 293+ function pregRemoveAndRecord( ) {
294294 $this->mFound = true;
295295 return '';
296296 }
Index: trunk/phase3/includes/ParserCache.php
@@ -56,8 +56,6 @@
5757 $fname = 'ParserCache::get';
5858 wfProfileIn( $fname );
5959
60 - $hash = $user->getPageRenderingHash();
61 - $pageid = intval( $article->getID() );
6260 $key = $this->getKey( $article, $user );
6361
6462 wfDebug( "Trying parser cache $key\n" );
Index: trunk/phase3/includes/ProfilerSimple.php
@@ -61,15 +61,13 @@
6262 }
6363
6464 function profileOut($functionname) {
65 - $memory = memory_get_usage();
66 -
6765 global $wgDebugFunctionEntry;
6866
6967 if ($wgDebugFunctionEntry) {
7068 $this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
7169 }
7270
73 - list($ofname,$ocount,$ortime,$octime) = array_pop($this->mWorkStack);
 71+ list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack);
7472
7573 if (!$ofname) {
7674 $this->debug("Profiling error: $functionname\n");
Index: trunk/phase3/includes/HistoryBlob.php
@@ -226,7 +226,7 @@
227227 $flags = explode( ',', $row->old_flags );
228228 if( in_array( 'external', $flags ) ) {
229229 $url=$row->old_text;
230 - @list($proto,$path)=explode('://',$url,2);
 230+ @list( /* $proto */ ,$path)=explode('://',$url,2);
231231 if ($path=="") {
232232 wfProfileOut( $fname );
233233 return false;
Index: trunk/phase3/includes/ImageFunctions.php
@@ -126,6 +126,7 @@
127127 '' => 1.0, // "User units" pixels by default
128128 '%' => 2.0, // Fake it!
129129 );
 130+ $matches = array();
130131 if( preg_match( '/^(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) {
131132 $length = floatval( $matches[1] );
132133 $unit = $matches[2];
@@ -156,6 +157,7 @@
157158 fclose( $f );
158159
159160 // Uber-crappy hack! Run through a real XML parser.
 161+ $matches = array();
160162 if( !preg_match( '/<svg\s*([^>]*)\s*>/s', $chunk, $matches ) ) {
161163 return false;
162164 }
@@ -206,6 +208,7 @@
207209 }
208210
209211 # Find all links
 212+ $m = array();
210213 if ( !preg_match_all( '/\[\[:?(.*?)\]\]/', $line, $m ) ) {
211214 continue;
212215 }
Index: trunk/phase3/includes/WikiError.php
@@ -59,7 +59,7 @@
6060 * @return bool
6161 * @static
6262 */
63 - public static function isError( &$object ) {
 63+ public static function isError( $object ) {
6464 return $object instanceof WikiError;
6565 }
6666 }
Index: trunk/phase3/includes/SearchMySQL4.php
@@ -43,6 +43,7 @@
4444 $this->searchTerms = array();
4545
4646 # FIXME: This doesn't handle parenthetical expressions.
 47+ $m = array();
4748 if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
4849 $filteredText, $m, PREG_SET_ORDER ) ) {
4950 foreach( $m as $terms ) {
@@ -60,7 +61,7 @@
6162 $this->searchTerms[] = $regexp;
6263 }
6364 wfDebug( "Would search with '$searchon'\n" );
64 - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
 65+ wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
6566 } else {
6667 wfDebug( "Can't understand search query '{$filteredText}'\n" );
6768 }
Index: trunk/phase3/includes/SpecialVersion.php
@@ -281,8 +281,6 @@
282282 // subversion is release 1.4
283283 return intval( $content[3] );
284284 }
285 -
286 - return false;
287285 }
288286
289287 /**#@-*/
Index: trunk/phase3/includes/StringUtils.php
@@ -50,7 +50,8 @@
5151 $encEnd = preg_quote( $endDelim, '!' );
5252 $strcmp = strpos( $flags, 'i' ) === false ? 'strcmp' : 'strcasecmp';
5353 $endLength = strlen( $endDelim );
54 -
 54+ $m = array();
 55+
5556 while ( $inputPos < strlen( $subject ) &&
5657 preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) )
5758 {
Index: trunk/phase3/includes/FileStore.php
@@ -57,7 +57,7 @@
5858 $dbw = wfGetDB( DB_MASTER );
5959 $lockname = $dbw->addQuotes( FileStore::lockName() );
6060 $result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", __METHOD__ );
61 - $row = $dbw->fetchObject( $result );
 61+ $dbw->fetchObject( $result );
6262 $dbw->freeResult( $result );
6363 }
6464
Index: trunk/phase3/includes/SkinTemplate.php
@@ -148,7 +148,8 @@
149149 // adding of CSS or Javascript by extensions.
150150 wfRunHooks( 'BeforePageDisplay', array( &$out ) );
151151
152 - extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 152+ $oldid = $wgRequest->getVal( 'oldid' );
 153+ $diff = $wgRequest->getVal( 'diff' );
153154
154155 wfProfileIn( "$fname-init" );
155156 $this->initPage( $out );
@@ -768,9 +769,6 @@
769770 $variants = $wgContLang->getVariants();
770771 if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
771772 $preferred = $wgContLang->getPreferredVariant();
772 - $actstr = '';
773 - if( $action )
774 - $actstr = 'action=' . $action . '&';
775773 $vcount=0;
776774 foreach( $variants as $code ) {
777775 $varname = $wgContLang->getVariantname( $code );
@@ -810,7 +808,6 @@
811809
812810 $action = $wgRequest->getText( 'action' );
813811 $oldid = $wgRequest->getVal( 'oldid' );
814 - $diff = $wgRequest->getVal( 'diff' );
815812
816813 $nav_urls = array();
817814 $nav_urls['mainpage'] = array( 'href' => self::makeI18nUrl( 'mainpage') );
Index: trunk/phase3/includes/SpecialUndelete.php
@@ -348,7 +348,6 @@
349349 }
350350
351351 $revision = null;
352 - $newRevId = $previousRevId;
353352 $restored = 0;
354353
355354 while( $row = $dbw->fetchObject( $result ) ) {
@@ -375,7 +374,7 @@
376375 'minor_edit' => $row->ar_minor_edit,
377376 'text_id' => $row->ar_text_id,
378377 ) );
379 - $newRevId = $revision->insertOn( $dbw );
 378+ $revision->insertOn( $dbw );
380379 $restored++;
381380 }
382381
@@ -594,8 +593,8 @@
595594 }
596595
597596 $archive = new PageArchive( $this->mTargetObj );
598 - $text = $archive->getLastRevisionText();
599597 /*
 598+ $text = $archive->getLastRevisionText();
600599 if( is_null( $text ) ) {
601600 $wgOut->addWikiText( wfMsg( "nohistory" ) );
602601 return;
@@ -739,7 +738,6 @@
740739 global $wgOut, $wgUser;
741740 if( !is_null( $this->mTargetObj ) ) {
742741 $archive = new PageArchive( $this->mTargetObj );
743 - $ok = true;
744742
745743 $ok = $archive->undelete(
746744 $this->mTargetTimestamp,
Index: trunk/phase3/includes/HTMLCacheUpdate.php
@@ -55,7 +55,6 @@
5656 $numRows = $res->numRows();
5757 $numBatches = ceil( $numRows / $this->mRowsPerJob );
5858 $realBatchSize = $numRows / $numBatches;
59 - $boundaries = array();
6059 $start = false;
6160 $jobs = array();
6261 do {
Index: trunk/phase3/includes/SpecialAllmessages.php
@@ -28,7 +28,6 @@
2929 # Make sure all extension messages are available
3030 MessageCache::loadAllMessages();
3131
32 - $first = true;
3332 $sortedArray = array_merge( Language::getMessagesFor( 'en' ), $wgMessageCache->getExtensionMessagesFor( 'en' ) );
3433 ksort( $sortedArray );
3534 $messages = array();
@@ -75,7 +74,7 @@
7675 } else {
7776 $comment = '';
7877 }
79 - $txt .= "'$key' => '" . preg_replace( "/(?<!\\\\)'/", "\'", $m['msg']) . "',$comment\n";
 78+ $txt .= "'$key' => '" . preg_replace( '/(?<!\\\\)\'/', "\'", $m['msg']) . "',$comment\n";
8079 }
8180 $txt .= ');';
8281 return $txt;
@@ -92,8 +91,6 @@
9392
9493 $sk =& $wgUser->getSkin();
9594 $talk = $wgLang->getNsText( NS_TALK );
96 - $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
97 - $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK );
9895
9996 $input = wfElement( 'input', array(
10097 'type' => 'text',
Index: trunk/phase3/includes/Skin.php
@@ -48,6 +48,7 @@
4949 # while code from www.php.net
5050 while (false !== ($file = $skinDir->read())) {
5151 // Skip non-PHP files, hidden files, and '.dep' includes
 52+ $matches = array();
5253 if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
5354 $aSkin = $matches[1];
5455 $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
@@ -369,7 +370,6 @@
370371 function getUserStylesheet() {
371372 global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
372373 $sheet = $this->getStylesheet();
373 - $action = $wgRequest->getText('action');
374374 $s = "@import \"$wgStylePath/common/common.css?$wgStyleVersion\";\n";
375375 $s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
376376 if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
@@ -490,7 +490,6 @@
491491 else $a = array( 'bgcolor' => '#FFFFFF' );
492492 if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
493493 $wgTitle->userCanEdit() ) {
494 - $t = wfMsg( 'editthispage' );
495494 $s = $wgTitle->getFullURL( $this->editUrlOptions() );
496495 $s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
497496 $a += array ('ondblclick' => $s);
@@ -696,7 +695,8 @@
697696 function pageTitleLinks() {
698697 global $wgOut, $wgTitle, $wgUser, $wgRequest;
699698
700 - extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 699+ $oldid = $wgRequest->getVal( 'oldid' );
 700+ $diff = $wgRequest->getVal( 'diff' );
701701 $action = $wgRequest->getText( 'action' );
702702
703703 $s = $this->printableLink();
@@ -838,7 +838,6 @@
839839 function nameAndLogin() {
840840 global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader;
841841
842 - $li = $wgContLang->specialPage( 'Userlogin' );
843842 $lo = $wgContLang->specialPage( 'Userlogout' );
844843
845844 $s = '';
@@ -1011,7 +1010,8 @@
10121011 global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
10131012 global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
10141013
1015 - extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 1014+ $oldid = $wgRequest->getVal( 'oldid' );
 1015+ $diff = $wgRequest->getVal( 'diff' );
10161016 if ( ! $wgOut->isArticle() ) { return ''; }
10171017 if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
10181018 if ( 0 == $wgArticle->getID() ) { return ''; }
@@ -1144,7 +1144,6 @@
11451145 */
11461146 function specialPagesList() {
11471147 global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
1148 - $a = array();
11491148 $pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
11501149 foreach ( $pages as $name => $page ) {
11511150 $pages[$name] = $page->getDescription();
@@ -1629,7 +1628,7 @@
16301629 }
16311630 }
16321631 if ($cacheSidebar)
1633 - $cachednotice = $parserMemc->set( $key, $bar, 86400 );
 1632+ $parserMemc->set( $key, $bar, 86400 );
16341633 wfProfileOut( $fname );
16351634 return $bar;
16361635 }
Index: trunk/phase3/includes/DjVuImage.php
@@ -217,7 +217,7 @@
218218 global $wgDjvuToXML;
219219 if ( isset( $wgDjvuToXML ) ) {
220220 $cmd = $wgDjvuToXML . ' --without-anno --without-text ' . $this->mFilename;
221 - $xml = wfShellExec( $cmd, $retval );
 221+ $xml = wfShellExec( $cmd );
222222 } else {
223223 $xml = null;
224224 }
Index: trunk/phase3/includes/SpecialRandompage.php
@@ -11,7 +11,7 @@
1212 * used as e.g. Special:Randompage/Category
1313 */
1414 function wfSpecialRandompage( $par = NS_MAIN ) {
15 - global $wgOut, $wgExtraRandompageSQL, $wgContLang, $wgLang;
 15+ global $wgOut, $wgExtraRandompageSQL;
1616 $fname = 'wfSpecialRandompage';
1717
1818 # Determine namespace
Index: trunk/phase3/includes/SpecialIpblocklist.php
@@ -167,6 +167,7 @@
168168 }
169169
170170 $conds = array();
 171+ $matches = array();
171172 if ( $this->ip == '' ) {
172173 // No extra conditions
173174 } elseif ( substr( $this->ip, 0, 1 ) == '#' ) {
@@ -174,7 +175,7 @@
175176 } elseif ( IP::toUnsigned( $this->ip ) !== false ) {
176177 $conds['ipb_address'] = $this->ip;
177178 $conds['ipb_auto'] = 0;
178 - } elseif( preg_match( "/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/", $this->ip, $matches ) ) {
 179+ } elseif( preg_match( '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/', $this->ip, $matches ) ) {
179180 $conds['ipb_address'] = Block::normaliseRange( $this->ip );
180181 $conds['ipb_auto'] = 0;
181182 } else {
Index: trunk/phase3/includes/EditPage.php
@@ -1625,15 +1625,15 @@
16261626 */
16271627 $toolarray=array(
16281628 array( 'image'=>'button_bold.png',
1629 - 'open' => "\'\'\'",
1630 - 'close' => "\'\'\'",
 1629+ 'open' => '\\\'\\\'\\\'',
 1630+ 'close' => '\\\'\\\'\\\'',
16311631 'sample'=> wfMsg('bold_sample'),
16321632 'tip' => wfMsg('bold_tip'),
16331633 'key' => 'B'
16341634 ),
16351635 array( 'image'=>'button_italic.png',
1636 - 'open' => "\'\'",
1637 - 'close' => "\'\'",
 1636+ 'open' => '\\\'\\\'',
 1637+ 'close' => '\\\'\\\'',
16381638 'sample'=> wfMsg('italic_sample'),
16391639 'tip' => wfMsg('italic_tip'),
16401640 'key' => 'I'
Index: trunk/phase3/includes/SpecialLog.php
@@ -151,7 +151,6 @@
152152 */
153153 function getQuery() {
154154 $logging = $this->db->tableName( "logging" );
155 - $user = $this->db->tableName( 'user' );
156155 $sql = "SELECT /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp,
157156 log_user, user_name,
158157 log_namespace, log_title, page_id,
@@ -304,7 +303,6 @@
305304 function logLine( $s ) {
306305 global $wgLang;
307306 $title = Title::makeTitle( $s->log_namespace, $s->log_title );
308 - $user = Title::makeTitleSafe( NS_USER, $s->user_name );
309307 $time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true );
310308
311309 // Enter the existence or non-existence of this page into the link cache,
Index: trunk/phase3/includes/SpecialDisambiguations.php
@@ -32,7 +32,7 @@
3333
3434 function getSQL() {
3535 $dbr =& wfGetDB( DB_SLAVE );
36 - extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
 36+ list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
3737
3838 $dMsgText = wfMsgForContent('disambiguationspage');
3939
Index: trunk/phase3/includes/Hooks.php
@@ -31,7 +31,6 @@
3232 function wfRunHooks($event, $args = null) {
3333
3434 global $wgHooks;
35 - $fname = 'wfRunHooks';
3635
3736 if (!is_array($wgHooks)) {
3837 throw new MWException("Global hooks array is not an array!\n");
Index: trunk/phase3/includes/Math.php
@@ -75,12 +75,13 @@
7676 $retval = substr ($contents, 0, 1);
7777 $errmsg = '';
7878 if (($retval == 'C') || ($retval == 'M') || ($retval == 'L')) {
79 - if ($retval == 'C')
 79+ if ($retval == 'C') {
8080 $this->conservativeness = 2;
81 - else if ($retval == 'M')
 81+ } else if ($retval == 'M') {
8282 $this->conservativeness = 1;
83 - else
 83+ } else {
8484 $this->conservativeness = 0;
 85+ }
8586 $outdata = substr ($contents, 33);
8687
8788 $i = strpos($outdata, "\000");
@@ -89,12 +90,13 @@
9091 $this->mathml = substr($outdata, $i+1);
9192 } else if (($retval == 'c') || ($retval == 'm') || ($retval == 'l')) {
9293 $this->html = substr ($contents, 33);
93 - if ($retval == 'c')
 94+ if ($retval == 'c') {
9495 $this->conservativeness = 2;
95 - else if ($retval == 'm')
 96+ } else if ($retval == 'm') {
9697 $this->conservativeness = 1;
97 - else
 98+ } else {
9899 $this->conservativeness = 0;
 100+ }
99101 $this->mathml = NULL;
100102 } else if ($retval == 'X') {
101103 $this->html = NULL;
@@ -118,7 +120,7 @@
119121 $this->hash = substr ($contents, 1, 32);
120122 }
121123
122 - $res = wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );
 124+ wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );
123125
124126 if ( $errmsg ) {
125127 return $errmsg;
Index: trunk/phase3/includes/ImageGallery.php
@@ -134,7 +134,7 @@
135135 *
136136 */
137137 function toHTML() {
138 - global $wgLang, $wgIgnoreImageErrors, $wgGenerateThumbnailOnParse;
 138+ global $wgLang, $wgGenerateThumbnailOnParse;
139139
140140 $sk = $this->getSkin();
141141
@@ -147,7 +147,6 @@
148148 $img =& $pair[0];
149149 $text = $pair[1];
150150
151 - $name = $img->getName();
152151 $nt = $img->getTitle();
153152
154153 if( $nt->getNamespace() != NS_IMAGE ) {
Index: trunk/phase3/includes/AjaxResponse.php
@@ -61,7 +61,7 @@
6262 }
6363
6464 function sendHeaders() {
65 - global $wgUseSquid, $wgUseESI, $wgSquidMaxage;
 65+ global $wgUseSquid, $wgUseESI;
6666
6767 if ( $this->mResponseCode ) {
6868 $n = preg_replace( '/^ *(\d+)/', '\1', $this->mResponseCode );
@@ -122,7 +122,7 @@
123123 * returns true iff the response code was set to 304 Not Modified.
124124 */
125125 function checkLastModified ( $timestamp ) {
126 - global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest;
 126+ global $wgCachePages, $wgCacheEpoch, $wgUser;
127127 $fname = 'AjaxResponse::checkLastModified';
128128
129129 if ( !$timestamp || $timestamp == '19700101000000' ) {
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -34,7 +34,7 @@
3535 * Load some values
3636 */
3737 function PreferencesForm( &$request ) {
38 - global $wgLang, $wgContLang, $wgUser, $wgAllowRealName;
 38+ global $wgContLang, $wgUser, $wgAllowRealName;
3939
4040 $this->mQuickbar = $request->getVal( 'wpQuickbar' );
4141 $this->mOldpass = $request->getVal( 'wpOldpass' );
@@ -378,7 +378,6 @@
379379
380380 $togs = User::getToggles();
381381 foreach ( $togs as $tname ) {
382 - $ttext = wfMsg('tog-'.$tname);
383382 $this->mToggles[$tname] = $wgUser->getOption( $tname );
384383 }
385384
@@ -526,8 +525,6 @@
527526 $enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
528527 $enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
529528 $enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
530 - $prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
531 - $prefs_help_realname = '';
532529
533530 # </FIXME>
534531
Index: trunk/phase3/includes/Title.php
@@ -109,8 +109,6 @@
110110 * @access public
111111 */
112112 public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
113 - $fname = 'Title::newFromText';
114 -
115113 if( is_object( $text ) ) {
116114 throw new MWException( 'Title::newFromText given an object' );
117115 }
@@ -289,6 +287,7 @@
290288 $mwRedir = MagicWord::get( 'redirect' );
291289 $rt = NULL;
292290 if ( $mwRedir->matchStart( $text ) ) {
 291+ $m = array();
293292 if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) {
294293 # categories are escaped using : for example one can enter:
295294 # #REDIRECT [[:Category:Music]]. Need to remove it.
@@ -859,6 +858,7 @@
860859 } else {
861860 global $wgActionPaths;
862861 $url = false;
 862+ $matches = array();
863863 if( !empty( $wgActionPaths ) &&
864864 preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) )
865865 {
@@ -1429,7 +1429,6 @@
14301430 */
14311431 /* private */ function secureAndSplit() {
14321432 global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks;
1433 - $fname = 'Title::secureAndSplit';
14341433
14351434 # Initialisation
14361435 static $rxTc = false;
@@ -1467,6 +1466,7 @@
14681467 # Namespace or interwiki prefix
14691468 $firstPass = true;
14701469 do {
 1470+ $m = array();
14711471 if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $t, $m ) ) {
14721472 $p = $m[1];
14731473 $lowerNs = $wgContLang->lc( $p );
@@ -1628,7 +1628,6 @@
16291629 */
16301630 function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) {
16311631 $linkCache =& LinkCache::singleton();
1632 - $id = $this->getArticleID();
16331632
16341633 if ( $options ) {
16351634 $db =& wfGetDB( DB_MASTER );
@@ -1899,7 +1898,6 @@
19001899 }
19011900
19021901 $now = wfTimestampNow();
1903 - $rand = wfRandom();
19041902 $newid = $nt->getArticleID();
19051903 $oldid = $this->getArticleID();
19061904 $dbw =& wfGetDB( DB_MASTER );
@@ -1937,7 +1935,7 @@
19381936 'page' => $newid,
19391937 'comment' => $comment,
19401938 'text' => $redirectText ) );
1941 - $revid = $redirectRevision->insertOn( $dbw );
 1939+ $redirectRevision->insertOn( $dbw );
19421940 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
19431941 $linkCache->clearLink( $this->getPrefixedDBkey() );
19441942
@@ -1980,7 +1978,6 @@
19811979 $oldid = $this->getArticleID();
19821980 $dbw =& wfGetDB( DB_MASTER );
19831981 $now = $dbw->timestamp();
1984 - $rand = wfRandom();
19851982 $linkCache =& LinkCache::singleton();
19861983
19871984 # Save a null revision in the page's history notifying of the move
@@ -2010,7 +2007,7 @@
20112008 'page' => $newid,
20122009 'comment' => $comment,
20132010 'text' => $redirectText ) );
2014 - $revid = $redirectRevision->insertOn( $dbw );
 2011+ $redirectRevision->insertOn( $dbw );
20152012 $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
20162013 $linkCache->clearLink( $this->getPrefixedDBkey() );
20172014
@@ -2062,6 +2059,7 @@
20632060
20642061 # Does the redirect point to the source?
20652062 # Or is it a broken self-redirect, usually caused by namespace collisions?
 2063+ $m = array();
20662064 if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) {
20672065 $redirTitle = Title::newFromText( $m[1] );
20682066 if( !is_object( $redirTitle ) ||
@@ -2113,7 +2111,7 @@
21142112 'comment' => $comment,
21152113 'text' => "#REDIRECT [[" . $dest->getPrefixedText() . "]]\n",
21162114 ) );
2117 - $revisionId = $revision->insertOn( $dbw );
 2115+ $revision->insertOn( $dbw );
21182116 $article->updateRevisionOn( $dbw, $revision, 0 );
21192117
21202118 # Link table
@@ -2372,7 +2370,7 @@
23732371 */
23742372 function isSpecial( $name ) {
23752373 if ( $this->getNamespace() == NS_SPECIAL ) {
2376 - list( $thisName, $subpage ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() );
 2374+ list( $thisName, /* $subpage */ ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() );
23772375 if ( $name == $thisName ) {
23782376 return true;
23792377 }
Index: trunk/phase3/includes/Image.php
@@ -235,7 +235,7 @@
236236 * Load metadata from the file itself
237237 */
238238 function loadFromFile() {
239 - global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang, $wgShowEXIF;
 239+ global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang;
240240 wfProfileIn( __METHOD__ );
241241 $this->imagePath = $this->getFullPath();
242242 $this->fileExists = file_exists( $this->imagePath );
@@ -925,7 +925,7 @@
926926 if ( !$this->mustRender() && $width == $this->width && $height == $this->height ) {
927927 $url = $this->getURL();
928928 } else {
929 - list( $isScriptUrl, $url ) = $this->thumbUrl( $width );
 929+ list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $width );
930930 }
931931 $thumb = new ThumbnailImage( $url, $width, $height );
932932 } else {
@@ -1360,8 +1360,9 @@
13611361 $dir = wfImageThumbDir( $this->name, $shared );
13621362 $urls = array();
13631363 foreach ( $files as $file ) {
 1364+ $m = array();
13641365 if ( preg_match( '/^(\d+)px/', $file, $m ) ) {
1365 - list( $isScriptUrl, $url ) = $this->thumbUrl( $m[1] );
 1366+ list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $m[1] );
13661367 $urls[] = $url;
13671368 @unlink( "$dir/$file" );
13681369 }
Index: trunk/phase3/includes/SpecialExport.php
@@ -30,11 +30,6 @@
3131 global $wgExportAllowHistory, $wgExportMaxHistory;
3232
3333 $curonly = true;
34 - $fullHistory = array(
35 - 'dir' => 'asc',
36 - 'offset' => false,
37 - 'limit' => $wgExportMaxHistory,
38 - );
3934 if( $wgRequest->wasPosted() ) {
4035 $page = $wgRequest->getText( 'pages' );
4136 $curonly = $wgRequest->getCheck( 'curonly' );
Index: trunk/phase3/includes/SpecialPrefixindex.php
@@ -97,7 +97,6 @@
9898 $n = 0;
9999 $out = '<table style="background: inherit;" border="0" width="100%">';
100100
101 - $namespaces = $wgContLang->getFormattedNamespaces();
102101 while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
103102 $t = Title::makeTitle( $s->page_namespace, $s->page_title );
104103 if( $t ) {
Index: trunk/phase3/includes/Revision.php
@@ -532,7 +532,7 @@
533533 # Use external methods for external objects, text in table is URL-only then
534534 if ( in_array( 'external', $flags ) ) {
535535 $url=$text;
536 - @list($proto,$path)=explode('://',$url,2);
 536+ @list(/* $proto */,$path)=explode('://',$url,2);
537537 if ($path=="") {
538538 wfProfileOut( $fname );
539539 return false;
Index: trunk/phase3/includes/User.php
@@ -2133,6 +2133,7 @@
21342134 */
21352135 function sendConfirmationMail() {
21362136 global $wgContLang;
 2137+ $expiration = null; // gets passed-by-ref and defined in next line.
21372138 $url = $this->confirmationTokenUrl( $expiration );
21382139 return $this->sendMail( wfMsg( 'confirmemail_subject' ),
21392140 wfMsg( 'confirmemail_body',
Index: trunk/phase3/includes/SpecialImagelist.php
@@ -9,7 +9,7 @@
1010 *
1111 */
1212 function wfSpecialImagelist() {
13 - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgMiserMode;
 13+ global $wgOut;
1414
1515 $pager = new ImageListPager;
1616
Index: trunk/phase3/includes/DifferenceEngine.php
@@ -144,8 +144,6 @@
145145 }
146146
147147 $sk = $wgUser->getSkin();
148 - $talk = $wgContLang->getNsText( NS_TALK );
149 - $contribs = wfMsg( 'contribslink' );
150148
151149 if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
152150 $rollback = '&nbsp;&nbsp;&nbsp;' . $sk->generateRollback( $this->mNewRev );
@@ -901,7 +899,7 @@
902900 $ymids[$k] = $ymids[$k-1];
903901 break;
904902 }
905 - while (list ($junk, $y) = each($matches)) {
 903+ while (list ( /* $junk */, $y) = each($matches)) {
906904 if ($y > $this->seq[$k-1]) {
907905 USE_ASSERTS && assert($y < $this->seq[$k]);
908906 // Optimization: this is a common case:
@@ -1619,6 +1617,7 @@
16201618 $words[] = $line;
16211619 $stripped[] = $line;
16221620 } else {
 1621+ $m = array();
16231622 if (preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
16241623 $line, $m))
16251624 {
Index: trunk/phase3/includes/SpecialAllpages.php
@@ -184,8 +184,6 @@
185185 * @param integer $namespace (Default NS_MAIN)
186186 */
187187 function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
188 - global $wgUser;
189 -
190188 $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
191189 $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
192190 $queryparams = ($namespace ? "namespace=$namespace" : '');
Index: trunk/phase3/includes/Block.php
@@ -113,9 +113,6 @@
114114 $options = array();
115115 $db =& $this->getDBOptions( $options );
116116
117 - $ret = false;
118 - $killed = false;
119 -
120117 if ( 0 == $user && $address == '' ) {
121118 # Invalid user specification, not blocked
122119 $this->clear();
Index: trunk/phase3/includes/DatabasePostgres.php
@@ -18,7 +18,7 @@
1919 $failFunction = false, $flags = 0 )
2020 {
2121
22 - global $wgOut, $wgDBprefix, $wgCommandLineMode;
 22+ global $wgOut;
2323 # Can't get a reference if it hasn't been set yet
2424 if ( !isset( $wgOut ) ) {
2525 $wgOut = NULL;
@@ -60,7 +60,6 @@
6161 $this->mPassword = $password;
6262 $this->mDBname = $dbName;
6363
64 - $success = false;
6564 $hstring="";
6665 if ($server!=false && $server!="") {
6766 $hstring="host=$server ";
@@ -87,12 +86,13 @@
8887 ## If this is the initial connection, setup the schema stuff and possibly create the user
8988 if (defined('MEDIAWIKI_INSTALL')) {
9089 global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBsuperuser, $wgDBmwschema,
91 - $wgDBts2schema, $wgDBts2locale;
 90+ $wgDBts2schema;
9291 print "OK</li>\n";
9392
9493 print "<li>Checking the version of Postgres...";
9594 $version = pg_fetch_result($this->doQuery("SELECT version()"),0,0);
96 - if (!preg_match("/PostgreSQL (\d+\.\d+)(\S+)/", $version, $thisver)) {
 95+ $thisver = array();
 96+ if (!preg_match('/PostgreSQL (\d+\.\d+)(\S+)/', $version, $thisver)) {
9797 print "<b>FAILED</b> (could not determine the version)</li>\n";
9898 dieout("</ul>");
9999 }
@@ -804,10 +804,10 @@
805805 $SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES ";
806806 while ( ! feof( $f ) ) {
807807 $line = fgets($f,1024);
808 - if (!preg_match("/^\s*(\(.+?),(\d)\)/", $line, $matches)) {
 808+ $matches = array();
 809+ if (!preg_match('/^\s*(\(.+?),(\d)\)/', $line, $matches)) {
809810 continue;
810811 }
811 - $yesno = $matches[2]; ## ? "'true'" : "'false'";
812812 $this->query("$SQL $matches[1],$matches[2])");
813813 }
814814 print " (table interwiki successfully populated)...\n";
@@ -831,7 +831,7 @@
832832 return "E'$s[1]'";
833833 }
834834 return "'" . pg_escape_string($s) . "'";
835 - return "E'" . pg_escape_string($s) . "'";
 835+ // Unreachable: return "E'" . pg_escape_string($s) . "'";
836836 }
837837
838838 function quote_ident( $s ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r70696Remove $wgColorErrors. Apparently unused at least since r17991 at 2006-11-29nikerabbit13:52, 8 August 2010