jenkins-bot has submitted this change and it was merged. 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. * Removed uses of the error suppression (@) operator. Change-Id: I1e394acfb2dd30861d6b5cb55d34f9234cc2d97c --- M wmf-config/StartProfiler.php 1 file changed, 13 insertions(+), 20 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/wmf-config/StartProfiler.php b/wmf-config/StartProfiler.php index 0d5e0ac..ece20f8 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() ); +} elseif ( isset( $_SERVER['HTTP_HOST'] ) && $_SERVER['HTTP_HOST'] === 'test2.wikipedia.org' ) { + $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" ); + if ( strpos( $_SERVER['REQUEST_URI'], '/w/thumb.php' ) !== false ) { + $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: merged Gerrit-Change-Id: I1e394acfb2dd30861d6b5cb55d34f9234cc2d97c Gerrit-PatchSet: 2 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: PleaseStand <pleasest...@live.com> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits