Withoutaname has uploaded a new change for review. https://gerrit.wikimedia.org/r/156053
Change subject: Consolidate parts of WebStart.php and doMaintenance.php into Initialize.php ...................................................................... Consolidate parts of WebStart.php and doMaintenance.php into Initialize.php Some of the various code used to initialize MediaWiki were combined into a single file. Change-Id: I12b568ec6a30ccdbe012a0c65df91f66f40fc0fa --- A includes/Initialize.php M includes/WebStart.php M maintenance/Maintenance.php M maintenance/doMaintenance.php 4 files changed, 53 insertions(+), 61 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/53/156053/1 diff --git a/includes/Initialize.php b/includes/Initialize.php new file mode 100644 index 0000000..4bc63f4 --- /dev/null +++ b/includes/Initialize.php @@ -0,0 +1,49 @@ +<?php +/** + * Helper file to initialize the rest of MediaWiki. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ +// Valid web server entry point, enable includes. +// Please don't move this line to includes/Defines.php. This line essentially +// defines a valid entry point. If you put it in includes/Defines.php, then +// any script that includes it becomes an entry point, thereby defeating +// its purpose. +define( 'MEDIAWIKI', true ); + +$wgRequestTime = microtime( true ); + +// Start the autoloader, so that extensions can derive classes from core files +require_once "$IP/includes/AutoLoader.php"; +// Load composer's autoloader if present +if ( is_readable( "$IP/vendor/autoload.php" ) ) { + require_once "$IP/vendor/autoload.php"; +} + +// Load the profiler +require_once "$IP/includes/profiler/Profiler.php"; +// Start the profiler +$wgProfiler = array(); +if ( file_exists( "$IP/StartProfiler.php" ) ) { + require "$IP/StartProfiler.php"; +} + +// Load up some global defines. +require_once "$IP/includes/Defines.php"; +// Load default settings +require_once "$IP/includes/DefaultSettings.php"; diff --git a/includes/WebStart.php b/includes/WebStart.php index e137628..84a9ae6 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -1,12 +1,7 @@ <?php /** - * This does the initial set up for a web request. - * It does some security checks, starts the profiler and loads the - * configuration, and optionally loads Setup.php depending on whether - * MW_NO_SETUP is defined. - * - * Setup.php (if loaded) then sets up GlobalFunctions, the AutoLoader, - * and the configuration globals (though not $wgTitle). + * This does the initial set up for a web request, including a few + * security checks and loading the initializer. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,17 +34,9 @@ # points and when $wgOut gets disabled or overridden. header( 'X-Content-Type-Options: nosniff' ); -$wgRequestTime = microtime( true ); # getrusage() does not exist on the Microsoft Windows platforms, catching this $wgRUstart = function_exists( 'getrusage' ) ? getrusage() : array(); unset( $IP ); - -# Valid web server entry point, enable includes. -# Please don't move this line to includes/Defines.php. This line essentially -# defines a valid entry point. If you put it in includes/Defines.php, then -# any script that includes it becomes an entry point, thereby defeating -# its purpose. -define( 'MEDIAWIKI', true ); # Full path to working directory. # Makes it possible to for example to have effective exclude path in apc. @@ -60,30 +47,9 @@ $IP = realpath( '.' ) ?: dirname( __DIR__ ); } -# Start the autoloader, so that extensions can derive classes from core files -require_once "$IP/includes/AutoLoader.php"; - -# Load the profiler -require_once "$IP/includes/profiler/Profiler.php"; - -# Load up some global defines. -require_once "$IP/includes/Defines.php"; - -# Start the profiler -$wgProfiler = array(); -if ( file_exists( "$IP/StartProfiler.php" ) ) { - require "$IP/StartProfiler.php"; -} +require_once "$IP/includes/Initialize.php"; wfProfileIn( 'WebStart.php-conf' ); - -# Load default settings -require_once "$IP/includes/DefaultSettings.php"; - -# Load composer's autoloader if present -if ( is_readable( "$IP/vendor/autoload.php" ) ) { - require_once "$IP/vendor/autoload.php"; -} if ( defined( 'MW_CONFIG_CALLBACK' ) ) { # Use a callback function to configure MediaWiki diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index ffb07eb..2cc791b 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -527,11 +527,6 @@ # But sometimes this doesn't seem to be the case. ini_set( 'max_execution_time', 0 ); - $wgRequestTime = microtime( true ); - - # Define us as being in MediaWiki - define( 'MEDIAWIKI', true ); - $wgCommandLineMode = true; # Turn off output buffering if it's on diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index 28a0545..3ffee10 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -53,25 +53,7 @@ // to $maintenance->mSelf. Keep that here for b/c $self = $maintenance->getName(); -# Start the autoloader, so that extensions can derive classes from core files -require_once "$IP/includes/AutoLoader.php"; -# Stub the profiler -require_once "$IP/includes/profiler/Profiler.php"; - -# Start the profiler -$wgProfiler = array(); -if ( file_exists( "$IP/StartProfiler.php" ) ) { - require "$IP/StartProfiler.php"; -} - -// Some other requires -require_once "$IP/includes/Defines.php"; -require_once "$IP/includes/DefaultSettings.php"; - -# Load composer's autoloader if present -if ( is_readable( "$IP/vendor/autoload.php" ) ) { - require_once "$IP/vendor/autoload.php"; -} +require_once "$IP/includes/Initialize.php"; if ( defined( 'MW_CONFIG_CALLBACK' ) ) { # Use a callback function to configure MediaWiki -- To view, visit https://gerrit.wikimedia.org/r/156053 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12b568ec6a30ccdbe012a0c65df91f66f40fc0fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Withoutaname <drevit...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits