Fixed spacing around parenthesis in languages/tests/maintenance

Change-Id: Idd4299d17f1fcf98ab1d635484cb4e880f35ee24
This commit is contained in:
umherirrender 2013-04-27 13:23:52 +02:00 committed by Gerrit Code Review
parent 6f79eef473
commit bfb75bc8e2
28 changed files with 63 additions and 63 deletions

View file

@ -258,7 +258,7 @@ class LanguageConverter {
// Get language variant preference from logged in users
// Don't call this on stub objects because that causes infinite
// recursion during initialisation
if ( $wgUser->isLoggedIn() ) {
if ( $wgUser->isLoggedIn() ) {
$ret = $wgUser->getOption( 'variant' );
} else {
// figure out user lang without constructing wgLang to avoid
@ -833,7 +833,7 @@ class LanguageConverter {
* @author Nikola Smolenski <smolensk@eunet.rs>
* @since 1.19
*/
public function guessVariant($text, $variant) {
public function guessVariant( $text, $variant ) {
return false;
}

View file

@ -67,7 +67,7 @@ class CLDRPluralRuleEvaluator {
public static function evaluateCompiled( $number, array $rules ) {
// The compiled form is RPN, with tokens strictly delimited by
// spaces, so this is a simple RPN evaluator.
foreach ( $rules as $i => $rule ) {
foreach ( $rules as $i => $rule ) {
$stack = array();
$zero = ord( '0' );
$nine = ord( '9' );
@ -104,7 +104,7 @@ class CLDRPluralRuleEvaluator {
*/
private static function doOperation( $token, $left, $right ) {
if ( in_array( $token, array( 'in', 'not-in', 'within', 'not-within' ) ) ) {
if ( !($right instanceof CLDRPluralRuleEvaluator_Range ) ) {
if ( !( $right instanceof CLDRPluralRuleEvaluator_Range ) ) {
$right = new CLDRPluralRuleEvaluator_Range( $right );
}
}

View file

@ -766,7 +766,7 @@ abstract class Maintenance {
$this->output( "\n" );
$scriptDependantParams = $this->mDependantParameters;
if ( count($scriptDependantParams) > 0 ) {
if ( count( $scriptDependantParams ) > 0 ) {
$this->output( "Script dependant parameters:\n" );
// Parameters description
foreach ( $scriptDependantParams as $par => $info ) {
@ -791,7 +791,7 @@ abstract class Maintenance {
$this->mGenericParameters,
$this->mDependantParameters
);
if ( count($scriptSpecificParams) > 0 ) {
if ( count( $scriptSpecificParams ) > 0 ) {
$this->output( "Script specific parameters:\n" );
// Parameters description
foreach ( $scriptSpecificParams as $par => $info ) {
@ -1077,7 +1077,7 @@ abstract class Maintenance {
* @param &$db DatabaseBase object
*/
private function unlockSearchindex( &$db ) {
$db->unlockTables( __CLASS__ . '::' . __METHOD__ );
$db->unlockTables( __CLASS__ . '::' . __METHOD__ );
}
/**

View file

@ -82,9 +82,9 @@ class UploadStashCleanup extends Maintenance {
$stash->getFile( $key, true );
$stash->removeFileNoAuth( $key );
} catch ( UploadStashBadPathException $ex ) {
$this->output( "Failed removing stashed upload with key: $key\n" );
$this->output( "Failed removing stashed upload with key: $key\n" );
} catch ( UploadStashZeroLengthFileException $ex ) {
$this->output( "Failed removing stashed upload with key: $key\n" );
$this->output( "Failed removing stashed upload with key: $key\n" );
}
if ( $i % 100 == 0 ) {
$this->output( "$i\n" );

View file

@ -80,7 +80,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
# --------------------------------------------------------------------
list ( $cur, $links, $links_temp, $links_backup ) = $dbw->tableNamesN( 'cur', 'links', 'links_temp', 'links_backup' );
list( $cur, $links, $links_temp, $links_backup ) = $dbw->tableNamesN( 'cur', 'links', 'links_temp', 'links_backup' );
if ( $dbw->tableExists( 'pagelinks' ) ) {
$this->output( "...have pagelinks; skipping old links table updates\n" );
@ -177,7 +177,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
}
$dbw->freeResult( $res );
# $this->output( "rowOffset: $rowOffset\ttuplesAdded: $tuplesAdded\tnumBadLinks: $numBadLinks\n" );
if ( $tuplesAdded != 0 ) {
if ( $tuplesAdded != 0 ) {
if ( $reportLinksConvProgress ) {
$this->output( "Inserting $tuplesAdded tuples into $links_temp..." );
}

View file

@ -42,7 +42,7 @@ class CreateAndPromote extends Maintenance {
$this->addOption( $role, "Add the account to the {$role} group" );
}
$this->addArg( "username", "Username of new user" );
$this->addArg( "password", "Password to set (not required if --force is used)", false);
$this->addArg( "password", "Password to set (not required if --force is used)", false );
}
public function execute() {

View file

@ -45,7 +45,7 @@ if ( isset( $options['pagelist'] ) ) {
chdir( $olddir );
if ( $pages === false ) {
echo( "Unable to open file {$options['pagelist']}\n" );
die(1);
die( 1 );
}
$pages = array_map( 'trim', $pages );
$dumper->pages = array_filter( $pages, create_function( '$x', 'return $x !== "";' ) );
@ -79,7 +79,7 @@ if ( isset( $options['full'] ) ) {
$dumper->dump( WikiExporter::STABLE, $textMode );
} elseif ( isset( $options['logs'] ) ) {
$dumper->dump( WikiExporter::LOGS );
} elseif ( isset($options['revrange'] ) ) {
} elseif ( isset( $options['revrange'] ) ) {
$dumper->dump( WikiExporter::RANGE, $textMode );
} else {
$dumper->progress( <<<ENDS

View file

@ -81,9 +81,9 @@ abstract class DumpIterator extends Maintenance {
$this->conclusions();
$delta = microtime( true ) - $this->startTime;
$this->error( "Done {$this->count} revisions in " . round($delta, 2) . " seconds " );
$this->error( "Done {$this->count} revisions in " . round( $delta, 2 ) . " seconds " );
if ( $delta > 0 ) {
$this->error( round($this->count / $delta, 2) . " pages/sec" );
$this->error( round( $this->count / $delta, 2 ) . " pages/sec" );
}
# Perform the memory_get_peak_usage() when all the other data has been output so there's no damage if it dies.
@ -126,7 +126,7 @@ abstract class DumpIterator extends Maintenance {
if ( $this->from != $title ) {
return;
}
$this->output( "Skipped " . ($this->count - 1) . " pages\n" );
$this->output( "Skipped " . ( $this->count - 1 ) . " pages\n" );
$this->count = 1;
$this->from = null;

View file

@ -56,12 +56,12 @@ class FetchText extends Maintenance {
}
$textId = intval( $line );
$text = $this->doGetText( $db, $textId );
if ($text === false) {
if ( $text === false ) {
# actual error, not zero-length text
$textLen = "-1";
}
else {
$textLen = strlen($text);
$textLen = strlen( $text );
}
$this->output( $textId . "\n" . $textLen . "\n" . $text );
}

View file

@ -79,7 +79,7 @@ class TestFileOpPerformance extends Maintenance {
$this->output( "Using '$dirname/$file' in operations.\n" );
$dst = $baseDir . '/' . wfBaseName( $file );
$ops1[] = array( 'op' => 'store',
'src' => "$dirname/$file", 'dst' => $dst, 'overwrite' => 1);
'src' => "$dirname/$file", 'dst' => $dst, 'overwrite' => 1 );
$ops2[] = array( 'op' => 'copy',
'src' => "$dst", 'dst' => "$dst-1", 'overwrite' => 1 );
$ops3[] = array( 'op' => 'move',
@ -106,7 +106,7 @@ class TestFileOpPerformance extends Maintenance {
$e = ( microtime( true ) - $start ) * 1000;
if ( $status->getErrorsArray() ) {
print_r( $status->getErrorsArray() );
exit(0);
exit( 0 );
}
$this->output( $backend->getName() . ": Stored " . count( $ops1 ) . " files in $e ms.\n" );
@ -115,7 +115,7 @@ class TestFileOpPerformance extends Maintenance {
$e = ( microtime( true ) - $start ) * 1000;
if ( $status->getErrorsArray() ) {
print_r( $status->getErrorsArray() );
exit(0);
exit( 0 );
}
$this->output( $backend->getName() . ": Copied " . count( $ops2 ) . " files in $e ms.\n" );
@ -124,7 +124,7 @@ class TestFileOpPerformance extends Maintenance {
$e = ( microtime( true ) - $start ) * 1000;
if ( $status->getErrorsArray() ) {
print_r( $status->getErrorsArray() );
exit(0);
exit( 0 );
}
$this->output( $backend->getName() . ": Moved " . count( $ops3 ) . " files in $e ms.\n" );
@ -133,7 +133,7 @@ class TestFileOpPerformance extends Maintenance {
$e = ( microtime( true ) - $start ) * 1000;
if ( $status->getErrorsArray() ) {
print_r( $status->getErrorsArray() );
exit(0);
exit( 0 );
}
$this->output( $backend->getName() . ": Deleted " . count( $ops4 ) . " files in $e ms.\n" );
@ -142,7 +142,7 @@ class TestFileOpPerformance extends Maintenance {
$e = ( microtime( true ) - $start ) * 1000;
if ( $status->getErrorsArray() ) {
print_r( $status->getErrorsArray() );
exit(0);
exit( 0 );
}
$this->output( $backend->getName() . ": Deleted " . count( $ops5 ) . " files in $e ms.\n" );
}

View file

@ -320,7 +320,7 @@ class GenerateSitemap extends Maintenance {
$this->output( "$namespace ($fns)\n" );
$skippedRedirects = 0; // Number of redirects skipped for that namespace
foreach ( $res as $row ) {
if ($this->skipRedirects && $row->page_is_redirect ) {
if ( $this->skipRedirects && $row->page_is_redirect ) {
$skippedRedirects++;
continue;
}
@ -357,7 +357,7 @@ class GenerateSitemap extends Maintenance {
}
}
if ($this->skipRedirects && $skippedRedirects > 0) {
if ( $this->skipRedirects && $skippedRedirects > 0 ) {
$this->output( " skipped $skippedRedirects redirect(s)\n" );
}

View file

@ -41,7 +41,7 @@ class CommandLineInstaller extends Maintenance {
parent::__construct();
global $IP;
$this->addArg( 'name', 'The name of the wiki', true);
$this->addArg( 'name', 'The name of the wiki', true );
$this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', true );
$this->addOption( 'pass', 'The password for the wiki administrator.', false, true );

View file

@ -50,7 +50,7 @@ class JSParseHelper extends Maintenance {
wfSuppressWarnings();
$js = file_get_contents( $filename );
wfRestoreWarnings();
if ($js === false) {
if ( $js === false ) {
$this->output( "$filename ERROR: could not read file\n" );
$this->errs++;
continue;
@ -58,7 +58,7 @@ class JSParseHelper extends Maintenance {
try {
$parser->parse( $js, $filename, 1 );
} catch (Exception $e) {
} catch ( Exception $e ) {
$this->errs++;
$this->output( "$filename ERROR: " . $e->getMessage() . "\n" );
continue;
@ -67,8 +67,8 @@ class JSParseHelper extends Maintenance {
$this->output( "$filename OK\n" );
}
if ($this->errs > 0) {
exit(1);
if ( $this->errs > 0 ) {
exit( 1 );
}
}
}

View file

@ -96,7 +96,7 @@ $wgRequiredMessagesNumber = count( $wgGeneralMessages['required'] );
foreach ( $wgLanguages->getLanguages() as $code ) {
# Don't check English, RTL English or dummy language codes
if ( $code == 'en' || $code == 'enRTL' || (is_array( $wgDummyLanguageCodes ) &&
if ( $code == 'en' || $code == 'enRTL' || ( is_array( $wgDummyLanguageCodes ) &&
isset( $wgDummyLanguageCodes[$code] ) ) ) {
continue;
}

View file

@ -18,6 +18,6 @@ if ( PHP_SAPI != 'cli' ) {
$source = file_get_contents( $argv[1] );
$regexp = '#\@var\s+([^\s]+)([^/]+)/\s+(var|public|protected|private)\s+(\$[^\s;=]+)#';
$replac = '${2} */ ${3} ${1} ${4}';
$source = preg_replace($regexp, $replac, $source);
$source = preg_replace( $regexp, $replac, $source );
echo $source;

View file

@ -49,7 +49,7 @@ class AlterSharedConstraints extends Maintenance {
$dbw = wfGetDB( DB_MASTER );
foreach ( $wgSharedTables as $table ) {
$stable = $dbw->tableNameInternal($table);
$stable = $dbw->tableNameInternal( $table );
if ( $wgSharedPrefix != null ) {
$ltable = preg_replace( "/^$wgSharedPrefix(.*)/i", "$wgDBprefix\\1", $stable );
} else {
@ -62,14 +62,14 @@ class AlterSharedConstraints extends Maintenance {
AND ucc.constraint_name = uc.constraint_name
AND uccpk.constraint_name = uc.r_constraint_name
AND uccpk.table_name = '$ltable'" );
while (($row = $result->fetchRow()) !== false) {
while ( ( $row = $result->fetchRow() ) !== false ) {
$this->output( "Altering {$row['constraint_name']} ...");
$this->output( "Altering {$row['constraint_name']} ..." );
try {
$dbw->query( "ALTER TABLE {$row['table_name']} DROP CONSTRAINT {$wgDBprefix}{$row['constraint_name']}" );
} catch (DBQueryError $exdb) {
if ($exdb->errno != 2443) {
} catch ( DBQueryError $exdb ) {
if ( $exdb->errno != 2443 ) {
throw $exdb;
}
}

View file

@ -90,7 +90,7 @@ class CLIParser extends Maintenance {
if ( $input_file === $php_stdin ) {
$ctrl = wfIsWindows() ? 'CTRL+Z' : 'CTRL+D';
$this->error( basename(__FILE__) . ": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" );
$this->error( basename( __FILE__ ) . ": warning: reading wikitext from STDIN. Press $ctrl to parse.\n" );
}
return file_get_contents( $input_file );

View file

@ -46,8 +46,8 @@ if ( ( isset( $_REQUEST ) && array_key_exists( 'argv', $_REQUEST ) ) || count( $
$output = "Connecting to $ip:$port, target $url, this hostname $host\n";
# Open socket
$sock = @fsockopen($ip, $port, $errno, $errstr, 5);
if ($errno == 0 ) {
$sock = @fsockopen( $ip, $port, $errno, $errstr, 5 );
if ( $errno == 0 ) {
$output .= "Connected\n";
# Send payload
$request = "GET $url HTTP/1.0\r\n";
@ -56,10 +56,10 @@ if ( ( isset( $_REQUEST ) && array_key_exists( 'argv', $_REQUEST ) ) || count( $
# $request .= "Host: ".$url."\r\n";
# $request .= "User-Agent: MediaWiki open proxy check\r\n";
$request .= "\r\n";
@fputs($sock, $request);
$response = fgets($sock, 65536);
@fputs( $sock, $request );
$response = fgets( $sock, 65536 );
$output .= $response;
@fclose($sock);
@fclose( $sock );
} else {
$output .= "No connection\n";
}

View file

@ -99,7 +99,7 @@ class RebuildRecentchanges extends Maintenance {
*/
private function rebuildRecentChangesTablePass2() {
$dbw = wfGetDB( DB_MASTER );
list ( $recentchanges, $revision ) = $dbw->tableNamesN( 'recentchanges', 'revision' );
list( $recentchanges, $revision ) = $dbw->tableNamesN( 'recentchanges', 'revision' );
$this->output( "Updating links and size differences...\n" );

View file

@ -99,7 +99,7 @@ class RefreshImageMetadata extends Maintenance {
if ( $res->numRows() > 0 ) {
$row1 = $res->current();
$this->output( "Processing next {$this->mBatchSize} rows starting with {$row1->img_name}.\n");
$this->output( "Processing next {$this->mBatchSize} rows starting with {$row1->img_name}.\n" );
$res->rewind();
} else {
$this->error( "No images to process.", 4 );
@ -123,7 +123,7 @@ class RefreshImageMetadata extends Maintenance {
$this->output( "Warning: File:{$row->img_name} used to have " .
"$oldLength bytes of metadata but now has $newLength bytes.\n" );
} elseif ( $verbose ) {
$this->output("Refreshed File:{$row->img_name}.\n" );
$this->output( "Refreshed File:{$row->img_name}.\n" );
}
} else {
$leftAlone++;
@ -138,7 +138,7 @@ class RefreshImageMetadata extends Maintenance {
}
if ( $verbose ) {
$this->output("Forcibly refreshed File:{$row->img_name}.\n" );
$this->output( "Forcibly refreshed File:{$row->img_name}.\n" );
}
}
else {

View file

@ -69,9 +69,9 @@ class DumpRenderer extends Maintenance {
$importer->doImport();
$delta = microtime( true ) - $this->startTime;
$this->error( "Rendered {$this->count} pages in " . round($delta, 2) . " seconds " );
$this->error( "Rendered {$this->count} pages in " . round( $delta, 2 ) . " seconds " );
if ( $delta > 0 ) {
$this->error( round($this->count / $delta, 2) . " pages/sec" );
$this->error( round( $this->count / $delta, 2 ) . " pages/sec" );
}
$this->error( "\n" );
}

View file

@ -91,7 +91,7 @@ class MwSql extends Maintenance {
readline_add_history( $wholeLine . $dbw->getDelimiter() );
readline_write_history( $historyFile );
}
try{
try {
$res = $dbw->query( $wholeLine );
$this->sqlPrintResult( $res, $dbw );
$prompt = $newPrompt;

View file

@ -462,7 +462,7 @@ class CheckStorage {
return;
}
if ( !$id ) {
if ( !$id ) {
// No ID, can't import
echo "No id tag in revision, can't import\n";
return;

View file

@ -223,7 +223,7 @@ class CompressOld extends Maintenance {
}
$conds[] = "rev_timestamp>'" . $beginDate . "'";
}
if ( $endDate ) {
if ( $endDate ) {
if ( !preg_match( '/^\d{14}$/', $endDate ) ) {
$this->error( "Invalid end date \"$endDate\"\n" );
return false;
@ -282,7 +282,7 @@ class CompressOld extends Maintenance {
$revs[] = $revRow;
}
if ( count( $revs ) < 2) {
if ( count( $revs ) < 2 ) {
# No revisions matching, no further processing
$this->output( "\n" );
continue;
@ -351,12 +351,12 @@ class CompressOld extends Maintenance {
if ( $extdb != "" ) {
# Move blob objects to External Storage
$stored = $storeObj->store( $extdb, serialize( $chunk ));
if ($stored === false) {
if ( $stored === false ) {
$this->error( "Unable to store object" );
return false;
}
# Store External Storage URLs instead of Stub placeholders
foreach ($stubs as $stub) {
foreach ( $stubs as $stub ) {
if ( $stub === false ) {
continue;
}
@ -388,7 +388,7 @@ class CompressOld extends Maintenance {
if ( $stubs[$j] !== false && $revs[$i + $j]->rev_text_id != $primaryOldid ) {
$dbw->update( 'text',
array( /* SET */
'old_text' => serialize($stubs[$j]),
'old_text' => serialize( $stubs[$j] ),
'old_flags' => 'object,utf-8',
), array( /* WHERE */
'old_id' => $revs[$i + $j]->rev_text_id

View file

@ -124,7 +124,7 @@ class UpdateSpecialPages extends Maintenance {
$this->output( sprintf( "%.2fs\n", $seconds ) );
}
# Reopen any connections that have closed
if ( !wfGetLB()->pingAll() ) {
if ( !wfGetLB()->pingAll() ) {
$this->output( "\n" );
do {
$this->error( "Connection failed, reconnecting in 10 seconds..." );

View file

@ -85,7 +85,7 @@ class SeleniumTester extends Maintenance {
protected function startServer() {
if ( $this->seleniumServerExecPath == '' ) {
die ( "The selenium server exec path is not set in " .
die( "The selenium server exec path is not set in " .
"selenium_settings.ini. Cannot start server \n" .
"as requested - terminating RunSeleniumTests\n" );
}
@ -96,7 +96,7 @@ class SeleniumTester extends Maintenance {
case 'started':
break;
case 'failed':
die ( "Unable to start the Selenium Server - " .
die( "Unable to start the Selenium Server - " .
"terminating RunSeleniumTests\n" );
case 'running':
echo ( "Warning: The Selenium Server is " .

View file

@ -37,6 +37,6 @@ class ParserTestResult {
/** Whether the test passed */
public function isSuccess() {
return ($this->expected === $this->actual);
return $this->expected === $this->actual;
}
}

View file

@ -90,5 +90,5 @@ if ( isset( $options['fuzz'] ) ) {
$tester->fuzzTest( $files );
} else {
$ok = $tester->runTestsFromFiles( $files );
exit ( $ok ? 0 : 1 );
exit( $ok ? 0 : 1 );
}