jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/361303 )
Change subject: Use short array syntax ...................................................................... Use short array syntax Done by phpcbf over composer fix Done manuell inside @codingStandardsIgnore Change-Id: I1c71874313c7ec619ada12363ac268c0c732c994 --- M Farmer.alias.php M Farmer.php M MediaWikiFarmer.php M MediaWikiFarmer_Extension.php M MediaWikiFarmer_Wiki.php M SpecialFarmer.php 6 files changed, 210 insertions(+), 210 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/Farmer.alias.php b/Farmer.alias.php index 7934352..a5b1c6f 100644 --- a/Farmer.alias.php +++ b/Farmer.alias.php @@ -6,149 +6,149 @@ * @ingroup Extensions */ -$specialPageAliases = array(); +$specialPageAliases = []; /** English (English) */ -$specialPageAliases['en'] = array( - 'Farmer' => array( 'Farmer' ), -); +$specialPageAliases['en'] = [ + 'Farmer' => [ 'Farmer' ], +]; /** Afrikaans (Afrikaans) */ -$specialPageAliases['af'] = array( - 'Farmer' => array( 'Boer' ), -); +$specialPageAliases['af'] = [ + 'Farmer' => [ 'Boer' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'Farmer' => array( 'مزارع' ), -); +$specialPageAliases['ar'] = [ + 'Farmer' => [ 'مزارع' ], +]; /** Egyptian Spoken Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'Farmer' => array( 'فلاح' ), -); +$specialPageAliases['arz'] = [ + 'Farmer' => [ 'فلاح' ], +]; /** Assamese (অসমীয়া) */ -$specialPageAliases['as'] = array( - 'Farmer' => array( 'খেতিয়ক' ), -); +$specialPageAliases['as'] = [ + 'Farmer' => [ 'খেতিয়ক' ], +]; /** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'Farmer' => array( 'Resber' ), -); +$specialPageAliases['diq'] = [ + 'Farmer' => [ 'Resber' ], +]; /** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'Farmer' => array( 'کشاورز' ), -); +$specialPageAliases['fa'] = [ + 'Farmer' => [ 'کشاورز' ], +]; /** Franco-Provençal (arpetan) */ -$specialPageAliases['frp'] = array( - 'Farmer' => array( 'Grangiér' ), -); +$specialPageAliases['frp'] = [ + 'Farmer' => [ 'Grangiér' ], +]; /** Gujarati (ગુજરાતી) */ -$specialPageAliases['gu'] = array( - 'Farmer' => array( 'ખેડૂત' ), -); +$specialPageAliases['gu'] = [ + 'Farmer' => [ 'ખેડૂત' ], +]; /** Haitian (Kreyòl ayisyen) */ -$specialPageAliases['ht'] = array( - 'Farmer' => array( 'Kiltivatè' ), -); +$specialPageAliases['ht'] = [ + 'Farmer' => [ 'Kiltivatè' ], +]; /** Interlingua (interlingua) */ -$specialPageAliases['ia'] = array( - 'Farmer' => array( 'Fermero' ), -); +$specialPageAliases['ia'] = [ + 'Farmer' => [ 'Fermero' ], +]; /** Indonesian (Bahasa Indonesia) */ -$specialPageAliases['id'] = array( - 'Farmer' => array( 'Petani' ), -); +$specialPageAliases['id'] = [ + 'Farmer' => [ 'Petani' ], +]; /** Japanese (日本語) */ -$specialPageAliases['ja'] = array( - 'Farmer' => array( 'ウィキファーム管理' ), -); +$specialPageAliases['ja'] = [ + 'Farmer' => [ 'ウィキファーム管理' ], +]; /** Korean (한국어) */ -$specialPageAliases['ko'] = array( - 'Farmer' => array( '농부' ), -); +$specialPageAliases['ko'] = [ + 'Farmer' => [ '농부' ], +]; /** Colognian (Ripoarisch) */ -$specialPageAliases['ksh'] = array( - 'Farmer' => array( 'StallVollWikis', 'WikiStall' ), -); +$specialPageAliases['ksh'] = [ + 'Farmer' => [ 'StallVollWikis', 'WikiStall' ], +]; /** Cornish (kernowek) */ -$specialPageAliases['kw'] = array( - 'Farmer' => array( 'Tiek' ), -); +$specialPageAliases['kw'] = [ + 'Farmer' => [ 'Tiek' ], +]; /** Ladino (Ladino) */ -$specialPageAliases['lad'] = array( - 'Farmer' => array( 'Agricultor' ), -); +$specialPageAliases['lad'] = [ + 'Farmer' => [ 'Agricultor' ], +]; /** Macedonian (македонски) */ -$specialPageAliases['mk'] = array( - 'Farmer' => array( 'Фармер' ), -); +$specialPageAliases['mk'] = [ + 'Farmer' => [ 'Фармер' ], +]; /** Marathi (मराठी) */ -$specialPageAliases['mr'] = array( - 'Farmer' => array( 'शेतकरी' ), -); +$specialPageAliases['mr'] = [ + 'Farmer' => [ 'शेतकरी' ], +]; /** Erzya (эрзянь) */ -$specialPageAliases['myv'] = array( - 'Farmer' => array( 'Фермер' ), -); +$specialPageAliases['myv'] = [ + 'Farmer' => [ 'Фермер' ], +]; /** Norwegian Bokmål (norsk (bokmål)) */ -$specialPageAliases['nb'] = array( - 'Farmer' => array( 'Bonde' ), -); +$specialPageAliases['nb'] = [ + 'Farmer' => [ 'Bonde' ], +]; /** Nedersaksisch (Nedersaksisch) */ -$specialPageAliases['nds-nl'] = array( - 'Farmer' => array( 'WikiBoerderieje' ), -); +$specialPageAliases['nds-nl'] = [ + 'Farmer' => [ 'WikiBoerderieje' ], +]; /** Dutch (Nederlands) */ -$specialPageAliases['nl'] = array( - 'Farmer' => array( 'Wikifarm' ), -); +$specialPageAliases['nl'] = [ + 'Farmer' => [ 'Wikifarm' ], +]; /** Romanian (română) */ -$specialPageAliases['ro'] = array( - 'Farmer' => array( 'Fermier' ), -); +$specialPageAliases['ro'] = [ + 'Farmer' => [ 'Fermier' ], +]; /** Slovak (slovenčina) */ -$specialPageAliases['sk'] = array( - 'Farmer' => array( 'Farma' ), -); +$specialPageAliases['sk'] = [ + 'Farmer' => [ 'Farma' ], +]; /** Tagalog (Tagalog) */ -$specialPageAliases['tl'] = array( - 'Farmer' => array( 'Magsasaka' ), -); +$specialPageAliases['tl'] = [ + 'Farmer' => [ 'Magsasaka' ], +]; /** Turkish (Türkçe) */ -$specialPageAliases['tr'] = array( - 'Farmer' => array( 'Çiftçi' ), -); +$specialPageAliases['tr'] = [ + 'Farmer' => [ 'Çiftçi' ], +]; /** Simplified Chinese (中文(简体)) */ -$specialPageAliases['zh-hans'] = array( - 'Farmer' => array( '农场' ), -); +$specialPageAliases['zh-hans'] = [ + 'Farmer' => [ '农场' ], +]; /** Traditional Chinese (中文(繁體)) */ -$specialPageAliases['zh-hant'] = array( - 'Farmer' => array( '農場' ), -); +$specialPageAliases['zh-hant'] = [ + 'Farmer' => [ '農場' ], +]; diff --git a/Farmer.php b/Farmer.php index bbb27ff..360e0c1 100644 --- a/Farmer.php +++ b/Farmer.php @@ -11,20 +11,20 @@ * */ -$wgExtensionCredits['specialpage'][] = array( +$wgExtensionCredits['specialpage'][] = [ 'path' => __FILE__, 'name' => 'Farmer', - 'author' => array( 'Gregory Szorc <gregory.sz...@case.edu>', 'Alexandre Emsenhuber' ), + 'author' => [ 'Gregory Szorc <gregory.sz...@case.edu>', 'Alexandre Emsenhuber' ], 'url' => 'https://www.mediawiki.org/wiki/Extension:Farmer', 'descriptionmsg' => 'farmer-desc', 'version' => '0.1.2', 'license-name' => 'GPL-2.0+', -); +]; /** * Extension's configuration */ -$wgFarmerSettings = array( +$wgFarmerSettings = [ // Path to the directory that holds settings for wikis 'configDirectory' => __DIR__ . '/configs/', @@ -35,13 +35,13 @@ 'defaultWiki' => '', // Function used to identify the wiki to use - 'wikiIdentifierFunction' => array( 'MediaWikiFarmer', '_matchByURLHostname' ), + 'wikiIdentifierFunction' => [ 'MediaWikiFarmer', '_matchByURLHostname' ], 'matchRegExp' => '', 'matchOffset' => null, 'matchServerNameSuffix' => '', // Function to call for unknown wiki - 'onUnknownWiki' => array( 'MediaWikiFarmer', '_redirectTo' ), + 'onUnknownWiki' => [ 'MediaWikiFarmer', '_redirectTo' ], // If onUnknownWiki calls MediaWikiFarmer::_redirectTo (default), url to redirect to 'redirectToURL' => '', @@ -56,7 +56,7 @@ 'newDbSourceFile' => "$IP/maintenance/tables.sql", // Get DB name and table prefix for a wiki - 'dbFromWikiFunction' => array( 'MediaWikiFarmer', '_prefixTable' ), + 'dbFromWikiFunction' => [ 'MediaWikiFarmer', '_prefixTable' ], 'dbTablePrefixSeparator' => '', 'dbTablePrefix' => '', @@ -71,7 +71,7 @@ // default skin 'defaultSkin' => 'vector', -); +]; $wgMessagesDirs['MediaWikiFarmer'] = __DIR__ . '/i18n'; diff --git a/MediaWikiFarmer.php b/MediaWikiFarmer.php index 5198a66..cb8cbd7 100644 --- a/MediaWikiFarmer.php +++ b/MediaWikiFarmer.php @@ -12,7 +12,7 @@ // @codingStandardsIgnoreStart - protected $_parameters = array(); + protected $_parameters = []; /** Database name to use, null means use file storage */ protected $_databaseName; @@ -53,7 +53,7 @@ protected $_defaultSkin; /** Extensions available to Farmer */ - protected $_extensions = array(); + protected $_extensions = []; protected $_sharedGroups = false; protected $_extensionsLoaded = false; @@ -375,11 +375,11 @@ // @codingStandardsIgnoreEnd if ( $farmer->useWgConf() ) { global $wgConf; - return array( $wgConf->get( 'wgDBname', $wiki ), $wgConf->get( 'wgDBprefix', $wiki ) ); + return [ $wgConf->get( 'wgDBname', $wiki ), $wgConf->get( 'wgDBprefix', $wiki ) ]; } else { global $wgDBname; $prefix = $farmer->_dbTablePrefix . $wiki . $farmer->_dbTablePrefixSeparator; - return array( $wgDBname, $prefix ); + return [ $wgDBname, $prefix ]; } } @@ -395,7 +395,7 @@ } try { - $db = wfGetDB( $type, array(), $this->_databaseName ); + $db = wfGetDB( $type, [], $this->_databaseName ); } catch ( DBConnectionError $e ) { throw new MWException( __METHOD__ . ": impossible to connect to {$this->_databaseName} to get farm configuration: " . @@ -456,8 +456,8 @@ if ( $this->useDatabase() ) { $dbr = $this->getDB( DB_SLAVE ); - $res = $dbr->select( 'farmer_extension', '*', array(), __METHOD__ ); - $this->_extensions = array(); + $res = $dbr->select( 'farmer_extension', '*', [], __METHOD__ ); + $this->_extensions = []; foreach ( $res as $row ) { $this->_extensions[$row->fe_name] = MediaWikiFarmer_Extension::newFromRow( $row ); } @@ -485,11 +485,11 @@ public function registerExtension( MediaWikiFarmer_Extension $e ) { if ( $this->useDatabase() ) { $dbw = $this->getDB( DB_MASTER ); - $dbw->insert( 'farmer_extension', array( + $dbw->insert( 'farmer_extension', [ 'fe_name' => $e->name, 'fe_description' => $e->description, 'fe_path' => $e->includeFiles[0], - ), __METHOD__ ); + ], __METHOD__ ); } else { // force reload of file $this->getExtensions( true ); @@ -542,16 +542,16 @@ public function getFarmList() { if ( $this->useDatabase() ) { $dbr = $this->getDB( DB_SLAVE ); - $res = $dbr->select( 'farmer_wiki', array( + $res = $dbr->select( 'farmer_wiki', [ 'fw_name', 'fw_title', 'fw_description' - ), array(), __METHOD__ ); - $arr = array(); + ], [], __METHOD__ ); + $arr = []; foreach ( $res as $row ) { - $arr[$row->fw_name] = array( + $arr[$row->fw_name] = [ 'name' => $row->fw_name, 'title' => $row->fw_title, 'description' => $row->fw_description - ); + ]; } return $arr; } else { @@ -569,7 +569,7 @@ } $directory = new DirectoryIterator( $this->_configDirectory . '/wikis/' ); - $wikis = array(); + $wikis = []; foreach ( $directory as $file ) { if ( !$file->isDot() && !$file->isDir() ) { @@ -580,10 +580,10 @@ } } - $farmList = array(); + $farmList = []; foreach ( $wikis as $k => $v ) { - $arr = array(); + $arr = []; $arr['name'] = $v->name; $arr['title'] = $v->title; $arr['description'] = $v->description; @@ -601,14 +601,14 @@ public function updateInterwikiTable() { $wikis = $this->getFarmList(); $dbw = wfGetDB( DB_MASTER ); - $replacements = array(); + $replacements = []; foreach ( $wikis as $key => $stuff ) { $wiki = MediaWikiFarmer_Wiki::factory( $key ); - $replacements[] = array( + $replacements[] = [ 'iw_prefix' => $wiki->name, 'iw_url' => $wiki->getUrl(), 'iw_local' => 1, - ); + ]; } $dbw->replace( 'interwiki', 'iw_prefix', $replacements, __METHOD__ ); } diff --git a/MediaWikiFarmer_Extension.php b/MediaWikiFarmer_Extension.php index eec265f..2d30c17 100644 --- a/MediaWikiFarmer_Extension.php +++ b/MediaWikiFarmer_Extension.php @@ -15,7 +15,7 @@ /** * List of files that need to be included for this extension to work */ - protected $_includeFiles = array(); + protected $_includeFiles = []; // @codingStandardsIgnoreEnd public static function newFromRow( $row ) { diff --git a/MediaWikiFarmer_Wiki.php b/MediaWikiFarmer_Wiki.php index b424607..2fa727c 100644 --- a/MediaWikiFarmer_Wiki.php +++ b/MediaWikiFarmer_Wiki.php @@ -20,13 +20,13 @@ protected $_creator; /** Extensions to load for this wiki */ - protected $_extensions = array(); + protected $_extensions = []; /** Global variables set for this wiki */ - protected $_variables = array(); + protected $_variables = []; /** Permissions are so funky, we give them their own variable */ - protected $_permissions = array( '*' => array(), 'user' => array() ); + protected $_permissions = [ '*' => [], 'user' => [] ]; /** DB object */ protected $_db; @@ -35,7 +35,7 @@ /** * Creates a wiki instance from a wiki name */ - public function __construct( $wiki, $variables = array() ) { + public function __construct( $wiki, $variables = [] ) { $this->_name = $wiki; $this->_variables = $variables; } @@ -51,7 +51,7 @@ } public function __set( $k, $v ) { - if ( in_array( $k, array( 'name', 'title', 'description', 'creator', 'extensions' ) ) ) { + if ( in_array( $k, [ 'name', 'title', 'description', 'creator', 'extensions' ] ) ) { $property = '_' . $k; $this->$property = $v; } elseif ( substr( $k, 0, 2 ) == 'wg' ) { @@ -66,12 +66,12 @@ return $this->_name; } - public static function factory( $wiki, $variables = array() ) { + public static function factory( $wiki, $variables = [] ) { $farmer = MediaWikiFarmer::getInstance(); if ( $farmer->useDatabase() ) { $dbr = $farmer->getDB( DB_SLAVE ); - $row = $dbr->selectRow( 'farmer_wiki', '*', array( 'fw_name' => $wiki ), __METHOD__ ); + $row = $dbr->selectRow( 'farmer_wiki', '*', [ 'fw_name' => $wiki ], __METHOD__ ); if ( $row === false ) { return new MediaWikiFarmer_Wiki( $wiki, $variables ); } else { @@ -98,7 +98,7 @@ * Create a new wiki from settings */ public static function newFromParams( - $name, $title, $description, $creator, $variables = array() + $name, $title, $description, $creator, $variables = [] ) { $wiki = self::factory( $name, $variables ); @@ -119,14 +119,14 @@ $dbr = MediaWikiFarmer::getInstance()->getDB( DB_SLAVE ); $res = $dbr->select( - array( 'farmer_extension', 'farmer_wiki_extension' ), + [ 'farmer_extension', 'farmer_wiki_extension' ], '*', - array( 'fwe_wiki' => $row->fw_id ), + [ 'fwe_wiki' => $row->fw_id ], __METHOD__, - array(), - array( 'farmer_wiki_extension' => array( 'LEFT JOIN', 'fwe_extension = fe_id' ) ) + [], + [ 'farmer_wiki_extension' => [ 'LEFT JOIN', 'fwe_extension = fe_id' ] ] ); - $wiki->_extensions = array(); + $wiki->_extensions = []; foreach ( $res as $row ) { $wiki->_extensions[$row->fe_name] = MediaWikiFarmer_Extension::newFromRow( $row ); } @@ -163,7 +163,7 @@ if ( $farmer->useDatabase() ) { return (bool)$farmer->getDB( DB_SLAVE )->selectField( - 'farmer_wiki', 1, array( 'fw_name' => $this->_name ), __METHOD__ + 'farmer_wiki', 1, [ 'fw_name' => $this->_name ], __METHOD__ ); } else { return file_exists( self::_getWikiConfigFile( $this->_name ) ); @@ -175,30 +175,30 @@ if ( $farmer->useDatabase() ) { $dbw = $farmer->getDB( DB_MASTER ); - $new = array( + $new = [ 'fw_name' => $this->_name, 'fw_title' => $this->_title, 'fw_description' => $this->_description, 'fw_creator' => $this->_creator, 'fw_parameters' => serialize( $this->_variables ), 'fw_permissions' => serialize( $this->_permissions ), - ); + ]; - $curId = $dbw->selectField( 'farmer_wiki', 'fw_id', array( - 'fw_name' => $this->_name ), __METHOD__ + $curId = $dbw->selectField( 'farmer_wiki', 'fw_id', [ + 'fw_name' => $this->_name ], __METHOD__ ); if ( $curId == null ) { $dbw->insert( 'farmer_wiki', $new, __METHOD__ ); $curId = $dbw->insertId(); } else { - $dbw->update( 'farmer_wiki', $new, array( 'fw_id' => $curId ), __METHOD__ ); + $dbw->update( 'farmer_wiki', $new, [ 'fw_id' => $curId ], __METHOD__ ); } - $insert = array(); + $insert = []; foreach ( $this->_extensions as $ext ) { - $insert[] = array( 'fwe_wiki' => $curId, 'fwe_extension' => $ext->id ); + $insert[] = [ 'fwe_wiki' => $curId, 'fwe_extension' => $ext->id ]; } - $dbw->delete( 'farmer_wiki_extension', array( 'fwe_wiki' => $curId ), __METHOD__ ); + $dbw->delete( 'farmer_wiki_extension', [ 'fwe_wiki' => $curId ], __METHOD__ ); $dbw->insert( 'farmer_wiki_extension', $insert, __METHOD__ ); return true; @@ -220,11 +220,11 @@ if ( $farmer->useDatabase() ) { $dbw = $farmer->getDB( DB_MASTER ); - $dbw->deleteJoin( 'farmer_wiki_extension', 'farmer_wiki', 'fwe_wiki', 'fw_id', array( + $dbw->deleteJoin( 'farmer_wiki_extension', 'farmer_wiki', 'fwe_wiki', 'fw_id', [ 'fw_name' => $this->_name - ), __METHOD__ + ], __METHOD__ ); - $dbw->delete( 'farmer_wiki', array( 'fw_name' => $this->_name ), __METHOD__ ); + $dbw->delete( 'farmer_wiki', [ 'fw_name' => $this->_name ], __METHOD__ ); } else { unlink( self::_getWikiConfigFile( $this->_name ) ); } @@ -297,7 +297,7 @@ if ( $farmer->sharingGroups() ) { $group = '[farmer][' . $this->_name . '][admin]'; - $grantToWikiAdmins = array( 'read', 'edit' ); + $grantToWikiAdmins = [ 'read', 'edit' ]; foreach ( $grantToWikiAdmins as $v ) { $wgGroupPermissions[$group][$v] = true; @@ -371,7 +371,7 @@ public function setPermission( $group, $permission, $value ) { if ( !array_key_exists( $group, $this->_permissions ) ) { - $this->_permissions[$group] = array(); + $this->_permissions[$group] = []; } $this->_permissions[$group][$permission] = $value ? true : false; @@ -470,7 +470,7 @@ // FIXME! Hacky $oldShared = $wgSharedTables; - $wgSharedTables = array(); + $wgSharedTables = []; $farmer = MediaWikiFarmer::getInstance(); $db = false; @@ -503,23 +503,23 @@ )->inContentLanguage()->useDatabase( false )->plain() ); $article = new Article( $titleobj ); $newid = $article->insertOn( $db ); - $revision = new Revision( array( + $revision = new Revision( [ 'page' => $newid, 'text' => wfMessage( 'farmernewwikimainpage' )->inContentLanguage()->text(), 'comment' => '', 'user' => 0, 'user_text' => 'MediaWiki default', - ) ); + ] ); $revid = $revision->insertOn( $db ); $article->updateRevisionOn( $db, $revision ); // site_stats table entry - $db->insert( 'site_stats', array( + $db->insert( 'site_stats', [ 'ss_row_id' => 1, 'ss_total_views' => 0, 'ss_total_edits' => 0, 'ss_good_articles' => 0 - ) ); + ] ); } /** @@ -533,13 +533,13 @@ $db = $this->getDatabase(); $db->insert( 'interwiki', - array( + [ 'iw_prefix' => strtolower( $this->title ), 'iw_url' => $this->getUrl(), 'iw_local' => 1, - ), + ], __METHOD__, - array( 'IGNORE' ) + [ 'IGNORE' ] ); } @@ -554,10 +554,10 @@ } else { $userId = User::idFromName( $this->creator ); if ( $userId ) { - $insert = array( - array( 'ug_user' => $userId, 'ug_group' => 'sysop' ), - array( 'ug_user' => $userId, 'ug_group' => 'bureaucrat' ), - ); + $insert = [ + [ 'ug_user' => $userId, 'ug_group' => 'sysop' ], + [ 'ug_user' => $userId, 'ug_group' => 'bureaucrat' ], + ]; $db = $this->getDatabase(); $db->insert( 'user_groups', $insert, __METHOD__ ); } @@ -605,7 +605,7 @@ // @codingStandardsIgnoreEnd $db = $this->getDatabase(); if ( $db->tableExists( 'interwiki' ) ) { - $db->delete( 'interwiki', array( 'iw_prefix' => strtolower( $this->_title ) ), __METHOD__ ); + $db->delete( 'interwiki', [ 'iw_prefix' => strtolower( $this->_title ) ], __METHOD__ ); } else { wfDebug( __METHOD__ . ": Table 'interwiki' does not exists\n" ); } diff --git a/SpecialFarmer.php b/SpecialFarmer.php index a5c706a..7de1471 100644 --- a/SpecialFarmer.php +++ b/SpecialFarmer.php @@ -66,34 +66,34 @@ $wgOut->addWikiMsg( 'farmer-about-text' ); $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-list-wiki' ); - $wgOut->wrapWikiMsg( '* $1', array( 'farmer-list-wiki-text', 'Special:Farmer/list' ) ); + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-list-wiki-text', 'Special:Farmer/list' ] ); if ( $wgFarmer->getActiveWiki()->isDefaultWiki() ) { if ( MediaWikiFarmer::userCanCreateWiki( $wgUser ) ) { $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-createwiki' ); - $wgOut->wrapWikiMsg( '* $1', array( 'farmer-createwiki-text', 'Special:Farmer/create' ) ); + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-createwiki-text', 'Special:Farmer/create' ] ); } // if the user is a farmer admin, give them a menu of cool admin tools if ( MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ) { $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-administration' ); $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-administration-extension' ); - $wgOut->wrapWikiMsg( '* $1', array( + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-administration-extension-text', 'Special:Farmer/manageExtensions' - ) + ] ); $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-admimistration-listupdate' ); - $wgOut->wrapWikiMsg( '* $1', array( + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-admimistration-listupdate-text', 'Special:Farmer/updateList' - ) + ] ); $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-administration-delete' ); - $wgOut->wrapWikiMsg( '* $1', array( + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-administration-delete-text', 'Special:Farmer/delete' - ) + ] ); } } @@ -102,9 +102,9 @@ if ( MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) || $wiki->userIsAdmin( $wgUser ) ) { $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-administer-thiswiki' ); - $wgOut->wrapWikiMsg( '* $1', array( + $wgOut->wrapWikiMsg( '* $1', [ 'farmer-administer-thiswiki-text', 'Special:Farmer/admin' - ) + ] ); } } @@ -144,7 +144,7 @@ $wikiObj->create(); $log = new LogPage( 'farmer' ); - $log->addEntry( 'create', $this->getTitle(), $reason, array( $name ) ); + $log->addEntry( 'create', $this->getTitle(), $reason, [ $name ] ); $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-wikicreated' ); $wgOut->addWikiMsg( 'farmer-wikicreated-text', $wikiObj->getUrl( wfUrlencode( @@ -160,9 +160,9 @@ $wiki = new MediaWikiFarmer_Wiki( $name ); if ( $wiki->exists() || $wiki->databaseExists() ) { - $wgOut->wrapWikiMsg( "== $1 ==\n\n$2", 'farmer-wikiexists', array( + $wgOut->wrapWikiMsg( "== $1 ==\n\n$2", 'farmer-wikiexists', [ 'farmer-wikiexists-text', $name - ) + ] ); return; } @@ -170,23 +170,23 @@ $url = $wiki->getUrl( '' ); $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-confirmsetting' ); - $wgOut->addHtml( Xml::openElement( 'table', array( 'class' => 'wikitable' ) ) . "\n" . - Xml::tags( 'tr', array(), Xml::tags( 'th', array(), + $wgOut->addHtml( Xml::openElement( 'table', [ 'class' => 'wikitable' ] ) . "\n" . + Xml::tags( 'tr', [], Xml::tags( 'th', [], wfMessage( 'farmer-confirmsetting-name' - )->parse() ) . Xml::element( 'td', array(), $name ) ) . "\n" . - Xml::tags( 'tr', array(), Xml::tags( 'th', array(), + )->parse() ) . Xml::element( 'td', [], $name ) ) . "\n" . + Xml::tags( 'tr', [], Xml::tags( 'th', [], wfMessage( 'farmer-confirmsetting-title' - )->parse() ) . Xml::element( 'td', array(), $title ) ) . "\n" . - Xml::tags( 'tr', array(), Xml::tags( 'th', array(), + )->parse() ) . Xml::element( 'td', [], $title ) ) . "\n" . + Xml::tags( 'tr', [], Xml::tags( 'th', [], wfMessage( 'farmer-confirmsetting-description' - )->parse() ) . Xml::element( 'td', array(), $description ) ) . "\n" . - Xml::tags( 'tr', array(), Xml::tags( 'th', array(), + )->parse() ) . Xml::element( 'td', [], $description ) ) . "\n" . + Xml::tags( 'tr', [], Xml::tags( 'th', [], wfMessage( 'farmer-confirmsetting-reason' - )->parse() ) . Xml::element( 'td', array(), $reason ) ) . "\n" . + )->parse() ) . Xml::element( 'td', [], $reason ) ) . "\n" . Xml::closeElement( 'table' ) ); $wgOut->addWikiMsg( 'farmer-confirmsetting-text', $name, $title, $url ); @@ -231,15 +231,15 @@ $token = htmlspecialchars( $wgUser->getEditToken() ); $wgOut->addHTML( - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action ) ) . "\n" . + Xml::openElement( 'form', [ 'method' => 'post', 'action' => $action ] ) . "\n" . Xml::buildForm( - array( - 'farmer-createwiki-user' => Xml::element( 'b', array(), $wgUser->getName() ), + [ + 'farmer-createwiki-user' => Xml::element( 'b', [], $wgUser->getName() ), 'farmer-createwiki-name' => Xml::input( 'wpName', 20, $name ), 'farmer-createwiki-title' => Xml::input( 'wpTitle', 20, $title ), 'farmer-createwiki-description' => Xml::textarea( 'wpDescription', $description ), 'farmer-createwiki-reason' => Xml::input( 'wpReason', 20, $reason ), - ), 'farmer-button-submit' + ], 'farmer-button-submit' ) . "\n" . Html::Hidden( 'token', $token ) . "\n" . Xml::closeElement( 'form' ) @@ -281,14 +281,14 @@ $wiki = $wgRequest->getVal( 'wpWiki' ); if ( $wiki && $wiki != '-1' ) { if ( $wgRequest->getCheck( 'wpConfirm' ) ) { - $wgOut->wrapWikiMsg( '<div class="successbox">$1</div>', array( 'farmer-deleting', $wiki ) ); + $wgOut->wrapWikiMsg( '<div class="successbox">$1</div>', [ 'farmer-deleting', $wiki ] ); $log = new LogPage( 'farmer' ); $log->addEntry( 'delete', $this->getTitle(), $wgRequest->getVal( 'wpReason' ), - array( $wiki ) + [ $wiki ] ); $deleteWiki = MediaWikiFarmer_Wiki::factory( $wiki ); @@ -296,11 +296,11 @@ } else { $wgOut->addWikiMsg( 'farmer-delete-confirm-wiki', $wiki ); $wgOut->addHTML( - Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'deleteWiki' ) ) . "\n" . - Xml::buildForm( array( + Xml::openElement( 'form', [ 'method' => 'post', 'name' => 'deleteWiki' ] ) . "\n" . + Xml::buildForm( [ 'farmer-delete-reason' => Xml::input( 'wpReason', false, $wgRequest->getVal( 'wpReason' ) ), 'farmer-delete-confirm' => Xml::check( 'wpConfirm' ) - ), 'farmer-delete-form-submit' ) . "\n" . + ], 'farmer-delete-form-submit' ) . "\n" . Html::Hidden( 'wpWiki', $wiki ) . "\n" . Xml::closeElement( 'form' ) ); @@ -324,7 +324,7 @@ } $wgOut->addHTML( - Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'deleteWiki' ) ) . "\n" . + Xml::openElement( 'form', [ 'method' => 'post', 'name' => 'deleteWiki' ] ) . "\n" . $select->getHTML() . "\n" . Xml::submitButton( wfMessage( 'farmer-delete-form-submit' )->text() ) . "\n" . Xml::closeElement( 'form' ) @@ -414,7 +414,7 @@ ); # Permissions stuff - if ( Hooks::run( 'FarmerAdminPermissions', array( $wgFarmer ) ) ) { + if ( Hooks::run( 'FarmerAdminPermissions', [ $wgFarmer ] ) ) { # Import if ( $wgRequest->wasPosted() ) { @@ -441,12 +441,12 @@ $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-basic-permission-visitor' ); $wgOut->addWikiMsg( 'farmer-basic-permission-visitor-text' ); - $doArray = array( - array( 'read', wfMessage( 'right-read' )->text() ), - array( 'edit', wfMessage( 'right-edit' )->text() ), - array( 'createpage', wfMessage( 'right-createpage' )->text() ), - array( 'createtalk', wfMessage( 'right-createtalk' )->text() ) - ); + $doArray = [ + [ 'read', wfMessage( 'right-read' )->text() ], + [ 'edit', wfMessage( 'right-edit' )->text() ], + [ 'createpage', wfMessage( 'right-createpage' )->text() ], + [ 'createtalk', wfMessage( 'right-createtalk' )->text() ] + ]; foreach ( $doArray as $arr ) { $this->_doPermissionInput( $wgOut, $wiki, '*', $arr[0], $arr[1] ); @@ -455,16 +455,16 @@ $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-basic-permission-user' ); $wgOut->addWikiMsg( 'farmer-basic-permission-user-text' ); - $doArray = array( - array( 'read', wfMessage( 'right-read' )->text() ), - array( 'edit', wfMessage( 'right-edit' )->text() ), - array( 'createpage', wfMessage( 'right-createpage' )->text() ), - array( 'createtalk', wfMessage( 'right-createtalk' )->text() ), - array( 'move', wfMessage( 'right-move' )->text() ), - array( 'upload', wfMessage( 'right-upload' )->text() ), - array( 'reupload', wfMessage( 'right-reupload' )->text() ), - array( 'minoredit', wfMessage( 'right-minoredit' )->text() ) - ); + $doArray = [ + [ 'read', wfMessage( 'right-read' )->text() ], + [ 'edit', wfMessage( 'right-edit' )->text() ], + [ 'createpage', wfMessage( 'right-createpage' )->text() ], + [ 'createtalk', wfMessage( 'right-createtalk' )->text() ], + [ 'move', wfMessage( 'right-move' )->text() ], + [ 'upload', wfMessage( 'right-upload' )->text() ], + [ 'reupload', wfMessage( 'right-reupload' )->text() ], + [ 'minoredit', wfMessage( 'right-minoredit' )->text() ] + ]; foreach ( $doArray as $arr ) { $this->_doPermissionInput( $wgOut, $wiki, 'user', $arr[0], $arr[1] ); @@ -476,7 +476,7 @@ } # Default skin - if ( Hooks::run( 'FarmerAdminSkin', array( $wgFarmer ) ) ) { + if ( Hooks::run( 'FarmerAdminSkin', [ $wgFarmer ] ) ) { # Import if ( $wgRequest->wasPosted() ) { @@ -523,13 +523,13 @@ } # Manage active extensions - if ( Hooks::run( 'FarmerAdminExtensions', array( $wgFarmer ) ) ) { + if ( Hooks::run( 'FarmerAdminExtensions', [ $wgFarmer ] ) ) { $extensions = $wgFarmer->getExtensions(); // if we post a list of new extensions, wipe the old list from the wiki if ( $wgRequest->wasPosted() && $wgRequest->getCheck( 'submitExtension' ) ) { - $wiki->extensions = array(); + $wiki->extensions = []; // go through all posted extensions and add the appropriate ones foreach ( (array)$wgRequest->getArray( 'extension' ) as $k => $e ) { @@ -571,7 +571,7 @@ // @codingStandardsIgnoreEnd global $wgOut, $wgUser, $wgRequest; - if ( !Hooks::run( 'FarmerManageExtensions', array( $wgFarmer ) ) ) { + if ( !Hooks::run( 'FarmerManageExtensions', [ $wgFarmer ] ) ) { return; } -- To view, visit https://gerrit.wikimedia.org/r/361303 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1c71874313c7ec619ada12363ac268c0c732c994 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Farmer Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits