MediaWiki  1.29.1
autoload.ide.php
Go to the documentation of this file.
1 <?php
2 
20 // Set a flag which can be used to detect when other scripts have been entered
21 // through this entry point or not.
23 
25 $argv[1] = '--wiki';
26 $argv[2] = getenv( 'WIKI_NAME' ) ?: 'wiki';
27 
28 require_once __DIR__ . "/phpunit.php";
29 
30 // Get an object to start us off
33 
34 // Basic sanity checks and such
35 $maintenance->setup();
36 
37 // We used to call this variable $self, but it was moved
38 // to $maintenance->mSelf. Keep that here for b/c
39 $self = $maintenance->getName();
41 # Start the autoloader, so that extensions can derive classes from core files
42 require_once "$IP/includes/AutoLoader.php";
43 # Grab profiling functions
44 require_once "$IP/includes/profiler/ProfilerFunctions.php";
45 
46 # Start the profiler
48 if ( file_exists( "$IP/StartProfiler.php" ) ) {
49  require "$IP/StartProfiler.php";
50 }
51 
52 $requireOnceGlobalsScope = function ( $file ) use ( $self ) {
53  foreach ( array_keys( $GLOBALS ) as $varName ) {
54  eval( sprintf( 'global $%s;', $varName ) );
55  }
56 
57  require_once $file;
58 
59  unset( $file );
60  $definedVars = get_defined_vars();
61  foreach ( $definedVars as $varName => $value ) {
62  eval( sprintf( 'global $%s; $%s = $value;', $varName, $varName ) );
63  }
64 };
65 
66 // Some other requires
67 $requireOnceGlobalsScope( "$IP/includes/Defines.php" );
68 $requireOnceGlobalsScope( "$IP/includes/DefaultSettings.php" );
69 $requireOnceGlobalsScope( "$IP/includes/GlobalFunctions.php" );
70 
71 foreach ( array_keys( $GLOBALS ) as $varName ) {
72  eval( sprintf( 'global $%s;', $varName ) );
73 }
74 
75 # Load composer's autoloader if present
76 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
77  require_once "$IP/vendor/autoload.php";
78 }
79 
80 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
81  # Use a callback function to configure MediaWiki
82  call_user_func( MW_CONFIG_CALLBACK );
83 } else {
84  // Require the configuration (probably LocalSettings.php)
85  require $maintenance->loadSettings();
86 }
87 
88 if ( $maintenance->getDbType() === Maintenance::DB_NONE ) {
89  if (
90  $wgLocalisationCacheConf['storeClass'] === false
91  && (
92  $wgLocalisationCacheConf['store'] == 'db'
93  || ( $wgLocalisationCacheConf['store'] == 'detect' && !$wgCacheDirectory )
94  )
95  ) {
96  $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
97  }
98 }
99 
100 $maintenance->finalSetup();
101 // Some last includes
102 $requireOnceGlobalsScope( "$IP/includes/Setup.php" );
103 
104 // Initialize main config instance
105 $maintenance->setConfig( MediaWikiServices::getInstance()->getMainConfig() );
106 
107 // Sanity-check required extensions are installed
108 $maintenance->checkRequiredExtensions();
109 
110 // A good time when no DBs have writes pending is around lag checks.
111 // This avoids having long running scripts just OOM and lose all the updates.
112 $maintenance->setAgentAndTriggers();
$IP
global $IP
Definition: autoload.ide.php:40
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$wgCacheDirectory
$wgCacheDirectory
Directory for caching data in the local filesystem.
Definition: DefaultSettings.php:2205
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
PHPUnitMaintClass
Definition: phpunit.php:16
$maintenance
$maintenance
Definition: autoload.ide.php:32
$wgProfiler
$wgProfiler
Definition: autoload.ide.php:47
$self
$self
Definition: autoload.ide.php:39
MW_CONFIG_CALLBACK
const MW_CONFIG_CALLBACK
Definition: install.php:26
$requireOnceGlobalsScope
if(file_exists("$IP/StartProfiler.php")) $requireOnceGlobalsScope
Definition: autoload.ide.php:52
$wgLocalisationCacheConf
$wgLocalisationCacheConf
Localisation cache configuration.
Definition: DefaultSettings.php:2489
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
$GLOBALS
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
Definition: Autoload.php:10
$value
$value
Definition: styleTest.css.php:45
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition: Maintenance.php:62
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$argv
global $argv
Definition: autoload.ide.php:24
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23