On Tue, 27 Dec 2011 18:06:41 -0800, Tim Starling tstarling@wikimedia.org wrote:
On 26/12/11 09:20, Daniel Friesen wrote:
The support requests for users with "PHP Fatal error: Cannot redeclare wfProfileIn()" continue in #mediawiki.
My idea on how to fix the issue previously was to include in 1.18.1 (whenever we release it) an includes/ProfilerStub.php with something like: <?php wfDeprecated( 'includes/ProfilerStub.php' );
So that it would override any dead includes/ProfilerStub.php from an old version of MediaWiki and the bad require_once people still have would just become a no-op and things would continue working.
Sounds good.
I've been starting to think that in 1.19 we should drop StartProfiler.php altogether.
StartProfiler.php simply exists to initiate the profiler. It's basically a LocalSettings.php that runs before LocalSettings.php
Back in 1.17 we loaded things in the order: StartProfiler, Defines, AutoLoader, DefaultSettings, LocalSettings
However the order we load things now is: Init, AutoLoader, Profiler, Defines, StartProfiler, DefaultSettings, LocalSettings
So there is absolutely no extra value to StartProfiler now since it loads directly before our settings and can no longer profile things before the settings.
As long as it's treated like an extension, with a minimum of boilerplate PHP code in LocalSettings.php, I think that should be OK.
-- Tim Starling
The typical thing to go into StartProfiler.php for someone who wants to use it is: $wgProfiler['class'] = 'Profiler';
;) ie: It's pure config, it's not even php code.
Well, unless you're using StartProfiler.example's method of setting up a sampling profiler: if ( !mt_rand( 0, 100 ) ) { $wgProfiler['class'] = 'Profiler'; } else { $wgProfiler['class'] = 'ProfilerStub'; }
We could try to simplify those kind of common cases.