"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "maintenance/language/listVariants.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

listVariants.php  (mediawiki-1.31.1):listVariants.php  (mediawiki-1.32.0)
skipping to change at line 45 skipping to change at line 45
$this->addDescription( 'Outputs a list of language variants' ); $this->addDescription( 'Outputs a list of language variants' );
$this->addOption( 'flat', 'Output variants in a flat list' ); $this->addOption( 'flat', 'Output variants in a flat list' );
$this->addOption( 'json', 'Output variants as JSON' ); $this->addOption( 'json', 'Output variants as JSON' );
} }
public function execute() { public function execute() {
$variantLangs = []; $variantLangs = [];
$variants = []; $variants = [];
foreach ( LanguageConverter::$languagesWithVariants as $langCode ) { foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
$lang = Language::factory( $langCode ); $lang = Language::factory( $langCode );
if ( count( $lang->getVariants() ) > 1 ) { if ( $lang->hasVariants() ) {
$variants += array_flip( $lang->getVariants() ); $variants += array_flip( $lang->getVariants() );
$variantLangs[$langCode] = $lang->getVariants(); $variantLangs[$langCode] = $lang->getVariants();
} }
} }
$variants = array_keys( $variants ); $variants = array_keys( $variants );
sort( $variants ); sort( $variants );
$result = $this->hasOption( 'flat' ) ? $variants : $variantLangs; $result = $this->hasOption( 'flat' ) ? $variants : $variantLangs;
// Not using $this->output() because muting makes no sense here // Not using $this->output() because muting makes no sense here
if ( $this->hasOption( 'json' ) ) { if ( $this->hasOption( 'json' ) ) {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)