With some manual corrections.
Change-Id: Icd947288c32fdb90a0f35388963ef5a17ffa58e7
$text = wfMessage( $msg, $params )->parse();
$text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 <$1>', $text );
+
return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
}
if ( !$this->specifiedScriptPath ) {
$this->showMessage( 'config-no-cli-uri', $this->getVar( "wgScriptPath" ) );
}
+
return parent::envCheckPath();
}
public function dirIsExecutable( $dir, $url ) {
$this->showMessage( 'config-no-cli-uploads-check', $dir );
+
return false;
}
}
$this->db->clearFlag( DBO_TRX );
$this->db->commit( __METHOD__ );
}
+
return $status;
}
if ( $this->db->tableExists( 'archive', __METHOD__ ) ) {
$status->warning( 'config-install-tables-exist' );
$this->enableLB();
+
return $status;
}
if ( $status->isOk() ) {
$this->enableLB();
}
+
return $status;
}
}
$up->purgeCache();
ob_end_flush();
+
return $ret;
}
* long after the constructor. Helpful for things like modifying setup steps :)
*/
public function preInstall() {
-
}
/**
* Allow DB installers a chance to make checks before upgrade.
*/
public function preUpgrade() {
-
}
/**
wfSuppressWarnings();
$compiled = wfDl( $name );
wfRestoreWarnings();
+
return $compiled;
}
} elseif ( isset( $internal[$var] ) ) {
$default = $internal[$var];
}
+
return $this->parent->getVar( $var, $default );
}
if ( !isset( $attribs ) ) {
$attribs = array();
}
+
return $this->parent->getTextBox( array(
'var' => $var,
'label' => $label,
if ( !isset( $attribs ) ) {
$attribs = array();
}
+
return $this->parent->getPasswordBox( array(
'var' => $var,
'label' => $label,
public function getCheckBox( $var, $label, $attribs = array(), $helpData = "" ) {
$name = $this->getName() . '_' . $var;
$value = $this->getVar( $var );
+
return $this->parent->getCheckBox( array(
'var' => $var,
'label' => $label,
'controlName' => $name,
'value' => $value,
'help' => $helpData
- ));
+ ) );
}
/**
public function getRadioSet( $params ) {
$params['controlName'] = $this->getName() . '_' . $params['var'];
$params['value'] = $this->getVar( $params['var'] );
+
return $this->parent->getRadioSet( $params );
}
if ( !$this->db->selectDB( $this->getVar( 'wgDBname' ) ) ) {
return false;
}
+
return $this->db->tableExists( 'cur', __METHOD__ ) || $this->db->tableExists( 'revision', __METHOD__ );
}
*/
public function submitInstallUserBox() {
$this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) );
+
return Status::newGood();
}
$s .= $this->getCheckBox( '_CreateDBAccount', 'config-db-web-create' );
}
$s .= Html::closeElement( 'div' ) . Html::closeElement( 'fieldset' );
+
return $s;
}
if ( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) {
$status->warning( 'config-install-interwiki-exists' );
+
return $status;
}
global $IP;
);
}
$this->db->insert( 'interwiki', $interwikis, __METHOD__ );
+
return Status::newGood();
}
$type = $db->getType();
if ( in_array( $type, Installer::getDBTypes() ) ) {
$class = ucfirst( $type ) . 'Updater';
+
return new $class( $db, $shared, $maintenance );
} else {
throw new MWException( __METHOD__ . ' called for unsupported $wgDBtype' );
array( 'ul_key' => $key ),
__METHOD__
);
+
return (bool)$row;
}
foreach ( $wgExtNewFields as $fieldRecord ) {
$updates[] = array(
'addField', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2], true
+ $fieldRecord[2], true
);
}
foreach ( $wgExtNewIndexes as $fieldRecord ) {
$updates[] = array(
'addIndex', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2], true
+ $fieldRecord[2], true
);
}
foreach ( $wgExtModifiedFields as $fieldRecord ) {
$updates[] = array(
'modifyField', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2], true
+ $fieldRecord[2], true
);
}
if ( fwrite( $this->fileHandle, $line ) === false ) {
throw new MWException( "trouble writing file" );
}
+
return false;
}
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change ($msg).\n" );
+
return false;
}
$this->db->sourceFile( $path );
}
$this->output( "done.\n" );
+
return true;
}
} else {
return $this->applyPatch( $patch, $fullpath, "Creating $name table" );
}
+
return true;
}
} else {
return $this->applyPatch( $patch, $fullpath, "Adding $field field to table $table" );
}
+
return true;
}
} else {
return $this->applyPatch( $patch, $fullpath, "Adding index $index to table $table" );
}
+
return true;
}
} else {
$this->output( "...$table table does not contain $field field.\n" );
}
+
return true;
}
} else {
$this->output( "...$index key doesn't exist.\n" );
}
+
return true;
}
// First requirement: the table must exist
if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "...skipping: '$table' table doesn't exist yet.\n" );
+
return true;
}
$this->output( "...WARNING: $oldIndex still exists, despite it has been renamed into $newIndex (which also exists).\n" .
" $oldIndex should be manually removed if not needed anymore.\n" );
}
+
return true;
}
// Third requirement: the old index must exist
if ( !$this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
$this->output( "...skipping: index $oldIndex doesn't exist.\n" );
+
return true;
}
$this->output( "$msg ..." );
$this->db->dropTable( $table, __METHOD__ );
$this->output( "done.\n" );
- }
- else {
+ } else {
return $this->applyPatch( $patch, $fullpath, $msg );
}
} else {
$this->output( "...$table doesn't exist.\n" );
}
+
return true;
}
$this->output( "...$field in table $table already modified by patch $patch.\n" );
} else {
$this->insertUpdateRow( $updateKey );
+
return $this->applyPatch( $patch, $fullpath, "Modifying $field field of table $table" );
}
+
return true;
}
$this->output( "missing ss_total_pages, rebuilding...\n" );
} else {
$this->output( "done.\n" );
+
return;
}
SiteStatsInit::doAllAndCommit( $this->db );
protected function doLogUsertextPopulation() {
if ( !$this->updateRowExists( 'populate log_usertext' ) ) {
$this->output(
- "Populating log_user_text field, printing progress markers. For large\n" .
- "databases, you may want to hit Ctrl-C and do this manually with\n" .
- "maintenance/populateLogUsertext.php.\n" );
+ "Populating log_user_text field, printing progress markers. For large\n" .
+ "databases, you may want to hit Ctrl-C and do this manually with\n" .
+ "maintenance/populateLogUsertext.php.\n"
+ );
$task = $this->maintenance->runChild( 'PopulateLogUsertext' );
$task->execute();
protected function doUpdateTranscacheField() {
if ( $this->updateRowExists( 'convert transcache field' ) ) {
$this->output( "...transcache tc_time already converted.\n" );
+
return true;
}
'COUNT(*)',
'cl_collation != ' . $this->db->addQuotes( $wgCategoryCollation ),
__METHOD__
- ) == 0 ) {
- $this->output( "...collations up-to-date.\n" );
- return;
+ ) == 0
+ ) {
+ $this->output( "...collations up-to-date.\n" );
+
+ return;
}
$this->output( "Updating category collations..." );
class InstallDocFormatter {
static function format( $text ) {
$obj = new self( $text );
+
return $obj->execute();
}
$text = preg_replace_callback( '/bug (\d+)/', array( $this, 'replaceBugLinks' ), $text );
// add links to manual to every global variable mentioned
$text = preg_replace_callback( '/(\$wg[a-z0-9_]+)/i', array( $this, 'replaceConfigLinks' ), $text );
+
return $text;
}
*/
protected $settings;
-
/**
* List of detected DBs, access using getCompiledDBs().
*
if ( file_exists( "$IP/AdminSettings.php" ) ) {
require "$IP/AdminSettings.php";
}
+
return get_defined_vars();
}
'ss_users' => 0,
'ss_images' => 0 ),
__METHOD__, 'IGNORE' );
+
return Status::newGood();
}
$databases = $this->getCompiledDBs();
- $databases = array_flip ( $databases );
+ $databases = array_flip( $databases );
foreach ( array_keys( $databases ) as $db ) {
$installer = $this->getDBInstaller( $db );
$status = $installer->checkPrerequisites();
$databases = array_flip( $databases );
if ( !$databases ) {
$this->showError( 'config-no-db', $wgLang->commaList( $allNames ) );
+
// @todo FIXME: This only works for the web installer!
return false;
}
+
return true;
}
$test = new PhpXmlBugTester();
if ( !$test->ok ) {
$this->showError( 'config-brokenlibxml' );
+
return false;
}
+
return true;
}
$test->execute();
if ( !$test->ok ) {
$this->showError( 'config-using531', phpversion() );
+
return false;
}
+
return true;
}
protected function envCheckMagicQuotes() {
if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
$this->showError( 'config-magic-quotes-runtime' );
+
return false;
}
+
return true;
}
protected function envCheckMagicSybase() {
if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
$this->showError( 'config-magic-quotes-sybase' );
+
return false;
}
+
return true;
}
protected function envCheckMbstring() {
if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
$this->showError( 'config-mbstring' );
+
return false;
}
+
return true;
}
protected function envCheckZE1() {
if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) {
$this->showError( 'config-ze1' );
+
return false;
}
+
return true;
}
$this->setVar( '_SafeMode', true );
$this->showMessage( 'config-safe-mode' );
}
+
return true;
}
protected function envCheckXML() {
if ( !function_exists( "utf8_encode" ) ) {
$this->showError( 'config-xml-bad' );
+
return false;
}
+
return true;
}
protected function envCheckPCRE() {
if ( !function_exists( 'preg_match' ) ) {
$this->showError( 'config-pcre' );
+
return false;
}
wfSuppressWarnings();
wfRestoreWarnings();
if ( $regexd != '--' || $regexprop != '--' ) {
$this->showError( 'config-pcre-no-utf8' );
+
return false;
}
+
return true;
}
$this->setVar( '_RaiseMemory', true );
}
}
+
return true;
}
if ( self::apacheModulePresent( 'mod_security' ) ) {
$this->showMessage( 'config-mod-security' );
}
+
return true;
}
$this->setVar( 'wgDiff3', false );
$this->showMessage( 'config-diff3-bad' );
}
+
return true;
}
if ( $convert ) {
$this->setVar( 'wgImageMagickConvertCommand', $convert );
$this->showMessage( 'config-imagemagick', $convert );
+
return true;
} elseif ( function_exists( 'imagejpeg' ) ) {
$this->showMessage( 'config-gd' );
-
} else {
$this->showMessage( 'config-no-scaling' );
}
+
return true;
}
$this->setVar( 'wgGitBin', false );
$this->showMessage( 'config-git-bad' );
}
+
return true;
}
$server = $this->envGetDefaultServer();
$this->showMessage( 'config-using-server', $server );
$this->setVar( 'wgServer', $server );
+
return true;
}
$this->setVar( 'IP', $IP );
$this->showMessage( 'config-using-uri', $this->getVar( 'wgServer' ), $this->getVar( 'wgScriptPath' ) );
+
return true;
}
$ext = 'php';
}
$this->setVar( 'wgScriptExtension', ".$ext" );
+
return true;
}
# Try the current value of LANG.
if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
$this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
+
return true;
}
foreach ( $commonLocales as $commonLocale ) {
if ( isset( $candidatesByLocale[$commonLocale] ) ) {
$this->setVar( 'wgShellLocale', $commonLocale );
+
return true;
}
}
if ( isset( $candidatesByLang[$wikiLang] ) ) {
$m = reset( $candidatesByLang[$wikiLang] );
$this->setVar( 'wgShellLocale', $m[0] );
+
return true;
}
if ( count( $candidatesByLocale ) ) {
$m = reset( $candidatesByLocale );
$this->setVar( 'wgShellLocale', $m[0] );
+
return true;
}
if ( !$safe ) {
$this->showMessage( 'config-uploads-not-safe', $dir );
}
+
return true;
}
// Only warn if the value is below the sane 1024
$this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
}
+
return true;
}
protected function envCheckCtype() {
if ( !function_exists( 'ctype_digit' ) ) {
$this->showError( 'config-ctype' );
+
return false;
}
+
return true;
}
protected function envCheckJSON() {
if ( !function_exists( 'json_decode' ) ) {
$this->showError( 'config-json' );
+
return false;
}
+
return true;
}
* @param string $path path to search
* @param array $names of executable names
* @param $versionInfo Boolean false or array with two members:
- * 0 => Command to run for version check, with $1 for the full executable name
- * 1 => String to compare the output with
+ * 0 => Command to run for version check, with $1 for the full executable name
+ * 1 => String to compare the output with
*
* If $versionInfo is not false, only executables with a version
* matching $versionInfo[1] will be returned.
}
}
}
+
return false;
}
return $exe;
}
}
+
return false;
}
try {
$text = Http::get( $url . $file, array( 'timeout' => 3 ) );
- }
- catch ( MWException $e ) {
+ } catch ( MWException $e ) {
// Http::get throws with allow_url_fopen = false and no curl extension.
$text = null;
}
if ( $text == 'exec' ) {
wfRestoreWarnings();
+
return $ext;
}
}
ob_start();
phpinfo( INFO_MODULES );
$info = ob_get_clean();
+
return strpos( $info, $moduleName ) !== false;
}
*/
protected function getInstallSteps( DatabaseInstaller $installer ) {
$coreInstallSteps = array(
- array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ),
- array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ),
- array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ),
- array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ),
- array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ),
- array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ),
- array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
+ array( 'name' => 'database', 'callback' => array( $installer, 'setupDatabase' ) ),
+ array( 'name' => 'tables', 'callback' => array( $installer, 'createTables' ) ),
+ array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ),
+ array( 'name' => 'stats', 'callback' => array( $this, 'populateSiteStats' ) ),
+ array( 'name' => 'keys', 'callback' => array( $this, 'generateKeys' ) ),
+ array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ),
+ array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
);
// Build the array of install steps starting from the core install list,
'callback' => array( $installer, 'createExtensionTables' )
);
}
+
return $this->installSteps;
}
if ( $status->isOk() ) {
$this->setVar( '_InstallDone', true );
}
+
return $installResults;
}
if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
$keys['wgUpgradeKey'] = 16;
}
+
return $this->doGenerateKeys( $keys );
}
);
$page->doEditContent( $content,
- '',
- EDIT_NEW,
- false,
- User::newFromName( 'MediaWiki default' ) );
+ '',
+ EDIT_NEW,
+ false,
+ User::newFromName( 'MediaWiki default' )
+ );
} catch ( MWException $e ) {
//using raw, because $wgShowExceptionDetails can not be set yet
$status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
}
$mcservers = $this->buildMemcachedServerList();
+
return "<?php
# This file was automatically generated by the MediaWiki {$GLOBALS['wgVersion']}
# installer. If you make manual changes, please keep track in case you
{$groupRights}";
}
-
}
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
}
+
return $status;
}
$status = $this->getConnection();
if ( !$status->isOK() ) {
$this->parent->showStatusError( $status );
+
return;
}
/**
}
}
$engines = array_intersect( $this->supportedEngines, $engines );
+
return $engines;
}
// Can't grant everything
return false;
}
+
return true;
}
$s .= Xml::openElement( 'div', array(
'id' => 'dbMyisamWarning'
- ));
+ ) );
$myisamWarning = 'config-mysql-myisam-dep';
if ( count( $engines ) === 1 ) {
$myisamWarning = 'config-mysql-only-myisam-dep';
'class' => 'hideShowRadio',
'rel' => 'dbMyisamWarning'
)
- )));
+ )
+ ) );
$s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
}
'label' => 'config-mysql-charset',
'itemLabelPrefix' => 'config-mysql-',
'values' => $charsets
- ));
+ ) );
$s .= $this->parent->getHelpBox( 'config-mysql-charset-help' );
}
if ( !in_array( $this->getVar( '_MysqlCharset' ), $charsets ) ) {
$this->setVar( '_MysqlCharset', reset( $charsets ) );
}
+
return Status::newGood();
}
$conn->selectDB( $dbName );
}
$this->setupSchemaVars();
+
return $status;
}
try {
$res = $this->db->selectRow( 'mysql.user', array( 'Host', 'User' ),
array( 'Host' => $host, 'User' => $user ), __METHOD__ );
+
return (bool)$res;
} catch ( DBQueryError $dqe ) {
return false;
}
-
}
/**
if ( $this->getVar( '_MysqlCharset' ) !== null ) {
$options[] = 'DEFAULT CHARSET=' . $this->getVar( '_MysqlCharset' );
}
+
return implode( ', ', $options );
}
$dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) );
$prefix = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBprefix' ) );
$tblOpts = LocalSettingsGenerator::escapePhpString( $this->getTableOptions() );
- return
-"# MySQL specific settings
+
+ return "# MySQL specific settings
\$wgDBprefix = \"{$prefix}\";
# MySQL table options to use during installation or update
foreach ( $info as $row ) {
if ( $row->Column_name == $field ) {
$this->output( "...index $index on table $table includes field $field.\n" );
+
return true;
}
}
}
$this->output( "...index $index on table $table has no field $field; added.\n" );
+
return false;
}
if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
$this->output( "...already have interwiki table\n" );
+
return;
}
}
if ( $meta->isMultipleKey() ) {
$this->output( "...indexes seem up to 20031107 standards.\n" );
+
return;
}
$info = $this->db->fieldInfo( 'imagelinks', 'il_from' );
if ( !$info || $info->type() !== 'string' ) {
$this->output( "...il_from OK\n" );
+
return;
}
$nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', __METHOD__ );
if ( $talk == $nontalk ) {
$this->output( "...watchlist talk page rows already present.\n" );
+
return;
}
function doSchemaRestructuring() {
if ( $this->db->tableExists( 'page', __METHOD__ ) ) {
$this->output( "...page table already exists.\n" );
+
return;
}
$this->output( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) );
$duplicate = array();
foreach ( $rows as $row ) {
- if ( ! isset( $duplicate[$row->cur_namespace] ) ) {
+ if ( !isset( $duplicate[$row->cur_namespace] ) ) {
$duplicate[$row->cur_namespace] = array();
}
$duplicate[$row->cur_namespace][] = $row->cur_title;
protected function doPagelinksUpdate() {
if ( $this->db->tableExists( 'pagelinks', __METHOD__ ) ) {
$this->output( "...already have pagelinks table.\n" );
+
return;
}
$duper = new UserDupes( $this->db, array( $this, 'output' ) );
if ( $duper->hasUniqueIndex() ) {
$this->output( "...already have unique user_name index.\n" );
+
return;
}
} else {
$this->output( "...user_groups table exists and is in current format.\n" );
}
+
return;
}
$this->output( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" );
$this->output( "*** You may need to manually configure some sysops by manipulating\n" );
$this->output( "*** the user_groups table.\n" );
+
return;
}
}
}
if ( $info->isNullable() ) {
$this->output( "...wl_notificationtimestamp is already nullable.\n" );
+
return;
}
protected function doTemplatelinksUpdate() {
if ( $this->db->tableExists( 'templatelinks', __METHOD__ ) ) {
$this->output( "...templatelinks table already exists\n" );
+
return;
}
'tl_title' => $row->pl_title,
), __METHOD__
);
-
}
} else {
// Fast update
protected function doBacklinkingIndicesUpdate() {
if ( !$this->indexHasField( 'pagelinks', 'pl_namespace', 'pl_from' ) ||
!$this->indexHasField( 'templatelinks', 'tl_namespace', 'tl_from' ) ||
- !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' ) )
- {
+ !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' )
+ ) {
$this->applyPatch( 'patch-backlinkindexes.sql', false, "Updating backlinking indices" );
}
}
protected function doRestrictionsUpdate() {
if ( $this->db->tableExists( 'page_restrictions', __METHOD__ ) ) {
$this->output( "...page_restrictions table already exists.\n" );
+
return;
}
protected function doCategoryPopulation() {
if ( $this->updateRowExists( 'populate category' ) ) {
$this->output( "...category table already populated.\n" );
+
return;
}
return true;
}
- if ( $wgProfileToDatabase === true && ! $this->db->tableExists( 'profiling', __METHOD__ ) ) {
+ if ( $wgProfileToDatabase === true && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
$this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
}
}
return true;
} elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
$this->output( "...profiling table has pf_memory field.\n" );
+
return true;
}
+
return $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
}
if ( !$info ) {
$this->applyPatch( 'patch-filearchive-user-index.sql', false, "Updating filearchive indices" );
}
+
return true;
}
$info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' );
if ( is_array( $info ) && !$info[0]->Non_unique ) {
$this->output( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" );
+
return true;
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change (making pl_namespace, tl_namespace and il_to indices UNIQUE).\n" );
+
return false;
}
protected function doUpdateMimeMinorField() {
if ( $this->updateRowExists( 'mime_minor_length' ) ) {
$this->output( "...*_mime_minor fields are already long enough.\n" );
+
return;
}
protected function doClFieldsUpdate() {
if ( $this->updateRowExists( 'cl_fields_update' ) ) {
$this->output( "...categorylinks up-to-date.\n" );
+
return;
}
}
if ( $info->isNullable() ) {
$this->output( "...user_last_timestamp is already nullable.\n" );
+
return;
}
$info = $this->db->indexInfo( 'iwlinks', 'iwl_prefix_title_from' );
if ( is_array( $info ) && $info[0]->Non_unique ) {
$this->output( "...iwl_prefix_title_from index is already non-UNIQUE.\n" );
+
return true;
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change (making iwl_prefix_title_from index non-UNIQUE).\n" );
+
return false;
}
if ( $this->getVar( 'wgDBserver' ) == 'localhost' ) {
$this->parent->setVar( 'wgDBserver', '' );
}
+
return $this->getTextBox( 'wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox( 'config-db-host-oracle-help' ) ) .
Html::openElement( 'fieldset' ) .
Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
public function submitInstallUserBox() {
parent::submitInstallUserBox();
$this->parent->setVar( '_InstallDBname', $this->getVar( '_InstallUser' ) );
+
return Status::newGood();
}
$this->connError = $e->db->lastErrno();
$status->fatal( 'config-connection-error', $e->getMessage() );
}
+
return $status;
}
$this->connError = $e->db->lastErrno();
$status->fatal( 'config-connection-error', $e->getMessage() );
}
+
return $status;
}
$this->parent->setVar( 'wgDBname', $this->getVar( 'wgDBuser' ) );
$retVal = parent::needsUpgrade();
$this->parent->setVar( 'wgDBname', $tempDBname );
+
return $retVal;
}
public function setupDatabase() {
$status = Status::newGood();
+
return $status;
}
foreach ( $varNames as $name ) {
$vars[$name] = $this->getVar( $name );
}
+
return $vars;
}
public function getLocalSettings() {
$prefix = $this->getVar( 'wgDBprefix' );
- return
-"# Oracle specific settings
+
+ return "# Oracle specific settings
\$wgDBprefix = \"{$prefix}\";
";
}
$isValid |= preg_match( '/^(?:\/\/)?[\w\-\.]+(?::[\d]+)?(?:\/(?:[\w\-\.]+(?::(pooled|dedicated|shared))?)?(?:\/[\w\-\.]+)?)?$/', $connect_string ); // EZConnect
return (bool)$isValid;
}
-
}
$row = $meta->fetchRow();
if ( $row['column_name'] == 'PR_ID' ) {
$this->output( "seems to be up to date.\n" );
+
return;
}
$this->db->delete( '/*Q*/' . $this->db->tableName( 'objectcache' ), '*', __METHOD__ );
$this->output( "done.\n" );
}
-
}
class PhpXmlBugTester {
private $parsedData = '';
public $ok = false;
+
public function __construct() {
$charData = '<b>c</b>';
$xml = '<a>' . htmlspecialchars( $charData ) . '</a>';
$parsedOk = xml_parse( $parser, $xml, true );
$this->ok = $parsedOk && ( $this->parsedData == $charData );
}
+
public function chardata( $parser, $data ) {
$this->parsedData .= $data;
}
$this->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
$this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
+
return Status::newGood();
}
if ( $status->isOK() ) {
$this->db = $status->value;
}
+
return $status;
}
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
}
+
return $status;
}
$conn->commit( __METHOD__ );
$this->pgConns[$type] = $conn;
}
+
return $status;
}
$safeRole = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
$conn->query( "SET ROLE $safeRole" );
}
+
return $status;
default:
throw new MWException( "Invalid special connection type: \"$type\"" );
$row = $conn->selectRow( '"pg_catalog"."pg_roles"', '*',
array( 'rolname' => $superuser ), __METHOD__ );
+
return $row;
}
if ( !$perms ) {
return false;
}
+
return $perms->rolsuper === 't' || $perms->rolcreaterole === 't';
}
if ( !$perms ) {
return false;
}
+
return $perms->rolsuper === 't';
}
} else {
$msg = 'config-install-user-missing';
}
+
return Status::newFatal( $msg, $this->getVar( 'wgDBuser' ) );
}
}
}
}
+
return false;
}
$safedb = $conn->addIdentifierQuotes( $dbName );
$conn->query( "CREATE DATABASE $safedb", __METHOD__ );
}
+
return Status::newGood();
}
// Select the new schema in the current connection
$conn->determineCoreSchema( $schema );
+
return Status::newGood();
}
function commitChanges() {
$this->db->commit( __METHOD__ );
+
return Status::newGood();
}
function getLocalSettings() {
$port = $this->getVar( 'wgDBport' );
$schema = $this->getVar( 'wgDBmwschema' );
- return
-"# Postgres specific settings
+
+ return "# Postgres specific settings
\$wgDBport = \"{$port}\";
\$wgDBmwschema = \"{$schema}\";";
}
if ( $conn->tableExists( 'archive' ) ) {
$status->warning( 'config-install-tables-exist' );
$this->enableLB();
+
return $status;
}
if ( !$conn->schemaExists( $schema ) ) {
$status->fatal( 'config-install-pg-schema-not-exist' );
+
return $status;
}
$error = $conn->sourceFile( $conn->getSchemaPath() );
if ( $status->isOk() ) {
$this->enableLB();
}
+
return $status;
}
} else {
return Status::newFatal( 'config-pg-no-plpgsql', $this->getVar( 'wgDBname' ) );
}
+
return Status::newGood();
}
}
# Add missing extension fields
foreach ( $wgExtPGNewFields as $fieldRecord ) {
$updates[] = array(
- 'addPgField', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2]
- );
+ 'addPgField', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2]
+ );
}
# Change altered columns
foreach ( $wgExtPGAlteredFields as $fieldRecord ) {
$updates[] = array(
- 'changeField', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2]
- );
+ 'changeField', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2]
+ );
}
# Add missing extension indexes
foreach ( $wgExtNewIndexes as $fieldRecord ) {
$updates[] = array(
- 'addPgExtIndex', $fieldRecord[0], $fieldRecord[1],
- $fieldRecord[2]
- );
+ 'addPgExtIndex', $fieldRecord[0], $fieldRecord[1],
+ $fieldRecord[2]
+ );
}
return $updates;
AND relname=%s AND nspname=%s
END;
$res = $this->db->query( sprintf( $q,
- $this->db->addQuotes( $table ),
- $this->db->addQuotes( $this->db->getCoreSchema() ) ) );
+ $this->db->addQuotes( $table ),
+ $this->db->addQuotes( $this->db->getCoreSchema() ) ) );
if ( !$res ) {
return null;
}
$cols = array();
foreach ( $res as $r ) {
$cols[] = array(
- "name" => $r[0],
- "ord" => $r[1],
- );
+ "name" => $r[0],
+ "ord" => $r[1],
+ );
}
+
return $cols;
}
if ( !( $row = $this->db->fetchRow( $r ) ) ) {
return null;
}
+
return $row[0];
}
function ruleDef( $table, $rule ) {
- $q = <<<END
+ $q = <<<END
SELECT definition FROM pg_rules
WHERE schemaname = %s
AND tablename = %s
return null;
}
$d = $row[0];
+
return $d;
}
protected function renameSequence( $old, $new ) {
if ( $this->db->sequenceExists( $new ) ) {
$this->output( "...sequence $new already exists.\n" );
+
return;
}
if ( $this->db->sequenceExists( $old ) ) {
// First requirement: the table must exist
if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "...skipping: '$table' table doesn't exist yet.\n" );
+
return;
}
if ( $this->db->indexExists( $table, $new, __METHOD__ ) ) {
$this->output( "...index $new already set on $table table.\n" );
if ( !$skipBothIndexExistWarning
- && $this->db->indexExists( $table, $old, __METHOD__ ) )
- {
+ && $this->db->indexExists( $table, $old, __METHOD__ )
+ ) {
$this->output( "...WARNING: $old still exists, despite it has been renamed into $new (which also exists).\n" .
" $old should be manually removed if not needed anymore.\n" );
}
+
return;
}
// Third requirement: the old index must exist
if ( !$this->db->indexExists( $table, $old, __METHOD__ ) ) {
$this->output( "...skipping: index $old doesn't exist.\n" );
+
return;
}
$fi = $this->db->fieldInfo( $table, $field );
if ( !is_null( $fi ) ) {
$this->output( "...column '$table.$field' already exists\n" );
+
return;
} else {
$this->output( "Adding column '$table.$field'\n" );
if ( 'NULL' === $null ) {
$this->output( "Changing '$table.$field' to allow NULLs\n" );
$this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" );
- }
- else {
+ } else {
$this->output( "...column '$table.$field' is already set as NOT NULL\n" );
}
}
$fi = $this->db->fieldInfo( $table, $field );
if ( is_null( $fi ) ) {
$this->output( "WARNING! Column '$table.$field' does not exist but it should! Please report this.\n" );
+
return;
}
if ( $fi->is_deferred() && $fi->is_deferrable() ) {
if ( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
$result->warning( 'config-no-fts3' );
}
+
return $result;
}
DIRECTORY_SEPARATOR,
dirname( $_SERVER['DOCUMENT_ROOT'] ) . '/data'
);
+
return array( 'wgSQLiteDataDir' => $path );
} else {
return array();
if ( !$result ) {
return $path;
}
+
return $result;
}
}
# Table prefix is not used on SQLite, keep it empty
$this->setVar( 'wgDBprefix', '' );
+
return $result;
}
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-sqlite-connection-error', $e->getMessage() );
}
+
return $status;
}
$this->setVar( 'wgDBuser', '' );
$this->setVar( 'wgDBpassword', '' );
$this->setupSchemaVars();
+
return $this->getConnection();
}
*/
public function createTables() {
$status = parent::createTables();
+
return $this->setupSearchIndex( $status );
}
} elseif ( !$fts3tTable && $module == 'FTS3' ) {
$this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-fts3.sql" );
}
+
return $status;
}
*/
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
- return
-"# SQLite-specific settings
+
+ return "# SQLite-specific settings
\$wgSQLiteDataDir = \"{$dir}\";";
}
}
// initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name', __METHOD__ ) ) {
$this->output( "...have initial indexes\n" );
+
return;
}
$this->applyPatch( 'initial-indexes.sql', false, "Adding initial indexes" );
protected function doEnableProfiling() {
global $wgProfileToDatabase;
- if ( $wgProfileToDatabase === true && ! $this->db->tableExists( 'profiling', __METHOD__ ) ) {
+ if ( $wgProfileToDatabase === true && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
$this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
}
}
$this->setupLanguage();
if ( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
- && $this->request->getVal( 'localsettings' ) )
- {
+ && $this->request->getVal( 'localsettings' )
+ ) {
$this->request->response()->header( 'Content-type: application/x-httpd-php' );
$this->request->response()->header(
'Content-Disposition: attachment; filename="LocalSettings.php"'
$ls->setGroupRights( $group, $rightsArr );
}
echo $ls->getText();
+
return $this->session;
}
$cssDir = ( $cssDir == 'rtl' ? 'rtl' : 'ltr' );
$this->request->response()->header( 'Content-type: text/css' );
echo $this->output->getCSS( $cssDir );
+
return $this->session;
}
$this->output->useShortHeader();
$this->output->allowFrames();
$page->submitCC();
+
return $this->finish();
}
$this->output->useShortHeader();
$this->output->allowFrames();
$this->output->addHTML( $page->getCCDoneBox() );
+
return $this->finish();
}
}
$this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
+
return $this->finish();
}
if ( $this->phpErrors ) {
$this->showError( 'config-session-error', $this->phpErrors[0] );
+
return false;
}
// the /mw-config/index.php. Kinda scary though?
$url = $m[1];
}
+
return md5( serialize( array(
'local path' => dirname( __DIR__ ),
'url' => $url,
*/
private function endPageWrapper() {
$this->output->addHTMLNoFlush(
- "<div class=\"visualClear\"></div>\n" .
- "</div>\n" .
- "<div class=\"visualClear\"></div>\n" .
+ "<div class=\"visualClear\"></div>\n" .
+ "</div>\n" .
+ "<div class=\"visualClear\"></div>\n" .
"</div>" );
}
$text = $this->parse( $text, true );
$icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/' . $icon;
$alt = wfMessage( 'config-information' )->text();
+
return Html::infoBox( $text, $icon, $alt, $class, false );
}
$args = func_get_args();
array_shift( $args );
$html = '<div class="config-message">' .
- $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) .
+ $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) .
"</div>\n";
$this->output->addHTML( $html );
}
" <div class=\"config-block-label\">\n" .
Xml::tags( 'label',
$attributes,
- $labelText ) . "\n" .
- $helpData .
+ $labelText
+ ) . "\n" .
+ $helpData .
" </div>\n" .
" <div class=\"config-block-elements\">\n" .
- $contents .
+ $contents .
" </div>\n" .
"</div>\n";
}
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
}
+
return $this->label(
- $params['label'],
+ $params['label'],
+ $params['controlName'],
+ Xml::input(
$params['controlName'],
- Xml::input(
- $params['controlName'],
- 30, // intended to be overridden by CSS
- $params['value'],
- $params['attribs'] + array(
- 'id' => $params['controlName'],
- 'class' => 'config-input-text',
- 'tabindex' => $this->nextTabIndex()
- )
- ),
- $params['help']
- );
+ 30, // intended to be overridden by CSS
+ $params['value'],
+ $params['attribs'] + array(
+ 'id' => $params['controlName'],
+ 'class' => 'config-input-text',
+ 'tabindex' => $this->nextTabIndex()
+ )
+ ),
+ $params['help']
+ );
}
/**
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
}
+
return $this->label(
- $params['label'],
+ $params['label'],
+ $params['controlName'],
+ Xml::textarea(
$params['controlName'],
- Xml::textarea(
- $params['controlName'],
- $params['value'],
- 30,
- 5,
- $params['attribs'] + array(
- 'id' => $params['controlName'],
- 'class' => 'config-input-text',
- 'tabindex' => $this->nextTabIndex()
- )
- ),
- $params['help']
- );
+ $params['value'],
+ 30,
+ 5,
+ $params['attribs'] + array(
+ 'id' => $params['controlName'],
+ 'class' => 'config-input-text',
+ 'tabindex' => $this->nextTabIndex()
+ )
+ ),
+ $params['help']
+ );
}
/**
* Implements password hiding
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
* itemLabelPrefix: The message name prefix for the item labels (required)
- * values: List of allowed values (required)
- * itemAttribs Array of attribute arrays, outer key is the value name (optional)
- * commonAttribs Attribute array applied to all items
- * controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * values: List of allowed values (required)
+ * itemAttribs: Array of attribute arrays, outer key is the value name (optional)
+ * commonAttribs: Attribute array applied to all items
+ * controlName: The name for the input element (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
*/
public function docLink( $linkText, $attribs, $parser ) {
$url = $this->getDocUrl( $attribs['href'] );
+
return '<a href="' . htmlspecialchars( $url ) . '">' .
htmlspecialchars( $linkText ) .
'</a>';
$anchor = Html::rawElement( 'a',
array( 'href' => $this->getURL( array( 'localsettings' => 1 ) ) ),
$img . ' ' . wfMessage( 'config-download-localsettings' )->parse() );
+
return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor );
}
$this->setVar( 'wgScriptPath', $uri );
} else {
$this->showError( 'config-no-uri' );
+
return false;
}
+
return parent::envCheckPath();
}
*/
public function getDir() {
global $wgLang;
+
return is_object( $wgLang ) ? $wgLang->getDir() : 'ltr';
}
*/
public function getLanguageCode() {
global $wgLang;
+
return is_object( $wgLang ) ? $wgLang->getCode() : 'en';
}
}
if ( $this->redirectTarget ) {
$this->parent->request->response()->header( 'Location: ' . $this->redirectTarget );
+
return;
}
if ( $this->useShortHeader ) {
$this->outputShortHeader();
+
return;
}
-
?>
<?php echo Html::htmlHeader( $this->getHeadAttribs() ); ?>
<head>
if ( $continue ) {
// Fake submit button for enter keypress (bug 26267)
// Messages: config-continue, config-restart, config-regenerate
- $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(),
- array( 'name' => "enter-$continue", 'style' =>
- 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n";
+ $s .= Xml::submitButton(
+ wfMessage( "config-$continue" )->text(),
+ array(
+ 'name' => "enter-$continue",
+ 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0'
+ )
+ ) . "\n";
}
if ( $back ) {
// Message: config-back
- $s .= Xml::submitButton( wfMessage( "config-$back" )->text(),
+ $s .= Xml::submitButton(
+ wfMessage( "config-$back" )->text(),
array(
'name' => "submit-$back",
'tabindex' => $this->parent->nextTabIndex()
- ) ) . "\n";
+ )
+ ) . "\n";
}
if ( $continue ) {
// Messages: config-continue, config-restart, config-regenerate
- $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(),
+ $s .= Xml::submitButton(
+ wfMessage( "config-$continue" )->text(),
array(
'name' => "submit-$continue",
'tabindex' => $this->parent->nextTabIndex(),
- ) ) . "\n";
+ )
+ ) . "\n";
}
$s .= "</div></form></div>\n";
if ( isset( $languages[$contLang] ) ) {
$this->setVar( 'wgLanguageCode', $contLang );
}
+
return 'continue';
}
} elseif ( $this->parent->showSessionWarning ) {
$s .= "\n" . Xml::option( "$code - $lang", $code, $code == $selectedCode );
}
$s .= "\n</select>\n";
+
return $this->parent->label( $label, $name, $s );
}
-
}
class WebInstaller_ExistingWiki extends WebInstallerPage {
// Check if the upgrade key supplied to the user has appeared in LocalSettings.php
if ( $vars['wgUpgradeKey'] !== false
&& $this->getVar( '_UpgradeKeySupplied' )
- && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey'] )
- {
+ && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey']
+ ) {
// It's there, so the user is authorized
$status = $this->handleExistingUpgrade( $vars );
if ( $status->isOK() ) {
$this->startForm();
$this->parent->showStatusBox( $status );
$this->endForm( 'continue' );
+
return 'output';
}
}
$this->getVar( 'wgUpgradeKey' ) . "';</pre>" )->plain()
) );
$this->endForm( 'continue' );
+
return 'output';
}
if ( !$key || $key !== $vars['wgUpgradeKey'] ) {
$this->parent->showError( 'config-localsettings-badkey' );
$this->showKeyForm();
+
return 'output';
}
// Key was OK
} else {
$this->parent->showStatusBox( $status );
$this->showKeyForm();
+
return 'output';
}
} else {
$this->showKeyForm();
+
return 'output';
}
}
}
$this->setVar( $name, $vars[$name] );
}
+
return $status;
}
protected function handleExistingUpgrade( $vars ) {
// Check $wgDBtype
if ( !isset( $vars['wgDBtype'] ) ||
- !in_array( $vars['wgDBtype'], Installer::getDBTypes() ) ) {
+ !in_array( $vars['wgDBtype'], Installer::getDBTypes() )
+ ) {
return Status::newFatal( 'config-localsettings-connection-error', '' );
}
// Adjust the error message to explain things correctly
$status->replaceMessage( 'config-connection-error',
'config-localsettings-connection-error' );
+
return $status;
}
// All good
$this->setVar( '_ExistingDBSettings', true );
+
return $status;
}
}
} else {
$this->parent->showStatusMessage( $status );
}
+
return '';
}
-
}
class WebInstaller_DBConnect extends WebInstallerPage {
if ( $status->isGood() ) {
$this->setVar( '_UpgradeDone', false );
+
return 'continue';
} else {
$this->parent->showStatusBox( $status );
// Messages: config-header-mysql, config-header-postgres, config-header-oracle,
// config-header-sqlite
- $settings .=
- Html::openElement( 'div', array( 'id' => 'DB_wrapper_' . $type,
- 'class' => 'dbWrapper' ) ) .
+ $settings .= Html::openElement(
+ 'div',
+ array(
+ 'id' => 'DB_wrapper_' . $type,
+ 'class' => 'dbWrapper'
+ )
+ ) .
Html::element( 'h3', array(), wfMessage( 'config-header-' . $type )->text() ) .
$installer->getConnectForm() .
"</div>\n";
}
- $types .= "</ul><br style=\"clear: left\"/>\n";
- $this->addHTML(
- $this->parent->label( 'config-db-type', false, $types ) .
- $settings
- );
+ $types .= "</ul><br style=\"clear: left\"/>\n";
+ $this->addHTML( $this->parent->label( 'config-db-type', false, $types ) . $settings );
$this->endForm();
}
if ( !$installer ) {
return Status::newFatal( 'config-invalid-db-type' );
}
+
return $installer->submitConnectForm();
}
-
}
class WebInstaller_Upgrade extends WebInstallerPage {
// Show the done message again
// Make them click back again if they want to do the upgrade again
$this->showDoneMessage();
+
return 'output';
}
}
}
$this->setVar( '_UpgradeDone', true );
$this->showDoneMessage();
+
return 'output';
}
}
$this->parent->getInfoBox(
wfMessage( $msg,
$this->getVar( 'wgServer' ) .
- $this->getVar( 'wgScriptPath' ) . '/index' .
- $this->getVar( 'wgScriptExtension' )
+ $this->getVar( 'wgScriptPath' ) . '/index' .
+ $this->getVar( 'wgScriptExtension' )
)->plain(), 'tick-32.png'
)
);
$this->parent->restoreLinkPopups();
$this->endForm( $regenerate ? 'regenerate' : false, false );
}
-
}
class WebInstaller_DBSettings extends WebInstallerPage {
$this->addHTML( $form );
$this->endForm();
}
-
}
class WebInstaller_Name extends WebInstallerPage {
$this->setVar( 'wgMetaNamespace', $metaNS );
$this->endForm();
+
return 'output';
}
return $retVal;
}
-
}
class WebInstaller_Options extends WebInstallerPage {
}
$extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
- $this->getFieldSetEnd();
+ $this->getFieldSetEnd();
$this->addHTML( $extHtml );
}
'lang' => $this->getVar( '_UserLang' ),
'stylesheet' => $styleUrl,
) );
+
return $iframeUrl;
}
// If you change this height, also change it in config.css
$expandJs = str_replace( '$1', '54em', $js );
$reduceJs = str_replace( '$1', '70px', $js );
+
return '<p>' .
Html::element( 'img', array( 'src' => $this->getVar( 'wgRightsIcon' ) ) ) .
'  ' .
array( 'wgRightsUrl', 'wgRightsText', 'wgRightsIcon' ) );
if ( count( $newValues ) != 3 ) {
$this->parent->showError( 'config-cc-error' );
+
return;
}
$this->setVar( '_CCDone', true );
'wgUseInstantCommons' ) );
if ( !in_array( $this->getVar( '_RightsProfile' ),
- array_keys( $this->parent->rightsProfiles ) ) )
- {
+ array_keys( $this->parent->rightsProfiles ) )
+ ) {
reset( $this->parent->rightsProfiles );
$this->setVar( '_RightsProfile', key( $this->parent->rightsProfiles ) );
}
if ( $code == 'cc-choose' ) {
if ( !$this->getVar( '_CCDone' ) ) {
$this->parent->showError( 'config-cc-not-chosen' );
+
return false;
}
} elseif ( in_array( $code, array_keys( $this->parent->licenses ) ) ) {
$memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) );
if ( !$memcServers ) {
$this->parent->showError( 'config-memcache-needservers' );
+
return false;
}
foreach ( $memcServers as $server ) {
$memcParts = explode( ":", $server, 2 );
if ( !isset( $memcParts[0] )
- || ( !IP::isValid( $memcParts[0] )
- && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) ) ) {
+ || ( !IP::isValid( $memcParts[0] )
+ && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) )
+ ) {
$this->parent->showError( 'config-memcache-badip', $memcParts[0] );
+
return false;
} elseif ( !isset( $memcParts[1] ) ) {
$this->parent->showError( 'config-memcache-noport', $memcParts[0] );
+
return false;
} elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
$this->parent->showError( 'config-memcache-badport', 1, 65535 );
+
return false;
}
}
}
+
return true;
}
-
}
class WebInstaller_Install extends WebInstallerPage {
$this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) );
$this->endForm();
}
+
return true;
}
$this->parent->showStatusBox( $status );
}
}
-
}
class WebInstaller_Complete extends WebInstallerPage {
// to download the file
$lsUrl = $this->getVar( 'wgServer' ) . $this->parent->getURL( array( 'localsettings' => 1 ) );
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
- strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) {
+ strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false
+ ) {
// JS appears to be the only method that works consistently with IE7+
$this->addHtml( "\n<script>jQuery( function () { document.location = " .
- Xml::encodeJsVar( $lsUrl ) . "; } );</script>\n" );
+ Xml::encodeJsVar( $lsUrl ) . "; } );</script>\n" );
} else {
$this->parent->request->response()->header( "Refresh: 0;url=$lsUrl" );
}
wfMessage( 'config-install-done',
$lsUrl,
$this->getVar( 'wgServer' ) .
- $this->getVar( 'wgScriptPath' ) . '/index' .
- $this->getVar( 'wgScriptExtension' ),
+ $this->getVar( 'wgScriptPath' ) . '/index' .
+ $this->getVar( 'wgScriptExtension' ),
'<downloadlink/>'
)->plain(), 'tick-32.png'
)
if ( $really ) {
$this->parent->reset();
}
+
return 'continue';
}
$this->addHTML( $s );
$this->endForm( 'restart' );
}
-
}
abstract class WebInstaller_Document extends WebInstallerPage {
public function getFileContents() {
$file = __DIR__ . '/../../' . $this->getFileName();
- if ( ! file_exists( $file ) ) {
+ if ( !file_exists( $file ) ) {
return wfMessage( 'config-nofile', $file )->plain();
}
+
return file_get_contents( $file );
}
-
}
class WebInstaller_Readme extends WebInstaller_Document {