r32855 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32854‎ | r32855 | r32856 >
Date:16:14, 6 April 2008
Author:ialex
Status:old
Tags:
Comment:
Removed usage of deprecated settings
Modified paths:
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/LinkCache.php (modified) (history)
  • /trunk/phase3/maintenance/eval.php (modified) (history)
  • /trunk/phase3/maintenance/refreshLinks.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/refreshLinks.inc
@@ -9,7 +9,7 @@
1010 #define( "REPORTING_INTERVAL", 1 );
1111
1212 function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $redirectsOnly = false, $oldRedirectsOnly = false ) {
13 - global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy;
 13+ global $wgUser, $wgParser, $wgUseTidy;
1414
1515 $fname = 'refreshLinks';
1616 $dbr = wfGetDB( DB_SLAVE );
@@ -21,8 +21,7 @@
2222 # Don't generate extension images (e.g. Timeline)
2323 $wgParser->clearTagHooks();
2424
25 - # Don't generate thumbnail images
26 - $wgUseImageResize = false;
 25+ # Don't use HTML tidy
2726 $wgUseTidy = false;
2827
2928 $what = $redirectsOnly ? "redirects" : "links";
Index: trunk/phase3/maintenance/eval.php
@@ -15,12 +15,7 @@
1616 * @addtogroup Maintenance
1717 */
1818
19 -$wgForceLoadBalancing = (getenv('MW_BALANCE') ? true : false);
20 -$wgUseNormalUser = (getenv('MW_WIKIUSER') ? true : false);
21 -if (getenv('MW_PROFILING')) {
22 - define('MW_CMDLINE_CALLBACK', 'wfSetProfiling');
23 -}
24 -function wfSetProfiling() { $GLOBALS['wgProfiling'] = true; }
 19+$wgUseNormalUser = (bool)getenv('MW_WIKIUSER');
2520
2621 $optionsWithArgs = array( 'd' );
2722
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -255,29 +255,30 @@
256256 */
257257 function wfLogProfilingData() {
258258 global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest;
259 - global $wgProfiling, $wgUser;
260 - if ( $wgProfiling ) {
261 - $now = wfTime();
262 - $elapsed = $now - $wgRequestTime;
263 - $prof = wfGetProfilingOutput( $wgRequestTime, $elapsed );
264 - $forward = '';
265 - if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
266 - $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
267 - if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) )
268 - $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP'];
269 - if( !empty( $_SERVER['HTTP_FROM'] ) )
270 - $forward .= ' from ' . $_SERVER['HTTP_FROM'];
271 - if( $forward )
272 - $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
273 - // Don't unstub $wgUser at this late stage just for statistics purposes
274 - if( StubObject::isRealObject($wgUser) && $wgUser->isAnon() )
275 - $forward .= ' anon';
276 - $log = sprintf( "%s\t%04.3f\t%s\n",
277 - gmdate( 'YmdHis' ), $elapsed,
278 - urldecode( $wgRequest->getRequestURL() . $forward ) );
279 - if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) {
280 - wfErrorLog( $log . $prof, $wgDebugLogFile );
281 - }
 259+ global $wgProfiler, $wgUser;
 260+ if ( !isset( $wgProfiler ) )
 261+ return;
 262+
 263+ $now = wfTime();
 264+ $elapsed = $now - $wgRequestTime;
 265+ $prof = wfGetProfilingOutput( $wgRequestTime, $elapsed );
 266+ $forward = '';
 267+ if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
 268+ $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
 269+ if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) )
 270+ $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP'];
 271+ if( !empty( $_SERVER['HTTP_FROM'] ) )
 272+ $forward .= ' from ' . $_SERVER['HTTP_FROM'];
 273+ if( $forward )
 274+ $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
 275+ // Don't unstub $wgUser at this late stage just for statistics purposes
 276+ if( StubObject::isRealObject($wgUser) && $wgUser->isAnon() )
 277+ $forward .= ' anon';
 278+ $log = sprintf( "%s\t%04.3f\t%s\n",
 279+ gmdate( 'YmdHis' ), $elapsed,
 280+ urldecode( $wgRequest->getRequestURL() . $forward ) );
 281+ if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) {
 282+ wfErrorLog( $log . $prof, $wgDebugLogFile );
282283 }
283284 }
284285
Index: trunk/phase3/includes/Database.php
@@ -447,10 +447,10 @@
448448 * @throws DBQueryError Thrown when the database returns an error of any kind
449449 */
450450 public function query( $sql, $fname = '', $tempIgnore = false ) {
451 - global $wgProfiling;
 451+ global $wgProfiler;
452452
453453 $isMaster = !is_null( $this->getLBInfo( 'master' ) );
454 - if ( $wgProfiling ) {
 454+ if ( isset( $wgProfiler ) ) {
455455 # generalizeSQL will probably cut down the query to reasonable
456456 # logging size most of the time. The substr is really just a sanity check.
457457
@@ -533,7 +533,7 @@
534534 $this->reportQueryError( $this->lastError(), $this->lastErrno(), $sql, $fname, $tempIgnore );
535535 }
536536
537 - if ( $wgProfiling ) {
 537+ if ( isset( $wgProfiler ) ) {
538538 wfProfileOut( $queryProf );
539539 wfProfileOut( $totalProf );
540540 }
Index: trunk/phase3/includes/LinkCache.php
@@ -110,8 +110,8 @@
111111 if ( 0 != $id ) { return $id; }
112112
113113 $fname = 'LinkCache::addLinkObj';
114 - global $wgProfiling, $wgProfiler;
115 - if ( $wgProfiling && isset( $wgProfiler ) ) {
 114+ global $wgProfiler;
 115+ if ( isset( $wgProfiler ) ) {
116116 $fname .= ' (' . $wgProfiler->getCurrentSection() . ')';
117117 }
118118

Status & tagging log