Umherirrender has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/359186 )
Change subject: Use short array syntax
......................................................................
Use short array syntax
Done by phpcbf over composer fix
Change-Id: I0f66a72c6e8b6d7aa353a7a3db448723096c751b
---
M Contributors.alias.php
M Contributors.i18n.php
M Contributors.magic.php
M api/ApiQueryCncontributors.php
M includes/Contributors.php
M includes/ContributorsHooks.php
M includes/ContributorsTablePager.php
M includes/SpecialContributors.php
M maintenance/PopulateContributorsTable.php
M phpcs.xml
10 files changed, 317 insertions(+), 319 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Contributors
refs/changes/86/359186/1
diff --git a/Contributors.alias.php b/Contributors.alias.php
index 4f801d1..1bb01d7 100644
--- a/Contributors.alias.php
+++ b/Contributors.alias.php
@@ -6,389 +6,389 @@
* @ingroup Extensions
*/
-$specialPageAliases = array();
+$specialPageAliases = [];
/** English (English) */
-$specialPageAliases['en'] = array(
- 'Contributors' => array( 'Contributors' ),
-);
+$specialPageAliases['en'] = [
+ 'Contributors' => [ 'Contributors' ],
+];
/** Afrikaans (Afrikaans) */
-$specialPageAliases['af'] = array(
- 'Contributors' => array( 'Bydraers' ),
-);
+$specialPageAliases['af'] = [
+ 'Contributors' => [ 'Bydraers' ],
+];
/** Arabic (العربية) */
-$specialPageAliases['ar'] = array(
- 'Contributors' => array( 'مساهمون' ),
-);
+$specialPageAliases['ar'] = [
+ 'Contributors' => [ 'مساهمون' ],
+];
/** Aramaic (ܐܪܡܝܐ) */
-$specialPageAliases['arc'] = array(
- 'Contributors' => array( 'ܫܘ̈ܬܦܐ' ),
-);
+$specialPageAliases['arc'] = [
+ 'Contributors' => [ 'ܫܘ̈ܬܦܐ' ],
+];
/** Egyptian Arabic (مصرى) */
-$specialPageAliases['arz'] = array(
- 'Contributors' => array( 'مساهمين' ),
-);
+$specialPageAliases['arz'] = [
+ 'Contributors' => [ 'مساهمين' ],
+];
/** Assamese (অসমীয়া) */
-$specialPageAliases['as'] = array(
- 'Contributors' => array( 'বৰঙনিদাতা' ),
-);
+$specialPageAliases['as'] = [
+ 'Contributors' => [ 'বৰঙনিদাতা' ],
+];
/** Avaric (авар) */
-$specialPageAliases['av'] = array(
- 'Contributors' => array( 'Вкладчики' ),
-);
+$specialPageAliases['av'] = [
+ 'Contributors' => [ 'Вкладчики' ],
+];
/** Bashkir (башҡортса) */
-$specialPageAliases['ba'] = array(
- 'Contributors' => array( 'Contributors' ),
-);
+$specialPageAliases['ba'] = [
+ 'Contributors' => [ 'Contributors' ],
+];
/** Western Balochi (بلوچی رخشانی) */
-$specialPageAliases['bgn'] = array(
- 'Contributors' => array( 'شرکت_کنۆک_ئان' ),
-);
+$specialPageAliases['bgn'] = [
+ 'Contributors' => [ 'شرکت_کنۆک_ئان' ],
+];
/** Banjar (Bahasa Banjar) */
-$specialPageAliases['bjn'] = array(
- 'Contributors' => array( 'Panyumbang' ),
-);
+$specialPageAliases['bjn'] = [
+ 'Contributors' => [ 'Panyumbang' ],
+];
/** Bengali (বাংলা) */
-$specialPageAliases['bn'] = array(
- 'Contributors' => array( 'অবদানকারীগণ' ),
-);
+$specialPageAliases['bn'] = [
+ 'Contributors' => [ 'অবদানকারীগণ' ],
+];
/** Breton (brezhoneg) */
-$specialPageAliases['br'] = array(
- 'Contributors' => array( 'Kenlabourerien' ),
-);
+$specialPageAliases['br'] = [
+ 'Contributors' => [ 'Kenlabourerien' ],
+];
/** Bosnian (bosanski) */
-$specialPageAliases['bs'] = array(
- 'Contributors' => array( 'Urednici' ),
-);
+$specialPageAliases['bs'] = [
+ 'Contributors' => [ 'Urednici' ],
+];
/** Min Dong Chinese (Mìng-dĕ̤ng-ngṳ̄) */
-$specialPageAliases['cdo'] = array(
- 'Contributors' => array( '貢獻其儂' ),
-);
+$specialPageAliases['cdo'] = [
+ 'Contributors' => [ '貢獻其儂' ],
+];
/** Chechen (нохчийн) */
-$specialPageAliases['ce'] = array(
- 'Contributors' => array( 'Ахча_охьадуьхкарш' ),
-);
+$specialPageAliases['ce'] = [
+ 'Contributors' => [ 'Ахча_охьадуьхкарш' ],
+];
/** Czech (čeština) */
-$specialPageAliases['cs'] = array(
- 'Contributors' => array( 'Přispěvatelé', 'Prispevatele' ),
-);
+$specialPageAliases['cs'] = [
+ 'Contributors' => [ 'Přispěvatelé', 'Prispevatele' ],
+];
/** German (Deutsch) */
-$specialPageAliases['de'] = array(
- 'Contributors' => array( 'Autoren' ),
-);
+$specialPageAliases['de'] = [
+ 'Contributors' => [ 'Autoren' ],
+];
/** Zazaki (Zazaki) */
-$specialPageAliases['diq'] = array(
- 'Contributors' => array( 'İştırakkeri' ),
-);
+$specialPageAliases['diq'] = [
+ 'Contributors' => [ 'İştırakkeri' ],
+];
/** Lower Sorbian (dolnoserbski) */
-$specialPageAliases['dsb'] = array(
- 'Contributors' => array( 'Awtory' ),
-);
+$specialPageAliases['dsb'] = [
+ 'Contributors' => [ 'Awtory' ],
+];
/** Greek (Ελληνικά) */
-$specialPageAliases['el'] = array(
- 'Contributors' => array( 'Συνεισφέροντες' ),
-);
+$specialPageAliases['el'] = [
+ 'Contributors' => [ 'Συνεισφέροντες' ],
+];
/** Esperanto (Esperanto) */
-$specialPageAliases['eo'] = array(
- 'Contributors' => array( 'Kontribuantoj' ),
-);
+$specialPageAliases['eo'] = [
+ 'Contributors' => [ 'Kontribuantoj' ],
+];
/** Persian (فارسی) */
-$specialPageAliases['fa'] = array(
- 'Contributors' => array( 'مشارکتکنندگان' ),
-);
+$specialPageAliases['fa'] = [
+ 'Contributors' => [ 'مشارکتکنندگان' ],
+];
/** Finnish (suomi) */
-$specialPageAliases['fi'] = array(
- 'Contributors' => array( 'Muokkaajat' ),
-);
+$specialPageAliases['fi'] = [
+ 'Contributors' => [ 'Muokkaajat' ],
+];
/** French (français) */
-$specialPageAliases['fr'] = array(
- 'Contributors' => array( 'Contributeurs' ),
-);
+$specialPageAliases['fr'] = [
+ 'Contributors' => [ 'Contributeurs' ],
+];
/** Galician (galego) */
-$specialPageAliases['gl'] = array(
- 'Contributors' => array( 'Colaboradores' ),
-);
+$specialPageAliases['gl'] = [
+ 'Contributors' => [ 'Colaboradores' ],
+];
/** Swiss German (Alemannisch) */
-$specialPageAliases['gsw'] = array(
- 'Contributors' => array( 'Autore' ),
-);
+$specialPageAliases['gsw'] = [
+ 'Contributors' => [ 'Autore' ],
+];
/** Hawaiian (Hawai`i) */
-$specialPageAliases['haw'] = array(
- 'Contributors' => array( 'MeaHaʻawina', 'MeaHaawina' ),
-);
+$specialPageAliases['haw'] = [
+ 'Contributors' => [ 'MeaHaʻawina', 'MeaHaawina' ],
+];
/** Hebrew (עברית) */
-$specialPageAliases['he'] = array(
- 'Contributors' => array( 'תורמים' ),
-);
+$specialPageAliases['he'] = [
+ 'Contributors' => [ 'תורמים' ],
+];
/** Croatian (hrvatski) */
-$specialPageAliases['hr'] = array(
- 'Contributors' => array( 'Doprinositelji' ),
-);
+$specialPageAliases['hr'] = [
+ 'Contributors' => [ 'Doprinositelji' ],
+];
/** Upper Sorbian (hornjoserbsce) */
-$specialPageAliases['hsb'] = array(
- 'Contributors' => array( 'Awtorojo' ),
-);
+$specialPageAliases['hsb'] = [
+ 'Contributors' => [ 'Awtorojo' ],
+];
/** Haitian (Kreyòl ayisyen) */
-$specialPageAliases['ht'] = array(
- 'Contributors' => array( 'Kontribitè' ),
-);
+$specialPageAliases['ht'] = [
+ 'Contributors' => [ 'Kontribitè' ],
+];
/** Interlingua (interlingua) */
-$specialPageAliases['ia'] = array(
- 'Contributors' => array( 'Contributores' ),
-);
+$specialPageAliases['ia'] = [
+ 'Contributors' => [ 'Contributores' ],
+];
/** Indonesian (Bahasa Indonesia) */
-$specialPageAliases['id'] = array(
- 'Contributors' => array( 'Kontributor' ),
-);
+$specialPageAliases['id'] = [
+ 'Contributors' => [ 'Kontributor' ],
+];
/** Ido (Ido) */
-$specialPageAliases['io'] = array(
- 'Contributors' => array( 'Kontributanti' ),
-);
+$specialPageAliases['io'] = [
+ 'Contributors' => [ 'Kontributanti' ],
+];
/** Italian (italiano) */
-$specialPageAliases['it'] = array(
- 'Contributors' => array( 'Contributori' ),
-);
+$specialPageAliases['it'] = [
+ 'Contributors' => [ 'Contributori' ],
+];
/** Japanese (日本語) */
-$specialPageAliases['ja'] = array(
- 'Contributors' => array( '投稿者' ),
-);
+$specialPageAliases['ja'] = [
+ 'Contributors' => [ '投稿者' ],
+];
/** Khmer (ភាសាខ្មែរ) */
-$specialPageAliases['km'] = array(
- 'Contributors' => array( 'អ្នករួមចំណែក' ),
-);
+$specialPageAliases['km'] = [
+ 'Contributors' => [ 'អ្នករួមចំណែក' ],
+];
/** Korean (한국어) */
-$specialPageAliases['ko'] = array(
- 'Contributors' => array( '기여자목록' ),
-);
+$specialPageAliases['ko'] = [
+ 'Contributors' => [ '기여자목록' ],
+];
/** Colognian (Ripoarisch) */
-$specialPageAliases['ksh'] = array(
- 'Contributors' => array( 'Schriiver' ),
-);
+$specialPageAliases['ksh'] = [
+ 'Contributors' => [ 'Schriiver' ],
+];
/** Cornish (kernowek) */
-$specialPageAliases['kw'] = array(
- 'Contributors' => array( 'Kevroryon' ),
-);
+$specialPageAliases['kw'] = [
+ 'Contributors' => [ 'Kevroryon' ],
+];
/** Ladino (Ladino) */
-$specialPageAliases['lad'] = array(
- 'Contributors' => array( 'Ajustadores' ),
-);
+$specialPageAliases['lad'] = [
+ 'Contributors' => [ 'Ajustadores' ],
+];
/** Luxembourgish (Lëtzebuergesch) */
-$specialPageAliases['lb'] = array(
- 'Contributors' => array( 'Auteuren' ),
-);
+$specialPageAliases['lb'] = [
+ 'Contributors' => [ 'Auteuren' ],
+];
/** Northern Luri (لۊری شومالی) */
-$specialPageAliases['lrc'] = array(
- 'Contributors' => array( 'ھومیاریا' ),
-);
+$specialPageAliases['lrc'] = [
+ 'Contributors' => [ 'ھومیاریا' ],
+];
/** Malagasy (Malagasy) */
-$specialPageAliases['mg'] = array(
- 'Contributors' => array( 'Mpandray_anjara' ),
-);
+$specialPageAliases['mg'] = [
+ 'Contributors' => [ 'Mpandray_anjara' ],
+];
/** Minangkabau (Baso Minangkabau) */
-$specialPageAliases['min'] = array(
- 'Contributors' => array( 'Panyumbang' ),
-);
+$specialPageAliases['min'] = [
+ 'Contributors' => [ 'Panyumbang' ],
+];
/** Macedonian (македонски) */
-$specialPageAliases['mk'] = array(
- 'Contributors' => array( 'Придонесувачи' ),
-);
+$specialPageAliases['mk'] = [
+ 'Contributors' => [ 'Придонесувачи' ],
+];
/** Malayalam (മലയാളം) */
-$specialPageAliases['ml'] = array(
- 'Contributors' => array( 'സംഭാവകർ' ),
-);
+$specialPageAliases['ml'] = [
+ 'Contributors' => [ 'സംഭാവകർ' ],
+];
/** Marathi (मराठी) */
-$specialPageAliases['mr'] = array(
- 'Contributors' => array( 'योगदानकर्ते' ),
-);
+$specialPageAliases['mr'] = [
+ 'Contributors' => [ 'योगदानकर्ते' ],
+];
/** Malay (Bahasa Melayu) */
-$specialPageAliases['ms'] = array(
- 'Contributors' => array( 'Penyumbang' ),
-);
+$specialPageAliases['ms'] = [
+ 'Contributors' => [ 'Penyumbang' ],
+];
/** Maltese (Malti) */
-$specialPageAliases['mt'] = array(
- 'Contributors' => array( 'Kontributuri' ),
-);
+$specialPageAliases['mt'] = [
+ 'Contributors' => [ 'Kontributuri' ],
+];
/** Norwegian Bokmål (norsk bokmål) */
-$specialPageAliases['nb'] = array(
- 'Contributors' => array( 'Bidragsytere' ),
-);
+$specialPageAliases['nb'] = [
+ 'Contributors' => [ 'Bidragsytere' ],
+];
/** Low Saxon (Netherlands) (Nedersaksies) */
-$specialPageAliases['nds-nl'] = array(
- 'Contributors' => array( 'Biedragers' ),
-);
+$specialPageAliases['nds-nl'] = [
+ 'Contributors' => [ 'Biedragers' ],
+];
/** Dutch (Nederlands) */
-$specialPageAliases['nl'] = array(
- 'Contributors' => array( 'Auteurs', 'Bijdragers' ),
-);
+$specialPageAliases['nl'] = [
+ 'Contributors' => [ 'Auteurs', 'Bijdragers' ],
+];
/** Norwegian Nynorsk (norsk nynorsk) */
-$specialPageAliases['nn'] = array(
- 'Contributors' => array( 'Bidragsytarar' ),
-);
+$specialPageAliases['nn'] = [
+ 'Contributors' => [ 'Bidragsytarar' ],
+];
/** Punjabi (ਪੰਜਾਬੀ) */
-$specialPageAliases['pa'] = array(
- 'Contributors' => array( 'ਯੋਗਦਾਨੀ' ),
-);
+$specialPageAliases['pa'] = [
+ 'Contributors' => [ 'ਯੋਗਦਾਨੀ' ],
+];
/** Polish (polski) */
-$specialPageAliases['pl'] = array(
- 'Contributors' => array( 'Autorzy' ),
-);
+$specialPageAliases['pl'] = [
+ 'Contributors' => [ 'Autorzy' ],
+];
/** Pashto (پښتو) */
-$specialPageAliases['ps'] = array(
- 'Contributors' => array( 'ونډه_وال' ),
-);
+$specialPageAliases['ps'] = [
+ 'Contributors' => [ 'ونډه_وال' ],
+];
/** Portuguese (português) */
-$specialPageAliases['pt'] = array(
- 'Contributors' => array( 'Contribuidores' ),
-);
+$specialPageAliases['pt'] = [
+ 'Contributors' => [ 'Contribuidores' ],
+];
/** Brazilian Portuguese (português do Brasil) */
-$specialPageAliases['pt-br'] = array(
- 'Contributors' => array( 'Colaboradores', 'Contribuidores' ),
-);
+$specialPageAliases['pt-br'] = [
+ 'Contributors' => [ 'Colaboradores', 'Contribuidores' ],
+];
/** Romanian (română) */
-$specialPageAliases['ro'] = array(
- 'Contributors' => array( 'Contribuitori' ),
-);
+$specialPageAliases['ro'] = [
+ 'Contributors' => [ 'Contribuitori' ],
+];
/** Russian (русский) */
-$specialPageAliases['ru'] = array(
- 'Contributors' => array( 'Вкладчики' ),
-);
+$specialPageAliases['ru'] = [
+ 'Contributors' => [ 'Вкладчики' ],
+];
/** Sanskrit (संस्कृतम्) */
-$specialPageAliases['sa'] = array(
- 'Contributors' => array( 'योगदाता' ),
-);
+$specialPageAliases['sa'] = [
+ 'Contributors' => [ 'योगदाता' ],
+];
/** Sinhala (සිංහල) */
-$specialPageAliases['si'] = array(
- 'Contributors' => array( 'දායකයන්' ),
-);
+$specialPageAliases['si'] = [
+ 'Contributors' => [ 'දායකයන්' ],
+];
/** Slovak (slovenčina) */
-$specialPageAliases['sk'] = array(
- 'Contributors' => array( 'Prispievatelia' ),
-);
+$specialPageAliases['sk'] = [
+ 'Contributors' => [ 'Prispievatelia' ],
+];
/** Albanian (shqip) */
-$specialPageAliases['sq'] = array(
- 'Contributors' => array( 'Kontribues' ),
-);
+$specialPageAliases['sq'] = [
+ 'Contributors' => [ 'Kontribues' ],
+];
/** Serbian (Cyrillic script) (српски (ћирилица)) */
-$specialPageAliases['sr-ec'] = array(
- 'Contributors' => array( 'Доприносиоци' ),
-);
+$specialPageAliases['sr-ec'] = [
+ 'Contributors' => [ 'Доприносиоци' ],
+];
/** Swedish (svenska) */
-$specialPageAliases['sv'] = array(
- 'Contributors' => array( 'Bidragsgivare' ),
-);
+$specialPageAliases['sv'] = [
+ 'Contributors' => [ 'Bidragsgivare' ],
+];
/** Swahili (Kiswahili) */
-$specialPageAliases['sw'] = array(
- 'Contributors' => array( 'Wachangiaji' ),
-);
+$specialPageAliases['sw'] = [
+ 'Contributors' => [ 'Wachangiaji' ],
+];
/** Thai (ไทย) */
-$specialPageAliases['th'] = array(
- 'Contributors' => array( 'ผู้เขียน' ),
-);
+$specialPageAliases['th'] = [
+ 'Contributors' => [ 'ผู้เขียน' ],
+];
/** Tagalog (Tagalog) */
-$specialPageAliases['tl'] = array(
- 'Contributors' => array( 'Mga_tagapag-ambag' ),
-);
+$specialPageAliases['tl'] = [
+ 'Contributors' => [ 'Mga_tagapag-ambag' ],
+];
/** Turkish (Türkçe) */
-$specialPageAliases['tr'] = array(
- 'Contributors' => array( 'KatkıdaBulunanlar' ),
-);
+$specialPageAliases['tr'] = [
+ 'Contributors' => [ 'KatkıdaBulunanlar' ],
+];
/** Ukrainian (українська) */
-$specialPageAliases['uk'] = array(
- 'Contributors' => array( 'Дописувачі' ),
-);
+$specialPageAliases['uk'] = [
+ 'Contributors' => [ 'Дописувачі' ],
+];
/** Urdu (اردو) */
-$specialPageAliases['ur'] = array(
- 'Contributors' => array( 'مشارکین' ),
-);
+$specialPageAliases['ur'] = [
+ 'Contributors' => [ 'مشارکین' ],
+];
/** Venetian (vèneto) */
-$specialPageAliases['vec'] = array(
- 'Contributors' => array( 'Contribudori' ),
-);
+$specialPageAliases['vec'] = [
+ 'Contributors' => [ 'Contribudori' ],
+];
/** Vietnamese (Tiếng Việt) */
-$specialPageAliases['vi'] = array(
- 'Contributors' => array( 'Người_đóng_góp' ),
-);
+$specialPageAliases['vi'] = [
+ 'Contributors' => [ 'Người_đóng_góp' ],
+];
/** Simplified Chinese (中文(简体)) */
-$specialPageAliases['zh-hans'] = array(
- 'Contributors' => array( '贡献者' ),
-);
+$specialPageAliases['zh-hans'] = [
+ 'Contributors' => [ '贡献者' ],
+];
/** Traditional Chinese (中文(繁體)) */
-$specialPageAliases['zh-hant'] = array(
- 'Contributors' => array( '貢獻者' ),
-);
+$specialPageAliases['zh-hant'] = [
+ 'Contributors' => [ '貢獻者' ],
+];
diff --git a/Contributors.i18n.php b/Contributors.i18n.php
index b299016..d4bbbe1 100644
--- a/Contributors.i18n.php
+++ b/Contributors.i18n.php
@@ -10,10 +10,10 @@
*
* This shim maintains compatibility back to MediaWiki 1.17.
*/
-$messages = array();
+$messages = [];
if ( !function_exists( 'wfJsonI18nShimea0a5e62e5f1189e' ) ) {
function wfJsonI18nShimea0a5e62e5f1189e( $cache, $code, &$cachedData ) {
- $codeSequence = array_merge( array( $code ),
$cachedData['fallbackSequence'] );
+ $codeSequence = array_merge( [ $code ],
$cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
$fileName = __DIR__ . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
diff --git a/Contributors.magic.php b/Contributors.magic.php
index 4bc4fb3..ee221a0 100644
--- a/Contributors.magic.php
+++ b/Contributors.magic.php
@@ -4,11 +4,11 @@
*
* @author Ike Hecht
*/
-$magicWords = array();
+$magicWords = [];
/** English
* @author Ike Hecht
*/
-$magicWords['en'] = array(
- 'contributors' => array( 0, 'contributors' ),
-);
+$magicWords['en'] = [
+ 'contributors' => [ 0, 'contributors' ],
+];
diff --git a/api/ApiQueryCncontributors.php b/api/ApiQueryCncontributors.php
index 4e85e87..cb14342 100644
--- a/api/ApiQueryCncontributors.php
+++ b/api/ApiQueryCncontributors.php
@@ -20,35 +20,35 @@
}
}
private function buildDbQuery( array $params ) {
- $this->addTables( array( 'contributors' , 'page' ) );
+ $this->addTables( [ 'contributors' , 'page' ] );
$this->addFields(
- array(
+ [
'Username' => 'cn_user_text',
'Number of revisions' => 'cn_revision_count',
'Date of first edit' => 'cn_first_edit',
'Date of last edit' => 'cn_last_edit'
- )
+ ]
);
- $this->addJoinConds( array(
- 'page' => array(
+ $this->addJoinConds( [
+ 'page' => [
'LEFT JOIN',
- array( 'cn_page_id = page_id' )
- )
- ) );
+ [ 'cn_page_id = page_id' ]
+ ]
+ ] );
$this->addWhereFld( 'page_title', $params['titles'] );
}
public function getAllowedParams() {
- return array(
- 'titles' => array(
+ return [
+ 'titles' => [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true,
- )
- );
+ ]
+ ];
}
public function getExamplesMessages() {
- return array(
+ return [
'action=query&prop=contributors&titles=Main+Page'
=> 'apihelp-query+contributors-example-1',
- );
+ ];
}
}
diff --git a/includes/Contributors.php b/includes/Contributors.php
index aa597ca..6d39b88 100644
--- a/includes/Contributors.php
+++ b/includes/Contributors.php
@@ -97,7 +97,7 @@
* @return array Numeric array of strings
*/
public static function getValidOptions() {
- return array( 'filteranon' );
+ return [ 'filteranon' ];
}
/**
@@ -122,28 +122,28 @@
$dbr = wfGetDB( DB_SLAVE );
$opts = $this->getOptions();
$pageId = $this->getTarget()->getArticleID();
- $contributors = array();
+ $contributors = [];
if ( array_key_exists( 'filteranon', $opts ) &&
$opts['filteranon'] ) {
- $cond = array( 'cn_page_id' => $pageId , 'cn_user_id
!=0' );
+ $cond = [ 'cn_page_id' => $pageId , 'cn_user_id !=0' ];
} else {
- $cond = array( 'cn_page_id' => $pageId );
+ $cond = [ 'cn_page_id' => $pageId ];
}
$res = $dbr->select(
'contributors',
- array( 'cn_user_text' , 'cn_user_id' ,
'cn_revision_count' ),
+ [ 'cn_user_text' , 'cn_user_id' , 'cn_revision_count' ],
$cond,
__METHOD__,
- array(
+ [
'GROUP BY' => 'cn_user_text',
'ORDER BY' => 'cn_revision_count DESC',
- ) );
+ ] );
if ( $res && $dbr->numRows( $res ) > 0 ) {
foreach ( $res as $row ) {
- $contributors[ $row->cn_user_text ] = array(
+ $contributors[ $row->cn_user_text ] = [
$row->cn_user_text,
$row->cn_revision_count
- );
+ ];
}
}
return $contributors;
@@ -191,7 +191,7 @@
if ( $wgContributorsLinkUsers ) {
$rawNames = $this->getContributorsNames();
- $names = array();
+ $names = [];
foreach ( $rawNames as $rawName ) {
$user = User::newFromName( $rawName );
if ( $user ) {
diff --git a/includes/ContributorsHooks.php b/includes/ContributorsHooks.php
index d9d7269..b09161f 100644
--- a/includes/ContributorsHooks.php
+++ b/includes/ContributorsHooks.php
@@ -41,7 +41,7 @@
inContentLanguage()->parseAsBlock();
}
- $options = array();
+ $options = [];
foreach ( $args as $arg ) {
$argString = trim( $frame->expand( $arg ) );
if ( in_array( $argString,
Contributors::getValidOptions() ) ) {
@@ -51,7 +51,7 @@
$contributors = new Contributors( $title, $options );
$list = $contributors->getSimpleList(
$parser->getFunctionLang() );
- return array( $list, 'noparse' => true, 'isHTML' => true );
+ return [ $list, 'noparse' => true, 'isHTML' => true ];
}
/**
@@ -68,12 +68,12 @@
&$revid
) {
if ( $skintemplate->getTitle()->getNamespace() === NS_MAIN &&
$revid !== 0 ) {
- $nav_urls['contributors'] = array(
+ $nav_urls['contributors'] = [
'text' => $skintemplate->msg(
'contributors-toolbox' ),
'href' => $skintemplate->makeSpecialUrl(
'Contributors/' . wfUrlencode(
$skintemplate->thispage )
),
- );
+ ];
}
return true;
}
@@ -148,7 +148,7 @@
$text = $user->getName();
$timestamp = $article->getTimestamp();
- $cond = array( 'cn_page_id' => $pageId, 'cn_user_id' =>
$userId, 'cn_user_text' => $text );
+ $cond = [ 'cn_page_id' => $pageId, 'cn_user_id' => $userId,
'cn_user_text' => $text ];
$res = $dbr->select(
'contributors',
@@ -158,35 +158,35 @@
);
if ( $res->numRows() == 0 ) {
$dbw->insert( 'contributors',
- array(
+ [
'cn_page_id' => $pageId,
'cn_user_id' => $userId,
'cn_user_text' => $text,
'cn_revision_count' => 1,
'cn_first_edit' => $timestamp
- ),
+ ],
__METHOD__
);
} else {
foreach ( $res as $row ) {
$dbw->upsert( 'contributors',
- array(
+ [
'cn_page_id' => $pageId,
'cn_user_id' => $userId,
'cn_user_text' => $text,
'cn_revision_count' => 1,
'cn_first_edit' => $timestamp
- ),
- array(
+ ],
+ [
'cn_page_id',
'cn_user_id',
'cn_user_text'
- ),
- array(
+ ],
+ [
'cn_revision_count' =>
$row->cn_revision_count + 1,
'cn_last_edit' => $timestamp
- ),
+ ],
__METHOD__
);
}
@@ -201,11 +201,11 @@
foreach ( $ids as $id ) {
// TODO defer updates & transactions
$revision = Revision::newFromId( $id );
- $conds = array(
+ $conds = [
'cn_page_id' => $title->getArticleID(),
'cn_user_id' => $revision->getUser(
Revision::RAW ),
'cn_user_text' => $revision->getUserText(
Revision::RAW )
- );
+ ];
if (
!( $visibilityChangeMap[$id]['oldBits'] &
Revision::DELETED_USER ) &&
@@ -228,9 +228,9 @@
} else {
$dbw->update(
'contributors',
- array(
+ [
'cn_revision_count' => $row->cn_revision_count - 1
- ),
+ ],
$conds,
__METHOD__
);
@@ -251,15 +251,15 @@
if ( !$row ) {
$dbw->insert(
'contributors',
- array_merge( $conds, array(
'cn_revision_count' => 1 ) ),
+ array_merge( $conds, [
'cn_revision_count' => 1 ] ),
__METHOD__
);
} else {
$dbw->update(
'contributors',
- array(
+ [
'cn_revision_count' =>
$row->cn_revision_count + 1
- ),
+ ],
$conds,
__METHOD__
);
diff --git a/includes/ContributorsTablePager.php
b/includes/ContributorsTablePager.php
index 3b24c35..b561b25 100644
--- a/includes/ContributorsTablePager.php
+++ b/includes/ContributorsTablePager.php
@@ -26,12 +26,12 @@
public function getFieldNames() {
if ( $this->fieldNames === null ) {
- $this->fieldNames = array(
+ $this->fieldNames = [
'cn_user_text' => $this->msg(
'contributors-name' )->escaped(),
'cn_revision_count' => $this->msg(
'contributors-revisions' )->escaped(),
'cn_first_edit' => $this->msg(
'contributors-first-edit' )->escaped(),
'cn_last_edit' => $this->msg(
'contributors-last-edit' )->escaped(),
- );
+ ];
}
return $this->fieldNames;
@@ -70,32 +70,32 @@
$prefixKey = $this->target->getPrefixedDBkey();
if ( $this->opts['filteranon'] == true ) {
- $conds = array( 'cn_page_id' => (int)$this->articleId ,
'cn_user_id !=0' );
+ $conds = [ 'cn_page_id' => (int)$this->articleId ,
'cn_user_id !=0' ];
} elseif ( $this->opts['pagePrefix'] == true ) {
$conds = [ 'page_title' . $dbr->buildLike( $prefixKey,
$dbr->anyString() ) ];
} else {
- $conds = array( 'cn_page_id' => (int)$this->articleId );
+ $conds = [ 'cn_page_id' => (int)$this->articleId ];
}
- $info = array(
- 'tables' => array( 'contributors' , 'page' ),
- 'fields' => array(
+ $info = [
+ 'tables' => [ 'contributors' , 'page' ],
+ 'fields' => [
'cn_user_id',
'cn_user_text',
'cn_first_edit',
'cn_last_edit',
'cn_revision_count',
'page_title'
- ),
+ ],
'conds' => $conds,
'join_conds' =>
- array( 'page' =>
- array(
+ [ 'page' =>
+ [
'LEFT JOIN' ,
'page_id = cn_page_id'
- )
- )
- );
+ ]
+ ]
+ ];
return $info;
}
@@ -104,7 +104,7 @@
}
public function isFieldSortable( $name ) {
- $sortable_fields = array( 'cn_user_text', 'cn_revision_count' );
+ $sortable_fields = [ 'cn_user_text', 'cn_revision_count' ];
return in_array( $name, $sortable_fields );
}
diff --git a/includes/SpecialContributors.php b/includes/SpecialContributors.php
index 902360c..be76d11 100644
--- a/includes/SpecialContributors.php
+++ b/includes/SpecialContributors.php
@@ -160,7 +160,7 @@
$result = $pager->getResult();
if ( $result && $result->numRows() !== 0 ) {
$out->addHTML( $pager->getNavigationBar() .
- Xml::tags( 'ul', array( 'class' => 'plainlinks'
), $pager->getBody() ) .
+ Xml::tags( 'ul', [ 'class' => 'plainlinks' ],
$pager->getBody() ) .
$pager->getNavigationBar() );
} else {
$out->addWikiMsg( 'contributors-nosuchpage' );
@@ -182,29 +182,29 @@
private function makeForm() {
$opts = $this->getOptions();
- $formDescriptor = array(
- 'target' => array(
+ $formDescriptor = [
+ 'target' => [
'name' => 'target',
'label-message' => 'contributors-target',
'type' => 'title',
'size' => 40,
'id'=> 'target',
'default' =>
$this->contributorsClass->getTargetText()
- ),
- 'filteranon' => array(
+ ],
+ 'filteranon' => [
'name' => 'filteranon',
'label-message' => 'contributors-filterip',
'type' => 'check',
'checked' => $opts['filteranon']
- ),
- 'pagePrefix' => array(
+ ],
+ 'pagePrefix' => [
'name'=>'pagePrefix',
'label-message' => 'contributors-add-subpages',
'type' => 'check',
'checked' => $opts['pagePrefix']
- ),
+ ],
- );
+ ];
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor,
$this->getContext() );
$htmlForm->setWrapperLegendMsg( 'contributors-legend' )
->setSubmitTextMsg( 'contributors-submit' )
diff --git a/maintenance/PopulateContributorsTable.php
b/maintenance/PopulateContributorsTable.php
index 6bb45a0..095c60b 100644
--- a/maintenance/PopulateContributorsTable.php
+++ b/maintenance/PopulateContributorsTable.php
@@ -38,17 +38,17 @@
$blockEnd = $start + $this->mBatchSize - 1;
while ( $blockEnd <= $end ) {
$this->output( "Getting Contributor's data..\n" );
- $cond = array(
+ $cond = [
"rev_page BETWEEN $blockStart AND $blockEnd",
$dbr->bitAnd( 'rev_deleted',
Revision::DELETED_USER ) . ' = 0'
- );
+ ];
$res = $dbr->select(
'revision',
- array( 'COUNT(*) AS cn_revision_count',
'rev_user', 'rev_user_text', 'rev_page',
- 'MIN(rev_timestamp) AS cn_first_edit',
'MAX(rev_timestamp) AS cn_last_edit' ),
+ [ 'COUNT(*) AS cn_revision_count', 'rev_user',
'rev_user_text', 'rev_page',
+ 'MIN(rev_timestamp) AS cn_first_edit',
'MAX(rev_timestamp) AS cn_last_edit' ],
$cond,
__METHOD__,
- array( 'GROUP BY' => array( 'rev_page',
'rev_user', 'rev_user_text' ) )
+ [ 'GROUP BY' => [ 'rev_page', 'rev_user',
'rev_user_text' ] ]
);
$this->output( "Writing data into Contributors Table..
\n" );
@@ -56,27 +56,27 @@
foreach ( $res as $row ) {
$dbw->upsert(
'contributors',
- array(
+ [
'cn_page_id' => $row->rev_page,
'cn_user_id' => $row->rev_user,
'cn_user_text' =>
$row->rev_user_text,
'cn_revision_count' =>
$row->cn_revision_count,
'cn_first_edit' =>
$row->cn_first_edit,
'cn_last_edit' =>
$row->cn_last_edit
- ),
- array(
+ ],
+ [
'cn_page_id',
'cn_user_id',
'cn_user_text'
- ),
- array(
+ ],
+ [
'cn_page_id' => $row->rev_page,
'cn_user_id' => $row->rev_user,
'cn_user_text' =>
$row->rev_user_text,
'cn_revision_count' =>
$row->cn_revision_count,
'cn_first_edit' =>
$row->cn_first_edit,
'cn_last_edit' =>
$row->cn_last_edit
- ),
+ ],
__METHOD__
);
}
diff --git a/phpcs.xml b/phpcs.xml
index d4b2b99..b859699 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,8 +1,6 @@
<?xml version="1.0"?>
<ruleset>
- <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
- <exclude name="Generic.Arrays.DisallowLongArraySyntax.Found"/>
- </rule>
+ <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
<file>.</file>
<arg name="extensions" value="php,php5,inc"/>
<arg name="encoding" value="UTF-8"/>
--
To view, visit https://gerrit.wikimedia.org/r/359186
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f66a72c6e8b6d7aa353a7a3db448723096c751b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Contributors
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits