From 2f41e3c98be89a5afd89475e1ba317391f33efae Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 6 Apr 2008 16:14:04 +0000 Subject: [PATCH] Removed usage of deprecated settings --- includes/Database.php | 6 ++--- includes/GlobalFunctions.php | 47 ++++++++++++++++++------------------ includes/LinkCache.php | 4 +-- maintenance/eval.php | 7 +----- maintenance/refreshLinks.inc | 5 ++-- 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index 486877fae5..df68f7ab5c 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -447,10 +447,10 @@ class Database { * @throws DBQueryError Thrown when the database returns an error of any kind */ public function query( $sql, $fname = '', $tempIgnore = false ) { - global $wgProfiling; + global $wgProfiler; $isMaster = !is_null( $this->getLBInfo( 'master' ) ); - if ( $wgProfiling ) { + if ( isset( $wgProfiler ) ) { # generalizeSQL will probably cut down the query to reasonable # logging size most of the time. The substr is really just a sanity check. @@ -533,7 +533,7 @@ class Database { $this->reportQueryError( $this->lastError(), $this->lastErrno(), $sql, $fname, $tempIgnore ); } - if ( $wgProfiling ) { + if ( isset( $wgProfiler ) ) { wfProfileOut( $queryProf ); wfProfileOut( $totalProf ); } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index c65c2fe005..f28d7cf9ea 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -255,29 +255,30 @@ function wfErrorLog( $text, $file ) { */ function wfLogProfilingData() { global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest; - global $wgProfiling, $wgUser; - if ( $wgProfiling ) { - $now = wfTime(); - $elapsed = $now - $wgRequestTime; - $prof = wfGetProfilingOutput( $wgRequestTime, $elapsed ); - $forward = ''; - if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) - $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR']; - if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) ) - $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP']; - if( !empty( $_SERVER['HTTP_FROM'] ) ) - $forward .= ' from ' . $_SERVER['HTTP_FROM']; - if( $forward ) - $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; - // Don't unstub $wgUser at this late stage just for statistics purposes - if( StubObject::isRealObject($wgUser) && $wgUser->isAnon() ) - $forward .= ' anon'; - $log = sprintf( "%s\t%04.3f\t%s\n", - gmdate( 'YmdHis' ), $elapsed, - urldecode( $wgRequest->getRequestURL() . $forward ) ); - if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) { - wfErrorLog( $log . $prof, $wgDebugLogFile ); - } + global $wgProfiler, $wgUser; + if ( !isset( $wgProfiler ) ) + return; + + $now = wfTime(); + $elapsed = $now - $wgRequestTime; + $prof = wfGetProfilingOutput( $wgRequestTime, $elapsed ); + $forward = ''; + if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) + $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR']; + if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) ) + $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP']; + if( !empty( $_SERVER['HTTP_FROM'] ) ) + $forward .= ' from ' . $_SERVER['HTTP_FROM']; + if( $forward ) + $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; + // Don't unstub $wgUser at this late stage just for statistics purposes + if( StubObject::isRealObject($wgUser) && $wgUser->isAnon() ) + $forward .= ' anon'; + $log = sprintf( "%s\t%04.3f\t%s\n", + gmdate( 'YmdHis' ), $elapsed, + urldecode( $wgRequest->getRequestURL() . $forward ) ); + if ( '' != $wgDebugLogFile && ( $wgRequest->getVal('action') != 'raw' || $wgDebugRawPage ) ) { + wfErrorLog( $log . $prof, $wgDebugLogFile ); } } diff --git a/includes/LinkCache.php b/includes/LinkCache.php index 7c49d88e21..1c094f66c1 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -110,8 +110,8 @@ class LinkCache { if ( 0 != $id ) { return $id; } $fname = 'LinkCache::addLinkObj'; - global $wgProfiling, $wgProfiler; - if ( $wgProfiling && isset( $wgProfiler ) ) { + global $wgProfiler; + if ( isset( $wgProfiler ) ) { $fname .= ' (' . $wgProfiler->getCurrentSection() . ')'; } diff --git a/maintenance/eval.php b/maintenance/eval.php index 605576e450..1545c3079e 100644 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -15,12 +15,7 @@ * @addtogroup Maintenance */ -$wgForceLoadBalancing = (getenv('MW_BALANCE') ? true : false); -$wgUseNormalUser = (getenv('MW_WIKIUSER') ? true : false); -if (getenv('MW_PROFILING')) { - define('MW_CMDLINE_CALLBACK', 'wfSetProfiling'); -} -function wfSetProfiling() { $GLOBALS['wgProfiling'] = true; } +$wgUseNormalUser = (bool)getenv('MW_WIKIUSER'); $optionsWithArgs = array( 'd' ); diff --git a/maintenance/refreshLinks.inc b/maintenance/refreshLinks.inc index 70e2a5dcb0..48d99712af 100644 --- a/maintenance/refreshLinks.inc +++ b/maintenance/refreshLinks.inc @@ -9,7 +9,7 @@ define( "REPORTING_INTERVAL", 100 ); #define( "REPORTING_INTERVAL", 1 ); function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $redirectsOnly = false, $oldRedirectsOnly = false ) { - global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy; + global $wgUser, $wgParser, $wgUseTidy; $fname = 'refreshLinks'; $dbr = wfGetDB( DB_SLAVE ); @@ -21,8 +21,7 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0, $red # Don't generate extension images (e.g. Timeline) $wgParser->clearTagHooks(); - # Don't generate thumbnail images - $wgUseImageResize = false; + # Don't use HTML tidy $wgUseTidy = false; $what = $redirectsOnly ? "redirects" : "links"; -- 2.20.1