class DeleteEqualMessages extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Deletes all pages in the MediaWiki namespace that are equal to the default message";
+ $this->mDescription = "Deletes all pages in the MediaWiki namespace that are equal to '
+ . 'the default message";
$this->addOption( 'delete', 'Actually delete the pages (default: dry run)' );
$this->addOption( 'delete-talk', 'Don\'t leave orphaned talk pages behind during deletion' );
- $this->addOption( 'lang-code', 'Check for subpages of this language code (default: root page against content language). ' .
- 'Use value "*" to run for all mwfile language code subpages (including the base pages that override content language).', false, true );
+ $this->addOption( 'lang-code', 'Check for subpages of this language code (default: root '
+ . 'page against content language). Use value "*" to run for all mwfile language code '
+ . 'subpages (including the base pages that override content language).', false, true );
}
/**
// Normalise message names for NS_MEDIAWIKI page_title
$messageNames = array_map( array( $wgContLang, 'ucfirst' ), $messageNames );
- $statuses = AllMessagesTablePager::getCustomisedStatuses( $messageNames, $langCode, $nonContLang );
+ $statuses = AllMessagesTablePager::getCustomisedStatuses(
+ $messageNames, $langCode, $nonContLang );
// getCustomisedStatuses is stripping the sub page from the page titles, add it back
$titleSuffix = $nonContLang ? "/$langCode" : '';
return;
}
- $this->output( "\n{$messageInfo['relevantPages']} pages in the MediaWiki namespace override messages." );
- $this->output( "\n{$messageInfo['equalPages']} pages are equal to the default message (+ {$messageInfo['equalPagesTalks']} talk pages).\n" );
+ $this->output( "\n{$messageInfo['relevantPages']} pages in the MediaWiki namespace ' .
+ 'override messages." );
+ $this->output( "\n{$messageInfo['equalPages']} pages are equal to the default message ' .
+ '(+ {$messageInfo['equalPagesTalks']} talk pages).\n" );
if ( !$doDelete ) {
$list = '';
$this->output( "\n* [[$title]]" );
$page = WikiPage::factory( $title );
$error = ''; // Passed by ref
- $page->doDeleteArticle( 'Orphaned talk page of no longer required message', false, 0, false, $error, $user );
+ $page->doDeleteArticle( 'Orphaned talk page of no longer required message',
+ false, 0, false, $error, $user );
}
}
$this->output( "\n\ndone!\n" );
}
$this->output( "Searching for supplementary i18n files...\n" );
$dir_iterator = new RecursiveDirectoryIterator( dirname( $phpfile ) );
- $iterator = new RecursiveIteratorIterator( $dir_iterator, RecursiveIteratorIterator::LEAVES_ONLY );
+ $iterator = new RecursiveIteratorIterator(
+ $dir_iterator, RecursiveIteratorIterator::LEAVES_ONLY );
foreach ( $iterator as $path => $fileObject ) {
if ( fnmatch( "*.i18n.php", $fileObject->getFilename() ) ) {
$this->output( "Converting $path.\n" );
/**
* Maintenance script to install and configure MediaWiki
*
- * Default values for the options are defined in DefaultSettings.php (see the mapping in CliInstaller.php)
+ * Default values for the options are defined in DefaultSettings.php
+ * (see the mapping in CliInstaller.php)
* Default for --dbpath (SQLite-specific) is defined in SqliteInstaller::getGlobalDefaults
*
* @ingroup Maintenance
true
);
$this->addOption( 'confpath', "Path to write LocalSettings.php to ($IP)", false, true );
- $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in PostgreSQL/Microsoft SQL Server (mediawiki)', false, true );
+ $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in '
+ . 'PostgreSQL/Microsoft SQL Server (mediawiki)', false, true );
/*
- $this->addOption( 'namespace', 'The project namespace (same as the "name" argument)', false, true );
+ $this->addOption( 'namespace', 'The project namespace (same as the "name" argument)',
+ false, true );
*/
$this->addOption( 'env-checks', "Run environment checks only, don't change anything" );
}
echo ' emptyPortlet';
}
?>" aria-labelledby="p-cactions-label">
- <h3 id="p-cactions-label"><span><?php $this->msg( 'vector-more-actions' ) ?></span><a href="#"></a></h3>
+ <h3 id="p-cactions-label"><span><?php
+ $this->msg( 'vector-more-actions' )
+ ?></span><a href="#"></a></h3>
<div class="menu">
<ul<?php $this->html( 'userlangattributes' ) ?>>
* @ingroup Testing
*/
-$otions = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled', 'run-parsoid' );
+$otions = array( 'quick', 'color', 'quiet', 'help', 'show-output',
+ 'record', 'run-disabled', 'run-parsoid' );
$optionsWithArgs = array( 'regex', 'filter', 'seed', 'setversion' );
require_once __DIR__ . '/../maintenance/commandLine.inc';
*/
public function testInLanguage() {
$this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inLanguage( 'en' )->text() );
- $this->assertEquals( 'Заглавная страница', wfMessage( 'mainpage' )->inLanguage( 'ru' )->text() );
+ $this->assertEquals( 'Заглавная страница',
+ wfMessage( 'mainpage' )->inLanguage( 'ru' )->text() );
// NOTE: make sure internal caching of the message text is reset appropriately
$msg = wfMessage( 'mainpage' );
array( 'tsv', 'text/plain', 'text/tab-separated-values' ),
array( 'json', 'text/plain', 'application/json' ),
array( 'foo', 'application/x-opc+zip', 'application/zip' ),
- array( 'docx', 'application/x-opc+zip', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ),
+ array( 'docx', 'application/x-opc+zip',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ),
array( 'djvu', 'image/x-djvu', 'image/vnd.djvu' ),
array( 'wav', 'audio/wav', 'audio/wav' ),
);
$this->setUpForeignRepo();
$fakeCallback = $this->getMock( 'RepoGroupTestHelper' );
$fakeCallback->expects( $this->once() )->method( 'callback' );
- RepoGroup::singleton()->forEachForeignRepo( array( $fakeCallback, 'callback' ), array( array() ) );
+ RepoGroup::singleton()->forEachForeignRepo(
+ array( $fakeCallback, 'callback' ), array( array() ) );
}
function testForEachForeignRepoNone() {
FileBackendGroup::destroySingleton();
$fakeCallback = $this->getMock( 'RepoGroupTestHelper' );
$fakeCallback->expects( $this->never() )->method( 'callback' );
- RepoGroup::singleton()->forEachForeignRepo( array( $fakeCallback, 'callback' ), array( array() ) );
+ RepoGroup::singleton()->forEachForeignRepo(
+ array( $fakeCallback, 'callback' ), array( array() ) );
}
private function setUpForeignRepo() {
$backend = RepoGroup::singleton()->getLocalRepo()->getBackend();
$backend->prepare( array( 'dir' => "$base/local-public/3/3a" ) );
$backend->store( array(
- 'src' => "$IP/tests/phpunit/data/parser/headbg.jpg", 'dst' => "$base/local-public/3/3a/Foobar.jpg"
+ 'src' => "$IP/tests/phpunit/data/parser/headbg.jpg",
+ 'dst' => "$base/local-public/3/3a/Foobar.jpg"
) );
$backend->prepare( array( 'dir' => "$base/local-public/e/ea" ) );
$backend->store( array(
- 'src' => "$IP/tests/phpunit/data/parser/wiki.png", 'dst' => "$base/local-public/e/ea/Thumb.png"
+ 'src' => "$IP/tests/phpunit/data/parser/wiki.png",
+ 'dst' => "$base/local-public/e/ea/Thumb.png"
) );
$backend->prepare( array( 'dir' => "$base/local-public/0/09" ) );
$backend->store( array(
- 'src' => "$IP/tests/phpunit/data/parser/headbg.jpg", 'dst' => "$base/local-public/0/09/Bad.jpg"
+ 'src' => "$IP/tests/phpunit/data/parser/headbg.jpg",
+ 'dst' => "$base/local-public/0/09/Bad.jpg"
) );
$backend->prepare( array( 'dir' => "$base/local-public/5/5f" ) );
$backend->store( array(
- 'src' => "$IP/tests/phpunit/data/parser/LoremIpsum.djvu", 'dst' => "$base/local-public/5/5f/LoremIpsum.djvu"
+ 'src' => "$IP/tests/phpunit/data/parser/LoremIpsum.djvu",
+ 'dst' => "$base/local-public/5/5f/LoremIpsum.djvu"
) );
// No helpful SVG file to copy, so make one ourselves
<?php
-// We will use this class with getMockForAbstractClass to create a concrete mock class. That call will die if the
-// contructor is not public, unless we use disableOriginalConstructor(), in which case we could not test the constructor.
+// We will use this class with getMockForAbstractClass to create a concrete mock class.
+// That call will die if the contructor is not public, unless we use disableOriginalConstructor(),
+// in which case we could not test the constructor.
abstract class PoolCounterAbstractMock extends PoolCounter {
public function __construct() {
call_user_func_array( 'parent::__construct', func_get_args() );
$poolCounter = $this->getMockBuilder( 'PoolCounterAbstractMock' )
->setConstructorArgs( array( $poolCounterConfig, 'testCounter', 'someKey' ) )
- // don't mock anything - the proper syntax would be setMethods(null), but due to a PHPUnit bug that
- // does not work with getMockForAbstractClass()
+ // don't mock anything - the proper syntax would be setMethods(null), but due
+ // to a PHPUnit bug that does not work with getMockForAbstractClass()
->setMethods( array( 'idontexist' ) )
->getMockForAbstractClass();
$this->assertInstanceOf( 'PoolCounter', $poolCounter );
public function testHashKeyIntoSlots() {
$poolCounter = $this->getMockBuilder( 'PoolCounterAbstractMock' )
- // don't mock anything - the proper syntax would be setMethods(null), but due to a PHPUnit bug that
- // does not work with getMockForAbstractClass()
+ // don't mock anything - the proper syntax would be setMethods(null), but due
+ // to a PHPUnit bug that does not work with getMockForAbstractClass()
->setMethods( array( 'idontexist' ) )
->disableOriginalConstructor()
->getMockForAbstractClass();
class TestFileIterator implements Iterator {
private $file;
private $fh;
- private $parserTest; /* An instance of ParserTest (parserTests.php) or MediaWikiParserTest (phpunit) */
+ /**
+ * @var ParserTest|MediaWikiParserTest An instance of ParserTest (parserTests.php)
+ * or MediaWikiParserTest (phpunit)
+ */
+ private $parserTest;
private $index = 0;
private $test;
private $section = null;
$this->checkSection( 'text' );
$this->checkSection( 'article' );
- $this->parserTest->addArticle( ParserTest::chomp( $this->sectionData['article'] ), $this->sectionData['text'], $this->lineNum );
+ $this->parserTest->addArticle(
+ ParserTest::chomp( $this->sectionData['article'] ),
+ $this->sectionData['text'], $this->lineNum );
$this->clearSection();
}
if ( $input == false || $result == false ||
- ( ( preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runDisabled )
- || ( preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] ) && $result != 'html/php' && !$this->parserTest->runParsoid )
+ ( ( preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] )
+ && !$this->parserTest->runDisabled )
+ || ( preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] )
+ && $result != 'html/php' && !$this->parserTest->runParsoid )
|| !preg_match( "/" . $this->parserTest->regex . "/i", $this->sectionData['test'] ) )
) {
# disabled test
}
if ( isset( $this->sectionData[$this->section] ) ) {
- throw new MWException( "duplicate section '$this->section' at line {$this->lineNum} of $this->file\n" );
+ throw new MWException( "duplicate section '$this->section' "
+ . "at line {$this->lineNum} of $this->file\n" );
}
$this->sectionData[$this->section] = '';
*/
public function unleash( &$parserTest ) {
if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) {
- throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or NewParserTest classes\n" );
+ throw new MWException( __METHOD__ . " must be passed an instance of ParserTest or "
+ . "NewParserTest classes\n" );
}
# Trigger delayed hooks. Any failure will make us abort
$errorHtml = false;
// guard thumbnail rendering with PoolCounter to avoid stampedes
- // expensive files use a separate PoolCounter config so it is possible to set up a global limit on them
+ // expensive files use a separate PoolCounter config so it is possible
+ // to set up a global limit on them
if ( $file->isExpensiveToThumbnail() ) {
$poolCounterType = 'FileRenderExpensive';
} else {