PleaseStand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/80528


Change subject: More StartProfiler.php cleanup
......................................................................

More StartProfiler.php cleanup

* Now use isset(...) instead of @defined(...) for checking for params.
  As written, &forceprofile simply wouldn't work unless you made it,
  for example, &forceprofile=MEDIAWIKI.
* Removed unnecessary require_once lines.
* Converted to new-style (array-based) profiler config format.
* Removed unnecessary $min and $max args from mt_rand() call.

Change-Id: I1e394acfb2dd30861d6b5cb55d34f9234cc2d97c
---
M wmf-config/StartProfiler.php
1 file changed, 11 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/28/80528/1

diff --git a/wmf-config/StartProfiler.php b/wmf-config/StartProfiler.php
index 0d5e0ac..5e66b56 100644
--- a/wmf-config/StartProfiler.php
+++ b/wmf-config/StartProfiler.php
@@ -4,30 +4,23 @@
 # NOTE: this file is loaded early on in WebStart.php, so be careful with 
globals.
 
 # Non-logged profiling for debugging
-if ( @defined( $_REQUEST['forceprofile'] ) ) {
-       require_once( $IP . '/includes/profiler/ProfilerSimpleText.php' );
-       $wgProfiler = new ProfilerSimpleText( array() );
+if ( isset( $_REQUEST['forceprofile'] ) ) {
+       $wgProfiler['class'] = 'ProfilerSimpleText';
 # Non-logged profiling for debugging
-} elseif ( @defined( $_REQUEST['forcetrace'] ) ) {
-       require_once( $IP . '/includes/profiler/ProfilerSimpleTrace.php' );
-       $wgProfiler = new ProfilerSimpleTrace( array() );
+} elseif ( isset( $_REQUEST['forcetrace'] ) ) {
+       $wgProfiler['class'] = 'ProfilerSimpleTrace';
 # Profiling hack for test2 wiki (not sampled, but shouldn't distort too much)
 } elseif ( @$_SERVER['HTTP_HOST'] === 'test2.wikipedia.org' ) {
-       require_once( $IP . '/includes/profiler/ProfilerSimpleUDP.php' );
-       $wgProfiler = new ProfilerSimpleUDP( array() );
-       $wgProfiler->setProfileID( 'test2' );
-# Normal case: randomly selected for logged profiling sample
-} elseif ( PHP_SAPI !== 'cli' && $wmfDatacenter == 'eqiad' && ( mt_rand( 0, 
0x7fffffff ) % 50 ) == 0 ) {
-       require_once( $IP . '/includes/profiler/ProfilerSimpleUDP.php' );
-       $wgProfiler = new ProfilerSimpleUDP( array() );
+       $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       $wgProfiler['profileID'] = 'test2';
+# Normal case: randomly (or not) selected for logged profiling sample
+} elseif ( PHP_SAPI !== 'cli' && $wmfDatacenter == 'eqiad' && ( mt_rand() % 50 
) == 0 ) {
+       $wgProfiler['class'] = 'ProfilerSimpleUDP';
        // $IP is something like '/usr/local/apache/common-local/php-1.19'
        $version = str_replace( 'php-', '', basename( $IP ) );
        if ( strpos( @$_SERVER['REQUEST_URI'], '/w/thumb.php' ) !== false ) {
-               $wgProfiler->setProfileID( "thumb-$version" );
+               $wgProfiler['profileID'] = "thumb-$version";
        } else {
-               $wgProfiler->setProfileID( $version );
+               $wgProfiler['profileID'] = $version;
        }
-# Normal case: randomly not selected for logged profiling sample
-} else {
-       require_once( $IP . '/includes/profiler/ProfilerStub.php' );
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/80528
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e394acfb2dd30861d6b5cb55d34f9234cc2d97c
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to