diff --git a/LocalSettings.php b/LocalSettings.php index e4a22d5ff2..b01fe1d46e 100644 --- a/LocalSettings.php +++ b/LocalSettings.php @@ -28,9 +28,14 @@ * Disabled on production hosts because it seems to be causing performance issues (how ironic) */ $forceprofile = $_GET['forceprofile'] ?? 0; -if ( ( $forceprofile == 1 || PHP_SAPI === 'cli' ) && extension_loaded( 'tideways_xhprof' ) ) { - $xhprofFlags = TIDEWAYS_XHPROF_FLAGS_CPU | TIDEWAYS_XHPROF_FLAGS_MEMORY | TIDEWAYS_XHPROF_FLAGS_NO_BUILTINS; - tideways_xhprof_enable( $xhprofFlags ); +if ( ( $forceprofile == 1 || PHP_SAPI === 'cli' ) && ( extension_loaded( 'tideways_xhprof' ) || extension_loaded( 'xhprof' ) ) ) { + if ( version_compare( PHP_VERSION, '8.2', '>=' ) ) { + $xhprofFlags = XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY; + xhprof_enable( $xhprofFlags ); + } else { + $xhprofFlags = TIDEWAYS_XHPROF_FLAGS_CPU | TIDEWAYS_XHPROF_FLAGS_MEMORY | TIDEWAYS_XHPROF_FLAGS_NO_BUILTINS; + tideways_xhprof_enable( $xhprofFlags ); + } $wgProfiler = [ 'class' => ProfilerXhprof::class,