[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/mw-config/ -> index.php (source)

   1  <?php
   2  /**
   3   * New version of MediaWiki web-based config/installation
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License along
  16   * with this program; if not, write to the Free Software Foundation, Inc.,
  17   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18   * http://www.gnu.org/copyleft/gpl.html
  19   *
  20   * @file
  21   */
  22  
  23  // Bail if PHP is too low
  24  if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) {
  25      // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
  26      require dirname( dirname( __FILE__ ) ) . '/includes/PHPVersionError.php';
  27      wfPHPVersionError( 'mw-config/index.php' );
  28  }
  29  
  30  define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
  31  define( 'MEDIAWIKI_INSTALL', true );
  32  
  33  // Resolve relative to regular MediaWiki root
  34  // instead of mw-config subdirectory.
  35  chdir( dirname( __DIR__ ) );
  36  require dirname( __DIR__ ) . '/includes/WebStart.php';
  37  
  38  wfInstallerMain();
  39  
  40  function wfInstallerMain() {
  41      global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
  42  
  43      $installer = InstallerOverrides::getWebInstaller( $wgRequest );
  44  
  45      if ( !$installer->startSession() ) {
  46  
  47          if ( $installer->request->getVal( "css" ) ) {
  48              // Do not display errors on css pages
  49              $installer->outputCss();
  50              exit;
  51          }
  52  
  53          $errors = $installer->getPhpErrors();
  54          $installer->showError( 'config-session-error', $errors[0] );
  55          $installer->finish();
  56          exit;
  57      }
  58  
  59      $fingerprint = $installer->getFingerprint();
  60      if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
  61          $session = $_SESSION['installData'][$fingerprint];
  62      } else {
  63          $session = array();
  64      }
  65  
  66      if ( !is_null( $wgRequest->getVal( 'uselang' ) ) ) {
  67          $langCode = $wgRequest->getVal( 'uselang' );
  68      } elseif ( isset( $session['settings']['_UserLang'] ) ) {
  69          $langCode = $session['settings']['_UserLang'];
  70      } else {
  71          $langCode = 'en';
  72      }
  73      $wgLang = Language::factory( $langCode );
  74  
  75      $installer->setParserLanguage( $wgLang );
  76  
  77      $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
  78  
  79      $session = $installer->execute( $session );
  80  
  81      $_SESSION['installData'][$fingerprint] = $session;
  82  
  83  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1