Advertisement
Guest User

Untitled

a guest
May 22nd, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. define( 'MEDIAWIKI', true );
  2.  
  3. global $IP;
  4. $IP = getenv( 'MW_INSTALL_PATH' );
  5.  
  6. if ( $IP === false ) {
  7.     $IP = dirname( __FILE__ ) . '/../../../..';
  8. }
  9.  
  10. $self = 'foobar';
  11.  
  12. // Detect compiled mode
  13. # Get the MWInit class
  14. require_once "$IP/includes/Init.php";
  15. require_once "$IP/includes/AutoLoader.php";
  16. # Stub the profiler
  17. require_once "$IP/includes/profiler/Profiler.php";
  18.  
  19. # Start the profiler
  20. $wgProfiler = array();
  21. if ( file_exists( "$IP/StartProfiler.php" ) ) {
  22.     require "$IP/StartProfiler.php";
  23. }
  24.  
  25. // Some other requires
  26. require_once "$IP/includes/Defines.php";
  27.  
  28. require_once MWInit::compiledPath( 'includes/DefaultSettings.php' );
  29.  
  30. foreach ( get_defined_vars() as $key => $var ) {
  31.     if ( !array_key_exists( $key, $GLOBALS ) ) {
  32.         $GLOBALS[$key] = $var;
  33.     }
  34. }
  35.  
  36. if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
  37.     # Use a callback function to configure MediaWiki
  38.     MWFunction::call( MW_CONFIG_CALLBACK );
  39. } else {
  40.     if ( file_exists( "$IP/../wmf-config/wikimedia-mode" ) ) {
  41.         // Load settings, using wikimedia-mode if needed
  42.         // @todo FIXME: Replace this hack with general farm-friendly code
  43.         # @todo FIXME: Wikimedia-specific stuff needs to go away to an ext
  44.         # Maybe a hook?
  45.         global $cluster;
  46.         $cluster = 'pmtpa';
  47.         require MWInit::interpretedPath( '../wmf-config/wgConf.php' );
  48.     }
  49.     // Require the configuration (probably LocalSettings.php)
  50.     require loadSettings();
  51. }
  52.  
  53. // Some last includes
  54. require_once MWInit::compiledPath( 'includes/Setup.php' );
  55.  
  56. // Much much faster startup than creating a title object
  57. $wgTitle = null;
  58.  
  59.  
  60. function loadSettings() {
  61.     global $wgCommandLineMode, $IP;
  62.  
  63.     $settingsFile = "$IP/LocalSettings.php";
  64.  
  65.     if ( !is_readable( $settingsFile ) ) {
  66.         $this->error( "A copy of your installation's LocalSettings.php\n" .
  67.             "must exist and be readable in the source directory.\n" .
  68.             "Use --conf to specify it.", true );
  69.     }
  70.     $wgCommandLineMode = true;
  71.     return $settingsFile;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement