From 5209adff6cf13a002843347d5e3942aeb5c255ce Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 18 Mar 2018 18:21:02 -0700 Subject: [PATCH] Setup: Deprecate StartProfiler, move default to DefaultSettings $wgProfiler was introduced in 3ea576aa25 (r15605; 2006; MW 1.8). The global was used from the Profiler.php class file, which would be manually from StartProfiler.php, which then (if enabled) assigned the global an actual instance of the Profiler class. We needed it that way because we actually instantiated and used the Profiler object (via wfProfileIn) very early on in WebStart. Specifically, before any settings and classes load. This first changed in 5a6d1ee2d3 (r86228; 2011; MW 1.17). That commit deprecated use of $wgProfiler as an object in favour of assigning it an array that MediaWiki would use to construct the class. Profiling methods were also changed to lazy-instantiate the class, which would first happen via a wfProfileIn() call two lines before loading DefaultSettings and LocalSettings. Some more relevant clean up happened in a0123d0549 (r89206; 2011). Now, in 2018, we don't actually lazy-instantiate the Profiler until after DefaultSetting and LocalSettings load. As such, I think we can finally get rid of its out-of-bound load strategy. Instead, we can simply set the default in DefaultSettings, and recommend admins to set their value in LocalSettings. Bug: T189966 Change-Id: I4e8dd9558132a5e38c22b26fed9c4b54cd324da7 --- StartProfiler.sample | 38 --------------------- includes/DefaultSettings.php | 62 +++++++++++++++++++++++++++++++++- includes/Setup.php | 11 +++--- tests/phpunit/autoload.ide.php | 6 ---- 4 files changed, 66 insertions(+), 51 deletions(-) delete mode 100644 StartProfiler.sample diff --git a/StartProfiler.sample b/StartProfiler.sample deleted file mode 100644 index bdf21396e2..0000000000 --- a/StartProfiler.sample +++ /dev/null @@ -1,38 +0,0 @@ -setup(); // We used to call this variable $self, but it was moved // to $maintenance->mSelf. Keep that here for b/c $self = $maintenance->getName(); -global $IP; -# Get profiler configuraton -$wgProfiler = []; -if ( file_exists( "$IP/StartProfiler.php" ) ) { - require "$IP/StartProfiler.php"; -} # Start the autoloader, so that extensions can derive classes from core files require_once "$IP/includes/AutoLoader.php"; -- 2.20.1