public function testPuralRulesFallback()
 {
     $cache = Language::getLocalisationCache();
     $this->assertEquals($cache->getItem('ru', 'pluralRules'), $cache->getItem('os', 'pluralRules'), 'os plural rules (undefined) fallback to ru (defined)');
     $this->assertEquals($cache->getItem('ru', 'compiledPluralRules'), $cache->getItem('os', 'compiledPluralRules'), 'os compiled plural rules (undefined) fallback to ru (defined)');
     $this->assertNotEquals($cache->getItem('ksh', 'pluralRules'), $cache->getItem('de', 'pluralRules'), 'ksh plural rules (defined) dont fallback to de (defined)');
     $this->assertNotEquals($cache->getItem('ksh', 'compiledPluralRules'), $cache->getItem('de', 'compiledPluralRules'), 'ksh compiled plural rules (defined) dont fallback to de (defined)');
 }
 static function updateMessageCache()
 {
     if (MwFunctions::isAsyncLoadRequest()) {
         return false;
     }
     // skip subsequent calls to load stuff
     global $wgLang;
     $langCode = $wgLang->getCode();
     wfDebugLog('MultiAuthPlugin', __METHOD__ . ': ' . "Detected lang: {$langCode}");
     Language::getLocalisationCache()->recache($langCode);
     // hack for post 1.18.0
     return true;
 }
示例#3
0
 public function execute()
 {
     // Prevent the script from timing out
     set_time_limit(0);
     ini_set("max_execution_time", 0);
     ini_set('memory_limit', -1);
     global $wgExtensionMessagesFiles, $IP;
     global $wgLocalisationUpdateRepositories;
     global $wgLocalisationUpdateRepository;
     $dir = LocalisationUpdate::getDirectory();
     if (!$dir) {
         $this->error("No cache directory configured", true);
         return;
     }
     $lc = Language::getLocalisationCache();
     if (is_callable(array($lc, 'getMessagesDirs'))) {
         // Introduced in 1.25
         $messagesDirs = $lc->getMessagesDirs();
     } else {
         global $wgMessagesDirs;
         $messagesDirs = $wgMessagesDirs;
     }
     $finder = new LU_Finder($wgExtensionMessagesFiles, $messagesDirs, $IP);
     $readerFactory = new LU_ReaderFactory();
     $fetcherFactory = new LU_FetcherFactory();
     $repoid = $this->getOption('repoid', $wgLocalisationUpdateRepository);
     if (!isset($wgLocalisationUpdateRepositories[$repoid])) {
         $known = implode(', ', array_keys($wgLocalisationUpdateRepositories));
         $this->error("Unknown repoid {$repoid}; known: {$known}", true);
         return;
     }
     $repos = $wgLocalisationUpdateRepositories[$repoid];
     // Do it ;)
     $updater = new LU_Updater();
     $updatedMessages = $updater->execute($finder, $readerFactory, $fetcherFactory, $repos);
     // Store it ;)
     $count = array_sum(array_map('count', $updatedMessages));
     if (!$count) {
         $this->output("Found no new translations\n");
         return;
     }
     foreach ($updatedMessages as $language => $messages) {
         $filename = "{$dir}/" . LocalisationUpdate::getFilename($language);
         file_put_contents($filename, FormatJson::encode($messages, true));
     }
     $this->output("Saved {$count} new translations\n");
 }
示例#4
0
 /**
  * @param string|bool $langCode See --lang-code option.
  * @param array &$messageInfo
  */
 protected function fetchMessageInfo($langCode, array &$messageInfo)
 {
     global $wgContLang;
     if ($langCode) {
         $this->output("\n... fetching message info for language: {$langCode}");
         $nonContLang = true;
     } else {
         $this->output("\n... fetching message info for content language");
         $langCode = $wgContLang->getCode();
         $nonContLang = false;
     }
     /* Based on SpecialAllmessages::reallyDoQuery #filter=modified */
     $l10nCache = Language::getLocalisationCache();
     $messageNames = $l10nCache->getSubitemList('en', 'messages');
     // Normalise message names for NS_MEDIAWIKI page_title
     $messageNames = array_map(array($wgContLang, 'ucfirst'), $messageNames);
     $statuses = AllMessagesTablePager::getCustomisedStatuses($messageNames, $langCode, $nonContLang);
     // getCustomisedStatuses is stripping the sub page from the page titles, add it back
     $titleSuffix = $nonContLang ? "/{$langCode}" : '';
     foreach ($messageNames as $key) {
         $customised = isset($statuses['pages'][$key]);
         if ($customised) {
             $actual = wfMessage($key)->inLanguage($langCode)->plain();
             $default = wfMessage($key)->inLanguage($langCode)->useDatabase(false)->plain();
             $messageInfo['relevantPages']++;
             if ($default !== '' && $default !== '-' && $actual === $default) {
                 $hasTalk = isset($statuses['talks'][$key]);
                 $messageInfo['results'][] = array('title' => $key . $titleSuffix, 'hasTalk' => $hasTalk);
                 $messageInfo['equalPages']++;
                 if ($hasTalk) {
                     $messageInfo['equalPagesTalks']++;
                 }
             }
         }
     }
 }
示例#5
0
 /**
  * Constructor, always call this from child classes.
  */
 public function __construct()
 {
     global $wgExtensionMessagesFiles, $wgUser;
     // Disable the i18n cache and LoadBalancer
     Language::getLocalisationCache()->disableBackend();
     LBFactory::disableBackend();
     // Load the installer's i18n file.
     $wgExtensionMessagesFiles['MediawikiInstaller'] = dirname(__FILE__) . '/Installer.i18n.php';
     // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
     $wgUser = User::newFromId(0);
     $this->settings = $this->internalDefaults;
     foreach ($this->defaultVarNames as $var) {
         $this->settings[$var] = $GLOBALS[$var];
     }
     $compiledDBs = array();
     foreach (self::getDBTypes() as $type) {
         $installer = $this->getDBInstaller($type);
         if (!$installer->isCompiled()) {
             continue;
         }
         $compiledDBs[] = $type;
         $defaults = $installer->getGlobalDefaults();
         foreach ($installer->getGlobalNames() as $var) {
             if (isset($defaults[$var])) {
                 $this->settings[$var] = $defaults[$var];
             } else {
                 $this->settings[$var] = $GLOBALS[$var];
             }
         }
     }
     $this->setVar('_CompiledDBs', $compiledDBs);
     $this->parserTitle = Title::newFromText('Installer');
     $this->parserOptions = new ParserOptions();
     // language will  be wrong :(
     $this->parserOptions->setEditSection(false);
 }
     // For MSSQL
     $wgDBprefix = $conf->DBprefix2;
 } elseif ($conf->DBprefix_ora != '') {
     // For Oracle
     $wgDBprefix = $conf->DBprefix_ora;
 }
 ## DB2 specific:
 $wgDBcataloged = $conf->DBcataloged;
 $wgCommandLineMode = true;
 if (!defined('STDERR')) {
     define('STDERR', fopen("php://stderr", "wb"));
 }
 $wgUseDatabaseMessages = false;
 /* FIXME: For database failure */
 require_once "{$IP}/includes/Setup.php";
 Language::getLocalisationCache()->disableBackend();
 chdir("config");
 $wgTitle = Title::newFromText("Installation script");
 error_reporting(E_ALL | E_STRICT);
 print "<li>Loading class: " . htmlspecialchars($dbclass) . "</li>\n";
 if ($conf->DBtype != 'sqlite') {
     $dbc = new $dbclass();
 }
 if ($conf->DBtype == 'mysql') {
     $mysqlOldClient = version_compare(mysql_get_client_info(), "4.1.0", "lt");
     if ($mysqlOldClient) {
         print "<li><b>PHP is linked with old MySQL client libraries. If you are\n\t\t\t\t\tusing a MySQL 4.1 server and have problems connecting to the database,\n\t\t\t\t\tsee <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'\n\t\t\t \t\t>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
     }
     $ok = true;
     # Let's be optimistic
     # Decide if we're going to use the superuser or the regular database user
 protected function tearDown()
 {
     parent::tearDown();
     global $wgLang;
     Language::getLocalisationCache()->recache($wgLang->getCode());
 }
示例#8
0
 function getAllMessages($descending)
 {
     wfProfileIn(__METHOD__);
     $messageNames = Language::getLocalisationCache()->getSubitemList('en', 'messages');
     if ($descending) {
         rsort($messageNames);
     } else {
         asort($messageNames);
     }
     // Normalise message names so they look like page titles
     $messageNames = array_map(array($this->lang, 'ucfirst'), $messageNames);
     wfProfileOut(__METHOD__);
     return $messageNames;
 }
示例#9
0
 function addDBData()
 {
     $this->tablesUsed[] = 'site_stats';
     $this->tablesUsed[] = 'interwiki';
     # disabled for performance
     #$this->tablesUsed[] = 'image';
     # Hack: insert a few Wikipedia in-project interwiki prefixes,
     # for testing inter-language links
     $this->db->insert('interwiki', array(array('iw_prefix' => 'wikipedia', 'iw_url' => 'http://en.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0), array('iw_prefix' => 'meatball', 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0), array('iw_prefix' => 'zh', 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'es', 'iw_url' => 'http://es.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'fr', 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'ru', 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1)), __METHOD__, array('IGNORE'));
     # Update certain things in site_stats
     $this->db->insert('site_stats', array('ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1), __METHOD__);
     # Reinitialise the LocalisationCache to match the database state
     Language::getLocalisationCache()->unloadAll();
     # Clear the message cache
     MessageCache::singleton()->clear();
     $user = User::newFromId(0);
     LinkCache::singleton()->clear();
     # Avoids the odd failure at creating the nullRevision
     # Upload DB table entries for files.
     # We will upload the actual files later. Note that if anything causes LocalFile::load()
     # to be triggered before then, it will break via maybeUpgrade() setting the fileExists
     # member to false and storing it in cache.
     $image = wfLocalFile(Title::makeTitle(NS_FILE, 'Foobar.jpg'));
     if (!$this->db->selectField('image', '1', array('img_name' => $image->getName()))) {
         $image->recordUpload2('', 'Upload of some lame file', 'Some lame file', array('size' => 12345, 'width' => 1941, 'height' => 220, 'bits' => 24, 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize(array()), 'sha1' => wfBaseConvert('', 16, 36, 31), 'fileExists' => true), $this->db->timestamp('20010115123500'), $user);
     }
     # This image will be blacklisted in [[MediaWiki:Bad image list]]
     $image = wfLocalFile(Title::makeTitle(NS_FILE, 'Bad.jpg'));
     if (!$this->db->selectField('image', '1', array('img_name' => $image->getName()))) {
         $image->recordUpload2('', 'zomgnotcensored', 'Borderline image', array('size' => 12345, 'width' => 320, 'height' => 240, 'bits' => 24, 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize(array()), 'sha1' => wfBaseConvert('', 16, 36, 31), 'fileExists' => true), $this->db->timestamp('20010115123500'), $user);
     }
 }
 function getAllMessages($descending)
 {
     $messageNames = Language::getLocalisationCache()->getSubitemList('en', 'messages');
     // Normalise message names so they look like page titles and sort correctly - T86139
     $messageNames = array_map(array($this->lang, 'ucfirst'), $messageNames);
     if ($descending) {
         rsort($messageNames);
     } else {
         asort($messageNames);
     }
     return $messageNames;
 }
示例#11
0
 /**
  * Add a 2-D array of messages by lang. Useful for extensions.
  * @deprecated Use $wgExtensionMessagesFiles
  *
  * @param array $messages The array to be added
  */
 function addMessagesByLang($messages)
 {
     wfDeprecated(__METHOD__);
     $lc = Language::getLocalisationCache();
     $lc->addLegacyMessages($messages);
 }
示例#12
0
 /**
  * Constructor, always call this from child classes.
  */
 public function __construct()
 {
     global $wgMemc, $wgUser, $wgObjectCaches;
     $defaultConfig = new GlobalVarConfig();
     // all the stuff from DefaultSettings.php
     $installerConfig = self::getInstallerConfig($defaultConfig);
     // Reset all services and inject config overrides
     MediaWiki\MediaWikiServices::resetGlobalInstance($installerConfig);
     // Don't attempt to load user language options (T126177)
     // This will be overridden in the web installer with the user-specified language
     RequestContext::getMain()->setLanguage('en');
     // Disable the i18n cache
     // TODO: manage LocalisationCache singleton in MediaWikiServices
     Language::getLocalisationCache()->disableBackend();
     // Disable all global services, since we don't have any configuration yet!
     MediaWiki\MediaWikiServices::disableStorageBackend();
     // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
     // SqlBagOStuff will then throw since we just disabled wfGetDB)
     $wgObjectCaches = MediaWikiServices::getInstance()->getMainConfig()->get('ObjectCaches');
     $wgMemc = ObjectCache::getInstance(CACHE_NONE);
     // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
     $wgUser = User::newFromId(0);
     RequestContext::getMain()->setUser($wgUser);
     $this->settings = $this->internalDefaults;
     foreach ($this->defaultVarNames as $var) {
         $this->settings[$var] = $GLOBALS[$var];
     }
     $this->doEnvironmentPreps();
     $this->compiledDBs = [];
     foreach (self::getDBTypes() as $type) {
         $installer = $this->getDBInstaller($type);
         if (!$installer->isCompiled()) {
             continue;
         }
         $this->compiledDBs[] = $type;
     }
     $this->parserTitle = Title::newFromText('Installer');
     $this->parserOptions = new ParserOptions($wgUser);
     // language will be wrong :(
     $this->parserOptions->setEditSection(false);
 }
示例#13
0
 /**
  * Constructor, always call this from child classes.
  */
 public function __construct()
 {
     global $wgMessagesDirs, $wgUser;
     // Disable the i18n cache
     Language::getLocalisationCache()->disableBackend();
     // Disable LoadBalancer and wfGetDB etc.
     LBFactory::disableBackend();
     // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
     // SqlBagOStuff will then throw since we just disabled wfGetDB)
     $GLOBALS['wgMemc'] = new EmptyBagOStuff();
     ObjectCache::clear();
     $emptyCache = array('class' => 'EmptyBagOStuff');
     $GLOBALS['wgObjectCaches'] = array(CACHE_NONE => $emptyCache, CACHE_DB => $emptyCache, CACHE_ANYTHING => $emptyCache, CACHE_MEMCACHED => $emptyCache);
     // Load the installer's i18n.
     $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
     // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
     $wgUser = User::newFromId(0);
     $this->settings = $this->internalDefaults;
     foreach ($this->defaultVarNames as $var) {
         $this->settings[$var] = $GLOBALS[$var];
     }
     $this->doEnvironmentPreps();
     $this->compiledDBs = array();
     foreach (self::getDBTypes() as $type) {
         $installer = $this->getDBInstaller($type);
         if (!$installer->isCompiled()) {
             continue;
         }
         $this->compiledDBs[] = $type;
     }
     $this->parserTitle = Title::newFromText('Installer');
     $this->parserOptions = new ParserOptions();
     // language will be wrong :(
     $this->parserOptions->setEditSection(false);
 }
示例#14
0
 function addDBData()
 {
     # Hack: insert a few Wikipedia in-project interwiki prefixes,
     # for testing inter-language links
     $this->db->insert('interwiki', array(array('iw_prefix' => 'wikipedia', 'iw_url' => 'http://en.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0), array('iw_prefix' => 'meatball', 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0), array('iw_prefix' => 'zh', 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'es', 'iw_url' => 'http://es.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'fr', 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1), array('iw_prefix' => 'ru', 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1)), __METHOD__, array('IGNORE'));
     # Update certain things in site_stats
     $this->db->insert('site_stats', array('ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1), __METHOD__, array('IGNORE'));
     # Reinitialise the LocalisationCache to match the database state
     Language::getLocalisationCache()->unloadAll();
     # Clear the message cache
     MessageCache::singleton()->clear();
     $this->uploadDir = $this->setupUploadDir();
     $user = User::newFromId(0);
     LinkCache::singleton()->clear();
     # Avoids the odd failure at creating the nullRevision
     $image = wfLocalFile(Title::makeTitle(NS_FILE, 'Foobar.jpg'));
     $image->recordUpload2('', 'Upload of some lame file', 'Some lame file', array('size' => 12345, 'width' => 1941, 'height' => 220, 'bits' => 24, 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize(array()), 'sha1' => wfBaseConvert('', 16, 36, 31), 'fileExists' => true), $this->db->timestamp('20010115123500'), $user);
     # This image will be blacklisted in [[MediaWiki:Bad image list]]
     $image = wfLocalFile(Title::makeTitle(NS_FILE, 'Bad.jpg'));
     $image->recordUpload2('', 'zomgnotcensored', 'Borderline image', array('size' => 12345, 'width' => 320, 'height' => 240, 'bits' => 24, 'media_type' => MEDIATYPE_BITMAP, 'mime' => 'image/jpeg', 'metadata' => serialize(array()), 'sha1' => wfBaseConvert('', 16, 36, 31), 'fileExists' => true), $this->db->timestamp('20010115123500'), $user);
 }
示例#15
0
	public function execute() {
		if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
			return 'skip';
		}
		if ( $this->parent->request->wasPosted() ) {
			if ( $this->submit() ) {
				return 'continue';
			}
		}

		$emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
		$this->startForm();
		$this->addHTML(
			# User Rights
			// getRadioSet() builds a set of labeled radio buttons.
			// For grep: The following messages are used as the item labels:
			// config-profile-wiki, config-profile-no-anon, config-profile-fishbowl, config-profile-private
			$this->parent->getRadioSet( array(
				'var' => '_RightsProfile',
				'label' => 'config-profile',
				'itemLabelPrefix' => 'config-profile-',
				'values' => array_keys( $this->parent->rightsProfiles ),
			) ) .
			$this->parent->getInfoBox( wfMessage( 'config-profile-help' )->plain() ) .

			# Licensing
			// getRadioSet() builds a set of labeled radio buttons.
			// For grep: The following messages are used as the item labels:
			// config-license-cc-by, config-license-cc-by-sa, config-license-cc-by-nc-sa,
			// config-license-cc-0, config-license-pd, config-license-gfdl,
			// config-license-none, config-license-cc-choose
			$this->parent->getRadioSet( array(
				'var' => '_LicenseCode',
				'label' => 'config-license',
				'itemLabelPrefix' => 'config-license-',
				'values' => array_keys( $this->parent->licenses ),
				'commonAttribs' => array( 'class' => 'licenseRadio' ),
			) ) .
			$this->getCCChooser() .
			$this->parent->getHelpBox( 'config-license-help' ) .

			# E-mail
			$this->getFieldSetStart( 'config-email-settings' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEnableEmail',
				'label' => 'config-enable-email',
				'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'emailwrapper' ),
			) ) .
			$this->parent->getHelpBox( 'config-enable-email-help' ) .
			"<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
			$this->parent->getTextBox( array(
				'var' => 'wgPasswordSender',
				'label' => 'config-email-sender'
			) ) .
			$this->parent->getHelpBox( 'config-email-sender-help' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEnableUserEmail',
				'label' => 'config-email-user',
			) ) .
			$this->parent->getHelpBox( 'config-email-user-help' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEnotifUserTalk',
				'label' => 'config-email-usertalk',
			) ) .
			$this->parent->getHelpBox( 'config-email-usertalk-help' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEnotifWatchlist',
				'label' => 'config-email-watchlist',
			) ) .
			$this->parent->getHelpBox( 'config-email-watchlist-help' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEmailAuthentication',
				'label' => 'config-email-auth',
			) ) .
			$this->parent->getHelpBox( 'config-email-auth-help' ) .
			"</div>" .
			$this->getFieldSetEnd()
		);

		$extensions = $this->parent->findExtensions();

		if ( $extensions ) {
			$extHtml = $this->getFieldSetStart( 'config-extensions' );

			/* Force a recache, so we load extensions descriptions */
			global $wgLang;
			$lc = Language::getLocalisationCache();
			$lc->setInitialisedLanguages( array() );
			$lc->getItem( $wgLang->mCode, '' );
			LinkCache::singleton()->useDatabase( false );

			foreach ( $extensions as $ext ) {
				if ( isset( $ext['descriptionmsg'] ) ) {
					$desc = wfMessage( $ext['descriptionmsg'] )->useDatabase( false )->parse();
				} else {
					$desc = '';
				}
				$extHtml .= $this->parent->getCheckBox( array(
						'var' => "ext-{$ext['name']}",
						'rawtext' => "<b>{$ext['name']}</b>: " .
						$desc,
				) );

			}

			$extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
				$this->getFieldSetEnd();
			$this->addHTML( $extHtml );
		}

		// Having / in paths in Windows looks funny :)
		$this->setVar( 'wgDeletedDirectory',
			str_replace(
				'/', DIRECTORY_SEPARATOR,
				$this->getVar( 'wgDeletedDirectory' )
			)
		);
		// If we're using the default, let the user set it relative to $wgScriptPath
		$curLogo = $this->getVar( 'wgLogo' );
		$logoString = ( $curLogo == "/wiki/skins/common/images/wiki.png" ) ?
			'$wgStylePath/common/images/wiki.png' : $curLogo;

		$uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none';
		$this->addHTML(
			# Uploading
			$this->getFieldSetStart( 'config-upload-settings' ) .
			$this->parent->getCheckBox( array(
				'var' => 'wgEnableUploads',
				'label' => 'config-upload-enable',
				'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'uploadwrapper' ),
				'help' => $this->parent->getHelpBox( 'config-upload-help' )
			) ) .
			'<div id="uploadwrapper" style="' . $uploadwrapperStyle . '">' .
			$this->parent->getTextBox( array(
				'var' => 'wgDeletedDirectory',
				'label' => 'config-upload-deleted',
				'attribs' => array( 'dir' => 'ltr' ),
				'help' => $this->parent->getHelpBox( 'config-upload-deleted-help' )
			) ) .
			'</div>' .
			$this->parent->getTextBox( array(
				'var' => 'wgLogo',
				'value' => $logoString,
				'label' => 'config-logo',
				'attribs' => array( 'dir' => 'ltr' ),
				'help' => $this->parent->getHelpBox( 'config-logo-help' )
			) )
		);
		$this->addHTML(
			$this->parent->getCheckBox( array(
				'var' => 'wgUseInstantCommons',
				'label' => 'config-instantcommons',
				'help' => $this->parent->getHelpBox( 'config-instantcommons-help' )
			) ) .
			$this->getFieldSetEnd()
		);

		$caches = array( 'none' );
		if ( count( $this->getVar( '_Caches' ) ) ) {
			$caches[] = 'accel';
		}
		$caches[] = 'memcached';

		// We'll hide/show this on demand when the value changes, see config.js.
		$cacheval = $this->getVar( 'wgMainCacheType' );
		if ( !$cacheval ) {
			// We need to set a default here; but don't hardcode it
			// or we lose it every time we reload the page for validation
			// or going back!
			$cacheval = 'none';
		}
		$hidden = ( $cacheval == 'memcached' ) ? '' : 'display: none';
		$this->addHTML(
			# Advanced settings
			$this->getFieldSetStart( 'config-advanced-settings' ) .
			# Object cache settings
			// getRadioSet() builds a set of labeled radio buttons.
			// For grep: The following messages are used as the item labels:
			// config-cache-none, config-cache-accel, config-cache-memcached
			$this->parent->getRadioSet( array(
				'var' => 'wgMainCacheType',
				'label' => 'config-cache-options',
				'itemLabelPrefix' => 'config-cache-',
				'values' => $caches,
				'value' => $cacheval,
			) ) .
			$this->parent->getHelpBox( 'config-cache-help' ) .
			"<div id=\"config-memcachewrapper\" style=\"$hidden\">" .
			$this->parent->getTextArea( array(
				'var' => '_MemCachedServers',
				'label' => 'config-memcached-servers',
				'help' => $this->parent->getHelpBox( 'config-memcached-help' )
			) ) .
			'</div>' .
			$this->getFieldSetEnd()
		);
		$this->endForm();
	}
示例#16
0
 /**
  * Constructor, always call this from child classes.
  */
 public function __construct()
 {
     global $wgMessagesDirs, $wgUser;
     // Disable the i18n cache and LoadBalancer
     Language::getLocalisationCache()->disableBackend();
     LBFactory::disableBackend();
     // Load the installer's i18n.
     $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
     // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
     $wgUser = User::newFromId(0);
     $this->settings = $this->internalDefaults;
     foreach ($this->defaultVarNames as $var) {
         $this->settings[$var] = $GLOBALS[$var];
     }
     $this->compiledDBs = array();
     foreach (self::getDBTypes() as $type) {
         $installer = $this->getDBInstaller($type);
         if (!$installer->isCompiled()) {
             continue;
         }
         $this->compiledDBs[] = $type;
     }
     $this->parserTitle = Title::newFromText('Installer');
     $this->parserOptions = new ParserOptions();
     // language will  be wrong :(
     $this->parserOptions->setEditSection(false);
 }