From ee31d378211184b783ca68f38cd6307e3fc4eb34 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 20 Apr 2013 23:11:46 +0200 Subject: [PATCH] Fixed spacing in context/installer/media/templates/upload folder Added spaces before if, foreach Added some braces for one line statements Change-Id: I9761be9fa47adc3554852a97b19792b4648466ad --- includes/context/RequestContext.php | 6 +- includes/installer/CliInstaller.php | 2 +- includes/installer/DatabaseInstaller.php | 16 +- includes/installer/Installer.php | 64 ++++---- includes/installer/LocalSettingsGenerator.php | 24 +-- includes/installer/MysqlInstaller.php | 22 +-- includes/installer/MysqlUpdater.php | 18 +-- includes/installer/PostgresInstaller.php | 12 +- includes/installer/PostgresUpdater.php | 24 +-- includes/installer/SqliteInstaller.php | 2 +- includes/installer/WebInstaller.php | 18 +-- includes/installer/WebInstallerOutput.php | 2 +- includes/installer/WebInstallerPage.php | 52 +++---- includes/media/BMP.php | 2 +- includes/media/Bitmap.php | 2 +- includes/media/BitmapMetadataHandler.php | 6 +- includes/media/DjVu.php | 11 +- includes/media/DjVuImage.php | 42 +++--- includes/media/Exif.php | 15 +- includes/media/FormatMetadata.php | 23 +-- includes/media/GIF.php | 2 +- includes/media/GIFMetadataExtractor.php | 38 +++-- includes/media/ImageHandler.php | 6 +- includes/media/Jpeg.php | 2 +- includes/media/JpegMetadataExtractor.php | 14 +- includes/media/MediaHandler.php | 57 ++++++-- includes/media/MediaTransformOutput.php | 4 +- includes/media/PNG.php | 7 +- includes/media/PNGMetadataExtractor.php | 2 +- includes/media/SVG.php | 4 +- includes/media/SVGMetadataExtractor.php | 46 +++--- includes/media/XCF.php | 4 +- includes/media/XMP.php | 12 +- includes/media/XMPInfo.php | 2 +- includes/templates/Usercreate.php | 57 ++++---- includes/templates/Userlogin.php | 20 +-- includes/templates/UserloginVForm.php | 40 ++--- includes/upload/UploadBase.php | 137 +++++++++--------- includes/upload/UploadFromChunks.php | 16 +- includes/upload/UploadFromFile.php | 2 +- includes/upload/UploadFromStash.php | 6 +- includes/upload/UploadFromUrl.php | 4 +- includes/upload/UploadStash.php | 4 +- 43 files changed, 457 insertions(+), 392 deletions(-) diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 6aefc98edd..fd99caf2ae 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -401,10 +401,10 @@ class RequestContext implements IContextSource { */ public function exportSession() { return array( - 'ip' => $this->getRequest()->getIP(), - 'headers' => $this->getRequest()->getAllHeaders(), + 'ip' => $this->getRequest()->getIP(), + 'headers' => $this->getRequest()->getAllHeaders(), 'sessionId' => session_id(), - 'userId' => $this->getUser()->getId() + 'userId' => $this->getUser()->getId() ); } diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index bb7e8776f3..e3bcb6f1f4 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -114,7 +114,7 @@ class CliInstaller extends Installer { */ public function execute() { $vars = Installer::getExistingLocalSettings(); - if( $vars ) { + if ( $vars ) { $this->showStatusMessage( Status::newFatal( "config-localsettings-cli-upgrade" ) ); diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index cd14e4e46f..13d5d425e0 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -173,7 +173,7 @@ abstract class DatabaseInstaller { } $this->db->selectDB( $this->getVar( 'wgDBname' ) ); - if( $this->db->tableExists( 'archive', __METHOD__ ) ) { + if ( $this->db->tableExists( 'archive', __METHOD__ ) ) { $status->warning( 'config-install-tables-exist' ); $this->enableLB(); return $status; @@ -183,7 +183,7 @@ abstract class DatabaseInstaller { $this->db->begin( __METHOD__ ); $error = $this->db->sourceFile( $this->db->getSchemaPath() ); - if( $error !== true ) { + if ( $error !== true ) { $this->db->reportQueryError( $error, 0, '', __METHOD__ ); $this->db->rollback( __METHOD__ ); $status->fatal( 'config-install-tables-failed', $error ); @@ -191,7 +191,7 @@ abstract class DatabaseInstaller { $this->db->commit( __METHOD__ ); } // Resume normal operations - if( $status->isOk() ) { + if ( $status->isOk() ) { $this->enableLB(); } return $status; @@ -569,7 +569,7 @@ abstract class DatabaseInstaller { $this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) ); } - if( $this->getVar( '_CreateDBAccount' ) && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) { + if ( $this->getVar( '_CreateDBAccount' ) && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) { return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) ); } @@ -588,7 +588,7 @@ abstract class DatabaseInstaller { } $this->db->selectDB( $this->getVar( 'wgDBname' ) ); - if( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) { + if ( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) { $status->warning( 'config-install-interwiki-exists' ); return $status; } @@ -601,9 +601,11 @@ abstract class DatabaseInstaller { if ( !$rows ) { return Status::newFatal( 'config-install-interwiki-list' ); } - foreach( $rows as $row ) { + foreach ( $rows as $row ) { $row = preg_replace( '/^\s*([^#]*?)\s*(#.*)?$/', '\\1', $row ); // strip comments - whee - if ( $row == "" ) continue; + if ( $row == "" ) { + continue; + } $row .= "||"; $interwikis[] = array_combine( array( 'iw_prefix', 'iw_url', 'iw_local', 'iw_api', 'iw_wikiid' ), diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 6a7970b031..35a546c843 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -401,7 +401,7 @@ abstract class Installer { */ public function doEnvironmentChecks() { $phpVersion = phpversion(); - if( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) { + if ( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) { $this->showMessage( 'config-env-php', $phpVersion ); $good = true; } else { @@ -409,7 +409,7 @@ abstract class Installer { $good = false; } - if( $good ) { + if ( $good ) { foreach ( $this->envChecks as $check ) { $status = $this->$check(); if ( $status === false ) { @@ -486,7 +486,7 @@ abstract class Installer { $_lsExists = file_exists( "$IP/LocalSettings.php" ); wfRestoreWarnings(); - if( !$_lsExists ) { + if ( !$_lsExists ) { return false; } unset( $_lsExists ); @@ -684,7 +684,7 @@ abstract class Installer { * Environment check for register_globals. */ protected function envCheckRegisterGlobals() { - if( wfIniGetBool( 'register_globals' ) ) { + if ( wfIniGetBool( 'register_globals' ) ) { $this->showMessage( 'config-register-globals' ); } } @@ -722,7 +722,7 @@ abstract class Installer { * @return bool */ protected function envCheckMagicQuotes() { - if( wfIniGetBool( "magic_quotes_runtime" ) ) { + if ( wfIniGetBool( "magic_quotes_runtime" ) ) { $this->showError( 'config-magic-quotes-runtime' ); return false; } @@ -830,10 +830,10 @@ abstract class Installer { $n = wfShorthandToInteger( $limit ); - if( $n < $this->minMemorySize * 1024 * 1024 ) { + if ( $n < $this->minMemorySize * 1024 * 1024 ) { $newLimit = "{$this->minMemorySize}M"; - if( ini_set( "memory_limit", $newLimit ) === false ) { + if ( ini_set( "memory_limit", $newLimit ) === false ) { $this->showMessage( 'config-memory-bad', $limit ); } else { $this->showMessage( 'config-memory-raised', $limit, $newLimit ); @@ -1082,7 +1082,7 @@ abstract class Installer { protected function envCheckSuhosinMaxValueLength() { $maxValueLength = ini_get( 'suhosin.get.max_value_length' ); if ( $maxValueLength > 0 ) { - if( $maxValueLength < 1024 ) { + if ( $maxValueLength < 1024 ) { # Only warn if the value is below the sane 1024 $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength ); } @@ -1140,14 +1140,14 @@ abstract class Installer { * We're going to prefer the pecl extension here unless * utf8_normalize is more up to date. */ - if( $utf8 ) { + if ( $utf8 ) { $useNormalizer = 'utf8'; $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC ); if ( $utf8 !== $normal_c ) { $needsUpdate = true; } } - if( $intl ) { + if ( $intl ) { $useNormalizer = 'intl'; $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C ); if ( $intl !== $normal_c ) { @@ -1156,11 +1156,11 @@ abstract class Installer { } // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl' - if( $useNormalizer === 'php' ) { + if ( $useNormalizer === 'php' ) { $this->showMessage( 'config-unicode-pure-php-warning' ); } else { $this->showMessage( 'config-unicode-using-' . $useNormalizer ); - if( $needsUpdate ) { + if ( $needsUpdate ) { $this->showMessage( 'config-unicode-update-warning' ); } } @@ -1243,9 +1243,9 @@ abstract class Installer { * @return bool|string */ public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) { - foreach( self::getPossibleBinPaths() as $path ) { + foreach ( self::getPossibleBinPaths() as $path ) { $exe = self::locateExecutable( $path, $names, $versionInfo ); - if( $exe !== false ) { + if ( $exe !== false ) { return $exe; } } @@ -1344,7 +1344,7 @@ abstract class Installer { * @return array */ public function findExtensions() { - if( $this->getVar( 'IP' ) === null ) { + if ( $this->getVar( 'IP' ) === null ) { return array(); } @@ -1356,10 +1356,10 @@ abstract class Installer { $dh = opendir( $extDir ); $exts = array(); while ( ( $file = readdir( $dh ) ) !== false ) { - if( !is_dir( "$extDir/$file" ) ) { + if ( !is_dir( "$extDir/$file" ) ) { continue; } - if( file_exists( "$extDir/$file/$file.php" ) ) { + if ( file_exists( "$extDir/$file/$file.php" ) ) { $exts[] = $file; } } @@ -1392,7 +1392,7 @@ abstract class Installer { require( "$IP/includes/DefaultSettings.php" ); - foreach( $exts as $e ) { + foreach ( $exts as $e ) { require_once( "$IP/extensions/$e/$e.php" ); } @@ -1431,9 +1431,9 @@ abstract class Installer { // Build the array of install steps starting from the core install list, // then adding any callbacks that wanted to attach after a given step - foreach( $coreInstallSteps as $step ) { + foreach ( $coreInstallSteps as $step ) { $this->installSteps[] = $step; - if( isset( $this->extraInstallSteps[$step['name']] ) ) { + if ( isset( $this->extraInstallSteps[$step['name']] ) ) { $this->installSteps = array_merge( $this->installSteps, $this->extraInstallSteps[$step['name']] @@ -1442,7 +1442,7 @@ abstract class Installer { } // Prepend any steps that want to be at the beginning - if( isset( $this->extraInstallSteps['BEGINNING'] ) ) { + if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) { $this->installSteps = array_merge( $this->extraInstallSteps['BEGINNING'], $this->installSteps @@ -1450,7 +1450,7 @@ abstract class Installer { } // Extensions should always go first, chance to tie into hooks and such - if( count( $this->getVar( '_Extensions' ) ) ) { + if ( count( $this->getVar( '_Extensions' ) ) ) { array_unshift( $this->installSteps, array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) ) ); @@ -1475,7 +1475,7 @@ abstract class Installer { $installer = $this->getDBInstaller(); $installer->preInstall(); $steps = $this->getInstallSteps( $installer ); - foreach( $steps as $stepObj ) { + foreach ( $steps as $stepObj ) { $name = $stepObj['name']; call_user_func_array( $startCB, array( $name ) ); @@ -1488,11 +1488,11 @@ abstract class Installer { // If we've hit some sort of fatal, we need to bail. // Callback already had a chance to do output above. - if( !$status->isOk() ) { + if ( !$status->isOk() ) { break; } } - if( $status->isOk() ) { + if ( $status->isOk() ) { $this->setVar( '_InstallDone', true ); } return $installResults; @@ -1566,7 +1566,7 @@ abstract class Installer { $user->addGroup( 'sysop' ); $user->addGroup( 'bureaucrat' ); - if( $this->getVar( '_AdminEmail' ) ) { + if ( $this->getVar( '_AdminEmail' ) ) { $user->setEmail( $this->getVar( '_AdminEmail' ) ); } $user->saveSettings(); @@ -1577,7 +1577,7 @@ abstract class Installer { } $status = Status::newGood(); - if( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) { + if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) { $this->subscribeToMediaWikiAnnounce( $status ); } @@ -1589,23 +1589,23 @@ abstract class Installer { */ private function subscribeToMediaWikiAnnounce( Status $s ) { $params = array( - 'email' => $this->getVar( '_AdminEmail' ), + 'email' => $this->getVar( '_AdminEmail' ), 'language' => 'en', - 'digest' => 0 + 'digest' => 0 ); // Mailman doesn't support as many languages as we do, so check to make // sure their selected language is available $myLang = $this->getVar( '_UserLang' ); - if( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) { + if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) { $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR $params['language'] = $myLang; } - if( MWHttpRequest::canMakeRequests() ) { + if ( MWHttpRequest::canMakeRequests() ) { $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl, array( 'method' => 'POST', 'postData' => $params ) )->execute(); - if( !$res->isOK() ) { + if ( !$res->isOK() ) { $s->warning( 'config-install-subscribe-fail', $res->getMessage() ); } } else { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index c9ebc7e0b9..d3dfc833f6 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -73,10 +73,10 @@ class LocalSettingsGenerator { 'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons' ); - foreach( $confItems as $c ) { + foreach ( $confItems as $c ) { $val = $installer->getVar( $c ); - if( in_array( $c, $boolItems ) ) { + if ( in_array( $c, $boolItems ) ) { $val = wfBoolToStr( $val ); } @@ -136,13 +136,13 @@ class LocalSettingsGenerator { public function getText() { $localSettings = $this->getDefaultText(); - if( count( $this->extensions ) ) { + if ( count( $this->extensions ) ) { $localSettings .= " # Enabled Extensions. Most extensions are enabled by including the base extension file here # but check specific extension documentation for more details # The following extensions were automatically enabled:\n"; - foreach( $this->extensions as $extName ) { + foreach ( $this->extensions as $extName ) { $encExtName = self::escapePhpString( $extName ); $localSettings .= "require_once( \"\$IP/extensions/$encExtName/$encExtName.php\" );\n"; } @@ -169,13 +169,13 @@ class LocalSettingsGenerator { protected function buildMemcachedServerList() { $servers = $this->values['_MemCachedServers']; - if( !$servers ) { + if ( !$servers ) { return 'array()'; } else { $ret = 'array( '; $servers = explode( ',', $servers ); - foreach( $servers as $srv ) { + foreach ( $servers as $srv ) { $srv = trim( $srv ); $ret .= "'$srv', "; } @@ -188,14 +188,14 @@ class LocalSettingsGenerator { * @return String */ protected function getDefaultText() { - if( !$this->values['wgImageMagickConvertCommand'] ) { + if ( !$this->values['wgImageMagickConvertCommand'] ) { $this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert'; $magic = '#'; } else { $magic = ''; } - if( !$this->values['wgShellLocale'] ) { + if ( !$this->values['wgShellLocale'] ) { $this->values['wgShellLocale'] = 'en_US.UTF-8'; $locale = '#'; } else { @@ -205,16 +205,16 @@ class LocalSettingsGenerator { //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused! $hashedUploads = $this->safeMode ? '' : '#'; $metaNamespace = ''; - if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) { + if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) { $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n"; } $groupRights = ''; - if( $this->groupPermissions ) { + if ( $this->groupPermissions ) { $groupRights .= "# The following permissions were set based on your choice in the installer\n"; - foreach( $this->groupPermissions as $group => $rightArr ) { + foreach ( $this->groupPermissions as $group => $rightArr ) { $group = self::escapePhpString( $group ); - foreach( $rightArr as $right => $perm ) { + foreach ( $rightArr as $right => $perm ) { $right = self::escapePhpString( $right ); $groupRights .= "\$wgGroupPermissions['$group']['$right'] = " . wfBoolToStr( $perm ) . ";\n"; diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 72514f2350..d5509096e7 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -353,7 +353,7 @@ class MysqlInstaller extends DatabaseInstaller { $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() ); $s .= Xml::closeElement( 'div' ); - if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) { + if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) { $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) ); $s .= '$(\'#dbMyisamWarning\').hide();'; $s .= Xml::closeElement( 'script' ); @@ -371,10 +371,12 @@ class MysqlInstaller extends DatabaseInstaller { 'itemAttribs' => array( 'MyISAM' => array( 'class' => 'showHideRadio', - 'rel' => 'dbMyisamWarning'), + 'rel' => 'dbMyisamWarning' + ), 'InnoDB' => array( 'class' => 'hideShowRadio', - 'rel' => 'dbMyisamWarning') + 'rel' => 'dbMyisamWarning' + ) ))); $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' ); } @@ -470,7 +472,7 @@ class MysqlInstaller extends DatabaseInstaller { } $conn = $status->value; $dbName = $this->getVar( 'wgDBname' ); - if( !$conn->selectDB( $dbName ) ) { + if ( !$conn->selectDB( $dbName ) ) { $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ ); $conn->selectDB( $dbName ); } @@ -483,7 +485,7 @@ class MysqlInstaller extends DatabaseInstaller { */ public function setupUser() { $dbUser = $this->getVar( 'wgDBuser' ); - if( $dbUser == $this->getVar( '_InstallUser' ) ) { + if ( $dbUser == $this->getVar( '_InstallUser' ) ) { return Status::newGood(); } $status = $this->getConnection(); @@ -520,7 +522,7 @@ class MysqlInstaller extends DatabaseInstaller { $tryToCreate = false; } - if( $tryToCreate ) { + if ( $tryToCreate ) { $createHostList = array( $server, 'localhost', @@ -531,16 +533,16 @@ class MysqlInstaller extends DatabaseInstaller { $createHostList = array_unique( $createHostList ); $escPass = $this->db->addQuotes( $password ); - foreach( $createHostList as $host ) { + foreach ( $createHostList as $host ) { $fullName = $this->buildFullUserName( $dbUser, $host ); - if( !$this->userDefinitelyExists( $dbUser, $host ) ) { + if ( !$this->userDefinitelyExists( $dbUser, $host ) ) { try{ $this->db->begin( __METHOD__ ); $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ ); $this->db->commit( __METHOD__ ); $grantableNames[] = $fullName; } catch( DBQueryError $dqe ) { - if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) { + if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) { // User (probably) already exists $this->db->rollback( __METHOD__ ); $status->warning( 'config-install-user-alreadyexists', $dbUser ); @@ -563,7 +565,7 @@ class MysqlInstaller extends DatabaseInstaller { // Try to grant to all the users we know exist or we were able to create $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*'; - foreach( $grantableNames as $name ) { + foreach ( $grantableNames as $name ) { try { $this->db->begin( __METHOD__ ); $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ ); diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index df1f610846..1c22afb343 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -331,7 +331,7 @@ class MysqlUpdater extends DatabaseUpdater { return; } - if( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) { + if ( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) { $this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this." ); } } @@ -368,7 +368,7 @@ class MysqlUpdater extends DatabaseUpdater { $this->output( wfTimestamp( TS_DB ) ); $this->output( "......checking for duplicate entries.\n" ); - list ( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' ); + list( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' ); $rows = $this->db->query( "SELECT cur_title, cur_namespace, COUNT(cur_namespace) AS c FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", __METHOD__ ); @@ -525,12 +525,12 @@ class MysqlUpdater extends DatabaseUpdater { protected function doNamespaceSize() { $tables = array( - 'page' => 'page', - 'archive' => 'ar', + 'page' => 'page', + 'archive' => 'ar', 'recentchanges' => 'rc', - 'watchlist' => 'wl', - 'querycache' => 'qc', - 'logging' => 'log', + 'watchlist' => 'wl', + 'querycache' => 'qc', + 'logging' => 'log', ); foreach ( $tables as $table => $prefix ) { $field = $prefix . '_namespace'; @@ -651,7 +651,7 @@ class MysqlUpdater extends DatabaseUpdater { foreach ( $groups as $group ) { $this->db->insert( 'user_groups', array( - 'ug_user' => $row->ur_user, + 'ug_user' => $row->ur_user, 'ug_group' => $group ), __METHOD__ ); } @@ -686,7 +686,7 @@ class MysqlUpdater extends DatabaseUpdater { $this->db->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", __METHOD__ ); $rows = $this->db->affectedRows(); - if( $rows ) { + if ( $rows ) { $this->output( "Set page_random to a random value on $rows rows where it was set to 0\n" ); } else { $this->output( "...no page_random rows needed to be set\n" ); diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index e7ae8d5897..37471890b4 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -431,7 +431,7 @@ class PostgresInstaller extends DatabaseInstaller { 'callback' => array( $this, 'setupSchema' ) ); - if( $this->getVar( '_CreateDBAccount' ) ) { + if ( $this->getVar( '_CreateDBAccount' ) ) { $this->parent->addInstallStep( $createDbAccount, 'database' ); } $this->parent->addInstallStep( $commitCB, 'interwiki' ); @@ -469,7 +469,7 @@ class PostgresInstaller extends DatabaseInstaller { $schema = $this->getVar( 'wgDBmwschema' ); $safeschema = $conn->addIdentifierQuotes( $schema ); $safeuser = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) ); - if( !$conn->schemaExists( $schema ) ) { + if ( !$conn->schemaExists( $schema ) ) { try { $conn->query( "CREATE SCHEMA $safeschema AUTHORIZATION $safeuser" ); } catch ( DBQueryError $e ) { @@ -557,7 +557,7 @@ class PostgresInstaller extends DatabaseInstaller { */ $conn = $status->value; - if( $conn->tableExists( 'archive' ) ) { + if ( $conn->tableExists( 'archive' ) ) { $status->warning( 'config-install-tables-exist' ); $this->enableLB(); return $status; @@ -565,12 +565,12 @@ class PostgresInstaller extends DatabaseInstaller { $conn->begin( __METHOD__ ); - if( !$conn->schemaExists( $schema ) ) { + if ( !$conn->schemaExists( $schema ) ) { $status->fatal( 'config-install-pg-schema-not-exist' ); return $status; } $error = $conn->sourceFile( $conn->getSchemaPath() ); - if( $error !== true ) { + if ( $error !== true ) { $conn->reportQueryError( $error, 0, '', __METHOD__ ); $conn->rollback( __METHOD__ ); $status->fatal( 'config-install-tables-failed', $error ); @@ -578,7 +578,7 @@ class PostgresInstaller extends DatabaseInstaller { $conn->commit( __METHOD__ ); } // Resume normal operations - if( $status->isOk() ) { + if ( $status->isOk() ) { $this->enableLB(); } return $status; diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 2615fc656d..58a54c4219 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -46,9 +46,9 @@ class PostgresUpdater extends DatabaseUpdater { # r15791 Change reserved word table names "user" and "text" array( 'renameTable', 'user', 'mwuser' ), array( 'renameTable', 'text', 'pagecontent' ), - array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey'), + array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey' ), array( 'renameIndex', 'mwuser', 'user_user_name_key', 'mwuser_user_name_key' ), - array( 'renameIndex', 'pagecontent','text_pkey', 'pagecontent_pkey' ), + array( 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ), # renamed sequences array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq' ), @@ -252,9 +252,9 @@ class PostgresUpdater extends DatabaseUpdater { ), 'CREATE INDEX cl_sortkey ON "categorylinks" USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ), array( 'checkIndex', 'iwl_prefix_title_from', array( - array('iwl_prefix', 'text_ops', 'btree', 0), - array('iwl_title', 'text_ops', 'btree', 0), - array('iwl_from', 'int4_ops', 'btree', 0), + array( 'iwl_prefix', 'text_ops', 'btree', 0 ), + array( 'iwl_title', 'text_ops', 'btree', 0 ), + array( 'iwl_from', 'int4_ops', 'btree', 0 ), ), 'CREATE INDEX iwl_prefix_title_from ON "iwlinks" USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ), array( 'checkIndex', 'logging_times', array( @@ -308,11 +308,11 @@ class PostgresUpdater extends DatabaseUpdater { array( 'checkOiNameConstraint' ), array( 'checkPageDeletedTrigger' ), array( 'checkRevUserFkey' ), - array( 'dropIndex', 'ipblocks', 'ipb_address'), + array( 'dropIndex', 'ipblocks', 'ipb_address' ), array( 'checkIndex', 'ipb_address_unique', array( array( 'ipb_address', 'text_ops', 'btree', 0 ), - array( 'ipb_user', 'int4_ops', 'btree', 0 ), - array( 'ipb_auto', 'int2_ops', 'btree', 0 ), + array( 'ipb_user', 'int4_ops', 'btree', 0 ), + array( 'ipb_auto', 'int2_ops', 'btree', 0 ), array( 'ipb_anon_only', 'int2_ops', 'btree', 0 ), ), 'CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ), @@ -515,7 +515,7 @@ END; if ( !$this->db->sequenceExists( $ns ) ) { $this->output( "Creating sequence $ns\n" ); $this->db->query( "CREATE SEQUENCE $ns" ); - if( $pkey !== false ) { + if ( $pkey !== false ) { $this->setDefault( $table, $pkey, '"nextval"(\'"' . $ns . '"\'::"regclass")' ); } } @@ -538,7 +538,7 @@ END; $old = $this->db->realTableName( $old, "quoted" ); $new = $this->db->realTableName( $new, "quoted" ); $this->db->query( "ALTER TABLE $old RENAME TO $new" ); - if( $patch !== false ) { + if ( $patch !== false ) { $this->applyPatch( $patch ); } } @@ -592,9 +592,9 @@ END; exit( 1 ); } - if ( $fi->type() === $newtype ) + if ( $fi->type() === $newtype ) { $this->output( "...column '$table.$field' is already of type '$newtype'\n" ); - else { + } else { $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" ); $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; if ( strlen( $default ) ) { diff --git a/includes/installer/SqliteInstaller.php b/includes/installer/SqliteInstaller.php index 68df6ab22e..50a7181864 100644 --- a/includes/installer/SqliteInstaller.php +++ b/includes/installer/SqliteInstaller.php @@ -60,7 +60,7 @@ class SqliteInstaller extends DatabaseInstaller { $result->fatal( 'config-outdated-sqlite', $db->getServerVersion(), self::MINIMUM_VERSION ); } // Check for FTS3 full-text search module - if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) { + if ( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) { $result->warning( 'config-no-fts3' ); } return $result; diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 30aa9568a8..9c565584e9 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -154,7 +154,7 @@ class WebInstaller extends Installer { $this->exportVars(); $this->setupLanguage(); - if( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) ) + if ( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) ) && $this->request->getVal( 'localsettings' ) ) { $this->request->response()->header( 'Content-type: application/x-httpd-php' ); @@ -164,7 +164,7 @@ class WebInstaller extends Installer { $ls = InstallerOverrides::getLocalSettingsGenerator( $this ); $rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )]; - foreach( $rightsProfile as $group => $rightsArr ) { + foreach ( $rightsProfile as $group => $rightsArr ) { $ls->setGroupRights( $group, $rightsArr ); } echo $ls->getText(); @@ -172,7 +172,7 @@ class WebInstaller extends Installer { } $cssDir = $this->request->getVal( 'css' ); - if( $cssDir ) { + if ( $cssDir ) { $cssDir = ( $cssDir == 'rtl' ? 'rtl' : 'ltr' ); $this->request->response()->header( 'Content-type: text/css' ); echo $this->output->getCSS( $cssDir ); @@ -250,7 +250,7 @@ class WebInstaller extends Installer { do { $nextPageId--; $nextPage = $this->pageSequence[$nextPageId]; - } while( isset( $this->skippedPages[$nextPage] ) ); + } while ( isset( $this->skippedPages[$nextPage] ) ); } else { $nextPage = $this->pageSequence[$lowestUnhappy]; } @@ -263,7 +263,7 @@ class WebInstaller extends Installer { $this->currentPageName = $page->getName(); $this->startPageWrapper( $pageName ); - if( $page->isSlow() ) { + if ( $page->isSlow() ) { $this->disableTimeLimit(); } @@ -324,7 +324,7 @@ class WebInstaller extends Installer { * @return bool */ public function startSession() { - if( wfIniGetBool( 'session.auto_start' ) || session_id() ) { + if ( wfIniGetBool( 'session.auto_start' ) || session_id() ) { // Done already return true; } @@ -889,7 +889,7 @@ class WebInstaller extends Installer { if ( !isset( $params['help'] ) ) { $params['help'] = ""; } - if( isset( $params['rawtext'] ) ) { + if ( isset( $params['rawtext'] ) ) { $labelText = $params['rawtext']; } else { $labelText = $this->parse( wfMessage( $params['label'] )->text() ); @@ -983,10 +983,10 @@ class WebInstaller extends Installer { * @param $status Status */ public function showStatusBox( $status ) { - if( !$status->isGood() ) { + if ( !$status->isGood() ) { $text = $status->getWikiText(); - if( $status->isOk() ) { + if ( $status->isOk() ) { $box = $this->getWarningBox( $text ); } else { $box = $this->getErrorBox( $text ); diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index a6a8667f68..3e65eae350 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -146,7 +146,7 @@ class WebInstallerOutput { } wfRestoreWarnings(); - if( $dir == 'rtl' ) { + if ( $dir == 'rtl' ) { $css = CSSJanus::transform( $css, true ); } diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 3f3e50a8ef..b640fb882b 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -254,7 +254,9 @@ class WebInstaller_Language extends WebInstallerPage { $languages = Language::fetchLanguageNames(); ksort( $languages ); foreach ( $languages as $code => $lang ) { - if ( isset( $wgDummyLanguageCodes[$code] ) ) continue; + if ( isset( $wgDummyLanguageCodes[$code] ) ) { + continue; + } $s .= "\n" . Xml::option( "$code - $lang", $code, $code == $selectedCode ); } $s .= "\n\n"; @@ -310,7 +312,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { $r = $this->parent->request; if ( $r->wasPosted() ) { $key = $r->getText( 'config_wgUpgradeKey' ); - if( !$key || $key !== $vars['wgUpgradeKey'] ) { + if ( !$key || $key !== $vars['wgUpgradeKey'] ) { $this->parent->showError( 'config-localsettings-badkey' ); $this->showKeyForm(); return 'output'; @@ -458,7 +460,7 @@ class WebInstaller_DBConnect extends WebInstallerPage { // Give grep a chance to find the usages: // config-support-mysql, config-support-postgres, config-support-oracle, config-support-sqlite $dbSupport = ''; - foreach( $this->parent->getDBTypes() as $type ) { + foreach ( $this->parent->getDBTypes() as $type ) { $link = DatabaseBase::factory( $type )->getSoftwareLink(); $dbSupport .= wfMessage( "config-support-$type", $link )->plain() . "\n"; } @@ -552,7 +554,7 @@ class WebInstaller_Upgrade extends WebInstallerPage { if ( $result ) { // If they're going to possibly regenerate LocalSettings, we // need to create the upgrade/secret keys. Bug 26481 - if( !$this->getVar( '_ExistingDBSettings' ) ) { + if ( !$this->getVar( '_ExistingDBSettings' ) ) { $this->parent->generateKeys(); } $this->setVar( '_UpgradeDone', true ); @@ -764,7 +766,7 @@ class WebInstaller_Name extends WebInstallerPage { // Make sure it won't conflict with any existing namespaces global $wgContLang; $nsIndex = $wgContLang->getNsIndex( $name ); - if( $nsIndex !== false && $nsIndex !== NS_PROJECT ) { + if ( $nsIndex !== false && $nsIndex !== NS_PROJECT ) { $this->parent->showError( 'config-ns-conflict', $name ); $retVal = false; } @@ -812,13 +814,13 @@ class WebInstaller_Name extends WebInstallerPage { // Validate e-mail if provided $email = $this->getVar( '_AdminEmail' ); - if( $email && !Sanitizer::validateEmail( $email ) ) { + if ( $email && !Sanitizer::validateEmail( $email ) ) { $this->parent->showError( 'config-admin-error-bademail' ); $retVal = false; } // If they asked to subscribe to mediawiki-announce but didn't give // an e-mail, show an error. Bug 29332 - if( !$email && $this->getVar( '_Subscribe' ) ) { + if ( !$email && $this->getVar( '_Subscribe' ) ) { $this->parent->showError( 'config-subscribe-noemail' ); $retVal = false; } @@ -911,10 +913,10 @@ class WebInstaller_Options extends WebInstallerPage { $extensions = $this->parent->findExtensions(); - if( $extensions ) { + if ( $extensions ) { $extHtml = $this->getFieldSetStart( 'config-extensions' ); - foreach( $extensions as $ext ) { + foreach ( $extensions as $ext ) { $extHtml .= $this->parent->getCheckBox( array( 'var' => "ext-$ext", 'rawtext' => $ext, @@ -974,7 +976,7 @@ class WebInstaller_Options extends WebInstallerPage { ); $caches = array( 'none' ); - if( count( $this->getVar( '_Caches' ) ) ) { + if ( count( $this->getVar( '_Caches' ) ) ) { $caches[] = 'accel'; } $caches[] = 'memcached'; @@ -987,7 +989,7 @@ class WebInstaller_Options extends WebInstallerPage { // or going back! $cacheval = 'none'; } - $hidden = ($cacheval == 'memcached') ? '' : 'display: none'; + $hidden = ( $cacheval == 'memcached' ) ? '' : 'display: none'; $this->addHTML( # Advanced settings $this->getFieldSetStart( 'config-advanced-settings' ) . @@ -1054,7 +1056,7 @@ class WebInstaller_Options extends WebInstallerPage { } else { $iframeAttribs['src'] = $this->getCCPartnerUrl(); } - $wrapperStyle = ($this->getVar( '_LicenseCode' ) == 'cc-choose') ? '' : 'display: none'; + $wrapperStyle = ( $this->getVar( '_LicenseCode' ) == 'cc-choose' ) ? '' : 'display: none'; return "
\n" . Html::element( 'iframe', $iframeAttribs, '', false /* not short */ ) . @@ -1139,31 +1141,31 @@ class WebInstaller_Options extends WebInstallerPage { $extsAvailable = $this->parent->findExtensions(); $extsToInstall = array(); - foreach( $extsAvailable as $ext ) { - if( $this->parent->request->getCheck( 'config_ext-' . $ext ) ) { + foreach ( $extsAvailable as $ext ) { + if ( $this->parent->request->getCheck( 'config_ext-' . $ext ) ) { $extsToInstall[] = $ext; } } $this->parent->setVar( '_Extensions', $extsToInstall ); - if( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) { + if ( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) { $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) ); - if( !$memcServers ) { + if ( !$memcServers ) { $this->parent->showError( 'config-memcache-needservers' ); return false; } - foreach( $memcServers as $server ) { + foreach ( $memcServers as $server ) { $memcParts = explode( ":", $server, 2 ); if ( !isset( $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] ) ) { + } elseif ( !isset( $memcParts[1] ) ) { $this->parent->showError( 'config-memcache-noport', $memcParts[0] ); return false; - } elseif( $memcParts[1] < 1 || $memcParts[1] > 65535 ) { + } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) { $this->parent->showError( 'config-memcache-badport', 1, 65535 ); return false; } @@ -1180,11 +1182,11 @@ class WebInstaller_Install extends WebInstallerPage { } public function execute() { - if( $this->getVar( '_UpgradeDone' ) ) { + if ( $this->getVar( '_UpgradeDone' ) ) { return 'skip'; - } elseif( $this->getVar( '_InstallDone' ) ) { + } elseif ( $this->getVar( '_InstallDone' ) ) { return 'continue'; - } elseif( $this->parent->request->wasPosted() ) { + } elseif ( $this->parent->request->wasPosted() ) { $this->startForm(); $this->addHTML( "