// Remove duplicates and create the string
$value = implode( ' ', array_unique( $value ) );
- } else if ( is_array( $value ) ) {
+ } elseif ( is_array( $value ) ) {
throw new MWException( "HTML attribute $key can not contain a list of values" );
}
function __construct( ImportStreamSource $source ) {
$this->reader = new XMLReader();
- if ( !in_array( 'uploadsource', stream_get_wrappers() ) ) {
+ if ( !in_array( 'uploadsource', stream_get_wrappers() ) ) {
stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' );
}
$id = UploadSourceAdapter::registerSource( $source );
try {
$formatter = self::getTitleFormatter();
return $formatter->getNamespaceName( $this->mNamespace, $this->mDbkeyform );
- } catch ( InvalidArgumentException $ex ) {
+ } catch ( InvalidArgumentException $ex ) {
wfDebug( __METHOD__ . ': ' . $ex->getMessage() . "\n" );
return false;
}
$data['articlepath'] = $config->get( 'ArticlePath' );
$data['scriptpath'] = $config->get( 'ScriptPath' );
$data['script'] = $config->get( 'Script' );
- $data['variantarticlepath'] = $config->get( 'VariantArticlePath' );
+ $data['variantarticlepath'] = $config->get( 'VariantArticlePath' );
$data['server'] = $config->get( 'Server' );
$data['servername'] = $config->get( 'ServerName' );
$data['wikiid'] = wfWikiID();
}
$val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
- if (substr( $row['iw_url'], 0, 2) == '//') {
+ if ( substr( $row['iw_url'], 0, 2 ) == '//' ) {
$val['protorel'] = '';
}
if ( isset( $row['iw_wikiid'] ) ) {
$this->getMain()->getRequest()->getValues(),
array_flip( $this->generatorParams )
);
- } else if ( $this->generatorContinuationData ) {
+ } elseif ( $this->generatorContinuationData ) {
// All the generator-using modules are complete, but the
// generator isn't. Continue the generator and restart the
// generator-using modules
* In Postgres when using FOR UPDATE, only the main table and tables that are inner joined
* can be locked. That means tables in an outer join cannot be FOR UPDATE locked. Trying to do
* so causes a DB error. This wrapper checks which tables can be locked and adjusts it accordingly.
- *
+ *
* MySQL uses "ORDER BY NULL" as an optimization hint, but that syntax is illegal in PostgreSQL.
*/
function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__,
*/
function numFields( $res ) {
$r = $res instanceof ResultWrapper ? $res->result : $res;
- if ( is_array($r) && count( $r ) > 0 ){
+ if ( is_array( $r ) && count( $r ) > 0 ) {
// The size of the result array is twice the number of fields. (Bug: 65578)
- return count( $r[0] ) / 2 ;
+ return count( $r[0] ) / 2;
} else {
// If the result is empty return 0
return 0;
$allowedParams = array( 'tabindex', 'size' );
$customParams = $this->getAttributes( $allowedParams );
- foreach( $customParams as $name => $value ) {
+ foreach ( $customParams as $name => $value ) {
$select->setAttribute( $name, $value );
}
if ( !strlen( $newValues['_InstallUser'] ) ) {
$status->fatal( 'config-db-username-empty' );
}
- if (!strlen( $newValues['_InstallPassword'] ) ) {
+ if ( !strlen( $newValues['_InstallPassword'] ) ) {
$status->fatal( 'config-db-password-empty', $newValues['_InstallUser'] );
}
if ( !$status->isOK() ) {
function submitConnectForm() {
// Get variables from the request
$newValues = $this->setVarsFromRequest( array(
- 'wgDBserver', 'wgDBport','wgDBname', 'wgDBmwschema',
+ 'wgDBserver', 'wgDBport', 'wgDBname', 'wgDBmwschema',
'_InstallUser', '_InstallPassword'
) );
$this->output( "...column '$table.$field' is already of type '$newtype'\n" );
} else {
$this->output( "Purging data from cache table '$table'\n" );
- $this->db->query("DELETE from $table" );
+ $this->db->query( "DELETE from $table" );
$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 ) ) {
// Try to be consistent with the names used by PNG files.
// Unclear from base media type if it has an alpha layer,
// so just assume that it does since it "potentially" could.
- switch( $header['base_type'] ) {
+ switch ( $header['base_type'] ) {
case 0:
$metadata['colorType'] = 'truecolour-alpha';
break;
protected $lastError = self::ERR_NONE;
/** Possible values for getLastError() */
- const ERR_NONE = 0; // no error
+ const ERR_NONE = 0; // no error
const ERR_NO_RESPONSE = 1; // no response
const ERR_UNREACHABLE = 2; // can't connect
- const ERR_UNEXPECTED = 3; // response gave some error
+ const ERR_UNEXPECTED = 3; // response gave some error
/**
* @param bool $bool
// it can be denoted as the current size being shown.
// Vectorized images are "infinitely" big, so all thumb
// sizes are shown.
- if ( ( ($size[0] <= $width_orig && $size[1] <= $height_orig)
+ if ( ( ( $size[0] <= $width_orig && $size[1] <= $height_orig )
|| $this->displayImg->isVectorized() )
&& $size[0] != $width && $size[1] != $height
) {
$this->keySha1 = sha1( $this->key );
$met = ini_get( 'max_execution_time' ); // usually 0 in CLI mode
- $this->lockTTL = $met ? 2*$met : 3600;
+ $this->lockTTL = $met ? 2 * $met : 3600;
if ( self::$active === null ) {
self::$active = array();
if ( is_array( $wgProfiler ) ) {
if ( !isset( $wgProfiler['class'] ) ) {
$class = 'ProfilerStub';
- } elseif ( $wgProfiler['class'] === 'Profiler' ) {
+ } elseif ( $wgProfiler['class'] === 'Profiler' ) {
$class = 'ProfilerStub'; // b/c; don't explode
} else {
$class = $wgProfiler['class'];
$output = $pager->getBody();
if ( !$this->including() ) {
$output = '<p>' . $pager->getNavigationBar() . '</p>' .
- $output.
+ $output .
'<p>' . $pager->getNavigationBar() . '</p>';
}
$out->addHTML( $output );
$talk = $this->msg( 'talkpagelinktext' )->escaped();
// Do a batch existence check
$batch = new LinkBatch();
- if (count($titles) >= 100) {
+ if ( count( $titles ) >= 100 ) {
$output = wfMessage( 'watchlistedit-too-many' )->parse();
return;
}
// Returns the default since the page is not loaded from DB
$defLang = $title->getPageLanguage()->getCode();
- $pageId = $title->getArticleID();
+ $pageId = $title->getArticleID();
// Check if article exists
if ( !$pageId ) {
</tr></thead>"
);
- foreach( $wgTrackingCategories as $catMsg ) {
+ foreach ( $wgTrackingCategories as $catMsg ) {
/*
* Check if the tracking category varies by namespace
* Otherwise only pages in the current namespace will be displayed
for ( $counter = 1; $counter <= $rounds; ++$counter ) {
$lastK = hash_hmac(
$hash,
- $lastK . $info . chr($counter),
+ $lastK . $info . chr( $counter ),
$prk,
true
);
* Date formats list for Special:Preferences
* see $dateFormats for definitions
*/
-$datePreferences = array(
+$datePreferences = array(
'ČSN basic dt',
'ČSN padded dt',
'ČSN basic td',
'PermanentLink' => array( 'PermanentLink', 'PermaLink' ),
'Popularpages' => array( 'PopularPages' ),
'Preferences' => array( 'Preferences' ),
- 'Prefixindex' => array( 'PrefixIndex' ) ,
+ 'Prefixindex' => array( 'PrefixIndex' ),
'Protectedpages' => array( 'ProtectedPages' ),
'Protectedtitles' => array( 'ProtectedTitles' ),
'Randompage' => array( 'Random', 'RandomPage' ),
# Aliases to renamed kk-arab namespaces
'مەدياۋيكي' => NS_MEDIAWIKI,
- 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK ,
- 'ٷلگٸ' => NS_TEMPLATE ,
+ 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK,
+ 'ٷلگٸ' => NS_TEMPLATE,
'ٷلگٸ_تالقىلاۋى' => NS_TEMPLATE_TALK,
'ٴۇلگٴى' => NS_TEMPLATE,
'ٴۇلگٴى_تالقىلاۋى' => NS_TEMPLATE_TALK,
# Aliases to renamed kk-arab namespaces
'مەدياۋيكي' => NS_MEDIAWIKI,
- 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK ,
- 'ٷلگٸ' => NS_TEMPLATE ,
+ 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK,
+ 'ٷلگٸ' => NS_TEMPLATE,
'ٷلگٸ_تالقىلاۋى' => NS_TEMPLATE_TALK,
'ٴۇلگٴى' => NS_TEMPLATE,
'ٴۇلگٴى_تالقىلاۋى' => NS_TEMPLATE_TALK,
# Aliases to renamed kk-arab namespaces
'مەدياۋيكي' => NS_MEDIAWIKI,
- 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK ,
- 'ٷلگٸ' => NS_TEMPLATE ,
+ 'مەدياۋيكي_تالقىلاۋى' => NS_MEDIAWIKI_TALK,
+ 'ٷلگٸ' => NS_TEMPLATE,
'ٷلگٸ_تالقىلاۋى' => NS_TEMPLATE_TALK,
'ٴۇلگٴى' => NS_TEMPLATE,
'ٴۇلگٴى_تالقىلاۋى' => NS_TEMPLATE_TALK,
);
$linkTrail = '/^((?:[a-z]|а|æ|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я|“|»)+)(.*)$/sDu';
-$fallback8bitEncoding = 'windows-1251';
+$fallback8bitEncoding = 'windows-1251';
);
$linkTrail = '/^([a-zåäöéÅÄÖÉ]+)(.*)$/sDu';
-$separatorTransformTable = array(
+$separatorTransformTable = array(
',' => "\xc2\xa0", // @bug 2749
'.' => ','
);
$this->output( "Found cache entry found for '{$title->getPrefixedText()}'..." );
$oldHtml = trim( preg_replace( '#<!-- .+-->#Us', '', $parserOutputOld->getText() ) );
- $newHtml = trim( preg_replace( '#<!-- .+-->#Us', '',$parserOutputNew->getText() ) );
+ $newHtml = trim( preg_replace( '#<!-- .+-->#Us', '', $parserOutputNew->getText() ) );
$diff = wfDiff( $oldHtml, $newHtml );
if ( strlen( $diff ) ) {
$this->output( "differences found:\n\n$diff\n\n" );
$xml = $this->open();
$this->callback = $callback;
- while ( $xml->name !== 'repertoire' && $xml->next() ) ;
+ while ( $xml->name !== 'repertoire' && $xml->next() );
while ( $xml->read() ) {
if ( $xml->nodeType == XMLReader::ELEMENT ) {
if ( !$this->xml ) {
throw new MWException( __METHOD__ . ": unable to open {$this->fileName}" );
}
- while ( $this->xml->name !== 'ucd' && $this->xml->read() ) ;
+ while ( $this->xml->name !== 'ucd' && $this->xml->read() );
$this->xml->read();
return $this->xml;
}
$xml = $this->open();
- while ( $xml->name !== 'blocks' && $xml->read() ) ;
+ while ( $xml->name !== 'blocks' && $xml->read() );
while ( $xml->read() ) {
if ( $xml->nodeType == XMLReader::ELEMENT ) {
if ( !$installer->startSession() ) {
- if( $installer->request->getVal( "css" ) ) {
+ if ( $installer->request->getVal( "css" ) ) {
// Do not display errors on css pages
$installer->outputCss();
exit;
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
<?php
- if ($wgVectorUseSimpleSearch) {
+ if ( $wgVectorUseSimpleSearch ) {
?>
<div id="simpleSearch">
<?php
if ( substr( $output, 0, 1 ) === '/' ) {
// Bug 64946: Day of the week calculations for very old
// timestamps varies from system to system.
- $this->assertRegExp( $output, $timestamp, $message );
+ $this->assertRegExp( $output, $timestamp, $message );
} else {
$this->assertEquals( $output, $timestamp, $message );
}
public function testHandlePageContainsRedirect( $xml, $redirectTitle ) {
$source = $this->getInputStreamSource( $xml );
- $redirect = NULL;
+ $redirect = null;
$callback = function( $title, $origTitle, $revCount, $sRevCount, $pageInfo ) use ( &$redirect ) {
if ( array_key_exists( 'redirect', $pageInfo ) ) {
$redirect = $pageInfo['redirect'];
</mediawiki>
EOF
,
- NULL
+ null
),
);
}
$po->setProperty( "bool", true );
$expected[] = array( "bool", true );
- $po->setProperty( "float", 4.0 + 1.0/4.0 );
- $expected[] = array( "float", 4.0 + 1.0/4.0 );
+ $po->setProperty( "float", 4.0 + 1.0 / 4.0 );
+ $expected[] = array( "float", 4.0 + 1.0 / 4.0 );
$po->setProperty( "int", -7 );
$expected[] = array( "int", -7 );
* @dataProvider provideMakeResourceLoaderLink
* @covers OutputPage::makeResourceLoaderLink
*/
- public function testMakeResourceLoaderLink( $args, $expectedHtml) {
+ public function testMakeResourceLoaderLink( $args, $expectedHtml ) {
$this->setMwGlobals( array(
'wgResourceLoaderDebug' => false,
'wgResourceLoaderUseESI' => true,
$out = new OutputPage( $ctx );
$rl = $out->getResourceLoader();
$rl->register( array(
- 'test.foo' => new ResourceLoaderTestModule(array(
+ 'test.foo' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.foo( { a: true } );',
'styles' => '.mw-test-foo { content: "style"; }',
)),
- 'test.bar' => new ResourceLoaderTestModule(array(
+ 'test.bar' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.bar( { a: true } );',
'styles' => '.mw-test-bar { content: "style"; }',
)),
- 'test.baz' => new ResourceLoaderTestModule(array(
+ 'test.baz' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.baz( { a: true } );',
'styles' => '.mw-test-baz { content: "style"; }',
)),
- 'test.quux' => new ResourceLoaderTestModule(array(
+ 'test.quux' => new ResourceLoaderTestModule( array(
'script' => 'mw.test.baz( { token: 123 } );',
'styles' => '/* pref-animate=off */ .mw-icon { transition: none; }',
'group' => 'private',
return array(
array( '20061231235959', 0, '20061231235959' ),
array( '20061231235959', 5, '20070101000459' ),
- array( '20061231235959', 15,'20070101001459' ),
+ array( '20061231235959', 15, '20070101001459' ),
array( '20061231235959', 60, '20070101005959' ),
array( '20061231235959', 90, '20070101012959' ),
array( '20061231235959', 120, '20070101015959' ),
parent::setUp();
$this->setMwGlobals( 'wgActions', array(
- 'null' => null,
- 'dummy' => true,
- 'string' => 'NamedDummyAction',
+ 'null' => null,
+ 'dummy' => true,
+ 'string' => 'NamedDummyAction',
'declared' => 'NonExistingClassName',
'callable' => array( $this, 'dummyActionCallback' ),
- 'object' => new InstantiatedDummyAction( $this->getPage(), $this->getContext() ),
+ 'object' => new InstantiatedDummyAction( $this->getPage(), $this->getContext() ),
) );
}
public function actionProvider() {
return array(
- array( 'dummy', 'DummyAction' ),
- array( 'string', 'NamedDummyAction' ),
+ array( 'dummy', 'DummyAction' ),
+ array( 'string', 'NamedDummyAction' ),
array( 'callable', 'CalledDummyAction' ),
- array( 'object', 'InstantiatedDummyAction' ),
+ array( 'object', 'InstantiatedDummyAction' ),
// Capitalization is ignored
- array( 'STRING', 'NamedDummyAction' ),
+ array( 'STRING', 'NamedDummyAction' ),
// Null and non-existing values
- array( 'null', null ),
+ array( 'null', null ),
array( 'undeclared', null ),
- array( '', null ),
- array( null, null ),
+ array( '', null ),
+ array( null, null ),
);
}
public function testRegister() {
$factory = new ConfigFactory();
$factory->register( 'unittest', 'GlobalVarConfig::newInstance' );
- $this->assertTrue( True ); // No exception thrown
+ $this->assertTrue( true ); // No exception thrown
$this->setExpectedException( 'InvalidArgumentException' );
$factory->register( 'invalid', 'Invalid callback' );
}
$factory = new ConfigFactory();
$factory->register( 'unittest', function() {
return true; // Not a Config object
- });
+ } );
$this->setExpectedException( 'UnexpectedValueException' );
$factory->makeConfig( 'unittest' );
}
$databaseCreation = $db->query( 'CREATE TABLE a ( a_1 )', __METHOD__ );
$this->assertInstanceOf( 'ResultWrapper', $databaseCreation, "Failed to create table a" );
- $res = $db->select( 'a' , '*');
- $this->assertEquals( 0, $db->numFields($res), "expects to get 0 fields for an empty table" );
+ $res = $db->select( 'a', '*' );
+ $this->assertEquals( 0, $db->numFields( $res ), "expects to get 0 fields for an empty table" );
$insertion = $db->insert( 'a', array( 'a_1' => 10 ), __METHOD__ );
$this->assertTrue( $insertion, "Insertion failed" );
- $res = $db->select( 'a' , '*');
- $this->assertEquals( 1, $db->numFields($res), "wrong number of fields" );
+ $res = $db->select( 'a', '*' );
+ $this->assertEquals( 1, $db->numFields( $res ), "wrong number of fields" );
$this->assertTrue( $db->close(), "closing database" );
}
'gitViewUrl', 'time', 'log', 'debugLog', 'queries', 'request', 'memory',
'memoryPeak', 'includes', 'profile', '_element' );
- foreach( $expectedKeys as $expectedKey ) {
+ foreach ( $expectedKeys as $expectedKey ) {
$this->assertArrayHasKey( $expectedKey, $data['debuginfo'], "debuginfo has $expectedKey" );
}
// Autodetect by file extension for the lazy.
$magic = MimeMagic::singleton();
$parts = explode( $name, '.' );
- $type = $magic->guessTypesForExtension( $parts[count( $parts ) - 1] );
+ $type = $magic->guessTypesForExtension( $parts[count( $parts ) - 1] );
}
return new UnregisteredLocalFile( false, $this->repo,
"mwstore://localtesting/data/$name", $type );
$wgParser->parse( '<recursivecallparser>baz</recursivecallparser>', $title, $po );
}
- public function helperParserFunc( $input, $args, $parser) {
+ public function helperParserFunc( $input, $args, $parser ) {
$title = Title::newFromText( 'foo' );
$po = new ParserOptions;
$parser->parse( $input, $title, $po );
->disableOriginalConstructor()
->getMockForAbstractClass();
- $hashKeyIntoSlots = new ReflectionMethod($poolCounter, 'hashKeyIntoSlots' );
+ $hashKeyIntoSlots = new ReflectionMethod( $poolCounter, 'hashKeyIntoSlots' );
$hashKeyIntoSlots->setAccessible( true );
-
$keysWithTwoSlots = $keysWithFiveSlots = array();
foreach ( range( 1, 100 ) as $i ) {
$keysWithTwoSlots[] = $hashKeyIntoSlots->invoke( $poolCounter, 'key ' . $i, 2 );
# The below code injects a parameter just like if the user called
# Probably fix bug 29226
$key = array_search( '--colors', $_SERVER['argv'] );
- if( $key === false ) {
+ if ( $key === false ) {
array_splice( $_SERVER['argv'], 1, 0, '--colors' );
}
}
# PHPUnit uses stream_resolve_include_path() internally
# See bug 32022
$key = array_search( '--include-path', $_SERVER['argv'] );
- if( $key === false ) {
+ if ( $key === false ) {
array_splice( $_SERVER['argv'], 1, 0,
__DIR__
. PATH_SEPARATOR