[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: Fix js error in mw.cx.ui.TranslationView#onTranslationTitleC...

2017-05-18 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354380 )

Change subject: Fix js error in 
mw.cx.ui.TranslationView#onTranslationTitleChange
..

Fix js error in mw.cx.ui.TranslationView#onTranslationTitleChange

While translation being loaded, setting the title in translation column
will trigger titleChange, and at that time the translation model might
not be ready. Just add a check there to avoid js error.

This will also fix the issue of Translation title misalignment with
source title, since the handler is registered correctly.

Change-Id: Id8c5eb6d16f50fce02cc04d99764f491bbda6eec
---
M modules/ui/mw.cx.ui.TranslationView.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/80/354380/1

diff --git a/modules/ui/mw.cx.ui.TranslationView.js 
b/modules/ui/mw.cx.ui.TranslationView.js
index 42a745b..61846db 100644
--- a/modules/ui/mw.cx.ui.TranslationView.js
+++ b/modules/ui/mw.cx.ui.TranslationView.js
@@ -205,6 +205,10 @@
  * @param {string} changedTitle The new title
  */
 mw.cx.ui.TranslationView.prototype.onTranslationTitleChange = function ( 
changedTitle ) {
+   if ( !this.translation ) {
+   mw.log( '[CX] Translation not ready yet' );
+   return;
+   }
this.translation.setTargetTitle( changedTitle );
// Align translation titles when it get changed/being edited
mw.cx.alignSections(

-- 
To view, visit https://gerrit.wikimedia.org/r/354380
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8c5eb6d16f50fce02cc04d99764f491bbda6eec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...CentralNotice[master]: [WIP] QUnit tests for ext.centralNotice.bannerSequence

2017-05-18 Thread AndyRussG (Code Review)
AndyRussG has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354379 )

Change subject: [WIP] QUnit tests for ext.centralNotice.bannerSequence
..

[WIP] QUnit tests for ext.centralNotice.bannerSequence

Bug: T144456
Change-Id: I79bf4d217fd6d757f704b23722bff7187e7ed4dc
---
M resources/subscribing/ext.centralNotice.bannerSequence.js
A tests/qunit/subscribing/ext.centralNotice.bannerSequence.tests.js
2 files changed, 183 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/79/354379/1

diff --git a/resources/subscribing/ext.centralNotice.bannerSequence.js 
b/resources/subscribing/ext.centralNotice.bannerSequence.js
index 20f7a7d..9699d74 100644
--- a/resources/subscribing/ext.centralNotice.bannerSequence.js
+++ b/resources/subscribing/ext.centralNotice.bannerSequence.js
@@ -47,8 +47,9 @@
 
this.sequence = sequence;
 
-   // Starts out at the page view before the banner is shown, and 
will be moved
-   // along as needed
+   // The page view in the sequence that we will display. (This 
will be updated if
+   // we have to skip this step or if the sequence length has been 
reduced and
+   // we're beyond the new limit.)
this.currentPageView = currentPageView;
 
// Track how many steps have been skipped due to stored flags
@@ -151,7 +152,7 @@
/**
 * Get the current page view for this sequence, as stored in the 
browser.
 * Note: The page view skips ahead if we skip a step because of an 
identifier, and
-* rolls over when we re-start a sequence, so it's not an accurate 
count of pageviews
+* rolls over when we re-start a sequence, so it's not an accurate 
count of page views
 * in the campaign.
 *
 * @returns {number}
@@ -206,7 +207,7 @@
 */
function setFlag( identifier ) {
 
-   // Value is timestamp for now. Flag expires in as per the days 
mixin param.
+   // Value is timestamp for now. Flag expires as per the days 
mixin param.
cn.kvStore.setItem(
FLAG_STORAGE_KEY + '_' + identifier,
Math.round( Date.now() / 1000 ),
@@ -235,7 +236,7 @@
}
 
// Determine if, and if so, how we can store data in the 
browser. This will try
-   // to use localstorage and will fall back to cookies if the 
campaign's category
+   // to use localStorage and will fall back to cookies if the 
campaign's category
// allows it.
multiStorageOption = cn.kvStore.getMultiStorageOption(
cn.getDataProperty( 'campaignCategoryUsesLegacy' ) );
@@ -308,4 +309,7 @@
// Register the mixin
cn.registerCampaignMixin( mixin );
 
+   // Export SequenceManager (for use in unit tests only)
+   module.exports = { private: { SequenceManager: SequenceManager } };
+
 }( mediaWiki ) );
diff --git a/tests/qunit/subscribing/ext.centralNotice.bannerSequence.tests.js 
b/tests/qunit/subscribing/ext.centralNotice.bannerSequence.tests.js
new file mode 100644
index 000..675c548
--- /dev/null
+++ b/tests/qunit/subscribing/ext.centralNotice.bannerSequence.tests.js
@@ -0,0 +1,174 @@
+( function ( mw, $ ) {
+   'use strict';
+
+   var SequenceManager =
+   require( 'ext.centralNotice.bannerSequence' 
).private.SequenceManager,
+
+   // Test sequence
+   sequence = [
+   {
+   banner: 'Banner_step1',
+   numPageViews: 3,
+   skipWithIdentifier: null
+   },
+   {
+   banner: 'Banner_step2',
+   numPageViews: 2,
+   skipWithIdentifier: 'identifier'
+   },
+   {
+   banner: null,
+   numPageViews: 2,
+   skipWithIdentifier: null
+   }
+   ],
+
+   // Expected sequence states at each page view
+   expectedSequenceStates = [
+   {
+   banner: 'Banner_step1',
+   identifierToCheck: null
+   },
+   {
+   banner: 'Banner_step1',
+   identifierToCheck: null
+   },
+   {
+   banner: 'Banner_step1',
+   identifierToCheck: null
+   },
+   {
+   

[MediaWiki-commits] [Gerrit] mediawiki...UniversalLanguageSelector[master]: Determine callout directionality based on position as oppose...

2017-05-18 Thread Isarra (Code Review)
Isarra has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354378 )

Change subject: Determine callout directionality based on position as opposed 
to language
..

Determine callout directionality based on position as opposed to language

For interlanguage toggle, interlanguage position is no longer assumed to be a
left sidebar, and is determined on the fly in order to appear correctly
regardless of where it is, and not go off the side of the page. This works
across most skins, and regardless of language directionality.

Does not necessarily resolve issues with interlanguage links appearing in the
middle of the page (header/footer), or the callout just plain not fitting for
other reasons (mobile devices).

bug: T161586
Change-Id: Icd55498a945e12c0ff79ba891c094d60ce791115
---
M extension.json
R resources/css/ext.uls.less
M resources/js/ext.uls.interface.js
3 files changed, 53 insertions(+), 12 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/78/354378/1

diff --git a/extension.json b/extension.json
index aa4cb66..273c92b 100644
--- a/extension.json
+++ b/extension.json
@@ -157,7 +157,7 @@
"ext.uls.common": {
"targets": [ "desktop", "mobile" ],
"scripts": "js/ext.uls.common.js",
-   "styles": "css/ext.uls.css",
+   "styles": "css/ext.uls.less",
"skinStyles": {
"monobook": "css/ext.uls-monobook.css"
},
diff --git a/resources/css/ext.uls.css b/resources/css/ext.uls.less
similarity index 65%
rename from resources/css/ext.uls.css
rename to resources/css/ext.uls.less
index 7e3c988..d09263a 100644
--- a/resources/css/ext.uls.css
+++ b/resources/css/ext.uls.less
@@ -16,25 +16,62 @@
border-bottom-left-radius: 4px;
 }
 
+/* Caret */
 .uls-menu.callout .caret-before,
 .uls-menu.callout .caret-after {
border-top: 10px solid transparent;
-   border-right: 10px solid #c9c9c9;
border-bottom: 10px solid transparent;
display: inline-block;
-   left: -11px;
/* 17px aligns nicely with the size of the search row in language 
selection */
top: 17px;
position: absolute;
 }
-
 .uls-menu.callout .caret-after {
-   border-right: 10px solid #fcfcfc;
display: inline-block;
-   left: -10px;
 }
 
-.uls-menu.callout--languageselection .caret-after {
+// How do you do switch for flipping in less? These are very redundant.
+.uls-menu.callout .caret-right {
+   .caret-before,
+   .caret-after {
+   /* @noflip */
+   border-left: 10px solid #c9c9c9;
+   /* @noflip */
+   right: -11px;
+   }
+
+   .caret-after {
+   /* @noflip */
+   border-left: 10px solid #fcfcfc;
+   /* @noflip */
+   right: -10px;
+   }
+
+}
+.uls-menu.callout--languageselection .caret-right .caret-after {
+   /* @noflip */
+   border-left: 10px solid #fff;
+}
+
+.uls-menu.callout .caret-left {
+   .caret-before,
+   .caret-after {
+   /* @noflip */
+   border-right: 10px solid #c9c9c9;
+   /* @noflip */
+   left: -11px;
+   }
+
+   .caret-after {
+   /* @noflip */
+   border-right: 10px solid #fcfcfc;
+   /* @noflip */
+   left: -10px;
+   }
+
+}
+.uls-menu.callout--languageselection .caret-left .caret-after {
+   /* @noflip */
border-right: 10px solid #fff;
 }
 
diff --git a/resources/js/ext.uls.interface.js 
b/resources/js/ext.uls.interface.js
index 2284dfd..0dfe1ec 100644
--- a/resources/js/ext.uls.interface.js
+++ b/resources/js/ext.uls.interface.js
@@ -294,7 +294,6 @@
var $triggers,
$pLang,
$ulsTrigger = $( '.uls-trigger' ),
-   rtlPage = $( 'body' ).hasClass( 'rtl' ),
anonMode = ( mw.user.isAnon() &&
!mw.config.get( 'wgULSAnonCanChangeLanguage' ) 
),
ulsPosition = mw.config.get( 'wgULSPosition' );
@@ -337,6 +336,7 @@
var caretRadius, 
caretPosition,
$caretBefore = 
$( '' ).addClass( 'caret-before' ),
$caretAfter = 
$( '' ).addClass( 'caret-after' ),
+   $caretWrapper = 
$( '' ),

ulsTriggerHeight = this.$element.height(),
ulsTriggerWidth 
= this.$element.width(),

[MediaWiki-commits] [Gerrit] operations...wikistats[master]: database queries, PDO, get rid of deprecated params

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354377 )

Change subject: database queries, PDO, get rid of deprecated params
..


database queries, PDO, get rid of deprecated params

Change-Id: I2484474b9e5095b03efc6108c2a1a1f1c113d856
---
M var/www/wikistats/detail.php
M var/www/wikistats/display.php
M var/www/wikistats/displayw.php
M var/www/wikistats/index.php
M var/www/wikistats/wikimedias_html.php
M var/www/wikistats/wikimedias_wiki.php
M var/www/wikistats/wikipedias_wiki.php
7 files changed, 50 insertions(+), 74 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/var/www/wikistats/detail.php b/var/www/wikistats/detail.php
index 30e814f..c04aca0 100644
--- a/var/www/wikistats/detail.php
+++ b/var/www/wikistats/detail.php
@@ -183,7 +183,7 @@
 
 $project_name="invalid";
 $domain="localhost";
-$db_table="";
+$db_table="invalid";
 
 print <prepare($query);
 $fnord -> execute();
 
@@ -238,7 +238,7 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by total desc,good desc";
+$query = "SELECT id FROM ${db_table} ORDER BY total desc,good desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $num_project=$wdb->query($query)->fetchColumn();
@@ -251,11 +251,11 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by edits desc";
+$query = "SELECT id FROM ${db_table} ORDER BY edits desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-$num_project=$wdb->query("select count(*) from ${db_table}")->fetchColumn();
+$num_project=$wdb->query("SELECT count(*) FROM ${db_table}")->fetchColumn();
 $count=1;
 
 while ($row = $fnord->fetch()) {
@@ -265,7 +265,7 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by users desc";
+$query = "SELECT id FROM ${db_table} ORDER by users desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $count=1;
@@ -283,10 +283,9 @@
 $rank_project_e=ordinal($rank_project_e);
 $rank_project_u=ordinal($rank_project_u);
 
-# main
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} where id=${wikiid}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness from ${db_table} WHERE id=:wikiid";
 $fnord = $wdb->prepare($query);
-$fnord -> execute();
+$fnord -> execute(['wikiid' => $wikiid]);
 #DEBUG# echo "Sent query: '$query'.";
 
 print <<";
-$uarr="";
-$nodeco="text-decoration:none;";
-
 require_once("/etc/wikistats/config.php");
 require_once("$IP/functions.php");
 require_once("$IP/http_status_codes.php");
-
-if (isset($_GET['p']) && is_numeric($_GET['p']) && $_GET['p'] > 1 && 
$_GET['p'] < 100) {
-$page=$_GET['p'];
-$page=htmlspecialchars($page);
-$offset=($page-1)*$page_size;
-} else {
-$page="1";
-$offset=0;
-}
 
 # db connect
 try {
@@ -232,7 +219,7 @@
 }
 
 include("$IP/sortswitch.php");
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} order by ${msort} limit ${page_size} offset ${offset}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness FROM ${db_table} ORDER BY ${msort}";
 #DEBUG# echo "sending query: '$query'.";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
diff --git a/var/www/wikistats/displayw.php b/var/www/wikistats/displayw.php
index 9ce9119..7bc35ea 100644
--- a/var/www/wikistats/displayw.php
+++ b/var/www/wikistats/displayw.php
@@ -201,23 +201,9 @@
 $listname="List of ${project_name}";
 $phpself=$_SERVER['PHP_SELF'];
 
-$darr="";
-$uarr="";
-$nodeco="text-decoration:none;";
-
 require_once("/etc/wikistats/config.php");
 require_once("$IP/functions.php");
 require_once("$IP/http_status_codes.php");
-
-if (isset($_GET['p']) && is_numeric($_GET['p']) && $_GET['p'] > 1 && 
$_GET['p'] < 100) {
-$page=$_GET['p'];
-$offset=($page-1)*${page_size};
-} else {
-$page="1";
-$offset=0;
-}
-
-include("$IP/sortswitch.php");
 
 # db connect
 try {
@@ -227,11 +213,12 @@
 die();
 }
 
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} order by ${msort} limit ${page_size} offset ${offset}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness FROM ${db_table} ORDER BY good desc,total desc";
 
 #DEBUG# echo "sending query: '$query'.";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
+
 echo "";
 
 print <<
 
 
-Wikistats 2.0
+Wikistats 2.2
 
 [beta]
 
@@ -79,7 +79,7 @@
 }
 
 foreach ($listtables as $listtable) {
-$query = "select 

[MediaWiki-commits] [Gerrit] operations...wikistats[master]: database queries, PDO, get rid of deprecated params

2017-05-18 Thread Dzahn (Code Review)
Dzahn has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354377 )

Change subject: database queries, PDO, get rid of deprecated params
..

database queries, PDO, get rid of deprecated params

Change-Id: I2484474b9e5095b03efc6108c2a1a1f1c113d856
---
M var/www/wikistats/detail.php
M var/www/wikistats/display.php
M var/www/wikistats/displayw.php
M var/www/wikistats/index.php
M var/www/wikistats/wikimedias_html.php
M var/www/wikistats/wikimedias_wiki.php
M var/www/wikistats/wikipedias_wiki.php
7 files changed, 50 insertions(+), 74 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/wikistats 
refs/changes/77/354377/1

diff --git a/var/www/wikistats/detail.php b/var/www/wikistats/detail.php
index 30e814f..c04aca0 100644
--- a/var/www/wikistats/detail.php
+++ b/var/www/wikistats/detail.php
@@ -183,7 +183,7 @@
 
 $project_name="invalid";
 $domain="localhost";
-$db_table="";
+$db_table="invalid";
 
 print <prepare($query);
 $fnord -> execute();
 
@@ -238,7 +238,7 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by total desc,good desc";
+$query = "SELECT id FROM ${db_table} ORDER BY total desc,good desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $num_project=$wdb->query($query)->fetchColumn();
@@ -251,11 +251,11 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by edits desc";
+$query = "SELECT id FROM ${db_table} ORDER BY edits desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-$num_project=$wdb->query("select count(*) from ${db_table}")->fetchColumn();
+$num_project=$wdb->query("SELECT count(*) FROM ${db_table}")->fetchColumn();
 $count=1;
 
 while ($row = $fnord->fetch()) {
@@ -265,7 +265,7 @@
 $count++;
 }
 
-$query = "select id from ${db_table} order by users desc";
+$query = "SELECT id FROM ${db_table} ORDER by users desc";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $count=1;
@@ -283,10 +283,9 @@
 $rank_project_e=ordinal($rank_project_e);
 $rank_project_u=ordinal($rank_project_u);
 
-# main
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} where id=${wikiid}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness from ${db_table} WHERE id=:wikiid";
 $fnord = $wdb->prepare($query);
-$fnord -> execute();
+$fnord -> execute(['wikiid' => $wikiid]);
 #DEBUG# echo "Sent query: '$query'.";
 
 print <<";
-$uarr="";
-$nodeco="text-decoration:none;";
-
 require_once("/etc/wikistats/config.php");
 require_once("$IP/functions.php");
 require_once("$IP/http_status_codes.php");
-
-if (isset($_GET['p']) && is_numeric($_GET['p']) && $_GET['p'] > 1 && 
$_GET['p'] < 100) {
-$page=$_GET['p'];
-$page=htmlspecialchars($page);
-$offset=($page-1)*$page_size;
-} else {
-$page="1";
-$offset=0;
-}
 
 # db connect
 try {
@@ -232,7 +219,7 @@
 }
 
 include("$IP/sortswitch.php");
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} order by ${msort} limit ${page_size} offset ${offset}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness FROM ${db_table} ORDER BY ${msort}";
 #DEBUG# echo "sending query: '$query'.";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
diff --git a/var/www/wikistats/displayw.php b/var/www/wikistats/displayw.php
index 9ce9119..7bc35ea 100644
--- a/var/www/wikistats/displayw.php
+++ b/var/www/wikistats/displayw.php
@@ -201,23 +201,9 @@
 $listname="List of ${project_name}";
 $phpself=$_SERVER['PHP_SELF'];
 
-$darr="";
-$uarr="";
-$nodeco="text-decoration:none;";
-
 require_once("/etc/wikistats/config.php");
 require_once("$IP/functions.php");
 require_once("$IP/http_status_codes.php");
-
-if (isset($_GET['p']) && is_numeric($_GET['p']) && $_GET['p'] > 1 && 
$_GET['p'] < 100) {
-$page=$_GET['p'];
-$offset=($page-1)*${page_size};
-} else {
-$page="1";
-$offset=0;
-}
-
-include("$IP/sortswitch.php");
 
 # db connect
 try {
@@ -227,11 +213,12 @@
 die();
 }
 
-$query = "select *,good/total as ratio,TIMESTAMPDIFF(MINUTE, ts, now()) as 
oldness from ${db_table} order by ${msort} limit ${page_size} offset ${offset}";
+$query = "SELECT *,good/total AS ratio,TIMESTAMPDIFF(MINUTE, ts, now()) AS 
oldness FROM ${db_table} ORDER BY good desc,total desc";
 
 #DEBUG# echo "sending query: '$query'.";
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
+
 echo "";
 
 print <<
 
 
-Wikistats 2.0
+Wikistats 2.2
 
 [beta]
 
@@ -79,7 +79,7 @@
 }
 
 foreach ($listtables as $listtable) {
-$query = 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid postgres PrefixSearchTest failures due to collation di...

2017-05-18 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354376 )

Change subject: Avoid postgres PrefixSearchTest failures due to collation 
differences
..

Avoid postgres PrefixSearchTest failures due to collation differences

Bug: T75174
Change-Id: I6b1df27ca6ae5c2da46134be3dbd7aed404d9601
---
M tests/phpunit/includes/PrefixSearchTest.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/76/354376/1

diff --git a/tests/phpunit/includes/PrefixSearchTest.php 
b/tests/phpunit/includes/PrefixSearchTest.php
index 31ee75b..a6cf14a 100644
--- a/tests/phpunit/includes/PrefixSearchTest.php
+++ b/tests/phpunit/includes/PrefixSearchTest.php
@@ -210,6 +210,11 @@
 
$namespaces = isset( $case['namespaces'] ) ? 
$case['namespaces'] : [];
 
+   if ( wfGetDB( DB_REPLICA )->getType() === 'postgres' ) {
+   // Postgres will sort lexicographically on utf8 code 
units (" " before "/")
+   sort( $case['results'], SORT_STRING );
+   }
+
$searcher = new StringPrefixSearch;
$results = $searcher->search( $case['query'], 3, $namespaces );
$this->assertEquals(
@@ -232,6 +237,11 @@
$searcher = new StringPrefixSearch;
$results = $searcher->search( $case['query'], 3, $namespaces, 1 
);
 
+   if ( wfGetDB( DB_REPLICA )->getType() === 'postgres' ) {
+   // Postgres will sort lexicographically on utf8 code 
units (" " before "/")
+   sort( $case['results'], SORT_STRING );
+   }
+
// We don't expect the first result when offsetting
array_shift( $case['results'] );
// And sometimes we expect a different last result

-- 
To view, visit https://gerrit.wikimedia.org/r/354376
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b1df27ca6ae5c2da46134be3dbd7aed404d9601
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...examples[master]: modified version of file

2017-05-18 Thread Lightjames (Code Review)
Lightjames has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354375 )

Change subject: modified version of file
..

modified version of file

Change-Id: I97b3a46a23f897a1ef1d918fa969178f9467d1a3
---
M Example/Example.hooks.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/examples 
refs/changes/75/354375/1

diff --git a/Example/Example.hooks.php b/Example/Example.hooks.php
index 0e2b4f5..53fd874 100644
--- a/Example/Example.hooks.php
+++ b/Example/Example.hooks.php
@@ -6,6 +6,7 @@
  * @ingroup Extensions
  */
 
+
 class ExampleHooks {
/**
 * Add welcome module to the load queue of all pages

-- 
To view, visit https://gerrit.wikimedia.org/r/354375
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97b3a46a23f897a1ef1d918fa969178f9467d1a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/examples
Gerrit-Branch: master
Gerrit-Owner: Lightjames 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Quit stuffing order_id with other fields

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354374 )

Change subject: Quit stuffing order_id with other fields
..

Quit stuffing order_id with other fields

Turns out we're no longer using it for a log identifier, and it's
valuable to know whether the message actually came in with one.

Bug: T165696
Change-Id: Ifdfac6e4b0eae267aaebcf140a55d6d3de44213c
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 0 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/74/354374/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 6aeeab7..f4754b6 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -1772,30 +1772,6 @@
 }
 }
 
-// Order ID is used as a message identifier in a bunch of places.
-// If it's missing, fill it with something unique-ish.
-if ( !isset( $msg[ 'order_id' ] ) ) {
-watchdog(
-'wmf_civicrm',
-'Message is missing order_id, looking for a substitute 
identifier.',
-array(),
-WATCHDOG_INFO
-);
-$keys = array( 'contribution_tracking_id', 'gateway_txn_id' );
-foreach ( $keys as $key ) {
-if ( isset( $msg[$key] ) ) {
-watchdog(
-'wmf_civicrm',
-"Filling order_id with {$msg[$key]} from key $key.",
-array(),
-WATCHDOG_INFO
-);
-$msg['order_id'] = $msg[$key];
-break;
-}
-}
-}
-
 if ( $msg['recurring'] and !isset( $msg['start_date'] ) ) {
 $msg['start_date'] = $msg['date'];
 $msg['create_date'] = $msg['date'];

-- 
To view, visit https://gerrit.wikimedia.org/r/354374
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdfac6e4b0eae267aaebcf140a55d6d3de44213c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations/puppet[production]: gerrit: rename "server" IP to "service" IP

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354075 )

Change subject: gerrit: rename "server" IP to "service" IP
..


gerrit: rename "server" IP to "service" IP

Because that's what this is, a service IP, NOT the server IP.

Rename the variables to make this less confusing.

Change-Id: I26d3afe502e3b0080a3e87c1d3a1c422cc858fc7
---
M hieradata/role/codfw/gerrit/server.yaml
M hieradata/role/eqiad/gerrit/server.yaml
M modules/profile/manifests/gerrit/server.pp
3 files changed, 6 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/hieradata/role/codfw/gerrit/server.yaml 
b/hieradata/role/codfw/gerrit/server.yaml
index e0aca96..718c615 100644
--- a/hieradata/role/codfw/gerrit/server.yaml
+++ b/hieradata/role/codfw/gerrit/server.yaml
@@ -1,3 +1,3 @@
 gerrit::jetty::db_host: 'm2-master.codfw.wmnet'
-profile::gerrit::server::ipv4: '208.80.153.107'
-profile::gerrit::server::ipv6: '2620:0:860:4:208:80:153:107'
+gerrit::service::ipv4: '208.80.153.107'
+gerrit::service::ipv6: '2620:0:860:4:208:80:153:107'
diff --git a/hieradata/role/eqiad/gerrit/server.yaml 
b/hieradata/role/eqiad/gerrit/server.yaml
index 1e8e0d8..1cc1c6b 100644
--- a/hieradata/role/eqiad/gerrit/server.yaml
+++ b/hieradata/role/eqiad/gerrit/server.yaml
@@ -1,3 +1,3 @@
 gerrit::jetty::db_host: 'm2-master.eqiad.wmnet'
-profile::gerrit::server::ipv4: '208.80.154.85'
-profile::gerrit::server::ipv6: '2620:0:861:3:208:80:154:85'
+gerrit::service::ipv4: '208.80.154.85'
+gerrit::service::ipv6: '2620:0:861:3:208:80:154:85'
diff --git a/modules/profile/manifests/gerrit/server.pp 
b/modules/profile/manifests/gerrit/server.pp
index 1fcfeb4..7ef290b 100644
--- a/modules/profile/manifests/gerrit/server.pp
+++ b/modules/profile/manifests/gerrit/server.pp
@@ -2,8 +2,8 @@
 #
 # filtertags: labs-project-git labs-project-ci-staging
 class profile::gerrit::server(
-$ipv4 = hiera('gerrit::server::ipv4'),
-$ipv6 = hiera('gerrit::server::ipv6'),
+$ipv4 = hiera('gerrit::service::ipv4'),
+$ipv6 = hiera('gerrit::service::ipv6'),
 $host = hiera('gerrit::server::host'),
 $master_host = hiera('gerrit::server::master_host'),
 $bacula = hiera('gerrit::server::bacula'),

-- 
To view, visit https://gerrit.wikimedia.org/r/354075
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I26d3afe502e3b0080a3e87c1d3a1c422cc858fc7
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Faidon Liambotis 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Hygiene: DRY up MwQueryResponse page results handling

2017-05-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354373 )

Change subject: Hygiene: DRY up MwQueryResponse page results handling
..

Hygiene: DRY up MwQueryResponse page results handling

Change-Id: I0403292601cce4ad50469692042c7244daed8579
---
M app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryResponse.java
M app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
M app/src/main/java/org/wikipedia/page/ImageLicenseFetchClient.java
M app/src/main/java/org/wikipedia/page/PageFragmentLoadState.java
M app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
M app/src/main/java/org/wikipedia/pageimages/PageImagesClient.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListPageDetailFetcher.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListPageInfoClient.java
M app/src/main/java/org/wikipedia/wikidata/GetDescriptionsClient.java
M app/src/test/java/org/wikipedia/page/ImageLicenseFetchClientTest.java
M app/src/test/java/org/wikipedia/pageimages/PageImagesClientTest.java
M app/src/test/java/org/wikipedia/readinglist/ReadingListPageInfoClientTest.java
M app/src/test/java/org/wikipedia/wikidata/GetDescriptionClientTest.java
13 files changed, 120 insertions(+), 134 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/73/354373/1

diff --git 
a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryResponse.java 
b/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryResponse.java
index 13642d3..d3d5bfe 100644
--- a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryResponse.java
+++ b/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryResponse.java
@@ -5,6 +5,8 @@
 
 import com.google.gson.annotations.SerializedName;
 
+import java.util.List;
+
 public class MwQueryResponse extends MwResponse {
 
 @SuppressWarnings("unused") @SerializedName("batchcomplete")
@@ -28,4 +30,12 @@
 protected void setQuery(@Nullable T query) {
 this.query = query;
 }
+
+public static class Pages {
+private List pages;
+
+public List pages() {
+return pages;
+}
+}
 }
diff --git a/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java 
b/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
index 39cc100..8b85605 100644
--- a/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
+++ b/app/src/main/java/org/wikipedia/page/DisambigListAdapter.java
@@ -36,14 +36,11 @@
 private static final int MAX_CACHE_SIZE_IMAGES = 24;
 @NonNull private final LruCache pageImagesCache = new 
LruCache<>(MAX_CACHE_SIZE_IMAGES);
 private final DisambigResult[] items;
-private final WikipediaApp app;
-private final WikiSite wiki;
+private final WikiSite wiki = WikipediaApp.getInstance().getWikiSite();
 
 DisambigListAdapter(@NonNull Context context, @NonNull DisambigResult[] 
items) {
 super(context, 0, items);
 this.items = items;
-app = (WikipediaApp) getContext().getApplicationContext();
-wiki = app.getWikiSite();
 requestPageImages();
 fetchDescriptions();
 }
@@ -62,7 +59,7 @@
 
 new PageImagesClient().request(wiki, titleList,
 new PageImagesClient.Callback() {
-@Override public void success(@NonNull 
Call call,
+@Override public void success(@NonNull 
Call call,
   @NonNull Map results) {
 for (Map.Entry entry : 
results.entrySet()) {
 if (entry.getValue() == null || 
entry.getValue().getImageName() == null) {
@@ -72,7 +69,8 @@
 }
 notifyDataSetInvalidated();
 }
-@Override public void failure(@NonNull 
Call call, @NonNull Throwable 
caught) {
+@Override public void failure(@NonNull 
Call call,
+  @NonNull Throwable caught) {
 // Don't actually do anything.
 // Thumbnails are expendable
 }
@@ -92,7 +90,7 @@
 }
 
 new GetDescriptionsClient().request(wiki, titleList, new 
GetDescriptionsClient.Callback() {
-@Override public void success(@NonNull 
Call call,
+@Override public void success(@NonNull 
Call call,
   @NonNull List results) {
 for (MwQueryPage page : results) {
 PageTitle pageTitle = new PageTitle(null, page.title(), 
wiki);
@@ -106,7 +104,7 @@
 }
 notifyDataSetChanged();
 }
-@Override 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Hygiene: Consolidate MwQueryImageLicensePage into MwQueryPage

2017-05-18 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354372 )

Change subject: Hygiene: Consolidate MwQueryImageLicensePage into MwQueryPage
..

Hygiene: Consolidate MwQueryImageLicensePage into MwQueryPage

Change-Id: Ia70629d59bb5b5c76963d873afda8122bb277ac9
---
D app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryImageLicensePage.java
M app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryPage.java
M app/src/main/java/org/wikipedia/page/ImageLicense.java
M app/src/main/java/org/wikipedia/page/ImageLicenseFetchClient.java
M app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java
M app/src/test/java/org/wikipedia/page/ImageLicenseFetchClientTest.java
6 files changed, 38 insertions(+), 110 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/72/354372/1

diff --git 
a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryImageLicensePage.java 
b/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryImageLicensePage.java
deleted file mode 100644
index ff42026..000
--- 
a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryImageLicensePage.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.wikipedia.dataclient.mwapi;
-
-import android.support.annotation.Nullable;
-
-import com.google.gson.annotations.SerializedName;
-
-import java.util.List;
-
-public class MwQueryImageLicensePage extends MwQueryPage {
-@SuppressWarnings("unused") @Nullable private List imageinfo;
-
-public String imageLicense() {
-return imageinfo != null
-&& imageinfo.get(0).extmetadata() != null
-&& imageinfo.get(0).extmetadata().license() != null
-? imageinfo.get(0).extmetadata().license().value() : "";
-}
-
-public String imageLicenseShortName() {
-return imageinfo != null
-&& imageinfo.get(0).extmetadata() != null
-&& imageinfo.get(0).extmetadata().licenseShortName() != null
-? imageinfo.get(0).extmetadata().licenseShortName().value() : 
"";
-}
-
-public String imageLicenseUrl() {
-return imageinfo != null
-&& imageinfo.get(0).extmetadata() != null
-&& imageinfo.get(0).extmetadata().licenseUrl() != null
-? imageinfo.get(0).extmetadata().licenseUrl().value() : "";
-}
-
-static class ImageInfo {
-@SuppressWarnings("unused") private Extmetadata extmetadata;
-Extmetadata extmetadata() {
-return extmetadata;
-}
-}
-
-static class Extmetadata {
-@SuppressWarnings("unused") @SerializedName("License") private License 
license;
-@SuppressWarnings("unused") @SerializedName("LicenseShortName") 
private LicenseShortName licenseShortName;
-@SuppressWarnings("unused") @SerializedName("LicenseUrl") private 
LicenseUrl licenseUrl;
-
-License license() {
-return license;
-}
-LicenseShortName licenseShortName() {
-return licenseShortName;
-}
-LicenseUrl licenseUrl() {
-return licenseUrl;
-}
-}
-
-static class License {
-@SuppressWarnings("unused") private String value;
-String value() {
-return value;
-}
-}
-
-static class LicenseShortName {
-@SuppressWarnings("unused") private String value;
-String value() {
-return value;
-}
-}
-
-static class LicenseUrl {
-@SuppressWarnings("unused") private String value;
-String value() {
-return value;
-}
-}
-}
diff --git a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryPage.java 
b/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryPage.java
index 2007a62..44dfed1 100644
--- a/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryPage.java
+++ b/app/src/main/java/org/wikipedia/dataclient/mwapi/MwQueryPage.java
@@ -5,6 +5,7 @@
 
 import com.google.gson.annotations.SerializedName;
 
+import org.wikipedia.gallery.ImageInfo;
 import org.wikipedia.json.annotations.Required;
 import org.wikipedia.model.BaseModel;
 
@@ -23,6 +24,7 @@
 @SuppressWarnings("unused") @Nullable private List 
coordinates;
 @SuppressWarnings("unused") @Nullable private Thumbnail thumbnail;
 @SuppressWarnings("unused") @Nullable private Terms terms;
+@SuppressWarnings("unused") @SerializedName("imageinfo") @Nullable private 
List imageInfo;
 
 @NonNull public String title() {
 return title;
@@ -53,6 +55,10 @@
 return terms != null && terms.description() != null ? 
terms.description().get(0) : null;
 }
 
+@Nullable public ImageInfo imageInfo() {
+return imageInfo != null ? imageInfo.get(0) : null;
+}
+
 public static class Revision {
 @SuppressWarnings("unused,NullableProblems") 
@SerializedName("contentformat") @NonNull 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Store order id in invoice_id column

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354371 )

Change subject: Store order id in invoice_id column
..

Store order id in invoice_id column

Perfect place for an id we generate ourselves

Bug: T165696
Change-Id: I64cd822b17b61fe1d0553bb113e45ec8af077a13
---
M sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/71/354371/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
index c221efd..6028af3 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/DonationQueueTest.php
@@ -61,6 +61,7 @@
'financial_type' => 'Cash',
'contribution_status' => 'Completed',
'payment_instrument' => 'Credit Card: Visa',
+   'invoice_id' => $message->get('order_id'),
$campaignField => '',
);
$returnFields = array_keys( $expected );
@@ -100,6 +101,7 @@
'financial_type' => 'Cash',
'contribution_status' => 'Completed',
'payment_instrument' => 'Credit Card: Visa',
+   'invoice_id' => $message2->get('order_id'),
$campaignField => 'Benefactor Gift',
);
$this->assertArraySubset( $expected, $contribution2 );
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 6aeeab7..7bf8db0 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -352,6 +352,11 @@
 $contribution[ 'thankyou_date' ] = wmf_common_date_unix_to_civicrm( 
$msg['thankyou_date'] );
 }
 
+// Store the identifier we generated on payments
+if ( !empty( $msg['order_id'] ) ) {
+   $contribution['invoice_id'] = $msg['order_id'];
+   }
+
 /**
 *  Hopefully the Civi API will eventually handle custom fields in the
 *  above "Create" call.

-- 
To view, visit https://gerrit.wikimedia.org/r/354371
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64cd822b17b61fe1d0553bb113e45ec8af077a13
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: rl: Break out mobile.mainMenu style module

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354225 )

Change subject: rl: Break out mobile.mainMenu style module
..


rl: Break out mobile.mainMenu style module

The mobile.mainMenu styles are loaded by OutputPage#addModuleStyles,
which requires that the specified modules are styles-only, on the
Special:MobileMenu page. A side effect of this is that the
mobile.mainMenu JS and templates aren't loaded on Special:MobileMenu,
which is fortunate as they aren't required. They are also loaded by the
RL on other pages.

Support both ways of loading the mobile.mainMenu styles (and other
content) and the RL by:

* Creating the mobile.mainMenu.styles styles-only RL module.
* Making the mobile.mainMenu RL module depend on mobile.mainMenu.styles.
* Only the mobile.mainMenu.styles RL module on Special:MobileMenu.

Bug: T164892
Change-Id: Ia108d63753593ca8e6ce266e595d32af148b436a
---
M extension.json
M includes/specials/SpecialMobileMenu.php
R resources/mobile.mainMenu.styles/mainmenu.less
3 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Bmansurov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 4ff68ea..7bac35e 100644
--- a/extension.json
+++ b/extension.json
@@ -299,6 +299,15 @@
"contributions": 
"resources/mobile.mainMenu.icons/contributions.svg"
}
},
+   "mobile.mainMenu.styles": {
+   "targets": [
+   "mobile",
+   "desktop"
+   ],
+   "styles": [
+   "resources/mobile.mainMenu.styles/mainmenu.less"
+   ]
+   },
"mobile.mainMenu": {
"targets": [
"mobile",
@@ -306,13 +315,11 @@
],
"dependencies": [
"mobile.mainMenu.icons",
+   "mobile.mainMenu.styles",
"mobile.startup",

"mobile.loggingSchemas.mobileWebMainMenuClickTracking"
],
"position": "bottom",
-   "styles": [
-   "resources/mobile.mainMenu/mainmenu.less"
-   ],
"templates": {
"menu.hogan": 
"resources/mobile.mainMenu/menu.mustache",
"menuGroup.hogan": 
"resources/mobile.mainMenu/menuGroup.mustache"
diff --git a/includes/specials/SpecialMobileMenu.php 
b/includes/specials/SpecialMobileMenu.php
index 7489064..8b8fff7 100644
--- a/includes/specials/SpecialMobileMenu.php
+++ b/includes/specials/SpecialMobileMenu.php
@@ -34,7 +34,7 @@
$out->addModuleStyles(
[
'mobile.mainMenu.icons',
-   'mobile.mainMenu',
+   'mobile.mainMenu.styles',
]
);
}
diff --git a/resources/mobile.mainMenu/mainmenu.less 
b/resources/mobile.mainMenu.styles/mainmenu.less
similarity index 100%
rename from resources/mobile.mainMenu/mainmenu.less
rename to resources/mobile.mainMenu.styles/mainmenu.less

-- 
To view, visit https://gerrit.wikimedia.org/r/354225
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia108d63753593ca8e6ce266e595d32af148b436a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Phuedx 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add gateway_session_id to queue messages

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354370 )

Change subject: Add gateway_session_id to queue messages
..

Add gateway_session_id to queue messages

Just for PayPal EC so far. Eventually we we want this for Ingenico
hosted checkout id as well.

Bug: T165687
Change-Id: I1ee4b8646a4d2c18c25bbb1ea68ee04c2e436656
---
M gateway_common/DonationData.php
M gateway_common/DonationQueue.php
M paypal_gateway/express_checkout/config/var_map.yaml
M paypal_gateway/express_checkout/paypal_express.adapter.php
M tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
A tests/phpunit/includes/Responses/paypal_ec/SetExpressCheckout_OK.testresponse
6 files changed, 60 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/70/354370/1

diff --git a/gateway_common/DonationData.php b/gateway_common/DonationData.php
index 72aac42..bfd3178 100644
--- a/gateway_common/DonationData.php
+++ b/gateway_common/DonationData.php
@@ -935,6 +935,7 @@
'amount',
'user_ip',
'date',
+   'gateway_session_id',
);
}
 
diff --git a/gateway_common/DonationQueue.php b/gateway_common/DonationQueue.php
index 97f4816..918ffd5 100644
--- a/gateway_common/DonationQueue.php
+++ b/gateway_common/DonationQueue.php
@@ -213,6 +213,7 @@
'email' => 'email',
'first_name' => 'fname',
'gross' => 'amount',
+   'gateway_session_id' => 'gateway_session_id',
'last_name' => 'lname',
'optout' => 'optout',
'recurring' => 'recurring',
diff --git a/paypal_gateway/express_checkout/config/var_map.yaml 
b/paypal_gateway/express_checkout/config/var_map.yaml
index 9bac3f2..fec9188 100644
--- a/paypal_gateway/express_checkout/config/var_map.yaml
+++ b/paypal_gateway/express_checkout/config/var_map.yaml
@@ -27,4 +27,4 @@
 # TODO: discuss whether to capture
 #PHONENUM: phone
 RETURNURL: returnto
-TOKEN: ec_token
+TOKEN: gateway_session_id
diff --git a/paypal_gateway/express_checkout/paypal_express.adapter.php 
b/paypal_gateway/express_checkout/paypal_express.adapter.php
index 481d94b..0e62ecb 100644
--- a/paypal_gateway/express_checkout/paypal_express.adapter.php
+++ b/paypal_gateway/express_checkout/paypal_express.adapter.php
@@ -415,6 +415,7 @@
case 'SetExpressCheckout':
case 'SetExpressCheckout_recurring':
$this->checkResponseAck( $response );
+   $this->addResponseData( $this->unstageKeys( 
$response ) );
$this->transaction_response->setRedirect(
$this->account_config['RedirectURL'] . 
$response['TOKEN'] );
break;
@@ -517,7 +518,7 @@
 
public function processDonorReturn( $requestValues ) {
$this->addRequestData( array(
-   'ec_token' => $requestValues['token'],
+   'gateway_session_id' => $requestValues['token'],
'payer_id' => $requestValues['PayerID'],
) );
$resultData = $this->do_transaction( 
'GetExpressCheckoutDetails' );
diff --git a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php 
b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
index ac4dba3..9c3170c 100644
--- a/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
+++ b/tests/phpunit/Adapter/PayPal/PayPalExpressTest.php
@@ -36,6 +36,58 @@
}
}
 
+   function testPaymentSetup() {
+   $init = array(
+   'amount' => 1.55,
+   'currency_code' => 'USD',
+   'payment_method' => 'paypal',
+   'utm_source' => 'CD1234_FR',
+   'utm_medium' => 'sitenotice',
+   'country' => 'US',
+   'contribution_tracking_id' => strval( mt_rand() ),
+   'language' => 'fr',
+   );
+   $gateway = $this->getFreshGatewayObject( $init );
+   $gateway->setDummyGatewayResponseCode( 'OK' );
+   $result = $gateway->doPayment();
+   $gateway->logPending(); // GatewayPage calls this for redirects
+   $this->assertEquals(
+   
'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout=EC-8US12345X1234567U',
+   $result->getRedirect(),
+   'Wrong redirect for PayPal EC payment setup'
+   );
+   $message = DonationQueue::instance()->pop( 'pending' );
+   $this->assertNotEmpty( $message, 'Missing pending 

[MediaWiki-commits] [Gerrit] oojs/ui[master]: MediaWiki, Apex theme: Increase Fieldset a Layout header's `...

2017-05-18 Thread VolkerE (Code Review)
VolkerE has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354369 )

Change subject: MediaWiki, Apex theme: Increase Fieldset a Layout header's 
`font-size`
..

MediaWiki, Apex theme: Increase Fieldset a Layout header's `font-size`

This has been decreased in , but we need to set it more carefully
apart from the labels and widgets. Increasing just to be rendered
by 1px higher, as the most prominent use case is Special Pages, where
every pixel counts.
Also aligning FieldsetLayout with icon's padding to icon padding
elsewhere.

Bug: T155575
Change-Id: I947c6cd4d15f62e04c14ef09838e787d3f6cde5a
---
M src/themes/apex/layouts.less
M src/themes/mediawiki/common.less
M src/themes/mediawiki/layouts.less
3 files changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/69/354369/1

diff --git a/src/themes/apex/layouts.less b/src/themes/apex/layouts.less
index 88bfa96..80d6963 100644
--- a/src/themes/apex/layouts.less
+++ b/src/themes/apex/layouts.less
@@ -133,7 +133,7 @@
 
&.oo-ui-labelElement > .oo-ui-fieldsetLayout-header > 
.oo-ui-labelElement-label {
display: inline-block;
-   font-size: 1.1em;
+   font-size: 1.15em;
margin-bottom: 0.5em;
padding: 0.25em 0;
font-weight: bold;
diff --git a/src/themes/mediawiki/common.less b/src/themes/mediawiki/common.less
index 695f63f..b4af696 100644
--- a/src/themes/mediawiki/common.less
+++ b/src/themes/mediawiki/common.less
@@ -98,6 +98,7 @@
 @margin-taboption: @margin-dialog-bar-button-framed;
 @margin-top-tagitem: 4 / @oo-ui-font-size-browser / @oo-ui-font-size-default;
 @margin-top-tagmultiselect-input: 6 / @oo-ui-font-size-browser / 
@oo-ui-font-size-default;
+@margin-bottom-fieldset-header: 8 / @oo-ui-font-size-browser / ( 
@oo-ui-font-size-default * @font-size-fieldset-header );
 
 @border-default: @border-width-default solid @border-color-default;
 @border-disabled: @border-width-default solid @border-color-disabled;
@@ -151,6 +152,7 @@
 @padding-start-input-text-icon: 6 / @oo-ui-font-size-browser / 
@oo-ui-font-size-default; // As long as we have whitespace in icon canvas, we 
need reduced `padding-left`.
 @padding-start-icon: @size-icon;
 @padding-start-icon-only: 26 / @oo-ui-font-size-browser / 
@oo-ui-font-size-default; // equals `2.03125em`≈`26px`; 
@min-width-button-default - @padding-horizontal-default - 2 * 
@border-width-default;
+@padding-start-fieldset-header-iconized: 26 / @oo-ui-font-size-browser / ( 
@oo-ui-font-size-default * @font-size-fieldset-header );
 @padding-start-indicator-only: @padding-start-icon-only;
 @padding-start-indicator-plus: 32 / @oo-ui-font-size-browser / 
@oo-ui-font-size-default;
 @padding-start-input-text-icon-label: 32 / @oo-ui-font-size-browser / 
@oo-ui-font-size-default;
@@ -168,9 +170,12 @@
 @box-shadow-erroneous-focus: inset 0 0 0 1px @color-erroneous;
 @box-shadow-disabled-filled: inset 0 0 0 1px @color-disabled-filled;
 
+@font-size-fieldset-header: 1.15em; // equals `16.1px` at base `font-size: 
12.8px`. Todo: Not able to get unified `16px` due to T
+
 @line-height-default: 1.6; // same as Vector
 @line-height-reset: 1; // Support: Safari, reset `line-height` in order to 
normalize it in a follow-up rule across browsers.
 @line-height-message: 1.4;
+@line-height-fieldset-header-iconized: 24 / @oo-ui-font-size-browser / ( 
@oo-ui-font-size-default * @font-size-fieldset-header );
 @line-height-form-element: 1.4;
 @line-height-input-binary-label: 1.5; // Checkboxes, Radios and 
ToggleSwitchWidget labels need a tad more for increased vertical click area
 @line-height-widget-multiline: 1.275;
diff --git a/src/themes/mediawiki/layouts.less 
b/src/themes/mediawiki/layouts.less
index a6185d7..86eb027 100644
--- a/src/themes/mediawiki/layouts.less
+++ b/src/themes/mediawiki/layouts.less
@@ -148,15 +148,15 @@
 
&.oo-ui-labelElement > .oo-ui-fieldsetLayout-header > 
.oo-ui-labelElement-label {
display: inline-block;
-   margin-bottom: 0.56818em; // equals `8px` due to `font-size: 
1.1em` below
-   font-size: 1.1em;
+   margin-bottom: @margin-bottom-fieldset-header;
+   font-size: @font-size-fieldset-header;
font-weight: bold;
line-height: @line-height-form-element;
}
 
&.oo-ui-iconElement > .oo-ui-fieldsetLayout-header > 
.oo-ui-labelElement-label {
-   padding-left: 2em;
-   line-height: 1.8;
+   padding-left: @padding-start-fieldset-header-iconized;
+   line-height: @line-height-fieldset-header-iconized;
}
 
&.oo-ui-iconElement > .oo-ui-fieldsetLayout-header > 
.oo-ui-iconElement-icon {

-- 
To view, visit https://gerrit.wikimedia.org/r/354369
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: rl: Break out mobile.messageBox styles module

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354222 )

Change subject: rl: Break out mobile.messageBox styles module
..


rl: Break out mobile.messageBox styles module

The mobile.messageBox styles are loaded using
OutputPage#addModuleStyles, which requires that the specified modules
are styles-only, on certain special pages. They are also loaded by the
RL on other pages as they are depended on by the mobile.nearby and
mobile.editor.common RL modules.

Support both ways of loading the mobile.messageBox styles (and other
content) and the RL by:

* Creating the mobile.messageBox.styles styles-only RL module.
* Making the mobile.messageBox RL module depend on
  mobile.messageBox.styles.
* Only loading the mobile.messageBox.styles RL module on certain pages.

Bug: T164892
Change-Id: I46dd7fbfdfebd1daf732f9c3a7dbbf488ff6c533
---
M extension.json
M includes/skins/SkinMinerva.php
R resources/mobile.messageBox.styles/messageBox.less
3 files changed, 14 insertions(+), 7 deletions(-)

Approvals:
  Bmansurov: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 4191e85..4ff68ea 100644
--- a/extension.json
+++ b/extension.json
@@ -321,17 +321,24 @@
"resources/mobile.mainMenu/MainMenu.js"
]
},
+   "mobile.messageBox.styles": {
+   "targets": [
+   "mobile",
+   "desktop"
+   ],
+   "position": "top",
+   "styles": [
+   
"resources/mobile.messageBox.styles/messageBox.less"
+   ]
+   },
"mobile.messageBox": {
"targets": [
"mobile",
"desktop"
],
"dependencies": [
-   "mobile.startup"
-   ],
-   "position": "top",
-   "styles": [
-   "resources/mobile.messageBox/messageBox.less"
+   "mobile.startup",
+   "mobile.messageBox.styles"
],
"templates": {
"MessageBox.hogan": 
"resources/mobile.messageBox/MessageBox.mustache"
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 1b18eeb..8cadaf4 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -1402,14 +1402,14 @@
$styles[] = 'skins.minerva.userpage.styles';
$styles[] = 'skins.minerva.userpage.icons';
} elseif ( $title->isSpecialPage() ) {
-   $styles[] = 'mobile.messageBox';
+   $styles[] = 'mobile.messageBox.styles';
$styles['special'] = 'skins.minerva.special.styles';
}
if ( $title->isSpecial( 'Notifications' ) ) {
$styles[] = 'skins.minerva.notifications.filter.styles';
}
if ( $this->getOutput()->getRequest()->getText( 'oldid' ) ) {
-   $styles[] = 'mobile.messageBox';
+   $styles[] = 'mobile.messageBox.styles';
}
 
return $styles;
diff --git a/resources/mobile.messageBox/messageBox.less 
b/resources/mobile.messageBox.styles/messageBox.less
similarity index 100%
rename from resources/mobile.messageBox/messageBox.less
rename to resources/mobile.messageBox.styles/messageBox.less

-- 
To view, visit https://gerrit.wikimedia.org/r/354222
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I46dd7fbfdfebd1daf732f9c3a7dbbf488ff6c533
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Phuedx 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...dbtree[master]: return HTTP 503 if database connection fails

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353388 )

Change subject: return HTTP 503 if database connection fails
..


return HTTP 503 if database connection fails

To prevent error pages from being cached in varnish.

Bug: T163143
Change-Id: I8413ce66e852f7bc53fcb684963ebd64640eda61
---
M index.php
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  ArielGlenn: Looks good to me, but someone else must approve
  Jcrespo: Looks good to me, but someone else must approve
  Dzahn: Verified; Looks good to me, approved



diff --git a/index.php b/index.php
index 206ed7f..66a470c 100644
--- a/index.php
+++ b/index.php
@@ -14,6 +14,13 @@
 }
 );
 
+# return http 503 if database connection fails to prevent
+# error pages from being cached in varnish (T163143)
+function db_fail($db_name, $db_host) {
+header($_SERVER['SERVER_PROTOCOL'] . ' Service Unavailable' . , true, 503);
+die('database connection to ' . $db_name . ' on ' . $db_host . 'failed');
+}
+
 function db()
 {
 static $db = null;
@@ -22,7 +29,7 @@
 {
 e("db connect: host");
 $db = @mysql_connect($db_host, $db_user, $db_pass)
-or die('database connection to ' . $db_name . ' on ' . $db_host . 
'failed');
+or db_fail($db_name, $db_host);
 mysql_select_db($db_name);
 }
 return $db;
@@ -33,4 +40,4 @@
 $tree = new Tree();
 list ($clusters) = $tree->generate();
 
-include 'inc/template.php';
\ No newline at end of file
+include 'inc/template.php';

-- 
To view, visit https://gerrit.wikimedia.org/r/353388
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8413ce66e852f7bc53fcb684963ebd64640eda61
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/dbtree
Gerrit-Branch: master
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: ArielGlenn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Jcrespo 
Gerrit-Reviewer: Muehlenhoff 
Gerrit-Reviewer: Reedy 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Display newly added talk topic

2017-05-18 Thread Bmansurov (Code Review)
Bmansurov has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354298 )

Change subject: Display newly added talk topic
..

Display newly added talk topic

Expose PageGateway cache to the module rather than keeping it
private to the instance. The reason is that the various types of
talk overlays, e.g. TalkOverlay, TalkSectionAddOverlay, etc. create
their own instances of PageGateway and a change in one of them didn’t
reflect in the other instances of PageGateway.

Bug: T151041

Change-Id: I026b4a5a7c7fdc13e6115466180cf82d57eed524
---
M resources/mobile.startup/PageGateway.js
M tests/browser/features/step_definitions/talk_steps.rb
M tests/browser/features/support/pages/article_page.rb
M tests/browser/features/talk.feature
4 files changed, 38 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/98/354298/1

diff --git a/resources/mobile.startup/PageGateway.js 
b/resources/mobile.startup/PageGateway.js
index 5df091e..c588ec6 100644
--- a/resources/mobile.startup/PageGateway.js
+++ b/resources/mobile.startup/PageGateway.js
@@ -1,5 +1,6 @@
 ( function ( M, $ ) {
-   var sectionTemplate = mw.template.get( 'mobile.startup', 
'Section.hogan' );
+   var sectionTemplate = mw.template.get( 'mobile.startup', 
'Section.hogan' ),
+   cache = {};
 
/**
 * Add child to listOfSections if the level of child is the same as the 
last
@@ -88,7 +89,6 @@
 */
function PageGateway( api ) {
this.api = api;
-   this.cache = {};
}
 
PageGateway.prototype = {
@@ -111,8 +111,8 @@
edit: [ '*' ]
};
 
-   if ( !this.cache[title] ) {
-   page = this.cache[title] = $.Deferred();
+   if ( !cache[title] ) {
+   page = cache[title] = $.Deferred();
this.api.get( {
action: 'mobileview',
page: title,
@@ -179,7 +179,7 @@
} ).fail( $.proxy( page, 'reject' ) );
}
 
-   return this.cache[title];
+   return cache[title];
},
 
/**
@@ -189,7 +189,7 @@
 * @param {string} title the title of the page who's cache you 
want to invalidate
 */
invalidatePage: function ( title ) {
-   delete this.cache[title];
+   delete cache[title];
},
 
/**
diff --git a/tests/browser/features/step_definitions/talk_steps.rb 
b/tests/browser/features/step_definitions/talk_steps.rb
index 9604327..d25b3a5 100644
--- a/tests/browser/features/step_definitions/talk_steps.rb
+++ b/tests/browser/features/step_definitions/talk_steps.rb
@@ -5,10 +5,28 @@
   end
 end
 
+When(/^no topic is present$/) do
+  
expect(on(ArticlePage).talk_overlay_content_header_element.when_present.text).to
 match "There are no conversations about this page."
+end
+
+When(/^I add a topic called "(.+)"$/) do |topic|
+  step "I click the add discussion button"
+  on(ArticlePage) do |page|
+page.talk_overlay_summary = topic
+page.talk_overlay_wikitext_editor = 'Topic body is a really long text.'
+page.wait_until { page.talk_overlay_save_button_element.enabled? }
+page.talk_overlay_save_button
+  end
+end
+
 When(/^I click the add discussion button$/) do
   on(ArticlePage).talkadd_element.when_present.click
 end
 
+Then(/^I should see the topic called "(.+)" in the list of topics$/) do |topic|
+  
expect(on(ArticlePage).talk_overlay_first_topic_title_element.when_present.text).to
 match topic
+end
+
 Then(/^I should see the talk overlay$/) do
   on(ArticlePage) do |page|
 page.wait_until_rl_module_ready('mobile.talk.overlays')
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index 7d63c48..68f58f0 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -189,4 +189,9 @@
 
   # talk overlay
   a(:talkadd, css: '.add.continue')
+  p(:talk_overlay_content_header, css: '.talk-overlay .content-header')
+  li(:talk_overlay_first_topic_title, css: '.talk-overlay .topic-title-list 
li:first-child')
+  text_field(:talk_overlay_summary, css: '.talk-overlay .summary')
+  text_area(:talk_overlay_wikitext_editor, css: '.talk-overlay 
.wikitext-editor')
+  button(:talk_overlay_save_button, css: '.talk-overlay .confirm-save')
 end
diff --git a/tests/browser/features/talk.feature 
b/tests/browser/features/talk.feature
index d81cd81..e301acb 100644
--- a/tests/browser/features/talk.feature
+++ 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove order requirement for SearchEnginePrefixTest tests

2017-05-18 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354274 )

Change subject: Remove order requirement for SearchEnginePrefixTest tests
..

Remove order requirement for SearchEnginePrefixTest tests

Bug: T75174
Change-Id: I0a7f3859945218319b3f418f607c0299d8569c61
---
M tests/phpunit/includes/search/SearchEnginePrefixTest.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/74/354274/1

diff --git a/tests/phpunit/includes/search/SearchEnginePrefixTest.php 
b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
index 63ed93e..b697d03 100644
--- a/tests/phpunit/includes/search/SearchEnginePrefixTest.php
+++ b/tests/phpunit/includes/search/SearchEnginePrefixTest.php
@@ -183,6 +183,9 @@
$results = array_map( function( Title $t ) {
return $t->getPrefixedText();
}, $results );
+
+   sort( $case['results'] );
+   sort( $results );
$this->assertEquals(
$case['results'],
$results,
@@ -208,6 +211,8 @@
array_merge( $case['results'], $case['offsetresult'] ) :
$case['results'];
 
+   sort( $expected );
+   sort( $results );
$this->assertEquals(
$expected,
$results,

-- 
To view, visit https://gerrit.wikimedia.org/r/354274
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a7f3859945218319b3f418f607c0299d8569c61
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Mark some more deprecated donationData fields

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354267 )

Change subject: Mark some more deprecated donationData fields
..

Mark some more deprecated donationData fields

Change-Id: I307decd5a4a4403d6d1ffed32ab79778753c6d9a
---
M gateway_common/DonationData.php
1 file changed, 7 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/67/354267/1

diff --git a/gateway_common/DonationData.php b/gateway_common/DonationData.php
index 72aac42..3a00499 100644
--- a/gateway_common/DonationData.php
+++ b/gateway_common/DonationData.php
@@ -37,12 +37,11 @@
 */
protected static $fieldNames = array(
'amount',
-   'amountGiven',
-   'amountOther',
+   'amountGiven',  // @deprecated
+   'amountOther',  // @deprecated
'appeal',
'email',
-   // @deprecated
-   'emailAdd',
+   'emailAdd', // @deprecated
'fname',
'lname',
'street',
@@ -51,10 +50,10 @@
'state',
'postal_code',
'country',
-   'card_num',
-   'card_type',
-   'expiration',
-   'cvv',
+   'card_num', // @deprecated
+   'card_type',// @deprecated
+   'expiration',   // @deprecated
+   'cvv',  // @deprecated
'currency',
'currency_code',
'payment_method',

-- 
To view, visit https://gerrit.wikimedia.org/r/354267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I307decd5a4a4403d6d1ffed32ab79778753c6d9a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Add payment_session_id to pending table

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354266 )

Change subject: Add payment_session_id to pending table
..

Add payment_session_id to pending table

For tracking transient identifiers like Ingenico's hosted checkout ID
or PayPal's session token.

To add to an existing table:
ALTER TABLE pending ADD
payment_session_id varchar(255) NULL;

ALTER TABLE pending ADD INDEX
idx_pending_gateway_payment_session_id (gateway, payment_session_id);

Bug: T165687
Change-Id: Ibbbd81400d2ddf68551d5bef92d6233f3cc7fb30
---
M Core/DataStores/PendingDatabase.php
M Schema/mysql/001_CreatePendingTable.sql
M Schema/sqlite/001_CreatePendingTable.sql
M Tests/PendingDatabaseTest.php
4 files changed, 54 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/66/354266/1

diff --git a/Core/DataStores/PendingDatabase.php 
b/Core/DataStores/PendingDatabase.php
index dde9bd5..8731e61 100644
--- a/Core/DataStores/PendingDatabase.php
+++ b/Core/DataStores/PendingDatabase.php
@@ -17,7 +17,8 @@
empty( $message['gateway'] ) ||
(   // need at least one transaction ID
empty( $message['gateway_txn_id'] ) &&
-   empty( $message['order_id'] )
+   empty( $message['order_id'] ) &&
+   empty( $message['payment_session_id'] )
)
) {
throw new SmashPigException( 'Message missing required 
fields' );
@@ -37,7 +38,11 @@
// These fields (and date) have their own columns in the 
database
// Copy the values from the message to the record
$indexedFields = array(
-   'gateway', 'gateway_account', 'gateway_txn_id', 
'order_id'
+   'gateway',
+   'gateway_account',
+   'gateway_txn_id',
+   'order_id',
+   'payment_session_id'
);
 
foreach ( $indexedFields as $fieldName ) {
@@ -85,6 +90,31 @@
}
 
/**
+* Return record matching a (gateway, payment_session_id), or null
+*
+* @param $gatewayName string
+* @param $paymentSessionId string
+* @return array|null Record related to a transaction, or null if 
nothing matches
+*/
+   public function fetchMessageByGatewayPaymentSessionId( $gatewayName, 
$paymentSessionId ) {
+   $sql = 'select * from pending
+   where gateway = :gateway
+   and payment_session_id = :payment_session_id
+   limit 1';
+
+   $params = array(
+   'gateway' => $gatewayName,
+   'payment_session_id' => $paymentSessionId,
+   );
+   $executed = $this->prepareAndExecute( $sql, $params );
+   $row = $executed->fetch( PDO::FETCH_ASSOC );
+   if ( !$row ) {
+   return null;
+   }
+   return $this->messageFromDbRow( $row );
+   }
+
+   /**
 * Get the oldest message for a given gateway, by date
 *
 * @param $gatewayName string
diff --git a/Schema/mysql/001_CreatePendingTable.sql 
b/Schema/mysql/001_CreatePendingTable.sql
index 76dd361..a4b7157 100644
--- a/Schema/mysql/001_CreatePendingTable.sql
+++ b/Schema/mysql/001_CreatePendingTable.sql
@@ -5,10 +5,12 @@
   `gateway_account` varchar(255) NULL,
   `order_id` varchar(255) NULL,
   `gateway_txn_id` varchar(255) NULL,
+  `payment_session_id` varchar(255) NULL,
   `message` text NOT NULL,
   INDEX `idx_pending_date` (`date`),
   INDEX `idx_pending_date_gateway` (`date`, `gateway`),
   INDEX `idx_pending_order_id_gateway` (`order_id`, `gateway`),
   INDEX `idx_pending_gateway_txn_id_gateway` (`gateway_txn_id`, `gateway`),
+  INDEX `idx_pending_payment_session_id_gateway` (`payment_session_id`, 
`gateway`),
   PRIMARY KEY `pk_pending_id` (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
diff --git a/Schema/sqlite/001_CreatePendingTable.sql 
b/Schema/sqlite/001_CreatePendingTable.sql
index 0edcd69..39c941e 100644
--- a/Schema/sqlite/001_CreatePendingTable.sql
+++ b/Schema/sqlite/001_CreatePendingTable.sql
@@ -5,5 +5,6 @@
   `gateway_account` varchar(255) NULL,
   `order_id` varchar(255) NULL,
   `gateway_txn_id` varchar(255) NULL,
+  `payment_session_id` varchar(255) NULL,
   `message` text NOT NULL
 );
diff --git a/Tests/PendingDatabaseTest.php b/Tests/PendingDatabaseTest.php
index e4068ee..f44f7a5 100644
--- a/Tests/PendingDatabaseTest.php
+++ b/Tests/PendingDatabaseTest.php
@@ -35,6 +35,7 @@
'gateway' => 'test',
'gateway_txn_id' => 

[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: [WIP] Statement list on newly added form

2017-05-18 Thread Aleksey Bekh-Ivanov (WMDE) (Code Review)
Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354265 )

Change subject: [WIP] Statement list on newly added form
..

[WIP] Statement list on newly added form

Bug: T165481
Change-Id: Ic9bd6d095bdda10108ec9f991228844d45936774
---
M extension.json
M resources/jquery.wikibase.lexemeformlistview.js
M resources/jquery.wikibase.lexemeformview.js
M resources/serialization/LexemeDeserializer.js
M resources/view/ControllerViewFactory.js
M src/DataModel/Serialization/LexemeSerializer.php
6 files changed, 63 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/65/354265/1

diff --git a/extension.json b/extension.json
index b9e74e3..3a953cc 100644
--- a/extension.json
+++ b/extension.json
@@ -77,7 +77,8 @@
],
"messages": [
"wikibase-lexeme-empty-form-representation",
-   "wikibase-lexeme-enter-form-representation"
+   "wikibase-lexeme-enter-form-representation",
+   "wikibase-statementsection-statements"
]
},
"jquery.wikibase.grammaticalfeatureview": {
diff --git a/resources/jquery.wikibase.lexemeformlistview.js 
b/resources/jquery.wikibase.lexemeformlistview.js
index f06d4ed..abaea0e 100644
--- a/resources/jquery.wikibase.lexemeformlistview.js
+++ b/resources/jquery.wikibase.lexemeformlistview.js
@@ -59,7 +59,8 @@
_createListView: function () {
this._listview = new $.wikibase.listview( {
listItemAdapter: 
this.options.getListItemAdapter( this._removeItem.bind( this ) ),
-   listItemNodeName: 'div'
+   listItemNodeName: 'div',
+   value: this.options.value
}, this.element.find( '.wikibase-lexeme-forms' ) );
 
},
diff --git a/resources/jquery.wikibase.lexemeformview.js 
b/resources/jquery.wikibase.lexemeformview.js
index 1b10d68..a9f081c 100644
--- a/resources/jquery.wikibase.lexemeformview.js
+++ b/resources/jquery.wikibase.lexemeformview.js
@@ -27,6 +27,31 @@
function () {
return mw.wbTemplate( 
'wikibase-lexeme-form-grammatical-features', '' );
},
+   function () {
+   //wikibase-statementsection-statements
+   //$className = 'wikibase-statements';
+
+   var $container = $( '' );
+
+   var $header = $( '' 
).applyTemplate(
+   'wb-section-heading',
+   [
+   
mw.message('wikibase-statementsection-statements').escaped(),
+   '',
+   'wikibase-statements',
+   ]
+   );
+   $container.append( $header );
+
+   var $listContainer = $( '' );
+   
this.options.buildStatementGroupListView(
+   new 
wb.lexeme.datamodel.LexemeForm(),
+   $listContainer
+   );
+   $container.append( $listContainer );
+
+   return $container;
+   },
'Statements\' section will be here' //TODO find 
way to render block of statements
],
templateShortCuts: {
@@ -35,7 +60,8 @@
$grammaticalFeatures: 
'.wikibase-lexeme-form-grammatical-features'
},
inputNodeName: 'TEXTAREA',
-   buildGrammaticalFeatureView: null
+   api: null,
+   buildStatementGroupListView: null
},
_inEditMode: false,
 
@@ -68,6 +94,8 @@
},
 
_create: function () {
+   //TODO validate type of 
options.buildStatementGroupListView
+
PARENT.prototype._create.call( this );
this._grammaticalFeatureView = 
this._buildGrammaticalFeatureView();
 
diff --git a/resources/serialization/LexemeDeserializer.js 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: wikistats: grant db permissions on first run (labs)

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353944 )

Change subject: wikistats: grant db permissions on first run (labs)
..


wikistats: grant db permissions on first run (labs)

On the first puppet run on a new instance, apply
database grants for the wikistats user.

Also move existing code that generates a random password
from init.pp to db.pp since it's db-related.

And add missing "unless" to generation of random password
so it just happens once.

Change-Id: I196c241b04970a4bf0d21c31f37f31d62b873db7
---
M modules/wikistats/manifests/db.pp
M modules/wikistats/manifests/init.pp
2 files changed, 40 insertions(+), 10 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/wikistats/manifests/db.pp 
b/modules/wikistats/manifests/db.pp
index 692b824..a0768f9 100644
--- a/modules/wikistats/manifests/db.pp
+++ b/modules/wikistats/manifests/db.pp
@@ -29,6 +29,17 @@
 minute  => '23',
 }
 
+# stash random db password in the wikistats-user home dir,
+# so that deploy-script can bootstrap a new system
+exec { 'generate-wikistats-db-pass':
+command => '/usr/bin/openssl rand -base64 12 > 
/usr/lib/wikistats/wikistats-db-pass',
+creates => '/usr/lib/wikistats/wikistats-db-pass',
+user=> 'root',
+timeout => '10',
+unless  => '/usr/bin/test -f /usr/lib/wikistats/wikistats-db-pass',
+}
+
+# database schema
 file { '/usr/lib/wikistats/schema.sql':
 ensure => 'present',
 owner  => 'wikistatsuser',
@@ -37,9 +48,9 @@
 source => 'puppet:///modules/wikistats/schema.sql',
 }
 
+# import db schema on the first run
 exec { 'bootstrap-mysql-schema':
 command => '/usr/bin/mysql -u root -Bs < 
/usr/lib/wikistats/schema.sql',
-creates => '/usr/lib/wikistats/db_init',
 user=> 'root',
 timeout => '30',
 unless  => '/usr/bin/test -f /usr/lib/wikistats/db_init_done',
@@ -53,4 +64,32 @@
 group   => 'wikistatsuser',
 mode=> '0444',
 }
+
+# grant db permissions on the first run
+
+file { '/usr/lib/wikistats/grants.sql':
+ensure  => 'present',
+content => template('wikistats/db/grants.sql.erb'),
+owner   => 'wikistatsuser',
+group   => 'wikistatsuser',
+mode=> '0444',
+}
+
+exec { 'bootstrap-mysql-grants':
+command  => '/usr/bin/mysql -u root -Bs < 
/usr/lib/wikistats/grants.sql',
+user => 'root',
+timeout  => '30',
+unless   => '/usr/bin/test -f /usr/lib/wikistats/db_grants_done',
+before   => File['/usr/lib/wikistats/db_grants_done'],
+requires => File['/usr/lib/wikistats/grants.sql'],
+}
+
+file { '/usr/lib/wikistats/db_grants_done':
+ensure  => 'present',
+content => 'database grants have been applied',
+owner   => 'wikistatsuser',
+group   => 'wikistatsuser',
+mode=> '0444',
+}
+
 }
diff --git a/modules/wikistats/manifests/init.pp 
b/modules/wikistats/manifests/init.pp
index b4ddd5b..063a176 100644
--- a/modules/wikistats/manifests/init.pp
+++ b/modules/wikistats/manifests/init.pp
@@ -38,15 +38,6 @@
 ensure => 'directory',
 }
 
-# stash random db password in the wikistats-user home dir,
-# so that deploy-script can bootstrap a new system
-exec { 'generate-wikistats-db-pass':
-command => '/usr/bin/openssl rand -base64 12 > 
/usr/lib/wikistats/wikistats-db-pass',
-creates => '/usr/lib/wikistats/wikistats-db-pass',
-user=> 'root',
-timeout => '10',
-}
-
 file { '/usr/local/bin/wikistats':
 ensure => 'directory',
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/353944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I196c241b04970a4bf0d21c31f37f31d62b873db7
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use test user helper methods in UserGroupMembershipTest/User...

2017-05-18 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354264 )

Change subject: Use test user helper methods in UserGroupMembershipTest/UserTest
..

Use test user helper methods in UserGroupMembershipTest/UserTest

This avoids postgres failures when trying to insert users with name
"false" (cast to 0, which fails since integer != text type).

Change-Id: I809edd94117811d22492eaba440fad6aaea1195b
---
M includes/user/User.php
M tests/phpunit/includes/user/UserGroupMembershipTest.php
M tests/phpunit/includes/user/UserTest.php
3 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/64/354264/1

diff --git a/includes/user/User.php b/includes/user/User.php
index 5dd4be1..3317a1b 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -4170,6 +4170,10 @@
$this->setToken(); // init token
}
 
+   if ( !is_string( $this->mName ) ) {
+   throw new RuntimeException( "User name field is not 
set." );
+   }
+
$this->mTouched = $this->newTouchedTimestamp();
 
$noPass = PasswordFactory::newInvalidPassword()->toString();
diff --git a/tests/phpunit/includes/user/UserGroupMembershipTest.php 
b/tests/phpunit/includes/user/UserGroupMembershipTest.php
index a297f29..c0e556b 100644
--- a/tests/phpunit/includes/user/UserGroupMembershipTest.php
+++ b/tests/phpunit/includes/user/UserGroupMembershipTest.php
@@ -50,8 +50,7 @@
 * @covers UserGroupMembership::delete
 */
public function testAddAndRemoveGroups() {
-   $user = new User;
-   $user->addToDatabase();
+   $user = $this->getMutableTestUser( [] )->getUser();
 
// basic tests
$ugm = new UserGroupMembership( $user->getId(), 'unittesters' );
diff --git a/tests/phpunit/includes/user/UserTest.php 
b/tests/phpunit/includes/user/UserTest.php
index a596851..bc4d53d 100644
--- a/tests/phpunit/includes/user/UserTest.php
+++ b/tests/phpunit/includes/user/UserTest.php
@@ -25,9 +25,7 @@
 
$this->setUpPermissionGlobals();
 
-   $this->user = new User;
-   $this->user->addToDatabase();
-   $this->user->addGroup( 'unittesters' );
+   $this->user = $this->getTestUser( [ 'unittesters' ] 
)->getUser();
}
 
private function setUpPermissionGlobals() {
@@ -100,10 +98,7 @@
 * @covers User::getRights
 */
public function testUserGetRightsHooks() {
-   $user = new User;
-   $user->addToDatabase();
-   $user->addGroup( 'unittesters' );
-   $user->addGroup( 'testwriters' );
+   $user = $this->getTestUser( [ 'unittesters', 'testwriters'] 
)->getUser();
$userWrapper = TestingAccessWrapper::newFromObject( $user );
 
$rights = $user->getRights();

-- 
To view, visit https://gerrit.wikimedia.org/r/354264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I809edd94117811d22492eaba440fad6aaea1195b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...wikistats[master]: remove commented mysql_ remnants from detail.php, fix permis...

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354260 )

Change subject: remove commented mysql_ remnants from detail.php, fix 
permissions
..


remove commented mysql_ remnants from detail.php, fix permissions

remove mysql_ remnants in comments.

fix some permissions that lintian keeps pointing out.
executable files that don't need to and vice versa.

Change-Id: I4da1538d4690003129ac808a54ad2da3e7de6e41
---
M usr/share/php/wikistats/grandtotal_wiki.php
M usr/share/php/wikistats/largest_query.php
M var/www/wikistats/detail.php
M var/www/wikistats/gpl.txt
M var/www/wikistats/largest_csv.php
M var/www/wikistats/largest_wiki.php
M var/www/wikistats/wikimedias_csv.php
7 files changed, 0 insertions(+), 13 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/usr/share/php/wikistats/grandtotal_wiki.php 
b/usr/share/php/wikistats/grandtotal_wiki.php
old mode 100755
new mode 100644
diff --git a/usr/share/php/wikistats/largest_query.php 
b/usr/share/php/wikistats/largest_query.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/detail.php b/var/www/wikistats/detail.php
index c63d901..30e814f 100644
--- a/var/www/wikistats/detail.php
+++ b/var/www/wikistats/detail.php
@@ -228,11 +228,9 @@
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query($query)->fetchColumn();
 $count=1;
 
-#while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_g=$count;
@@ -241,14 +239,11 @@
 }
 
 $query = "select id from ${db_table} order by total desc,good desc";
-#$result = mysql_query("$query") or die(mysql_error());
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query($query)->fetchColumn();
 $count=1;
 
-#while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_t=$count;
@@ -257,15 +252,11 @@
 }
 
 $query = "select id from ${db_table} order by edits desc";
-#$result = mysql_query("$query") or die(mysql_error());
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query("select count(*) from ${db_table}")->fetchColumn();
 $count=1;
-
-#while($row = mysql_fetch_array( $result )) {
 
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
@@ -275,13 +266,10 @@
 }
 
 $query = "select id from ${db_table} order by users desc";
-#$result = mysql_query("$query") or die(mysql_error());
-#$num_project = mysql_num_rows($result);
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $count=1;
 
-# while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_u=$count;
@@ -382,7 +370,6 @@
 $gusers=0;
 $gimages=0;
 
-#while($row = mysql_fetch_assoc( $result )) {
 while ($row = $fnord->fetch()) {
 
 $gtotal=$gtotal+$row['total'];
diff --git a/var/www/wikistats/gpl.txt b/var/www/wikistats/gpl.txt
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/largest_csv.php 
b/var/www/wikistats/largest_csv.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/largest_wiki.php 
b/var/www/wikistats/largest_wiki.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/wikimedias_csv.php 
b/var/www/wikistats/wikimedias_csv.php
old mode 100755
new mode 100644

-- 
To view, visit https://gerrit.wikimedia.org/r/354260
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4da1538d4690003129ac808a54ad2da3e7de6e41
Gerrit-PatchSet: 2
Gerrit-Project: operations/debs/wikistats
Gerrit-Branch: master
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...wikistats[master]: remove commented mysql_ remnants from detail.php, fix permis...

2017-05-18 Thread Dzahn (Code Review)
Dzahn has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354260 )

Change subject: remove commented mysql_ remnants from detail.php, fix 
permissions
..

remove commented mysql_ remnants from detail.php, fix permissions

Change-Id: I4da1538d4690003129ac808a54ad2da3e7de6e41
---
M usr/share/php/wikistats/grandtotal_wiki.php
M usr/share/php/wikistats/largest_query.php
M var/www/wikistats/detail.php
M var/www/wikistats/gpl.txt
M var/www/wikistats/largest_csv.php
M var/www/wikistats/largest_wiki.php
M var/www/wikistats/wikimedias_csv.php
7 files changed, 0 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/wikistats 
refs/changes/60/354260/1

diff --git a/usr/share/php/wikistats/grandtotal_wiki.php 
b/usr/share/php/wikistats/grandtotal_wiki.php
old mode 100755
new mode 100644
diff --git a/usr/share/php/wikistats/largest_query.php 
b/usr/share/php/wikistats/largest_query.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/detail.php b/var/www/wikistats/detail.php
index c63d901..30e814f 100644
--- a/var/www/wikistats/detail.php
+++ b/var/www/wikistats/detail.php
@@ -228,11 +228,9 @@
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query($query)->fetchColumn();
 $count=1;
 
-#while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_g=$count;
@@ -241,14 +239,11 @@
 }
 
 $query = "select id from ${db_table} order by total desc,good desc";
-#$result = mysql_query("$query") or die(mysql_error());
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query($query)->fetchColumn();
 $count=1;
 
-#while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_t=$count;
@@ -257,15 +252,11 @@
 }
 
 $query = "select id from ${db_table} order by edits desc";
-#$result = mysql_query("$query") or die(mysql_error());
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 
-#$num_project = mysql_num_rows($result);
 $num_project=$wdb->query("select count(*) from ${db_table}")->fetchColumn();
 $count=1;
-
-#while($row = mysql_fetch_array( $result )) {
 
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
@@ -275,13 +266,10 @@
 }
 
 $query = "select id from ${db_table} order by users desc";
-#$result = mysql_query("$query") or die(mysql_error());
-#$num_project = mysql_num_rows($result);
 $fnord = $wdb->prepare($query);
 $fnord -> execute();
 $count=1;
 
-# while($row = mysql_fetch_array( $result )) {
 while ($row = $fnord->fetch()) {
 if ($row['id']=="$wikiid") {
 $rank_project_u=$count;
@@ -382,7 +370,6 @@
 $gusers=0;
 $gimages=0;
 
-#while($row = mysql_fetch_assoc( $result )) {
 while ($row = $fnord->fetch()) {
 
 $gtotal=$gtotal+$row['total'];
diff --git a/var/www/wikistats/gpl.txt b/var/www/wikistats/gpl.txt
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/largest_csv.php 
b/var/www/wikistats/largest_csv.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/largest_wiki.php 
b/var/www/wikistats/largest_wiki.php
old mode 100755
new mode 100644
diff --git a/var/www/wikistats/wikimedias_csv.php 
b/var/www/wikistats/wikimedias_csv.php
old mode 100755
new mode 100644

-- 
To view, visit https://gerrit.wikimedia.org/r/354260
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4da1538d4690003129ac808a54ad2da3e7de6e41
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/wikistats
Gerrit-Branch: master
Gerrit-Owner: Dzahn 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...wikistats[master]: remove all mysql_ functions, use PDO

2017-05-18 Thread Dzahn (Code Review)
Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353946 )

Change subject: remove all mysql_ functions, use PDO
..


remove all mysql_ functions, use PDO

The MySQL extension providing all the mysql_ functions
in PHP has been deprecated and is completely removed
in PHP7.

To migrate to stretch we have switch to mysqli or PDO,
and there are a lot of other advantages to it anyways.

Picking PDO because it supports client-side prepared statements
which make it much safer against SQL injection attacks.

Bug:T165684
Change-Id: Id748eea7b4ffcacc3e41627ba36a27006119df3a
---
M usr/lib/wikistats/maintenance.php
M usr/lib/wikistats/update.php
M usr/lib/wikistats/update_functions.php
M usr/share/php/wikistats/functions.php
M usr/share/php/wikistats/sortswitch.php
M var/www/wikistats/api.php
M var/www/wikistats/detail.php
M var/www/wikistats/display.php
M var/www/wikistats/displayw.php
M var/www/wikistats/index.php
M var/www/wikistats/largest_csv.php
M var/www/wikistats/largest_html.php
M var/www/wikistats/largest_wiki.php
M var/www/wikistats/rank.php
M var/www/wikistats/wikimedias_csv.php
M var/www/wikistats/wikimedias_html.php
M var/www/wikistats/wikimedias_wiki.php
M var/www/wikistats/wikipedias_wiki.php
18 files changed, 432 insertions(+), 269 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/usr/lib/wikistats/maintenance.php 
b/usr/lib/wikistats/maintenance.php
old mode 100755
new mode 100644
index 504d575..0a155d2
--- a/usr/lib/wikistats/maintenance.php
+++ b/usr/lib/wikistats/maintenance.php
@@ -4,25 +4,34 @@
 # connect to the mysql database
 function dbConnect(){
 include "/etc/wikistats/config.php";
-mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error());
-mysql_select_db("$dbname") or die(mysql_error());
+# db connect
+try {
+$wdb = new PDO("mysql:host=${dbhost};dbname=${dbname}", $dbuser, 
$dbpass);
+} catch (PDOException $e) {
+print "Error!: " . $e->getMessage() . "";
+die();
+}
 #print "wikistats updater \n connected to mysql at $dbhost as $dbuser on 
$dbname. \n";
 }
 
-# run a query,log it and print the number of affected rows
+# run a query and log it
 function dbResult($query){
-$result = mysql_query("$query") or die(mysql_error()); echo "\n\n";
+$fnord = $wdb->prepare($query);
+$fnord -> execute();
 $time = @date('[Y-m-d H:i:s]');
 $processUser = posix_getpwuid(posix_geteuid());
 error_log("${time} - user '".$processUser['name']."' ran query: '${query}' 
\n", 3, "/var/log/wikistats/wsa.log");
-printf("affected rows: %d\n", mysql_affected_rows());
+# printf("affected rows: %d\n", mysql_affected_rows());
+# replace with PDO?
 }
 
 # get the update method of a wiki
 function getMethod($id) {
 $query="SELECT method FROM mediawikis WHERE id='${id}';";
-$result = mysql_query("$query") or die(mysql_error());
-while($row = mysql_fetch_array( $result )) {
+
+$fnord = $wdb->prepare($query);
+$fnord -> execute();
+while ($row = $fnord->fetch()) {
 $method=$row['method'];
 }
 return $method;
@@ -47,7 +56,7 @@
 
 # add a wiki to a table
 function addWiki($hive, $url) {
-$table=mysql_escape_string($hive);
+$table=$hive;
 echo "adding '$url' to '$table'\n\n";
 dbresult("INSERT INTO ${table} (statsurl) values ('${url}');");
 }
@@ -60,8 +69,9 @@
 # get the latest wiki id
 function getLatestWiki($table) {
 $query="SELECT id FROM ${table} order by id desc limit 1;";
-$result = mysql_query("$query") or die(mysql_error());
-while($row = mysql_fetch_array( $result )) {
+$fnord = $wdb->prepare($query);
+$fnord -> execute();
+while ($row = $fnord->fetch()) {
 $wikiid=$row['id'];
 }
 return $wikiid;
@@ -82,5 +92,6 @@
 #deleteWiki('10528');
 
 #
-#mysql_close();
+# close db connection
+$wdb = null;
 ?>
diff --git a/usr/lib/wikistats/update.php b/usr/lib/wikistats/update.php
old mode 100644
new mode 100755
index f178f89..8406144
--- a/usr/lib/wikistats/update.php
+++ b/usr/lib/wikistats/update.php
@@ -42,6 +42,7 @@
 $table = $argv[1];
 $domain = substr($table, 0, strlen($table)-1);
 $convert=false;
+$autofixit=false;
 $updcount=0;
 $convcount=0;
 $impcount=0;
@@ -52,9 +53,12 @@
 ini_set('default_socket_timeout', $socket_timeout);
 
 # db connect
-mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error());
-#DEBUG# print "wikistats updater \n connected to mysql. \n";
-mysql_select_db("$dbname") or die(mysql_error());
+try {
+$wdb = new PDO("mysql:host=${dbhost};dbname=${dbname}", $dbuser, $dbpass);
+} catch (PDOException $e) {
+print "Error!: " . $e->getMessage() . "";
+die();
+}
 
 ## main
 switch ($argv[1]) {
@@ -264,7 +268,10 @@
 $query = "select * from ${table} order by ts asc";
 }
 
-$myresult = mysql_query("$query") or die(mysql_error());
+

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Add failure branch to CallbackTask

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352919 )

Change subject: Add failure branch to CallbackTask
..


Add failure branch to CallbackTask

Bug: T152403
Change-Id: I9f374938d821c73e79cd6e36442ab8da29237454
---
M app/src/main/java/org/wikipedia/concurrency/CallbackTask.java
M app/src/main/java/org/wikipedia/feed/featured/FeaturedArticleCardView.java
M app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListBookmarkMenu.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.java
M app/src/main/java/org/wikipedia/readinglist/ReadingListsFragment.java
8 files changed, 36 insertions(+), 23 deletions(-)

Approvals:
  Niedzielski: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/concurrency/CallbackTask.java 
b/app/src/main/java/org/wikipedia/concurrency/CallbackTask.java
index d53b1f2..8fced1e 100644
--- a/app/src/main/java/org/wikipedia/concurrency/CallbackTask.java
+++ b/app/src/main/java/org/wikipedia/concurrency/CallbackTask.java
@@ -3,13 +3,16 @@
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 
+import org.wikipedia.util.log.L;
+
 public class CallbackTask extends SaneAsyncTask {
 public interface Callback {
-void success(T row);
+void success(T result);
+void failure(Throwable caught);
 }
 
 public interface Task {
-T execute();
+T execute() throws Throwable;
 }
 
 @NonNull private final Task task;
@@ -39,4 +42,20 @@
 callback = null;
 }
 }
+
+@Override public void onCatch(Throwable caught) {
+super.onCatch(caught);
+if (callback != null) {
+callback.failure(caught);
+callback = null;
+}
+}
+
+public static class DefaultCallback implements Callback {
+@Override public void success(T result) {
+}
+@Override public void failure(Throwable caught) {
+L.e(caught);
+}
+}
 }
diff --git 
a/app/src/main/java/org/wikipedia/feed/featured/FeaturedArticleCardView.java 
b/app/src/main/java/org/wikipedia/feed/featured/FeaturedArticleCardView.java
index 5be172e..524b4f5 100644
--- a/app/src/main/java/org/wikipedia/feed/featured/FeaturedArticleCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/featured/FeaturedArticleCardView.java
@@ -107,9 +107,8 @@
 private void footer(@NonNull FeaturedArticleCard card) {
 PageTitle title = new PageTitle(card.articleTitle(), card.wikiSite());
 
ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(title),
-new CallbackTask.Callback() {
-@Override
-public void success(@Nullable ReadingListPage page) {
+new CallbackTask.DefaultCallback() {
+@Override public void success(@Nullable ReadingListPage 
page) {
 boolean listContainsTitle = page != null;
 
 int actionIcon = listContainsTitle
diff --git a/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java 
b/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
index 189bf24..f843607 100644
--- a/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
+++ b/app/src/main/java/org/wikipedia/feed/random/RandomCardView.java
@@ -63,7 +63,7 @@
 };
 
 private void getRandomReadingListPage(@NonNull final Throwable 
throwableIfEmpty) {
-ReadingListPageDao.instance().randomPage(new 
CallbackTask.Callback() {
+ReadingListPageDao.instance().randomPage(new 
CallbackTask.DefaultCallback() {
 @Override public void success(@Nullable PageTitle title) {
 if (getCallback() != null && getCard() != null) {
 if (title != null) {
diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 3b64005..ad0f505 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -688,7 +688,7 @@
 
 public void updateBookmark() {
 
ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(getTitle()),
-new CallbackTask.Callback() {
+new CallbackTask.DefaultCallback() {
 @Override public void success(@Nullable ReadingListPage 
page) {
 if (!isAdded()) {
 return;
diff --git 
a/app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.java 

[MediaWiki-commits] [Gerrit] translatewiki[master]: Add ignored message keys to CommonsAndroid

2017-05-18 Thread Amire80 (Code Review)
Amire80 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354259 )

Change subject: Add ignored message keys to CommonsAndroid
..

Add ignored message keys to CommonsAndroid

These messages appear to be technical and internal.

Change-Id: I67afbcfb3705184cf94bed8263b680a2befcc9f1
---
M groups/Wikimedia/CommonsAndroid.yaml
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/59/354259/1

diff --git a/groups/Wikimedia/CommonsAndroid.yaml 
b/groups/Wikimedia/CommonsAndroid.yaml
index 1434e45..86598d8 100644
--- a/groups/Wikimedia/CommonsAndroid.yaml
+++ b/groups/Wikimedia/CommonsAndroid.yaml
@@ -55,6 +55,9 @@
 - commons-android-strings-hello_world
   ignored:
 - commons-android-strings-beta_opt_in_link
+- commons-android-strings-map_theme_light
+- commons-android-strings-map_theme_dark
+- commons-android-strings-mapbox_commons_app_token
 
 ---
 BASIC:

-- 
To view, visit https://gerrit.wikimedia.org/r/354259
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67afbcfb3705184cf94bed8263b680a2befcc9f1
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Amire80 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Mention the invalid id in "wikibase-error-invalid-entity-id"

2017-05-18 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354258 )

Change subject: Mention the invalid id in "wikibase-error-invalid-entity-id"
..

Mention the invalid id in "wikibase-error-invalid-entity-id"

Bug: T163815
Change-Id: I2e0e374958e81c956fb18f92cee19b76cceb986b
---
M client/i18n/en.json
M client/i18n/qqq.json
M client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibrary.php
M client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php
4 files changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/58/354258/1

diff --git a/client/i18n/en.json b/client/i18n/en.json
index a98e542..0920a09 100644
--- a/client/i18n/en.json
+++ b/client/i18n/en.json
@@ -88,7 +88,7 @@
"wikibase-watchlist-show-changes-pref": "Show {{WBREPONAME}} edits in 
your watchlist",
"wikibase-error-deserialize-error": "Failed to deserialize data.",
"wikibase-error-serialize-error": "Failed to serialize data.",
-   "wikibase-error-invalid-entity-id": "The ID entered is unknown to the 
system. Please use a valid entity ID.",
+   "wikibase-error-invalid-entity-id": "The ID entered is unknown to the 
system: \"$2\". Please use a valid entity ID.",
"wikibase-error-exceeded-entity-access-limit": "Too many {{WBREPONAME}} 
entities accessed.",
"unconnectedpages": "Pages not connected to items",
"unconnectedpages-summary": "This page lists pages with no connected 
data item (in namespaces that support connected items). The list is sorted by 
descending page ID, so that newer pages are listed first.",
diff --git a/client/i18n/qqq.json b/client/i18n/qqq.json
index ad291ef..c5f1c07 100644
--- a/client/i18n/qqq.json
+++ b/client/i18n/qqq.json
@@ -99,7 +99,7 @@
"wikibase-watchlist-show-changes-pref": "Option in the watchlist 
section of preferences to always show wikibase edits by default in the 
watchlist. Appears as a checkbox in the same list with options such as:\n* 
{{msg-mw|tog-watchdefault}}\n* {{msg-mw|tog-watchmoves}}\nAnd so on.",
"wikibase-error-deserialize-error": "Generic error when invalid 
(undeserializable) data has been given.",
"wikibase-error-serialize-error": "Generic error for when entity data 
failed to serialize or cannot be handled.",
-   "wikibase-error-invalid-entity-id": "Generic error message when an 
invalid entity ID was entered.",
+   "wikibase-error-invalid-entity-id": "Generic error message when an 
invalid entity ID was entered. Parameters:\n* $1 unused\n* $2 - the entered but 
invalid ID",
"wikibase-error-exceeded-entity-access-limit": "Error message shown in 
rendered page output when too many entities are accessed on the page. The limit 
on the number of full entities that can be loaded on any given page, via 
Scribunto and/or the property parser function, is controlled by the 
entityAccessLimit configuration setting.",
"unconnectedpages": "{{doc-special|UnconnectedPages}}",
"unconnectedpages-summary": "Introductory text used on 
Special:UnconnectedPages.",
diff --git 
a/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibrary.php 
b/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibrary.php
index 92f2423..801621b 100644
--- 
a/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibrary.php
+++ 
b/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibrary.php
@@ -186,7 +186,10 @@
)
];
} catch ( InvalidArgumentException $e ) {
-   throw new ScribuntoException( 
'wikibase-error-invalid-entity-id' );
+   throw new ScribuntoException(
+   'wikibase-error-invalid-entity-id',
+   [ 'args' => [ $entityId ] ]
+   );
} catch ( PropertyLabelNotResolvedException $e ) {
return [ null ];
}
@@ -219,7 +222,10 @@
)
];
} catch ( InvalidArgumentException $e ) {
-   throw new ScribuntoException( 
'wikibase-error-invalid-entity-id' );
+   throw new ScribuntoException(
+   'wikibase-error-invalid-entity-id',
+   [ 'args' => [ $entityId ] ]
+   );
} catch ( PropertyLabelNotResolvedException $e ) {
return [ null ];
}
diff --git 
a/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php 
b/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php
index 6ca2810..3e69e4a 100644
--- a/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php
+++ 

[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[wmf/1.30.0-wmf.1]: Revert "Dump should return decrypted votes"

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354194 )

Change subject: Revert "Dump should return decrypted votes"
..


Revert "Dump should return decrypted votes"

For large elections the decryption takes too long (same reason tally page 
doesn't work) and prohibits use of the dump page because of timeout. 

This reverts commit d2eac8c31231136e8df57a30f88ff75d7231f102.

Change-Id: Ic0c145ac87074fe7c38331d6a5add690546e20b6
---
M includes/pages/DumpPage.php
1 file changed, 1 insertion(+), 16 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dereckson: Looks good to me, approved



diff --git a/includes/pages/DumpPage.php b/includes/pages/DumpPage.php
index 5b0261c..71cb1ef 100644
--- a/includes/pages/DumpPage.php
+++ b/includes/pages/DumpPage.php
@@ -58,22 +58,7 @@
if ( !$this->headersSent ) {
$this->sendHeaders();
}
-   $record = $row->vote_record;
-   if ( $this->election->getCrypt() ) {
-   $status = $this->election->getCrypt()->decrypt( $record 
);
-   if ( !$status->isOK() ) {
-   // Decrypt failed, e.g. invalid or absent 
private key
-   // Still, return the encrypted vote
-   echo "\n" . $record . 
"\n\n";
-   } else {
-   $decrypted_record = $status->value;
-   echo "\n" . $record .
-   "\n" . 
$decrypted_record .
-   "\n\n";
-   }
-   } else {
-   echo "\n" . $record . 
"\n\n";
-   }
+   echo "" . $row->vote_record . "\n";
}
 
public function sendHeaders() {

-- 
To view, visit https://gerrit.wikimedia.org/r/354194
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0c145ac87074fe7c38331d6a5add690546e20b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: wmf/1.30.0-wmf.1
Gerrit-Owner: Jalexander 
Gerrit-Reviewer: Dereckson 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update VE core submodule to master (de3447ce5)

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354147 )

Change subject: Update VE core submodule to master (de3447ce5)
..


Update VE core submodule to master (de3447ce5)

New changes:
de3447ce5 Update OOjs UI to v0.21.4

Change-Id: Ibb13bce32090a8aab01bc5d82d87dfa2a98ac16e
---
M lib/ve
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/ve b/lib/ve
index 45aa796..de3447c 16
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit 45aa796b366cab8e54ab183b22529f37381634f6
+Subproject commit de3447ce5688d434b9f7fc31de859e85afd078b5

-- 
To view, visit https://gerrit.wikimedia.org/r/354147
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb13bce32090a8aab01bc5d82d87dfa2a98ac16e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...InputBox[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354257 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I80f669257f2daa12d7b0a9de88b146e5027a2343
---
M InputBox.classes.php
M InputBox.hooks.php
M composer.json
A phpcs.xml
4 files changed, 104 insertions(+), 92 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/InputBox 
refs/changes/57/354257/1

diff --git a/InputBox.classes.php b/InputBox.classes.php
index b03ccd4..b664d4e 100644
--- a/InputBox.classes.php
+++ b/InputBox.classes.php
@@ -15,7 +15,7 @@
private $mType = '';
private $mWidth = 50;
private $mPreload = '';
-   private $mPreloadparams = array();
+   private $mPreloadparams = [];
private $mEditIntro = '';
private $mUseVE = '';
private $mSummary = '';
@@ -46,11 +46,11 @@
// Split caches by language, to make sure visitors do not see a 
cached
// version in a random language (since labels are in the user 
language)
$this->mParser->getOptions()->getUserLangObj();
-   $this->mParser->getOutput()->addModuleStyles( array(
+   $this->mParser->getOutput()->addModuleStyles( [
'ext.inputBox.styles',
'mediawiki.ui.input',
'mediawiki.ui.checkbox',
-   ) );
+   ] );
}
 
public function render() {
@@ -65,20 +65,18 @@
case 'commenttitle':
return $this->getCommentForm();
case 'search':
-   return $this->getSearchForm('search');
+   return $this->getSearchForm( 'search' );
case 'fulltext':
-   return $this->getSearchForm('fulltext');
+   return $this->getSearchForm( 'fulltext' );
case 'search2':
return $this->getSearchForm2();
default:
return Xml::tags( 'div', null,
Xml::element( 'strong',
-   array(
-   'class' => 'error'
-   ),
+   [ 'class' => 'error' ],
strlen( $this->mType ) > 0
-   ? wfMessage( 
'inputbox-error-bad-type', $this->mType )->text()
-   : wfMessage( 
'inputbox-error-no-type' )->text()
+   ? wfMessage( 
'inputbox-error-bad-type', $this->mType )->text()
+   : wfMessage( 
'inputbox-error-no-type' )->text()
)
);
}
@@ -93,16 +91,16 @@
 */
private function getEditActionArgs() {
// default is wikitext editor
-   $args = array(
+   $args = [
'name' => 'action',
'value' => 'edit',
-   );
+   ];
// check, if VE is installed and VE editor is requested
if ( ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' 
) && $this->mUseVE ) {
-   $args = array(
+   $args = [
'name' => 'veaction',
'value' => 'edit',
-   );
+   ];
}
return $args;
}
@@ -133,9 +131,9 @@
$this->mSearchButtonLabel = wfMessage( 
'inputbox-searchfulltext' )->text();
}
if ( $this->mID !== '' ) {
-   $idArray = array( 'id' => Sanitizer::escapeId( 
$this->mID ) );
+   $idArray = [ 'id' => Sanitizer::escapeId( $this->mID ) 
];
} else {
-   $idArray = array();
+   $idArray = [];
}
// We need a unqiue id to link  to checkboxes, but also
// want multiple 's to not be invalid html
@@ -143,20 +141,20 @@
 
// Build HTML
$htmlOut = Xml::openElement( 'div',
-   array(
+   [
'class' => 'mw-inputbox-centered',
'style' => $this->bgColorStyle(),
-   )
+   ]
);
$htmlOut .= Xml::openElement( 'form',
-   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make sure unique keys carry over to postgres table duplicates

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354083 )

Change subject: Make sure unique keys carry over to postgres table duplicates
..


Make sure unique keys carry over to postgres table duplicates

This fixes BotPasswordTest failures.

Change-Id: I81003187af0c57020f9fc4cbcd2606e71907a903
---
M includes/libs/rdbms/database/DatabasePostgres.php
M tests/phpunit/includes/user/BotPasswordTest.php
2 files changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Brion VIBBER: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/rdbms/database/DatabasePostgres.php 
b/includes/libs/rdbms/database/DatabasePostgres.php
index 6cf890d..f84ffa9 100644
--- a/includes/libs/rdbms/database/DatabasePostgres.php
+++ b/includes/libs/rdbms/database/DatabasePostgres.php
@@ -828,7 +828,7 @@
$oldName = $this->addIdentifierQuotes( $oldName );
 
return $this->query( 'CREATE ' . ( $temporary ? 'TEMPORARY ' : 
'' ) . " TABLE $newName " .
-   "(LIKE $oldName INCLUDING DEFAULTS)", $fname );
+   "(LIKE $oldName INCLUDING DEFAULTS INCLUDING INDEXES)", 
$fname );
}
 
public function listTables( $prefix = null, $fname = __METHOD__ ) {
diff --git a/tests/phpunit/includes/user/BotPasswordTest.php 
b/tests/phpunit/includes/user/BotPasswordTest.php
index 58f1e5f..09cf350 100644
--- a/tests/phpunit/includes/user/BotPasswordTest.php
+++ b/tests/phpunit/includes/user/BotPasswordTest.php
@@ -382,6 +382,8 @@
}
 
$token = $bp->getToken();
+   $this->assertEquals( 42, $bp->getUserCentralId() );
+   $this->assertEquals( 'TestSave', $bp->getAppId() );
$this->assertFalse( $bp->save( 'insert' ) );
$this->assertTrue( $bp->save( 'update' ) );
$this->assertNotEquals( $token, $bp->getToken() );

-- 
To view, visit https://gerrit.wikimedia.org/r/354083
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I81003187af0c57020f9fc4cbcd2606e71907a903
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Elastica[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354254 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I8959022e4b439d79ff153c39b82b58c51a964114
---
M ElasticaConnection.php
M composer.json
A phpcs.xml
M tests/phpunit/UtilTest.php
4 files changed, 53 insertions(+), 37 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/ElasticaConnection.php b/ElasticaConnection.php
index 6ef082d..6441808 100644
--- a/ElasticaConnection.php
+++ b/ElasticaConnection.php
@@ -27,7 +27,7 @@
/**
 * @return array(string) server ips or hostnames
 */
-   public abstract function getServerList();
+   abstract public function getServerList();
 
/**
 * How many times can we attempt to connect per host?
@@ -210,7 +210,6 @@
}
 }
 
-
 /**
  * Utility class
  */
@@ -226,22 +225,24 @@
 * @param int $retryAttempts the number of times we retry
 * @param callable $retryErrorCallback function called before each 
retries
 */
-   public static function iterateOverScroll( \Elastica\Index $index, 
$scrollId, $scrollTime, $consumer, $limit = 0, $retryAttempts = 0, 
$retryErrorCallback = null ) {
+   public static function iterateOverScroll( \Elastica\Index $index, 
$scrollId, $scrollTime,
+   $consumer, $limit = 0, $retryAttempts = 0, $retryErrorCallback 
= null
+   ) {
$clearScroll = true;
$fetched = 0;
 
-   while( true ) {
+   while ( true ) {
$result = static::withRetry( $retryAttempts,
function() use ( $index, $scrollId, $scrollTime 
) {
-   return $index->search ( array(), array(
+   return $index->search( [], [
'scroll_id' => $scrollId,
'scroll' => $scrollTime
-   ) );
+   ] );
}, $retryErrorCallback );
 
$scrollId = $result->getResponse()->getScrollId();
 
-   if( !$result->count() ) {
+   if ( !$result->count() ) {
// No need to clear scroll on the last call
$clearScroll = false;
break;
@@ -250,21 +251,22 @@
$fetched += $result->count();
$results =  $result->getResults();
 
-   if( $limit > 0 && $fetched > $limit ) {
-   $results = array_slice( $results, 0, sizeof( 
$results ) - ( $fetched - $limit ) );
+   if ( $limit > 0 && $fetched > $limit ) {
+   $results = array_slice( $results, 0, count( 
$results ) - ( $fetched - $limit ) );
}
$consumer( $results );
 
-   if( $limit > 0 && $fetched >= $limit ) {
+   if ( $limit > 0 && $fetched >= $limit ) {
break;
}
}
// @todo: catch errors and clear the scroll, it'd be easy with 
a finally block ...
 
-   if( $clearScroll ) {
+   if ( $clearScroll ) {
try {
$index->getClient()->request( 
"_search/scroll/".$scrollId, \Elastica\Request::DELETE );
-   } catch ( Exception $e ) {}
+   } catch ( Exception $e ) {
+   }
}
}
 
@@ -289,7 +291,7 @@
return $func();
} catch ( Exception $e ) {
$errors += 1;
-   if( $beforeRetry ) {
+   if ( $beforeRetry ) {
$beforeRetry( $e, $errors );
} else {
$seconds = 
static::backoffDelay( $errors );
diff --git a/composer.json b/composer.json
index 3216fe9..c83e077 100644
--- a/composer.json
+++ b/composer.json
@@ -43,11 +43,14 @@
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude 

[MediaWiki-commits] [Gerrit] mediawiki/vagrant[master]: Add role for 'CodeMirror' extension

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352650 )

Change subject: Add role for 'CodeMirror' extension
..


Add role for 'CodeMirror' extension

Change-Id: Id2141297d7226a345132419d743d63132c31b164
---
A puppet/modules/role/manifests/codemirror.pp
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/modules/role/manifests/codemirror.pp 
b/puppet/modules/role/manifests/codemirror.pp
new file mode 100644
index 000..1db411f
--- /dev/null
+++ b/puppet/modules/role/manifests/codemirror.pp
@@ -0,0 +1,9 @@
+# == Class: role::codemirror
+# The CodeMirror extension extension provides syntax highlighting in 
WikiEditor and VisualEditor's
+# wikitext mode.
+class role::codemirror {
+include ::role::wikieditor
+include ::role::visualeditor
+
+mediawiki::extension { 'CodeMirror': }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/352650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id2141297d7226a345132419d743d63132c31b164
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: Kaldari 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...DismissableSiteNotice[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354253 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I0bac641435949110fa9b933e61cfa7d44040ad53
---
M DismissableSiteNotice.hooks.php
M DismissableSiteNotice.php
M composer.json
A phpcs.xml
4 files changed, 20 insertions(+), 7 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/DismissableSiteNotice.hooks.php b/DismissableSiteNotice.hooks.php
index 38475e5..ea7a2ac 100644
--- a/DismissableSiteNotice.hooks.php
+++ b/DismissableSiteNotice.hooks.php
@@ -25,15 +25,15 @@
$out->addModules( 'ext.dismissableSiteNotice' );
$out->addJsConfigVars( 'wgSiteNoticeId', 
"$major.$minor" );
 
-   $notice = Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice' ),
-   Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice-close' ),
+   $notice = Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice' ],
+   Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice-close' ],
$skin->msg( 'sitenotice_close-brackets' 
)
->rawParams(
-   Html::element( 'a', 
array( 'href' => '#' ), $skin->msg( 'sitenotice_close' )->text() )
+   Html::element( 'a', [ 
'href' => '#' ], $skin->msg( 'sitenotice_close' )->text() )
)
->escaped()
) .
-   Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice-body' ), $notice )
+   Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice-body' ], $notice )
);
}
 
diff --git a/DismissableSiteNotice.php b/DismissableSiteNotice.php
index bd66784..0c14305 100644
--- a/DismissableSiteNotice.php
+++ b/DismissableSiteNotice.php
@@ -19,7 +19,8 @@
// Keep i18n globals so mergeMessageFileList.php doesn't break
$wgMessagesDirs['DismissableSiteNotice'] = __DIR__ . '/i18n';
/* wfWarn(
-   'Deprecated PHP entry point used for DismissableSiteNotice 
extension. Please use wfLoadExtension instead, ' .
+   'Deprecated PHP entry point used for DismissableSiteNotice 
extension. ' .
+   'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
); */
return;
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354253
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0bac641435949110fa9b933e61cfa7d44040ad53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DismissableSiteNotice
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...XAnalytics[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354252 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Ib4dbe698323ad9c419d1c979fe838665ae454b98
---
M XAnalytics.class.php
M composer.json
A phpcs.xml
3 files changed, 17 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/XAnalytics.class.php b/XAnalytics.class.php
index 4c65b9e..6bc939e 100644
--- a/XAnalytics.class.php
+++ b/XAnalytics.class.php
@@ -38,8 +38,8 @@
}
self::$addedHeader = true;
$response = $out->getRequest()->response();
-   $headerItems = array();
-   Hooks::run( 'XAnalyticsSetHeader', array( $out, &$headerItems ) 
);
+   $headerItems = [];
+   Hooks::run( 'XAnalyticsSetHeader', [ $out, &$headerItems ] );
if ( count( $headerItems ) ) {
self::createHeader( $response, $headerItems );
}
@@ -74,7 +74,7 @@
if ( self::$addedHeader ) {
// If the header is already set, we need to append to 
it and replace it
global $wgRequest;
-   self::createHeader( $wgRequest->response(), array( 
$name => $value ) );
+   self::createHeader( $wgRequest->response(), [ $name => 
$value ] );
}
}
 }
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354252
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4dbe698323ad9c419d1c979fe838665ae454b98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/XAnalytics
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Poem[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354242 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I2b7c995e60d55e023b87c554274651654fb5d0b7
---
M Poem.class.php
M composer.json
A phpcs.xml
3 files changed, 22 insertions(+), 10 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/Poem.class.php b/Poem.class.php
index 586750c..f554fe5 100644
--- a/Poem.class.php
+++ b/Poem.class.php
@@ -10,7 +10,7 @@
 * @return bool true
 */
public static function init( &$parser ) {
-   $parser->setHook( 'poem', array( 'Poem', 'renderPoem' ) );
+   $parser->setHook( 'poem', [ 'Poem', 'renderPoem' ] );
return true;
}
 
@@ -22,7 +22,7 @@
 * @param boolean $frame
 * @return string
 */
-   public static function renderPoem( $in, $param = array(), $parser = 
null, $frame = false ) {
+   public static function renderPoem( $in, $param = [], $parser = null, 
$frame = false ) {
// using newlines in the text will cause the parser to add  
tags,
// which may not be desired in some cases
$newline = isset( $param['compact'] ) ? '' : "\n";
@@ -30,17 +30,17 @@
$tag = $parser->insertStripItem( "", $parser->mStripState 
);
 
// replace colons with indented spans
-   $text = preg_replace_callback( '/^(:+)(.+)$/m', array( 'Poem', 
'indentVerse' ), $in );
+   $text = preg_replace_callback( '/^(:+)(.+)$/m', [ 'Poem', 
'indentVerse' ], $in );
 
// replace newlines with  tags unless they are at the 
beginning or end
// of the poem
$text = preg_replace(
-   array( "/^\n/", "/\n$/D", "/\n/" ),
-   array( "", "", "$tag\n" ),
+   [ "/^\n/", "/\n$/D", "/\n/" ],
+   [ "", "", "$tag\n" ],
$text );
 
// replace spaces at the beginning of a line with non-breaking 
spaces
-   $text = preg_replace_callback( '/^( +)/m', array( 'Poem', 
'replaceSpaces' ), $text );
+   $text = preg_replace_callback( '/^( +)/m', [ 'Poem', 
'replaceSpaces' ], $text );
 
$text = $parser->recursiveTagParse( $text, $frame );
 
@@ -74,10 +74,10 @@
 * @return string
 */
protected static function indentVerse( $m ) {
-   $attribs = array(
+   $attribs = [
'class' => 'mw-poem-indented',
'style' => 'display: inline-block; margin-left: ' . 
strlen( $m[1] ) . 'em;'
-   );
+   ];
// @todo Should this really be raw?
return Html::rawElement( 'span', $attribs, $m[2] );
}
diff --git a/composer.json b/composer.json
index a3aecbe..e4e502f 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude node_modules --exclude 
vendor"
+   "parallel-lint . --exclude node_modules --exclude 
vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354242
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b7c995e60d55e023b87c554274651654fb5d0b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Poem
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...RelatedSites[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354243 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Id2d7f9479f842758697292b7839adae482d31e4c
---
M RelatedSites.class.php
M composer.json
A phpcs.xml
3 files changed, 21 insertions(+), 10 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/RelatedSites.class.php b/RelatedSites.class.php
index a113977..e7d6577 100644
--- a/RelatedSites.class.php
+++ b/RelatedSites.class.php
@@ -67,13 +67,12 @@
return true;
}
 
-
/**
 * @param array $relatedSites
 * @return array
 */
protected static function getRelatedSitesUrls( array $relatedSites ) {
-   $relatedSitesUrls = array();
+   $relatedSitesUrls = [];
 
foreach ( $relatedSites as $site ) {
$tmp = explode( ':', $site, 2 );
@@ -109,12 +108,12 @@
}
}
 
-   $relatedSitesUrls[] = array(
+   $relatedSitesUrls[] = [
'href' => $title->getFullURL(),
'text' => $linkText,
'title' => $linkTitle,
'class' => 'interwiki-' . $tmp[0]
-   );
+   ];
}
}
 
@@ -138,11 +137,11 @@
}
 
// build relatedsites 's
-   $relatedSites = array();
+   $relatedSites = [];
foreach ( (array) $relatedSitesUrls as $url ) {
$relatedSites[] =
-   Html::rawElement( 'li', array( 'class' => 
htmlspecialchars( $url['class'] ) ),
-   Html::rawElement( 'a', array( 'href' => 
htmlspecialchars( $url['href'] ) ),
+   Html::rawElement( 'li', [ 'class' => 
htmlspecialchars( $url['class'] ) ],
+   Html::rawElement( 'a', [ 'href' => 
htmlspecialchars( $url['href'] ) ],
$url['text']
)
);
@@ -150,7 +149,7 @@
 
// build complete html
$bar[$skin->msg( 'relatedsites-title' )->text()] =
-   Html::rawElement( 'ul', array(),
+   Html::rawElement( 'ul', [],
implode( '', $relatedSites )
);
 
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354243
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id2d7f9479f842758697292b7839adae482d31e4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RelatedSites
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...TocTree[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354245 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I993df5016c122cc82f7f968b18418171a19c9c8b
---
M TocTree.i18n.php
M composer.json
A phpcs.xml
3 files changed, 15 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/TocTree.i18n.php b/TocTree.i18n.php
index d5d53cd..77722fb 100644
--- a/TocTree.i18n.php
+++ b/TocTree.i18n.php
@@ -15,7 +15,7 @@
function wfJsonI18nShimbe1c9ea43bd38a62( $cache, $code, &$cachedData ) {
$codeSequence = array_merge( [ $code ], 
$cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
-   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
+   $fileName = __DIR__ . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
$data = FormatJson::decode( file_get_contents( 
$fileName ), true );
foreach ( array_keys( $data ) as $key ) {
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354245
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I993df5016c122cc82f7f968b18418171a19c9c8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TocTree
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Dashiki[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354139 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I73eeb7a6549de71bc229df2ad35dc9cbbe2c12bb
---
M composer.json
M includes/DashikiView.php
A phpcs.xml
3 files changed, 16 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/includes/DashikiView.php b/includes/DashikiView.php
index 51c5e3f..48a4fd3 100644
--- a/includes/DashikiView.php
+++ b/includes/DashikiView.php
@@ -41,7 +41,8 @@
public function renderHeader( $dbkey ) {
$buildMessage = wfMessage( 'dashiki-build' );
$span = Html::element( 'span', null, $buildMessage );
-   $pre = Html::element( 'pre', null, 'gulp --config ' . 
wfEscapeShellArg( $dbkey ) . ' --layout /*...*/' );
+   $pre = Html::element( 'pre', null,
+   'gulp --config ' . wfEscapeShellArg( $dbkey ) . ' 
--layout /*...*/' );
return $span . $pre;
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354139
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I73eeb7a6549de71bc229df2ad35dc9cbbe2c12bb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Dashiki
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...AntiSpoof[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354042 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I7c6f27bfc4b7ca746ac3a452030203b3f6549c95
---
M AntiSpoof.php
M AntiSpoofHooks.php
M AntiSpoof_body.php
M SpoofUser.php
M api/ApiAntiSpoof.php
M composer.json
M maintenance/BatchAntiSpoofClass.php
M maintenance/batchAntiSpoof.php
M maintenance/generateEquivset.php
A phpcs.xml
M tests/phpunit/AntiSpoofTest.php
M tests/phpunit/SpoofUserTest.php
12 files changed, 294 insertions(+), 263 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/AntiSpoof.php b/AntiSpoof.php
index 2e4ae93..151756e 100644
--- a/AntiSpoof.php
+++ b/AntiSpoof.php
@@ -29,17 +29,18 @@
 
 /**
  * Blacklisted character codes.
+ * defaults:
+ * 0x0337 - Combining short solidus overlay
+ * 0x0338 - Combining long solidus overlay
+ * 0x2044 - Fraction slash
+ * 0x2215 - Division slash
+ * 0x23AE - Integral extension
+ * 0x29F6 - Solidus with overbar
+ * 0x29F8 - Big solidus
+ * 0x2AFB - Triple solidus binary relation
+ * 0x2AFD - Double solidus operator
+ * 0xFF0F - Fullwidth solidus
+ *
  * @var int[]
  */
 $wgAntiSpoofBlacklist = null;
-//  defaults:
-// 0x0337, # Combining short solidus overlay
-// 0x0338, # Combining long solidus overlay
-// 0x2044, # Fraction slash
-// 0x2215, # Division slash
-// 0x23AE, # Integral extension
-// 0x29F6, # Solidus with overbar
-// 0x29F8, # Big solidus
-// 0x2AFB, # Triple solidus binary relation
-// 0x2AFD, # Double solidus operator
-// 0xFF0F  # Fullwidth solidus
diff --git a/AntiSpoofHooks.php b/AntiSpoofHooks.php
index 4ae3c85..b38f91c 100644
--- a/AntiSpoofHooks.php
+++ b/AntiSpoofHooks.php
@@ -62,7 +62,8 @@
if ( empty( $conflicts ) ) {
wfDebugLog( 'antispoof', "{$mode}PASS new 
account '$name' [$normalized]" );
} else {
-   wfDebugLog( 'antispoof', "{$mode}CONFLICT new 
account '$name' [$normalized] spoofs " . implode( ',', $conflicts ) );
+   wfDebugLog( 'antispoof', "{$mode}CONFLICT new 
account '$name' [$normalized] spoofs "
+   . implode( ',', $conflicts ) );
if ( $active ) {
$numConflicts = count( $conflicts );
$message = wfMessage( 
'antispoof-conflict-top', $name )
@@ -158,10 +159,10 @@
 */
public static function onAPIGetAllowedParams( &$module, &$params ) {
if ( $module instanceof ApiCreateAccount ) {
-   $params['ignoreantispoof'] = array(
+   $params['ignoreantispoof'] = [
ApiBase::PARAM_TYPE => 'boolean',
ApiBase::PARAM_DFLT => false
-   );
+   ];
}
 
return true;
diff --git a/AntiSpoof_body.php b/AntiSpoof_body.php
index 6ac03c9..c5a7a5f 100644
--- a/AntiSpoof_body.php
+++ b/AntiSpoof_body.php
@@ -1,135 +1,142 @@
 PHP conversion by Brion Vibber 
-
-# 2006-06-30 Handles non-CJK scripts as per UTR #39 + my extensions
-# 2006-07-01 Now handles Simplified <-> Traditional Chinese rules, as
-#  per JET Guidelines for Internationalized Domain Names,
-#  and the ICANN language registry values for .cn
-# 2006-09-14 Now handles 'rn' etc better, and uses stdin for input
-# 2006-09-18 Added exception handling for nasty cases, eg BiDi violations
-# 2006-09-19 Converted to PHP for easier integration into a MW extension
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
-# USA
+/**
+ * AntiSpoof.php
+ * Username spoofing prevention for MediaWiki
+ * Version 0.04
+ *
+ * Copyright (C) Neil Harris 2006
+ * Python->PHP conversion by Brion Vibber 
+ *
+ * 2006-06-30 Handles non-CJK scripts as per UTR #39 + my extensions
+ * 2006-07-01 Now handles Simplified <-> Traditional Chinese rules, as
+ *per JET 

[MediaWiki-commits] [Gerrit] mediawiki...NewUserMessage[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354236 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Iafd01ef4008a7f763b2a0a6132fbe9148f5be823
---
M NewUserMessage.class.php
M composer.json
A phpcs.xml
3 files changed, 25 insertions(+), 9 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/NewUserMessage.class.php b/NewUserMessage.class.php
index 48b4f62..512023e 100644
--- a/NewUserMessage.class.php
+++ b/NewUserMessage.class.php
@@ -24,7 +24,7 @@
$editor = User::newFromName( self::getMsg( 
'newusermessage-editor' )->text() );
 
if ( !$editor ) {
-   return false; # Invalid user name
+   return false; // Invalid user name
}
 
if ( !$editor->isLoggedIn() ) {
@@ -44,7 +44,7 @@
 
if ( !self::getMsg( 'newusermessage-signatures' )->isDisabled() 
) {
$pattern = '/^\* ?(.*?)$/m';
-   $signatureList = array();
+   $signatureList = [];
preg_match_all( $pattern, $signatures, $signatureList, 
PREG_SET_ORDER );
if ( count( $signatureList ) > 0 ) {
$rand = rand( 0, count( $signatureList ) - 1 );
@@ -110,8 +110,12 @@
global $wgNewUserMinorEdit, $wgNewUserSuppressRC;
 
$flags = EDIT_NEW;
-   if ( $wgNewUserMinorEdit ) $flags = $flags | EDIT_MINOR;
-   if ( $wgNewUserSuppressRC ) $flags = $flags | EDIT_SUPPRESS_RC;
+   if ( $wgNewUserMinorEdit ) {
+   $flags = $flags | EDIT_MINOR;
+   }
+   if ( $wgNewUserSuppressRC ) {
+   $flags = $flags | EDIT_SUPPRESS_RC;
+   }
 
return $flags;
}
@@ -125,7 +129,7 @@
 * @param $preparse bool If provided, then preparse the string using a 
Parser
 * @return string
 */
-   static private function substString( $str, $user, $editor, $talk, 
$preparse = null ) {
+   private static function substString( $str, $user, $editor, $talk, 
$preparse = null ) {
$realName = $user->getRealName();
$name = $user->getName();
 
@@ -258,7 +262,7 @@
 * @param $signature string the signature, if provided.
 * @return string in wiki text with complete user message
 */
-   static protected function formatUserMessage( $subject, $text, 
$signature ) {
+   protected static function formatUserMessage( $subject, $text, 
$signature ) {
$contents = "";
$signature = empty( $signature ) ? "" : "{$signature} 
~";
 
@@ -274,7 +278,7 @@
 * @param $name
 * @return Message
 */
-   static protected function getMsg( $name ) {
+   protected static function getMsg( $name ) {
return wfMessage( $name )->inContentLanguage();
}
 }
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iafd01ef4008a7f763b2a0a6132fbe9148f5be823
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NewUserMessage
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...NavigationTiming[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354234 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Id04068cb1eb56eef5ca5ba06b79295151c5b2dd6
---
M NavigationTiming.php
M composer.json
A phpcs.xml
3 files changed, 15 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/NavigationTiming.php b/NavigationTiming.php
index a0704e9..194fd72 100644
--- a/NavigationTiming.php
+++ b/NavigationTiming.php
@@ -25,4 +25,4 @@
return;
 } else {
die( 'This version of the NavigationTiming extension requires MediaWiki 
1.25+' );
-}
\ No newline at end of file
+}
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354234
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id04068cb1eb56eef5ca5ba06b79295151c5b2dd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MobileApp[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354233 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I668566534cbf54da053cc30353a57326974724e8
---
M MobileAppResourceLoaderModule.php
M composer.json
A phpcs.xml
3 files changed, 17 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/MobileAppResourceLoaderModule.php 
b/MobileAppResourceLoaderModule.php
index 5c0346f..bc68a8d 100644
--- a/MobileAppResourceLoaderModule.php
+++ b/MobileAppResourceLoaderModule.php
@@ -8,9 +8,8 @@
 * @return array
 */
protected function getPages( ResourceLoaderContext $context ) {
-   return array(
-   'MediaWiki:Mobile.css'  => array( 'type' => 'style' 
),
-   );
+   return [
+   'MediaWiki:Mobile.css' => [ 'type' => 'style' ],
+   ];
}
 }
-
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354233
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I668566534cbf54da053cc30353a57326974724e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileApp
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FundraisingTranslateWorkflow[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354256 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: Iba9016143979c488595e8c5bd9ba315e162234ae
---
M FundraisingMessageGroup.php
M FundraisingTranslateWorkflow.php
M composer.json
A phpcs.xml
4 files changed, 100 insertions(+), 27 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FundraisingTranslateWorkflow
 refs/changes/56/354256/1

diff --git a/FundraisingMessageGroup.php b/FundraisingMessageGroup.php
index 859646a..919139f 100644
--- a/FundraisingMessageGroup.php
+++ b/FundraisingMessageGroup.php
@@ -63,30 +63,90 @@
 * Delegate everything else to the pseudo-parent object
 */
public function __call( $method, $args ) {
-   return call_user_func_array( array( $this->group, $method ), 
$args );
+   return call_user_func_array( [ $this->group, $method ], $args );
}
 
-function getConfiguration() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getId() { return $this->__call( __FUNCTION__, func_get_args() ); }
-function getLabel( IContextSource $context = null ) { return 
$this->__call( __FUNCTION__, func_get_args() ); }
-function getDescription( IContextSource $context = null ) { return 
$this->__call( __FUNCTION__, func_get_args() ); }
-function getIcon() { return $this->__call( __FUNCTION__, func_get_args() 
); }
-function getNamespace() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function isMeta() { return $this->__call( __FUNCTION__, func_get_args() ); 
}
-function exists() { return $this->__call( __FUNCTION__, func_get_args() ); 
}
-function getFFS() { return $this->__call( __FUNCTION__, func_get_args() ); 
}
-function getChecker() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getMangler() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function initCollection( $code ) { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function load( $code ) { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getDefinitions() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getTags( $type = null ) { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getMessage( $key, $code ) { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getSourceLanguage() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getTranslatableLanguages() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-function getTranslationAids() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
+   function getConfiguration() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
 
-   // WikiPageMessageGroup functions
-   function getTitle() { return $this->__call( __FUNCTION__, 
func_get_args() ); }
-   function getInsertablesSuggester() { return $this->__call( 
__FUNCTION__, func_get_args() ); }
+   function getId() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getLabel( IContextSource $context = null ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getDescription( IContextSource $context = null ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getIcon() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getNamespace() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function isMeta() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function exists() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getFFS() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getChecker() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getMangler() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function initCollection( $code ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function load( $code ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getDefinitions() {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getTags( $type = null ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+   function getMessage( $key, $code ) {
+   return $this->__call( __FUNCTION__, func_get_args() );
+   }
+
+ 

[MediaWiki-commits] [Gerrit] mediawiki...LandingCheck[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354145 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I6191d21e02f88fcf42d20fe8e75cd7aec4627d6e
---
M SpecialLandingCheck.php
M composer.json
A phpcs.xml
3 files changed, 58 insertions(+), 50 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/SpecialLandingCheck.php b/SpecialLandingCheck.php
index f175c1e..a1a7858 100644
--- a/SpecialLandingCheck.php
+++ b/SpecialLandingCheck.php
@@ -5,14 +5,14 @@
 }
 
 /**
- * This checks to see if a version of a landing page exists for the user's 
language and country. 
- * If not, it looks for a version localized for the user's language. If that 
doesn't exist either, 
+ * This checks to see if a version of a landing page exists for the user's 
language and country.
+ * If not, it looks for a version localized for the user's language. If that 
doesn't exist either,
  * it looks for the English version. If any of those exist, it then redirects 
the user.
  */
 class SpecialLandingCheck extends SpecialPage {
protected $localServerType = null;
/**
-* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking 
+* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking
 * params. This is for non-fundraising links that just need 
localization.
 *
 * @var boolean $basic
@@ -27,12 +27,12 @@
 * @var string $anchor
 */
protected $anchor = null;
-   
+
public function __construct() {
// Register special page
parent::__construct( 'LandingCheck' );
}
-   
+
public function execute( $sub ) {
global $wgPriorityCountries;
$request = $this->getRequest();
@@ -41,7 +41,7 @@
 
$language = 'en';
$path = explode( '/', $sub );
-   if ( Language::isValidCode( $path[count($path) - 1] ) ) {
+   if ( Language::isValidCode( $path[count( $path ) - 1] ) ) {
$language = $sub;
}
 
@@ -49,10 +49,10 @@
$language = $request->getVal( 'language', $language );
$this->basic = $request->getBool( 'basic' );
$country = $request->getVal( 'country' );
-   $this->anchor = $request->getVal ( 'anchor' );
+   $this->anchor = $request->getVal( 'anchor' );
 
// if the language is false-ish, set to default
-   if( !$language ) {
+   if ( !$language ) {
$language = 'en';
}
 
@@ -75,25 +75,25 @@
if ( !$country ) {
$country = 'US'; // Default
}
-   
+
// determine if we are fulfilling a request for a priority 
country
$priority = in_array( $country, $wgPriorityCountries );
 
// handle the actual redirect
$this->routeRedirect( $country, $language, $priority );
}
-   
+
/**
 * Determine whether this server is configured as the priority or 
normal server
-* 
+*
 * If this is neither the priority nor normal server, assumes 'local' - 
meaning
 * this server should be handling the request.
 */
public function determineLocalServerType() {
global $wgServer, $wgLandingCheckPriorityURLBase, 
$wgLandingCheckNormalURLBase;
-   
+
$localServerDetails = wfParseUrl( $wgServer );
-   
+
// The following checks are necessary due to a bug in 
wfParseUrl that was fixed in r94352.
if ( $wgLandingCheckPriorityURLBase ) {
$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
@@ -105,9 +105,7 @@
} else {
$normalServerDetails = false;
}
-   //$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
-   //$normalServerDetails = wfParseUrl( 
$wgLandingCheckNormalURLBase );
-   
+
if ( $localServerDetails[ 'host' ] == $priorityServerDetails[ 
'host' ] ) {
return 'priority';
} elseif ( $localServerDetails[ 'host' ] == 
$normalServerDetails[ 'host' ] ) {
@@ -116,7 +114,7 @@
return 'local';
}
}
-   
+
/**
 * Route the request to the appropriate redirect method
 * @param string $country
@@ -125,28 +123,27 @@
 */
public function routeRedirect( $country, $language, $priority ) {
$localServerType = $this->getLocalServerType();
- 

[MediaWiki-commits] [Gerrit] mediawiki...Listings[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354232 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I3ac116bd7cc426253a7192cf71c2a1cc1420f19e
---
M Listings.body.php
M composer.json
A phpcs.xml
3 files changed, 48 insertions(+), 23 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/Listings.body.php b/Listings.body.php
index cba597e..e3f89ea 100644
--- a/Listings.body.php
+++ b/Listings.body.php
@@ -2,13 +2,13 @@
 
 class Listings {
public static function setupHooks( Parser $parser ) {
-   $parser->setHook( 'buy', array( 'Listings', 'buyListings'   
) );
-   $parser->setHook( 'do',  array( 'Listings', 'doListings'
) );
-   $parser->setHook( 'drink',   array( 'Listings', 'drinkListings' 
) );
-   $parser->setHook( 'eat', array( 'Listings', 'eatListings'   
) );
-   $parser->setHook( 'listing', array( 'Listings', 'otherlistings' 
) );
-   $parser->setHook( 'see', array( 'Listings', 'seeListings'   
) );
-   $parser->setHook( 'sleep',   array( 'Listings', 'sleepListings' 
) );
+   $parser->setHook( 'buy', [ 'Listings', 'buyListings' ] );
+   $parser->setHook( 'do', [ 'Listings', 'doListings' ] );
+   $parser->setHook( 'drink', [ 'Listings', 'drinkListings' ] );
+   $parser->setHook( 'eat', [ 'Listings', 'eatListings' ] );
+   $parser->setHook( 'listing', [ 'Listings', 'otherlistings' ] );
+   $parser->setHook( 'see', [ 'Listings', 'seeListings' ] );
+   $parser->setHook( 'sleep', [ 'Listings', 'sleepListings' ] );
 
return true;
}
@@ -93,7 +93,8 @@
private static function listingsTag( $aType, $input, $args, $parser ) {
 
/*
-* if a {{listings}} template exists, feed tag name and 
parameter list to template verbatim and exit
+* if a {{listings}} template exists,
+* feed tag name and parameter list to template verbatim and 
exit
 */
$ltemplate = '';
if ( !wfMessage( 'listings-template' 
)->inContentLanguage()->isDisabled() ) {
@@ -203,15 +204,15 @@
}
 
// @fixme: a lot of localisation-unfriendly patchwork below
-   $out = Html::element( 'strong', array(), $name );
+   $out = Html::element( 'strong', [], $name );
if ( $url != '' ) {
$sanitizedHref = Sanitizer::validateAttributes(
-   array( 'href' => $url ),
-   array( 'href' )
+   [ 'href' => $url ],
+   [ 'href' ]
);
if ( isset( $sanitizedHref['href'] ) ) {
$out = Html::rawElement( 'a',
-   $sanitizedHref + array( 'class' => 
'external text', 'rel' => 'nofollow', 'title' => $name ),
+   $sanitizedHref + [ 'class' => 'external 
text', 'rel' => 'nofollow', 'title' => $name ],
$out
);
}
@@ -236,27 +237,39 @@
}
}
 
-   $phoneSymbol = $parser->internalParse( wfMessage( 
'listings-phone-symbol' )->inContentLanguage()->text() );
+   $phoneSymbol = $parser->internalParse(
+   wfMessage( 'listings-phone-symbol' 
)->inContentLanguage()->text() );
if ( $phoneSymbol != '' ) {
-   $phoneSymbol = '' . $phoneSymbol . 
'';
+   $phoneSymbol = '' . $phoneSymbol . '';
} else {
$phoneSymbol = wfMessage( 'listings-phone' 
)->inContentLanguage()->escaped();
}
-   $faxSymbol = $parser->internalParse( wfMessage( 
'listings-fax-symbol' )->inContentLanguage()->text() );
+   $faxSymbol = $parser->internalParse(
+   wfMessage( 'listings-fax-symbol' 
)->inContentLanguage()->text() );
if ( $faxSymbol != '' ) {
-   $faxSymbol = '' . $faxSymbol . 
'';
+   $faxSymbol = '' . $faxSymbol . '';
} else {
$faxSymbol = wfMessage( 'listings-fax' 
)->inContentLanguage()->escaped();
}
-   $emailSymbol = $parser->internalParse( wfMessage( 
'listings-email-symbol' )->inContentLanguage()->text() );
+   $emailSymbol = $parser->internalParse(
+   wfMessage( 'listings-email-symbol' 
)->inContentLanguage()->text() );
if ( 

[MediaWiki-commits] [Gerrit] mediawiki...ImageMap[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354133 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Ia62022c4a57719bdafb618047490a005e6c373ce
---
M ImageMap_body.php
M composer.json
A phpcs.xml
3 files changed, 25 insertions(+), 11 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/ImageMap_body.php b/ImageMap_body.php
index b65bb02..7eca3d4 100644
--- a/ImageMap_body.php
+++ b/ImageMap_body.php
@@ -31,7 +31,7 @@
 * @param Parser $parser
 */
public static function onParserFirstCallInit( Parser &$parser ) {
-   $parser->setHook( 'imagemap', array( 'ImageMap', 'render' ) );
+   $parser->setHook( 'imagemap', [ 'ImageMap', 'render' ] );
}
 
/**
@@ -49,14 +49,14 @@
$first = true;
$lineNum = 0;
$mapHTML = '';
-   $links = array();
+   $links = [];
 
// Define canonical desc types to allow i18n of 
'imagemap_desc_types'
$descTypesCanonical = 'top-right, bottom-right, bottom-left, 
top-left, none';
$descType = self::BOTTOM_RIGHT;
$defaultLinkAttribs = false;
$realmap = true;
-   $extLinks = array();
+   $extLinks = [];
foreach ( $lines as $line ) {
++$lineNum;
$externLink = false;
@@ -149,7 +149,7 @@
$title = false;
// Find the link
$link = trim( strstr( $line, '[' ) );
-   $m = array();
+   $m = [];
if ( preg_match( '/^ \[\[  ([^|]*+)  \|  ([^\]]*+)  
\]\] \w* $ /x', $link, $m ) ) {
$title = Title::newFromText( $m[1] );
$alt = trim( $m[2] );
@@ -159,7 +159,9 @@
return self::error( 
'imagemap_invalid_title', $lineNum );
}
$alt = $title->getFullText();
-   } elseif ( in_array( substr( $link, 1, strpos( $link, 
'//' ) + 1 ), $wgUrlProtocols ) || in_array( substr( $link, 1, strpos( $link, 
':' ) ), $wgUrlProtocols ) ) {
+   } elseif ( in_array( substr( $link, 1, strpos( $link, 
'//' ) + 1 ), $wgUrlProtocols )
+   || in_array( substr( $link, 1, strpos( $link, 
':' ) ), $wgUrlProtocols )
+   ) {
if ( preg_match( '/^ \[  ([^\s]*+)  \s  
([^\]]*+)  \] \w* $ /x', $link, $m ) ) {
$title = $m[1];
$alt = trim( $m[2] );
@@ -181,7 +183,7 @@
$shape = strtok( $shapeSpec, " \t" );
switch ( $shape ) {
case 'default':
-   $coords = array();
+   $coords = [];
break;
case 'rect':
$coords = self::tokenizeCoords( 4, 
$lineNum );
@@ -196,7 +198,7 @@
}
break;
case 'poly':
-   $coords = array();
+   $coords = [];
$coord = strtok( " \t" );
while ( $coord !== false ) {
$coords[] = $coord;
@@ -219,7 +221,7 @@
}
 
// Construct the area tag
-   $attribs = array();
+   $attribs = [];
if ( $externLink ) {
$attribs['href'] = $title;
$attribs['class'] = 'plainlinks';
@@ -379,7 +381,7 @@
 * @return array|string String with error (HTML), or array of 
coordinates
 */
static function tokenizeCoords( $count, $lineNum ) {
-   $coords = array();
+   $coords = [];
for ( $i = 0; $i < $count; $i++ ) {
$coord = strtok( " \t" );
if ( $coord === false ) {
diff --git a/composer.json b/composer.json
index b4c136e..78bca69 100644
--- a/composer.json
+++ b/composer.json
@@ -23,11 +23,14 @@
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+  

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: DRY up logic to remove source_ fields

2017-05-18 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354255 )

Change subject: DRY up logic to remove source_ fields
..

DRY up logic to remove source_ fields

Change-Id: Iadefb93080d83fd57490de08c8f36425d6a2304f
---
M CrmLink/Messages/SourceFields.php
M PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
M PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
M PaymentProviders/AstroPay/Tests/phpunit/NormalizeTest.php
M PaymentProviders/PayPal/Tests/Data/express_checkout_transformed.json
M 
PaymentProviders/PayPal/Tests/Data/recurring_payment_profile_created_transformed.json
M PaymentProviders/PayPal/Tests/Data/recurring_payment_transformed.json
M PaymentProviders/PayPal/Tests/Data/refund_ec_transformed.json
M PaymentProviders/PayPal/Tests/Data/refund_recurring_ec_transformed.json
M PaymentProviders/PayPal/Tests/Data/refund_transformed.json
M PaymentProviders/PayPal/Tests/Data/subscr_payment_transformed.json
M PaymentProviders/PayPal/Tests/Data/subscr_signup_transformed.json
M PaymentProviders/PayPal/Tests/Data/web_accept_transformed.json
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
14 files changed, 36 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/55/354255/1

diff --git a/CrmLink/Messages/SourceFields.php 
b/CrmLink/Messages/SourceFields.php
index 6e26340..c61547a 100644
--- a/CrmLink/Messages/SourceFields.php
+++ b/CrmLink/Messages/SourceFields.php
@@ -6,6 +6,8 @@
 
 class SourceFields {
/**
+* Add fields to a queue message to identify the source
+*
 * @param array $message
 */
public static function addToMessage( &$message ) {
@@ -17,4 +19,23 @@
$message['source_version'] = $context->getSourceRevision();
$message['source_enqueued_time'] = UtcDate::getUtcTimestamp();
}
+
+   /**
+* Remove and return the source fields from a queue message
+*
+* @param array $message
+* @return array
+*/
+   public static function removeFromMessage( &$message ) {
+   $sourceFields = array();
+   $suffixes = array(
+   'name', 'type', 'host', 'run_id', 'version', 
'enqueued_time'
+   );
+   foreach ( $suffixes as $suffix ) {
+   $name = 'source_' . $suffix;
+   $sourceFields[$name] = $message[$name];
+   unset( $message[$name] );
+   }
+   return $sourceFields;
+   }
 }
diff --git a/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php 
b/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
index 8cab450..3d5bb44 100644
--- a/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
+++ b/PaymentProviders/Adyen/Tests/phpunit/ReportAvailableTest.php
@@ -6,6 +6,7 @@
 use SmashPig\Core\Context;
 use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
 use SmashPig\Core\UtcDate;
+use SmashPig\CrmLink\Messages\SourceFields;
 use SmashPig\PaymentProviders\Adyen\ExpatriatedMessages\ReportAvailable;
 use SmashPig\Tests\BaseSmashPigUnitTestCase;
 
@@ -47,20 +48,12 @@
$now = UtcDate::getUtcTimestamp();
$diff = abs( $job['source_enqueued_time'] ) - $now;
$this->assertTrue( $diff < 60, 'Odd enqueued time' );
-   $unsetFields = array(
-   'source_enqueued_time', 'source_host', 'source_run_id',
-   'source_version', 'propertiesExcludedFromExport',
-   'propertiesExportedAsKeys',
-   );
-   foreach ( $unsetFields as $fieldName ) {
-   unset( $job[$fieldName] );
-   }
+   SourceFields::removeFromMessage( $job );
+   unset( $job['propertiesExcludedFromExport'] );
$expected = array(
'php-message-class' => 
'SmashPig\PaymentProviders\Adyen\Jobs\DownloadReportJob',
'reportUrl' => $url,
'account' => $account,
-   'source_name' => 'SmashPig',
-   'source_type' => 'listener',
'gateway' => 'adyen',
);
$this->assertEquals( $expected, $job );
diff --git a/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php 
b/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
index 2861e6f..215b375 100644
--- a/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
+++ b/PaymentProviders/Amazon/Tests/phpunit/NormalizeTest.php
@@ -36,15 +36,8 @@
'order_id' => '98765432-1',
'payment_method' => 'amazon',
);
-   $stripFields = array(
-   'propertiesExportedAsKeys',
-   

[MediaWiki-commits] [Gerrit] mediawiki...WikimediaMessages[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354251 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I2092ad8cd7a43823a7adfd6595143bf29d53c293
---
M WikimediaMessages.hooks.php
M composer.json
A phpcs.xml
3 files changed, 353 insertions(+), 328 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/WikimediaMessages.hooks.php b/WikimediaMessages.hooks.php
index 5ea7b92..44a1dda 100644
--- a/WikimediaMessages.hooks.php
+++ b/WikimediaMessages.hooks.php
@@ -22,7 +22,7 @@
public static function onMessageCacheGet( &$lcKey ) {
global $wgLanguageCode, $wmfRealm;
 
-   static $keys = array(
+   static $keys = [
'acct_creation_throttle_hit',
'centralauth-contribs-locked',
'centralauth-uwbr-intro',
@@ -44,7 +44,7 @@
'sidebar',
'sulrenamewarning-usenew',
'ipb-confirmhideuser', // T121639
-   );
+   ];
 
if ( $wmfRealm === 'labs' && $lcKey === 'privacypage' ) {
$lcKey = 'wikimedia-privacypage-labs';
@@ -64,15 +64,17 @@
 
$cache = MessageCache::singleton();
if (
-   // Override order:
-   // 1. If the MediaWiki:$ucKey page exists, use 
the key unprefixed
-   // (in all languages) with normal fallback 
order.  Specific
-   // language pages (MediaWiki:$ucKey/xy) are not 
checked when
-   // deciding which key to use, but are still 
used if applicable
-   // after the key is decided.
-   //
-   // 2. Otherwise, use the prefixed key with 
normal fallback order
-   // (including MediaWiki pages if they exist).
+   /*
+* Override order:
+* 1. If the MediaWiki:$ucKey page exists, use 
the key unprefixed
+* (in all languages) with normal fallback 
order.  Specific
+* language pages (MediaWiki:$ucKey/xy) are not 
checked when
+* deciding which key to use, but are still 
used if applicable
+* after the key is decided.
+*
+* 2. Otherwise, use the prefixed key with 
normal fallback order
+* (including MediaWiki pages if they exist).
+*/
$cache->getMsgFromNamespace( $ucKey, 
$wgLanguageCode ) === false
) {
$lcKey = $transformedKey;
@@ -98,7 +100,7 @@
// return Wikipedia here.  Before deploying GettingStarted to 
one, find a
// way to determine the real family.
if ( $site === 'wikipedia' ) {
-   if ( in_array( $lcKey, array(
+   if ( in_array( $lcKey, [
"gettingstarted-task-toolbar-try-another-text",
"gettingstarted-task-toolbar-no-suggested-page",

"gettingstarted-task-copyedit-toolbar-description",
@@ -111,7 +113,7 @@

"guidedtour-tour-gettingstarted-click-preview-description",
"gettingstarted-cta-edit-page",
"gettingstarted-cta-fix-pages",
-   ) ) ) {
+   ] ) ) {
return "{$lcKey}-wikipedia";
}
}
@@ -133,10 +135,10 @@
public static function onSkinCopyrightFooter( $title, $type, &$msg, 
&$link ) {
global $wgRightsUrl;
 
-   if( strpos( $wgRightsUrl, 
'creativecommons.org/licenses/by-sa/3.0' ) !== false ) {
+   if ( strpos( $wgRightsUrl, 
'creativecommons.org/licenses/by-sa/3.0' ) !== false ) {
if ( $type !== 'history' ) {
global $wgDBname;
-   if ( in_array( $wgDBname, array( 
'wikidatawiki', 'testwikidatawiki' ) ) ) {
+   if ( in_array( $wgDBname, [ 'wikidatawiki', 
'testwikidatawiki' ] ) ) {
$msg = 'wikidata-copyright';
} else {
$msg = 'wikimedia-copyright'; // the 
default;
@@ -159,8 +161,8 @@

[MediaWiki-commits] [Gerrit] mediawiki...Elastica[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354254 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I8959022e4b439d79ff153c39b82b58c51a964114
---
M ElasticaConnection.php
M composer.json
A phpcs.xml
M tests/phpunit/UtilTest.php
4 files changed, 53 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Elastica 
refs/changes/54/354254/1

diff --git a/ElasticaConnection.php b/ElasticaConnection.php
index 6ef082d..6441808 100644
--- a/ElasticaConnection.php
+++ b/ElasticaConnection.php
@@ -27,7 +27,7 @@
/**
 * @return array(string) server ips or hostnames
 */
-   public abstract function getServerList();
+   abstract public function getServerList();
 
/**
 * How many times can we attempt to connect per host?
@@ -210,7 +210,6 @@
}
 }
 
-
 /**
  * Utility class
  */
@@ -226,22 +225,24 @@
 * @param int $retryAttempts the number of times we retry
 * @param callable $retryErrorCallback function called before each 
retries
 */
-   public static function iterateOverScroll( \Elastica\Index $index, 
$scrollId, $scrollTime, $consumer, $limit = 0, $retryAttempts = 0, 
$retryErrorCallback = null ) {
+   public static function iterateOverScroll( \Elastica\Index $index, 
$scrollId, $scrollTime,
+   $consumer, $limit = 0, $retryAttempts = 0, $retryErrorCallback 
= null
+   ) {
$clearScroll = true;
$fetched = 0;
 
-   while( true ) {
+   while ( true ) {
$result = static::withRetry( $retryAttempts,
function() use ( $index, $scrollId, $scrollTime 
) {
-   return $index->search ( array(), array(
+   return $index->search( [], [
'scroll_id' => $scrollId,
'scroll' => $scrollTime
-   ) );
+   ] );
}, $retryErrorCallback );
 
$scrollId = $result->getResponse()->getScrollId();
 
-   if( !$result->count() ) {
+   if ( !$result->count() ) {
// No need to clear scroll on the last call
$clearScroll = false;
break;
@@ -250,21 +251,22 @@
$fetched += $result->count();
$results =  $result->getResults();
 
-   if( $limit > 0 && $fetched > $limit ) {
-   $results = array_slice( $results, 0, sizeof( 
$results ) - ( $fetched - $limit ) );
+   if ( $limit > 0 && $fetched > $limit ) {
+   $results = array_slice( $results, 0, count( 
$results ) - ( $fetched - $limit ) );
}
$consumer( $results );
 
-   if( $limit > 0 && $fetched >= $limit ) {
+   if ( $limit > 0 && $fetched >= $limit ) {
break;
}
}
// @todo: catch errors and clear the scroll, it'd be easy with 
a finally block ...
 
-   if( $clearScroll ) {
+   if ( $clearScroll ) {
try {
$index->getClient()->request( 
"_search/scroll/".$scrollId, \Elastica\Request::DELETE );
-   } catch ( Exception $e ) {}
+   } catch ( Exception $e ) {
+   }
}
}
 
@@ -289,7 +291,7 @@
return $func();
} catch ( Exception $e ) {
$errors += 1;
-   if( $beforeRetry ) {
+   if ( $beforeRetry ) {
$beforeRetry( $e, $errors );
} else {
$seconds = 
static::backoffDelay( $errors );
diff --git a/composer.json b/composer.json
index 3216fe9..c83e077 100644
--- a/composer.json
+++ b/composer.json
@@ -43,11 +43,14 @@
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   

[MediaWiki-commits] [Gerrit] mediawiki...DismissableSiteNotice[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354253 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I0bac641435949110fa9b933e61cfa7d44040ad53
---
M DismissableSiteNotice.hooks.php
M DismissableSiteNotice.php
M composer.json
A phpcs.xml
4 files changed, 20 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DismissableSiteNotice 
refs/changes/53/354253/1

diff --git a/DismissableSiteNotice.hooks.php b/DismissableSiteNotice.hooks.php
index 38475e5..ea7a2ac 100644
--- a/DismissableSiteNotice.hooks.php
+++ b/DismissableSiteNotice.hooks.php
@@ -25,15 +25,15 @@
$out->addModules( 'ext.dismissableSiteNotice' );
$out->addJsConfigVars( 'wgSiteNoticeId', 
"$major.$minor" );
 
-   $notice = Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice' ),
-   Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice-close' ),
+   $notice = Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice' ],
+   Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice-close' ],
$skin->msg( 'sitenotice_close-brackets' 
)
->rawParams(
-   Html::element( 'a', 
array( 'href' => '#' ), $skin->msg( 'sitenotice_close' )->text() )
+   Html::element( 'a', [ 
'href' => '#' ], $skin->msg( 'sitenotice_close' )->text() )
)
->escaped()
) .
-   Html::rawElement( 'div', array( 'class' => 
'mw-dismissable-notice-body' ), $notice )
+   Html::rawElement( 'div', [ 'class' => 
'mw-dismissable-notice-body' ], $notice )
);
}
 
diff --git a/DismissableSiteNotice.php b/DismissableSiteNotice.php
index bd66784..0c14305 100644
--- a/DismissableSiteNotice.php
+++ b/DismissableSiteNotice.php
@@ -19,7 +19,8 @@
// Keep i18n globals so mergeMessageFileList.php doesn't break
$wgMessagesDirs['DismissableSiteNotice'] = __DIR__ . '/i18n';
/* wfWarn(
-   'Deprecated PHP entry point used for DismissableSiteNotice 
extension. Please use wfLoadExtension instead, ' .
+   'Deprecated PHP entry point used for DismissableSiteNotice 
extension. ' .
+   'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
); */
return;
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354253
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bac641435949110fa9b933e61cfa7d44040ad53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DismissableSiteNotice
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...XAnalytics[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354252 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: Ib4dbe698323ad9c419d1c979fe838665ae454b98
---
M XAnalytics.class.php
M composer.json
A phpcs.xml
3 files changed, 17 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/XAnalytics 
refs/changes/52/354252/1

diff --git a/XAnalytics.class.php b/XAnalytics.class.php
index 4c65b9e..6bc939e 100644
--- a/XAnalytics.class.php
+++ b/XAnalytics.class.php
@@ -38,8 +38,8 @@
}
self::$addedHeader = true;
$response = $out->getRequest()->response();
-   $headerItems = array();
-   Hooks::run( 'XAnalyticsSetHeader', array( $out, &$headerItems ) 
);
+   $headerItems = [];
+   Hooks::run( 'XAnalyticsSetHeader', [ $out, &$headerItems ] );
if ( count( $headerItems ) ) {
self::createHeader( $response, $headerItems );
}
@@ -74,7 +74,7 @@
if ( self::$addedHeader ) {
// If the header is already set, we need to append to 
it and replace it
global $wgRequest;
-   self::createHeader( $wgRequest->response(), array( 
$name => $value ) );
+   self::createHeader( $wgRequest->response(), [ $name => 
$value ] );
}
}
 }
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354252
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4dbe698323ad9c419d1c979fe838665ae454b98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/XAnalytics
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Dashiki[REL1_29]: Downgrade extension.json to manifest_version 1

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354250 )

Change subject: Downgrade extension.json to manifest_version 1
..


Downgrade extension.json to manifest_version 1

To fix the incompatibility after the version 2 format changed in
fdb7e9410465fd8f2, downgrade to manifest_version 1.

Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
(cherry picked from commit 43f2bcf30dbd6852d01dbc9a4b8ecd86374dfdc8)
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 45799a1..e1745a1 100644
--- a/extension.json
+++ b/extension.json
@@ -27,5 +27,5 @@
"isLocal": true
}
},
-   "manifest_version": 2
+   "manifest_version": 1
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/354250
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Dashiki
Gerrit-Branch: REL1_29
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikimediaMessages[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354251 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I2092ad8cd7a43823a7adfd6595143bf29d53c293
---
M WikimediaMessages.hooks.php
M composer.json
A phpcs.xml
3 files changed, 353 insertions(+), 328 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaMessages 
refs/changes/51/354251/1

diff --git a/WikimediaMessages.hooks.php b/WikimediaMessages.hooks.php
index e012c5e..f9a7866 100644
--- a/WikimediaMessages.hooks.php
+++ b/WikimediaMessages.hooks.php
@@ -22,7 +22,7 @@
public static function onMessageCacheGet( &$lcKey ) {
global $wgLanguageCode, $wmfRealm;
 
-   static $keys = array(
+   static $keys = [
'acct_creation_throttle_hit',
'centralauth-contribs-locked',
'centralauth-uwbr-intro',
@@ -44,7 +44,7 @@
'sidebar',
'sulrenamewarning-usenew',
'ipb-confirmhideuser', // T121639
-   );
+   ];
 
if ( $wmfRealm === 'labs' && $lcKey === 'privacypage' ) {
$lcKey = 'wikimedia-privacypage-labs';
@@ -64,15 +64,17 @@
 
$cache = MessageCache::singleton();
if (
-   // Override order:
-   // 1. If the MediaWiki:$ucKey page exists, use 
the key unprefixed
-   // (in all languages) with normal fallback 
order.  Specific
-   // language pages (MediaWiki:$ucKey/xy) are not 
checked when
-   // deciding which key to use, but are still 
used if applicable
-   // after the key is decided.
-   //
-   // 2. Otherwise, use the prefixed key with 
normal fallback order
-   // (including MediaWiki pages if they exist).
+   /*
+* Override order:
+* 1. If the MediaWiki:$ucKey page exists, use 
the key unprefixed
+* (in all languages) with normal fallback 
order.  Specific
+* language pages (MediaWiki:$ucKey/xy) are not 
checked when
+* deciding which key to use, but are still 
used if applicable
+* after the key is decided.
+*
+* 2. Otherwise, use the prefixed key with 
normal fallback order
+* (including MediaWiki pages if they exist).
+*/
$cache->getMsgFromNamespace( $ucKey, 
$wgLanguageCode ) === false
) {
$lcKey = $transformedKey;
@@ -98,7 +100,7 @@
// return Wikipedia here.  Before deploying GettingStarted to 
one, find a
// way to determine the real family.
if ( $site === 'wikipedia' ) {
-   if ( in_array( $lcKey, array(
+   if ( in_array( $lcKey, [
"gettingstarted-task-toolbar-try-another-text",
"gettingstarted-task-toolbar-no-suggested-page",

"gettingstarted-task-copyedit-toolbar-description",
@@ -111,7 +113,7 @@

"guidedtour-tour-gettingstarted-click-preview-description",
"gettingstarted-cta-edit-page",
"gettingstarted-cta-fix-pages",
-   ) ) ) {
+   ] ) ) {
return "{$lcKey}-wikipedia";
}
}
@@ -133,10 +135,10 @@
public static function onSkinCopyrightFooter( $title, $type, &$msg, 
&$link ) {
global $wgRightsUrl;
 
-   if( strpos( $wgRightsUrl, 
'creativecommons.org/licenses/by-sa/3.0' ) !== false ) {
+   if ( strpos( $wgRightsUrl, 
'creativecommons.org/licenses/by-sa/3.0' ) !== false ) {
if ( $type !== 'history' ) {
global $wgDBname;
-   if ( in_array( $wgDBname, array( 
'wikidatawiki', 'testwikidatawiki' ) ) ) {
+   if ( in_array( $wgDBname, [ 'wikidatawiki', 
'testwikidatawiki' ] ) ) {
$msg = 'wikidata-copyright';
} else {
$msg = 'wikimedia-copyright'; // the 
default;
@@ 

[MediaWiki-commits] [Gerrit] mediawiki...Dashiki[REL1_29]: Downgrade extension.json to manifest_version 1

2017-05-18 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354250 )

Change subject: Downgrade extension.json to manifest_version 1
..

Downgrade extension.json to manifest_version 1

To fix the incompatibility after the version 2 format changed in
fdb7e9410465fd8f2, downgrade to manifest_version 1.

Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
(cherry picked from commit 43f2bcf30dbd6852d01dbc9a4b8ecd86374dfdc8)
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Dashiki 
refs/changes/50/354250/1

diff --git a/extension.json b/extension.json
index 45799a1..e1745a1 100644
--- a/extension.json
+++ b/extension.json
@@ -27,5 +27,5 @@
"isLocal": true
}
},
-   "manifest_version": 2
+   "manifest_version": 1
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/354250
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Dashiki
Gerrit-Branch: REL1_29
Gerrit-Owner: Legoktm 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...citoid[master]: Relax date validation significantly

2017-05-18 Thread Mvolz (Code Review)
Mvolz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354249 )

Change subject: Relax date validation significantly
..

Relax date validation significantly

* Return dates where month and year are known in the format
month year (English natural language).
* If unable to parse date, leave the date in instead of
deleting it.

Bug: T132308
Change-Id: If35261294ede8c0942b4f7394fa17b12f38c2709
---
M lib/Exporter.js
M test/features/scraping/isbn.js
M test/features/unit/exporter.js
M test/features/unit/translators/util.js
4 files changed, 39 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/citoid 
refs/changes/49/354249/1

diff --git a/lib/Exporter.js b/lib/Exporter.js
index 33f5f30..674f4d9 100644
--- a/lib/Exporter.js
+++ b/lib/Exporter.js
@@ -19,9 +19,10 @@
 var CachedTypes = require('./zotero/cachedTypes.js');
 var pubMedRequest = require('./pubMedRequest.js');
 
-//TODO: Remove
+/* Globals */
 var defaultLogger;
 var userAgent;
+var acceptLanguage = 'en-US'; // Set global language default
 
 /* Custom chrono parsers */
 var customChrono = new chrono.Chrono();
@@ -35,7 +36,6 @@
 text: match[0],
 index: match.index,
 start: {
-day: 1,
 month: match[2],
 year: match[1]
 }
@@ -44,6 +44,7 @@
 customChrono.parsers.push(partialISO);
 
 //Target year first with range, i.e. 1975 Dec-Nov
+//TODO: Add to end
 var journalFormat = new chrono.Parser();
 journalFormat.pattern = function () { return 
/(\d{4})\s+([a-z]{3})\s*-\s*[a-z]{3}$/ig; };
 journalFormat.extract = function(text, ref, match, opt) {
@@ -54,7 +55,6 @@
 text: match[0],
 index: match.index,
 start: {
-day: 1,
 month: month,
 year: match[1]
 }
@@ -553,22 +553,27 @@
 // Try to parse with chrono first
 var p = customChrono.parse(citation.date); // Create ParsedResult 
object with chrono
 if (p && p[0] && p[0].start){
-p[0].start.assign('timezoneOffset', 0); // Remove timezone 
offset so that the user-observed date doesn't change based on offset
-d = p[0].start.date(); // Create a Date object from 
ParsedComponents Object
-} else {
-// Try to parse with Date.parse() as fallback; chrono doesn't 
seem to work with ambigious dates, such as '2010'
-d = new Date(citation.date + 
(/[0-9]T[0-9]/.test(citation.date) ? '' : ' GMT+00')); // Explicitly set to GMT 
time to avoid offset issue
+// Remove timezone offset so that the user-observed date 
doesn't change based on offset
+p[0].start.assign('timezoneOffset', 0);
+// Create a Date object from ParsedComponents Object
+d = p[0].start.date();
+// If a Date object is formed, format it.
+if (isFinite(d)) {
+// Only turn into ISO date if an all fields are known
+if(p[0].start.knownValues.year && 
p[0].start.knownValues.month && p[0].start.knownValues.day) {
+// Remove time from date
+citation.date = d.toISOString().split('T').shift();
+} else if (p[0].start.knownValues.year && 
p[0].start.knownValues.month){
+var options = {
+year: 'numeric',
+month: 'long'
+};
+citation.date = d.toLocaleDateString(acceptLanguage, 
options);
+}
+}
 }
-
-// Lastly, remove time from date
-if (isFinite(d)) {
-citation.date = d.toISOString().split('T').shift();
-} else {
-// If no finite translation of the date is available, remove 
the field
-delete citation.date;
-}
-} catch (e) { // Remove field if errors are thrown
-delete citation.date;
+} catch (e) {
+// Leave field as written if errors are thrown
 }
 }
 return citation;
diff --git a/test/features/scraping/isbn.js b/test/features/scraping/isbn.js
index 3434998..037c778 100644
--- a/test/features/scraping/isbn.js
+++ b/test/features/scraping/isbn.js
@@ -109,7 +109,7 @@
 assert.deepEqual(res.body[0].contributor, 
[['Sheen,','Martin.'],['Cohen,','Bonni.'],['Thomson,','Richard.'],['DK 
Publishing,','Inc.']], 'Unexpected value:' + res.body[0].author); // only get 
this sometimes
 assert.deepEqual(res.body[0].studio, 'DK Pub', 'Unexpected 
value; expected DK Pub, got ' + res.body[0].studio);
 //assert.deepEqual(res.body[0].place, 'New York', 'Unexpected 
value; expected New York, got ' + res.body[0].place);
-

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Phabricator: Redirect all http traffic to https

2017-05-18 Thread Paladox (Code Review)
Paladox has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354247 )

Change subject: Phabricator: Redirect all http traffic to https
..

Phabricator: Redirect all http traffic to https

Reason why I'm doing this is because in labs you can go to http or https. Using 
http can cause issues like T165643 .

This will also safe guard phabricator.wikimedia.org too just in case a http 
request is not transferred to https.

Bug: T165643
Change-Id: I0e513b209b11afde58a1c9b3f675dae77159
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/47/354247/1


-- 
To view, visit https://gerrit.wikimedia.org/r/354247
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e513b209b11afde58a1c9b3f675dae77159
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Paladox 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Remove ambiguity related to `datamodel.Lexeme` module

2017-05-18 Thread Aleksey Bekh-Ivanov (WMDE) (Code Review)
Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354248 )

Change subject: Remove ambiguity related to `datamodel.Lexeme` module
..

Remove ambiguity related to `datamodel.Lexeme` module

Class was named `wikibase.datamodel.Lexeme` but module was
named `wikibase.lexeme.datamodel.Lexeme`.
Now they both are is `wikibase.lexeme.datamodel.Lexeme`

Change-Id: I1f1478105e71f227f36d6266de5e6ea5aada3dd5
---
M resources/datamodel/Lexeme.js
M resources/serialization/LexemeDeserializer.js
M tests/qunit/datamodel/Lexeme.tests.js
M tests/qunit/serialization/LexemeDeserializer.tests.js
4 files changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/48/354248/1

diff --git a/resources/datamodel/Lexeme.js b/resources/datamodel/Lexeme.js
index 2b66caa..9ae196d 100644
--- a/resources/datamodel/Lexeme.js
+++ b/resources/datamodel/Lexeme.js
@@ -5,7 +5,7 @@
var StatementProvider = wb.datamodel.StatementProvider;
 
/**
-* @class wikibase.datamodel.Lexeme
+* @class wikibase.lexeme.datamodel.Lexeme
 * @extends wikibase.datamodel.Entity
 * @license GNU GPL v2+
 * @author Adrian Heine 
@@ -18,7 +18,7 @@
 *
 * @throws {Error} if a required parameter is not specified properly.
 */
-   var SELF = wb.datamodel.Lexeme = util.inherit(
+   var SELF = wb.lexeme.datamodel.Lexeme = util.inherit(
'WbDataModelLexeme',
PARENT,
function ( lexemeId, statementGroupSet ) {
diff --git a/resources/serialization/LexemeDeserializer.js 
b/resources/serialization/LexemeDeserializer.js
index 53ff3d9..c9dc0d7 100644
--- a/resources/serialization/LexemeDeserializer.js
+++ b/resources/serialization/LexemeDeserializer.js
@@ -17,12 +17,12 @@
/**
 * @inheritdoc
 *
-* @return {wikibase.datamodel.Lexeme}
+* @return {wikibase.lexeme.datamodel.Lexeme}
 *
 * @throws {Error} if serialization does not resolve to a 
serialized Lexeme.
 */
deserialize: function ( serialization ) {
-   if ( serialization.type !== wb.datamodel.Lexeme.TYPE ) {
+   if ( serialization.type !== 
wb.lexeme.datamodel.Lexeme.TYPE ) {
throw new Error( 'Serialization does not 
resolve to a Lexeme' );
}
 
@@ -34,7 +34,7 @@
return this.deserializeForm( form );
}.bind( this ) );
 
-   var lexeme = new wikibase.datamodel.Lexeme(
+   var lexeme = new wikibase.lexeme.datamodel.Lexeme(
serialization.id,
termMapDeserializer.deserialize( 
serialization.labels ),
statementGroupSetDeserializer.deserialize( 
serialization.claims )
diff --git a/tests/qunit/datamodel/Lexeme.tests.js 
b/tests/qunit/datamodel/Lexeme.tests.js
index d178c88..bf76eca 100644
--- a/tests/qunit/datamodel/Lexeme.tests.js
+++ b/tests/qunit/datamodel/Lexeme.tests.js
@@ -1,10 +1,10 @@
 (function ( wb, QUnit ) {
'use strict';
 
-   QUnit.module( 'wikibase.datamodel.Lexeme' );
+   QUnit.module( 'wikibase.lexeme.datamodel.Lexeme' );
 
-   /** @type {wikibase.datamodel.Lexeme} */
-   var Lexeme = wb.datamodel.Lexeme;
+   /** @type {wikibase.lexeme.datamodel.Lexeme} */
+   var Lexeme = wb.lexeme.datamodel.Lexeme;
/** @type {wikibase.lexeme.datamodel.LexemeForm} */
var LexemeForm = wb.lexeme.datamodel.LexemeForm;
 
diff --git a/tests/qunit/serialization/LexemeDeserializer.tests.js 
b/tests/qunit/serialization/LexemeDeserializer.tests.js
index dbda4fc..daae556 100644
--- a/tests/qunit/serialization/LexemeDeserializer.tests.js
+++ b/tests/qunit/serialization/LexemeDeserializer.tests.js
@@ -35,7 +35,7 @@
new wb.datamodel.PropertyNoValueSnak( 'P1' ), 
null, 'L1$1' ) )
] ) )
] );
-   var expectedDataModel = new wikibase.datamodel.Lexeme(
+   var expectedDataModel = new wikibase.lexeme.datamodel.Lexeme(
'L1',
null,
expectedStatementGroupSet

-- 
To view, visit https://gerrit.wikimedia.org/r/354248
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f1478105e71f227f36d6266de5e6ea5aada3dd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Aleksey Bekh-Ivanov (WMDE) 

___
MediaWiki-commits mailing list

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Log "api-readonly" errors

2017-05-18 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354246 )

Change subject: Log "api-readonly" errors
..

Log "api-readonly" errors

I have been asked for this repeatedly, so let's log these.

Bug: T164191
Bug: T123867
Change-Id: Ia09484d28d20b432dfd2769528fa2c731541
---
M wmf-config/InitialiseSettings.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/46/354246/1

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 24979a9..a5f1ae2 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -4848,6 +4848,7 @@
'antispoof' => 'debug',
'api' => [ 'logstash' => false ],
'api-feature-usage' => 'debug',
+   'api-readonly' => 'debug',
'ApiAction' => [
'udp2log' => false,
'logstash' => false,

-- 
To view, visit https://gerrit.wikimedia.org/r/354246
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia09484d28d20b432dfd2769528fa2c731541
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Hoo man 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...TocTree[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354245 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I993df5016c122cc82f7f968b18418171a19c9c8b
---
M TocTree.i18n.php
M composer.json
A phpcs.xml
3 files changed, 15 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TocTree 
refs/changes/45/354245/1

diff --git a/TocTree.i18n.php b/TocTree.i18n.php
index d5d53cd..77722fb 100644
--- a/TocTree.i18n.php
+++ b/TocTree.i18n.php
@@ -15,7 +15,7 @@
function wfJsonI18nShimbe1c9ea43bd38a62( $cache, $code, &$cachedData ) {
$codeSequence = array_merge( [ $code ], 
$cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
-   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
+   $fileName = __DIR__ . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
$data = FormatJson::decode( file_get_contents( 
$fileName ), true );
foreach ( array_keys( $data ) as $key ) {
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354245
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I993df5016c122cc82f7f968b18418171a19c9c8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TocTree
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add the "blacklistedUsageAspects" client setting

2017-05-18 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354244 )

Change subject: Add the "blacklistedUsageAspects" client setting
..

Add the "blacklistedUsageAspects" client setting

We need this to add new usage aspects which we don't
immediately want on all wikis.

Change-Id: I5817b1c2b85e8d4004dd32fe324a5f2ef777d1fb
---
M client/config/WikibaseClient.default.php
M client/includes/Store/Sql/DirectSqlStore.php
M client/includes/Usage/Sql/SqlUsageTracker.php
M client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
M docs/options.wiki
5 files changed, 109 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/44/354244/1

diff --git a/client/config/WikibaseClient.default.php 
b/client/config/WikibaseClient.default.php
index 0d3b5c1..6ad82b4 100644
--- a/client/config/WikibaseClient.default.php
+++ b/client/config/WikibaseClient.default.php
@@ -81,6 +81,8 @@
 */
'disabledDataTypes' => [],
 
+   'blacklistedUsageAspects' => [],
+
// The type of object cache to use. Use CACHE_XXX constants.
// This is both a repo and client setting, and should be set to 
the same value in
// repo and clients for multiwiki setups.
diff --git a/client/includes/Store/Sql/DirectSqlStore.php 
b/client/includes/Store/Sql/DirectSqlStore.php
index b87a048..5c8b642 100644
--- a/client/includes/Store/Sql/DirectSqlStore.php
+++ b/client/includes/Store/Sql/DirectSqlStore.php
@@ -166,6 +166,11 @@
private $writeFullEntityIdColumn;
 
/**
+* @var string[]
+*/
+   private $blacklistedUsageAspects;
+
+   /**
 * @param EntityChangeFactory $entityChangeFactory
 * @param EntityContentDataCodec $contentCodec
 * @param EntityIdParser $entityIdParser
@@ -202,6 +207,7 @@
$this->cacheDuration = $settings->getSetting( 
'sharedCacheDuration' );
$this->siteId = $settings->getSetting( 'siteGlobalID' );
$this->writeFullEntityIdColumn = $settings->getSetting( 
'writeFullEntityIdColumn' );
+   $this->blacklistedUsageAspects = $settings->getSetting( 
'blacklistedUsageAspects' );
}
 
/**
@@ -279,7 +285,7 @@
public function getUsageTracker() {
if ( $this->usageTracker === null ) {
$connectionManager = $this->getLocalConnectionManager();
-   $this->usageTracker = new SqlUsageTracker( 
$this->entityIdParser, $connectionManager );
+   $this->usageTracker = new SqlUsageTracker( 
$this->entityIdParser, $connectionManager, $this->blacklistedUsageAspects );
}
 
return $this->usageTracker;
diff --git a/client/includes/Usage/Sql/SqlUsageTracker.php 
b/client/includes/Usage/Sql/SqlUsageTracker.php
index 425fdc8..a66d4b6 100644
--- a/client/includes/Usage/Sql/SqlUsageTracker.php
+++ b/client/includes/Usage/Sql/SqlUsageTracker.php
@@ -35,6 +35,11 @@
private $connectionManager;
 
/**
+* @var string[]
+*/
+   private $blacklistedUsageAspects;
+
+   /**
 * @var int
 */
private $batchSize = 100;
@@ -42,10 +47,16 @@
/**
 * @param EntityIdParser $idParser
 * @param SessionConsistentConnectionManager $connectionManager
+* @param string[] $blacklistedUsageAspects
 */
-   public function __construct( EntityIdParser $idParser, 
SessionConsistentConnectionManager $connectionManager ) {
+   public function __construct(
+   EntityIdParser $idParser,
+   SessionConsistentConnectionManager $connectionManager,
+   array $blacklistedUsageAspects
+   ) {
$this->idParser = $idParser;
$this->connectionManager = $connectionManager;
+   $this->blacklistedUsageAspects = $blacklistedUsageAspects;
}
 
/**
@@ -106,6 +117,29 @@
}
 
/**
+* @param EntityUsage[] $usages
+*
+* @throws InvalidArgumentException
+* @return EntityUsage[]
+*/
+   private function removeBlacklistedUsages( array $usages ) {
+   $newUsages = array();
+
+   foreach ( $usages as $usage ) {
+   if ( !( $usage instanceof EntityUsage ) ) {
+   throw new InvalidArgumentException( '$usages 
must contain EntityUsage objects.' );
+   }
+   if ( in_array( $usage->getAspect(), 
$this->blacklistedUsageAspects ) ) {
+   continue;
+   }
+
+   $newUsages[] = $usage;
+   }
+
+   return $newUsages;
+   }
+
+   /**
 * @see UsageTracker::addUsedEntities
 

[MediaWiki-commits] [Gerrit] mediawiki...RelatedSites[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354243 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: Id2d7f9479f842758697292b7839adae482d31e4c
---
M RelatedSites.class.php
M composer.json
A phpcs.xml
3 files changed, 21 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RelatedSites 
refs/changes/43/354243/1

diff --git a/RelatedSites.class.php b/RelatedSites.class.php
index a113977..e7d6577 100644
--- a/RelatedSites.class.php
+++ b/RelatedSites.class.php
@@ -67,13 +67,12 @@
return true;
}
 
-
/**
 * @param array $relatedSites
 * @return array
 */
protected static function getRelatedSitesUrls( array $relatedSites ) {
-   $relatedSitesUrls = array();
+   $relatedSitesUrls = [];
 
foreach ( $relatedSites as $site ) {
$tmp = explode( ':', $site, 2 );
@@ -109,12 +108,12 @@
}
}
 
-   $relatedSitesUrls[] = array(
+   $relatedSitesUrls[] = [
'href' => $title->getFullURL(),
'text' => $linkText,
'title' => $linkTitle,
'class' => 'interwiki-' . $tmp[0]
-   );
+   ];
}
}
 
@@ -138,11 +137,11 @@
}
 
// build relatedsites 's
-   $relatedSites = array();
+   $relatedSites = [];
foreach ( (array) $relatedSitesUrls as $url ) {
$relatedSites[] =
-   Html::rawElement( 'li', array( 'class' => 
htmlspecialchars( $url['class'] ) ),
-   Html::rawElement( 'a', array( 'href' => 
htmlspecialchars( $url['href'] ) ),
+   Html::rawElement( 'li', [ 'class' => 
htmlspecialchars( $url['class'] ) ],
+   Html::rawElement( 'a', [ 'href' => 
htmlspecialchars( $url['href'] ) ],
$url['text']
)
);
@@ -150,7 +149,7 @@
 
// build complete html
$bar[$skin->msg( 'relatedsites-title' )->text()] =
-   Html::rawElement( 'ul', array(),
+   Html::rawElement( 'ul', [],
implode( '', $relatedSites )
);
 
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354243
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2d7f9479f842758697292b7839adae482d31e4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RelatedSites
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Poem[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354242 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I2b7c995e60d55e023b87c554274651654fb5d0b7
---
M Poem.class.php
M composer.json
A phpcs.xml
3 files changed, 22 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Poem 
refs/changes/42/354242/1

diff --git a/Poem.class.php b/Poem.class.php
index 586750c..f554fe5 100644
--- a/Poem.class.php
+++ b/Poem.class.php
@@ -10,7 +10,7 @@
 * @return bool true
 */
public static function init( &$parser ) {
-   $parser->setHook( 'poem', array( 'Poem', 'renderPoem' ) );
+   $parser->setHook( 'poem', [ 'Poem', 'renderPoem' ] );
return true;
}
 
@@ -22,7 +22,7 @@
 * @param boolean $frame
 * @return string
 */
-   public static function renderPoem( $in, $param = array(), $parser = 
null, $frame = false ) {
+   public static function renderPoem( $in, $param = [], $parser = null, 
$frame = false ) {
// using newlines in the text will cause the parser to add  
tags,
// which may not be desired in some cases
$newline = isset( $param['compact'] ) ? '' : "\n";
@@ -30,17 +30,17 @@
$tag = $parser->insertStripItem( "", $parser->mStripState 
);
 
// replace colons with indented spans
-   $text = preg_replace_callback( '/^(:+)(.+)$/m', array( 'Poem', 
'indentVerse' ), $in );
+   $text = preg_replace_callback( '/^(:+)(.+)$/m', [ 'Poem', 
'indentVerse' ], $in );
 
// replace newlines with  tags unless they are at the 
beginning or end
// of the poem
$text = preg_replace(
-   array( "/^\n/", "/\n$/D", "/\n/" ),
-   array( "", "", "$tag\n" ),
+   [ "/^\n/", "/\n$/D", "/\n/" ],
+   [ "", "", "$tag\n" ],
$text );
 
// replace spaces at the beginning of a line with non-breaking 
spaces
-   $text = preg_replace_callback( '/^( +)/m', array( 'Poem', 
'replaceSpaces' ), $text );
+   $text = preg_replace_callback( '/^( +)/m', [ 'Poem', 
'replaceSpaces' ], $text );
 
$text = $parser->recursiveTagParse( $text, $frame );
 
@@ -74,10 +74,10 @@
 * @return string
 */
protected static function indentVerse( $m ) {
-   $attribs = array(
+   $attribs = [
'class' => 'mw-poem-indented',
'style' => 'display: inline-block; margin-left: ' . 
strlen( $m[1] ) . 'em;'
-   );
+   ];
// @todo Should this really be raw?
return Html::rawElement( 'span', $attribs, $m[2] );
}
diff --git a/composer.json b/composer.json
index a3aecbe..e4e502f 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude node_modules --exclude 
vendor"
+   "parallel-lint . --exclude node_modules --exclude 
vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354242
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b7c995e60d55e023b87c554274651654fb5d0b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Poem
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...cxserver[master]: lineardoc: Add test to cover span wrapping for around linkba...

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354211 )

Change subject: lineardoc: Add test to cover span wrapping for around linkback 
a tags
..


lineardoc: Add test to cover span wrapping for around linkback a tags

Change-Id: I281ebe889bb5d58e35fa3586ffc76a873fbb4583
---
M test/lineardoc/LinearDoc.test.js
A test/lineardoc/data/test6-result.xhtml
A test/lineardoc/data/test6-result.xml
A test/lineardoc/data/test6.xhtml
4 files changed, 19 insertions(+), 1 deletion(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/test/lineardoc/LinearDoc.test.js b/test/lineardoc/LinearDoc.test.js
index ca397e9..2c27a97 100644
--- a/test/lineardoc/LinearDoc.test.js
+++ b/test/lineardoc/LinearDoc.test.js
@@ -9,7 +9,7 @@
it( 'should be possible to linearise all kind of HTML inputs', function 
() {
var parser, testXhtmlFile, resultXmlFile, resultXhtmlFile, 
testXhtml, resultXml,
resultXhtml, i,
-   numTests = 5;
+   numTests = 6;
for ( i = 1; i <= numTests; i++ ) {
testXhtmlFile = __dirname + '/data/test' + i + '.xhtml';
resultXmlFile = __dirname + '/data/test' + i + 
'-result.xml';
diff --git a/test/lineardoc/data/test6-result.xhtml 
b/test/lineardoc/data/test6-result.xhtml
new file mode 100644
index 000..e6376a9
--- /dev/null
+++ b/test/lineardoc/data/test6-result.xhtml
@@ -0,0 +1,3 @@
+
+1 2 
 foo
+
diff --git a/test/lineardoc/data/test6-result.xml 
b/test/lineardoc/data/test6-result.xml
new file mode 100644
index 000..06d0e70
--- /dev/null
+++ b/test/lineardoc/data/test6-result.xml
@@ -0,0 +1,12 @@
+
+
+
+
+  1 
+  2 
+   
+  foo
+
+
+
+
diff --git a/test/lineardoc/data/test6.xhtml b/test/lineardoc/data/test6.xhtml
new file mode 100644
index 000..453b5a8
--- /dev/null
+++ b/test/lineardoc/data/test6.xhtml
@@ -0,0 +1,3 @@
+
+1 2 
 foo
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354211
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I281ebe889bb5d58e35fa3586ffc76a873fbb4583
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 
Gerrit-Reviewer: KartikMistry 
Gerrit-Reviewer: Nikerabbit 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Refreshed[master]: Fixes for Echo

2017-05-18 Thread LegoFan4000 (Code Review)
LegoFan4000 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354241 )

Change subject: Fixes for Echo
..

Fixes for Echo

Bug: T163616
Please enter the commit message for your changes. Lines starting

Change-Id: I1f6525c26ce87996fea641dae3f829c33e986e06
---
M refreshed/extensions/Echo/echo.badge.less
M refreshed/extensions/Echo/echo.ui.less
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Refreshed 
refs/changes/41/354241/1

diff --git a/refreshed/extensions/Echo/echo.badge.less 
b/refreshed/extensions/Echo/echo.badge.less
index 41fa7b1..0cb19a9 100644
--- a/refreshed/extensions/Echo/echo.badge.less
+++ b/refreshed/extensions/Echo/echo.badge.less
@@ -2,8 +2,12 @@
display: none;
 }
 
-#pt-notifications {
-   display: inline;
+
+#pt-notifications-notice, #pt-notifications-alert {
float: right;
-   margin: 0.9em 0 0 0;
-}
+   }
+
+#pt-notifications-notice, #pt-notifications-alert {
+   display: inline;
+   margin: 0.9em 0.2em 0 0;
+   }
diff --git a/refreshed/extensions/Echo/echo.ui.less 
b/refreshed/extensions/Echo/echo.ui.less
index 2ec5f71..142462c 100644
--- a/refreshed/extensions/Echo/echo.ui.less
+++ b/refreshed/extensions/Echo/echo.ui.less
@@ -1,6 +1,6 @@
 #echo {
float: right; /* so Echo doesn't push menu items out of the header when 
the mobile logo is enabled */
-   padding-top: 1em;
+   padding-top: 0.1em;
line-height: 0;
 }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/354241
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f6525c26ce87996fea641dae3f829c33e986e06
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Refreshed
Gerrit-Branch: master
Gerrit-Owner: LegoFan4000 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Enable edit tab setup on appropriate Special pages

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353849 )

Change subject: Enable edit tab setup on appropriate Special pages
..


Enable edit tab setup on appropriate Special pages

Using the forthcoming wgRelevantPageIsProbablyEditable.

Bug: T165010
Depends-On: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1229
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 2 insertions(+), 5 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 917a2c2..5653786 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -761,7 +761,7 @@
( ( 'vewhitelist' in uri.query ) || !$.client.test( 
init.blacklist, null, true ) ) &&
 
// Not on protected pages, or if the user doesn't have 
permission to edit
-   mw.config.get( 'wgIsProbablyEditable' ) &&
+   ( mw.config.get( 'wgIsProbablyEditable' ) || mw.config.get( 
'wgRelevantPageIsProbablyEditable' ) ) &&
 
// Not on pages which are outputs of the Translate extensions
// TODO: Allow the Translate extension to do this itself
@@ -769,10 +769,7 @@
 
// Not on the edit conflict page of the TwoColumnConflict 
extension see T156251
// TODO: Allow the TwoColumnConflict extension to do this itself
-   mw.config.get( 'wgTwoColConflict' ) !== 'true' &&
-
-   // Not on pages like Special:RevisionDelete
-   mw.config.get( 'wgNamespaceNumber' ) !== -1
+   mw.config.get( 'wgTwoColConflict' ) !== 'true'
);
 
// Duplicated in VisualEditor.hooks.php#isVisualAvailable()

-- 
To view, visit https://gerrit.wikimedia.org/r/353849
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1229
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Change thank you and thank you test to thank you send

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354224 )

Change subject: Change thank you and thank you test to thank you send
..


Change thank you and thank you test to thank you send

Bug: T165671
Change-Id: If30368ebaf9b7d5fd4b1a701638196868710a0e5
---
M sites/all/modules/thank_you/thank_you.drush.inc
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/sites/all/modules/thank_you/thank_you.drush.inc 
b/sites/all/modules/thank_you/thank_you.drush.inc
index 6dbdc0d..a31611f 100644
--- a/sites/all/modules/thank_you/thank_you.drush.inc
+++ b/sites/all/modules/thank_you/thank_you.drush.inc
@@ -6,14 +6,14 @@
 function thank_you_drush_command() {
   $items = array();
 
-  $items['thank-you'] = array(
+  $items['thank-you-send'] = array(
 'description' => 
   'Sends thank you emails for donations',
 'examples' => array( 'drush thank-you' => '# Send thank you emails' ),
 'aliases' => array( 'ty' ),
   );
 
-  $items['thank-you-test'] = array(
+  $items['thank-you-send-test'] = array(
 'description' =>
   'Simulates sending 1000 thank you emails for donations, to test DB 
performance',
 'aliases' => array( 'tyt' ),
@@ -26,7 +26,7 @@
  */
 function thank_you_drush_help( $section ) {
   switch ( $section ) {
-case 'drush:thank-you':
+case 'drush:thank-you-send':
   return dt( "Send thank you emails for donations " );
   }
 }
@@ -37,7 +37,7 @@
  * This simply executes the code necessary to run the thank you modules.
  * All configuration happens in the module.
  */
-function drush_thank_you() {
+function drush_thank_you_send() {
   module_invoke( 'thank_you', 'batch_process' );
   $errors = drush_get_error_log();
   if (!empty($errors)){
@@ -60,6 +60,6 @@
  * This simply executes the code necessary to run the thank you modules.
  * All configuration happens in the module.
  */
-function drush_thank_you_test() {
+function drush_thank_you_send_test() {
module_invoke( 'thank_you', 'batch_test' );
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/354224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If30368ebaf9b7d5fd4b1a701638196868710a0e5
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Mepps 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Move example data from LexemeView to LexemeContent to make i...

2017-05-18 Thread Aleksey Bekh-Ivanov (WMDE) (Code Review)
Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354239 )

Change subject: Move example data from LexemeView to LexemeContent to make it 
"visible" to serializers
..

Move example data from LexemeView to LexemeContent to make it "visible" to 
serializers

Change-Id: Ideb0f9ba43a2e1b08645ef229e7405deab2bc169
---
M src/Content/LexemeContent.php
M src/DataModel/Lexeme.php
M src/View/LexemeView.php
3 files changed, 55 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/39/354239/1

diff --git a/src/Content/LexemeContent.php b/src/Content/LexemeContent.php
index b86a59a..0e881f9 100644
--- a/src/Content/LexemeContent.php
+++ b/src/Content/LexemeContent.php
@@ -3,11 +3,20 @@
 namespace Wikibase\Lexeme\Content;
 
 use InvalidArgumentException;
-use MongoDB\Driver\Exception\UnexpectedValueException;
 use Wikibase\Content\EntityHolder;
 use Wikibase\EntityContent;
 use Wikibase\Lexeme\DataModel\Lexeme;
 use Wikimedia\Assert\Assert;
+
+use DataValues\StringValue;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\DataModel\Snak\PropertyNoValueSnak;
+use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\Statement;
+use Wikibase\DataModel\Statement\StatementList;
+use Wikibase\Lexeme\DataModel\LexemeForm;
+use Wikibase\Lexeme\DataModel\LexemeFormId;
 
 /**
  * @license GPL-2.0+
@@ -44,7 +53,41 @@
 * @return Lexeme
 */
public function getEntity() {
-   return $this->lexemeHolder->getEntity( Lexeme::class );
+   /** @var Lexeme $lexeme */
+   $lexeme = $this->lexemeHolder->getEntity( Lexeme::class );
+
+   // TODO: This obviously is a dummy that must be removed
+   $grammaticalFeatures1 = [ new ItemId( 'Q2' ) ];
+   $grammaticalFeatures2 = [ new ItemId( 'Q2' ), new ItemId( 'Q3' 
) ];
+   $statements1 = new StatementList(
+   [
+   new Statement( new PropertyNoValueSnak( new 
PropertyId( 'P2' ) ), null, null, 'guid1' )
+   ]
+   );
+   $statements2 = new StatementList(
+   [
+   new Statement( new PropertyNoValueSnak( new 
PropertyId( 'P2' ) ), null, null, 'guid2' ),
+   new Statement(
+   new PropertyValueSnak(
+   new PropertyId( 'P3' ),
+   new StringValue( 'asd' )
+   ),
+   null,
+   null,
+   'guid3'
+   ),
+   ]
+   );
+
+   $forms = [
+   new LexemeForm( new LexemeFormId( 'F1' ), 'A', [] ),
+   new LexemeForm( new LexemeFormId( 'F2' ), 'B', 
$grammaticalFeatures1, $statements1 ),
+   new LexemeForm( new LexemeFormId( 'F3' ), 'C', 
$grammaticalFeatures2, $statements2 ),
+   ];
+
+   $lexeme->setForms( $forms );
+
+   return $lexeme;
}
 
/**
diff --git a/src/DataModel/Lexeme.php b/src/DataModel/Lexeme.php
index 014bab2..7575999 100644
--- a/src/DataModel/Lexeme.php
+++ b/src/DataModel/Lexeme.php
@@ -233,6 +233,14 @@
}
 
/**
+* @param LexemeForm[] $forms
+* @deprecated Temporary method, for demo. Just don't use.
+*/
+   public function setForms( $forms ) {
+   $this->forms = $forms;
+   }
+
+   /**
 * @return bool False if a non-optional field was never initialized, 
true otherwise.
 */
public function isSufficientlyInitialized() {
diff --git a/src/View/LexemeView.php b/src/View/LexemeView.php
index 22ac15c..4bdb94e 100644
--- a/src/View/LexemeView.php
+++ b/src/View/LexemeView.php
@@ -2,24 +2,16 @@
 
 namespace Wikibase\Lexeme\View;
 
-use DataValues\StringValue;
 use InvalidArgumentException;
 use Language;
 use Message;
 use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup;
 use Wikibase\DataModel\Services\Lookup\LabelDescriptionLookupException;
-use Wikibase\DataModel\Snak\PropertyNoValueSnak;
-use Wikibase\DataModel\Snak\PropertyValueSnak;
-use Wikibase\DataModel\Statement\Statement;
-use Wikibase\DataModel\Statement\StatementList;
 use Wikibase\DataModel\Term\Term;
 use Wikibase\DataModel\Term\TermList;
 use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\Lexeme\DataModel\LexemeForm;
-use 

[MediaWiki-commits] [Gerrit] mediawiki...ParsoidBatchAPI[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354238 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I75faa8bd39e062b12d544c2f48d1998bbce68893
---
M composer.json
M includes/ApiParsoidBatch.php
A phpcs.xml
3 files changed, 54 insertions(+), 42 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php
index fec3894..a4fcc27 100644
--- a/includes/ApiParsoidBatch.php
+++ b/includes/ApiParsoidBatch.php
@@ -21,7 +21,7 @@
$config = $context->getConfig();
$ipset = new IPSet( $config->get( 'ParsoidBatchAPI_AllowedIPs' 
) );
if ( !$ipset->match( $context->getRequest()->getIP() ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-notallowed', 'not_allowed' );
} else {
$this->dieUsage( "Client IP address not in 
ParsoidBatchAPI_AllowedIPs",
@@ -32,14 +32,14 @@
// Parameter validation
$batch = json_decode( $params['batch'], true );
if ( !is_array( $batch ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-invalidbatch', 'invalid_batch' );
} else {
$this->dieUsage( "Invalid batch, must be 
array", 'invalid_batch' );
}
}
if ( count( $batch ) > 500 ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-batchtoolarge', 'batch_too_large' );
} else {
$this->dieUsage( "Batch too large, limit is 
500", 'batch_too_large' );
@@ -49,7 +49,7 @@
wfIncrStats( 'ParsoidBatchAPI.items', count( $batch ) );
 
$size = 0;
-   $filenames = array();
+   $filenames = [];
foreach ( $batch as $itemIndex => $itemParams ) {
$action = $itemParams['action'];
$this->assertScalar( $itemParams, 'action' );
@@ -61,7 +61,7 @@
} elseif ( $action === 'pageprops' ) {
$this->assertArray( $itemParams, 'titles' );
if ( count( $itemParams['titles'] ) > 
ApiBase::LIMIT_BIG1 ) {
-   if ( is_callable( array( $this, 
'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 
'dieWithError' ] ) ) {
$this->dieWithError( [ 
'apiwarn-toomanyvalues', 'titles', ApiBase::LIMIT_BIG1 ] );
} else {
$this->dieUsage( "Too many 
titles", 'too-many-titles' );
@@ -84,7 +84,7 @@
$filenames[] = 
$batch[$itemIndex]['filename'] = $title->getDBkey();
}
} else {
-   if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) 
{
$this->dieWithError(
[ 
'apierror-parsoid-batch-invalidaction', wfEscapeWikiText( $itemIndex ) ], 
'invalid_action'
);
@@ -94,7 +94,7 @@
}
}
if ( $size > 1024 * $config->get( 'MaxArticleSize' ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   

[MediaWiki-commits] [Gerrit] mediawiki...Nostalgia[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354023 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: Icb479d07ce8854cd3d79b1def0640d31256fbbac
---
M Nostalgia_body.php
M composer.json
A phpcs.xml
3 files changed, 68 insertions(+), 47 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/Nostalgia_body.php b/Nostalgia_body.php
index 2e6ac3a..c3ad19f 100644
--- a/Nostalgia_body.php
+++ b/Nostalgia_body.php
@@ -73,13 +73,13 @@
$s .= $this->topLinks() . "\n";
 
$notice = $this->getSkin()->getSiteNotice();
-   if( $notice ) {
+   if ( $notice ) {
$s .= "\n$notice\n";
}
$s .= $this->pageTitleLinks();
 
$ol = $this->otherLanguages();
-   if( $ol ) {
+   if ( $ol ) {
$s .= '' . $ol;
}
 
@@ -119,16 +119,21 @@
 
$search = $wgRequest->getText( 'search' );
 
-   $s = 'searchboxes
+   . '" name="search" class="inline" method="post" 
action="'
. $this->getSkin()->escapeSearchLink() . "\">\n"
-   . '\n"
-   . '';
+   . '';
 
if ( $wgUseTwoButtonsSearchForm ) {
-   $s .= '\n";
+   $s .= '\n";
} else {
-   $s .= ' ' . wfMessage( 
'powersearch-legend' )->text() . "\n";
+   $s .= ' '
+   . wfMessage( 'powersearch-legend' )->text() . 
"\n";
}
 
$s .= '';
@@ -143,10 +148,10 @@
 * @return string
 */
function pageStats() {
-   $ret = array();
-   $items = array( 'viewcount', 'credits', 'lastmod', 
'numberofwatchingusers', 'copyright' );
+   $ret = [];
+   $items = [ 'viewcount', 'credits', 'lastmod', 
'numberofwatchingusers', 'copyright' ];
 
-   foreach( $items as $item ) {
+   foreach ( $items as $item ) {
if ( $this->data[$item] !== false ) {
$ret[] = $this->data[$item];
}
@@ -190,7 +195,7 @@
/* show my preferences link */
$s .= $sep . Linker::specialLink( 'Preferences' );
/* show upload file link */
-   if( UploadBase::isEnabled() && UploadBase::isAllowed( 
$user ) === true ) {
+   if ( UploadBase::isEnabled() && UploadBase::isAllowed( 
$user ) === true ) {
$s .= $sep . $this->getUploadLink();
}
 
@@ -225,12 +230,12 @@
if ( $varname == 'disable' ) {
continue;
}
-   $s = $wgLang->pipeList( array(
+   $s = $wgLang->pipeList( [
$s,
''
. htmlspecialchars( $varname ) 
. ''
-   ) );
+   ] );
}
}
 
@@ -336,7 +341,7 @@
$text = Language::fetchLanguageName( 
$nt->getInterwiki() );
 
$s .= Html::element( 'a',
-   array( 'href' => $nt->getFullURL(), 'title' => 
$nt->getText(), 'class' => "external" ),
+   [ 'href' => $nt->getFullURL(), 'title' => 
$nt->getText(), 'class' => 'external' ],
$text == '' ? $l : $text );
}
 
@@ -363,7 +368,7 @@
}
 
return Html::rawElement( 'form',
-   array( 'id' => 'specialpages', 'method' => 'get', 
'action' => $wgScript ),
+   [ 'id' => 'specialpages', 'method' => 'get', 'action' 
=> $wgScript ],
$select->getHTML() . Xml::submitButton( wfMessage( 'go' 
)->text() ) );
}
 
@@ -399,8 +404,8 @@
 
if ( $image ) {
$href = $image->getURL();
-   $s[] = Html::element( 'a', array( 
'href' => $href,
-   'title' => $href ), 
$title->getText() );
+   $s[] = Html::element( 'a', [ 'href' => 
$href,
+   'title' => $href ], 
$title->getText() );
 
}
}
@@ -420,15 +425,15 @@
   

[MediaWiki-commits] [Gerrit] mediawiki...MonoBook[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354019 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I9f48310a405844c61aa6619e6fc28cf3bcbb9619
---
M MonoBookTemplate.php
M SkinMonoBook.php
M composer.json
A phpcs.xml
4 files changed, 32 insertions(+), 18 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/MonoBookTemplate.php b/MonoBookTemplate.php
index 51670f7..6625e52 100644
--- a/MonoBookTemplate.php
+++ b/MonoBookTemplate.php
@@ -60,7 +60,9 @@

$this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
$this->text( 'pageLanguage' );
?>">html( 'title' ) ?>
-   
+   
 

msg( 
'tagline' ) ?>
@@ -126,27 +128,27 @@
if ( 
!$this->getSkin()->getUser()->isLoggedIn() &&

User::groupHasPermission( '*', 'edit' ) ) {
 
-   echo Html::rawElement( 
'li', array(
+   echo Html::rawElement( 
'li', [
'id' => 
'pt-anonuserpage'
-   ), $this->getMsg( 
'notloggedin' )->escaped() );
+   ], $this->getMsg( 
'notloggedin' )->escaped() );
}
 
foreach ( $personalTools as 
$key => $item ) { ?>
makeListItem( $key, $item ); ?>
 





 
$this->data['nav_urls']['mainpage']['href'],
'class' => 'mw-wiki-logo',
-   )
-   + 
Linker::tooltipAndAccesskeyAttribs( 'p-logo' )
+   ]
+   + Linker::tooltipAndAccesskeyAttribs( 
'p-logo' )
); ?>
 

@@ -250,19 +252,19 @@



-   makeSearchInput( 
array( 'id' => 'searchInput' ) ); ?>
+   makeSearchInput( [ 
'id' => 'searchInput' ] ); ?>
 
makeSearchButton(
'go',
-   array( 'id' => 
'searchGoButton', 'class' => 'searchButton' )
+   [ 'id' => 'searchGoButton', 
'class' => 'searchButton' ]
);
 
if ( $this->config->get( 
'UseTwoButtonsSearchForm' ) ) {
?>
makeSearchButton(
'fulltext',
-   array( 'id' => 
'mw-searchButton', 'class' => 'searchButton' )
+   [ 'id' => 
'mw-searchButton', 'class' => 'searchButton' ]
);
} else {
?>
@@ -318,8 +320,8 @@
 


renderAfterPortlet( 'tb' ); ?>
@@ -359,11 +361,11 @@
 * @param array|string $cont
 */
function customBox( $bar, $cont ) {
-   $portletAttribs = array(
+   $portletAttribs = [
'class' => 'generated-sidebar portlet',
'id' => Sanitizer::escapeId( "p-$bar" ),
'role' => 'navigation'
-   );
+   ];
 
$tooltip = Linker::titleAttrib( "p-$bar" );
if ( $tooltip !== false ) {
diff --git a/SkinMonoBook.php b/SkinMonoBook.php
index 0546e75..3c3437b 100644
--- a/SkinMonoBook.php
+++ b/SkinMonoBook.php
@@ -40,11 +40,11 @@
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
 
-   $out->addModuleStyles( array(
+   

[MediaWiki-commits] [Gerrit] mediawiki...Modern[master]: Add phpcs

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354018 )

Change subject: Add phpcs
..


Add phpcs

Change-Id: I9a5deb50df67a539ec61052d1b16b9c11291fecc
---
M composer.json
A phpcs.xml
2 files changed, 14 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/composer.json b/composer.json
index 8965257..1ef4ea4 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude node_modules --exclude 
vendor"
+   "parallel-lint . --exclude node_modules --exclude 
vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354018
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9a5deb50df67a539ec61052d1b16b9c11291fecc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Modern
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...PerformanceInspector[master]: Fix bad spacing in json file

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354015 )

Change subject: Fix bad spacing in json file
..


Fix bad spacing in json file

Change-Id: I7fafa70bfd7d6372060b72e03198e873303b0482
---
M i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Raimond Spekking: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/i18n/en.json b/i18n/en.json
index 4ec8cd0..81a6ad4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -77,5 +77,5 @@
"performanceinspector-newpp-cachereport-description": "When was this 
page cached in the parser cache.",
"performanceinspector-newpp-cachereport-now": "Now",
"performanceinspector-newpp-missing-report": "Couldn't fetch parser 
report data so the parser report fields will be empty.",
-  "performanceinspector-pagesize-summary": "The HTML size is $1 ($2 
compressed)"
+   "performanceinspector-pagesize-summary": "The HTML size is $1 ($2 
compressed)"
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/354015
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7fafa70bfd7d6372060b72e03198e873303b0482
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PerformanceInspector
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Raimond Spekking 
Gerrit-Reviewer: Siebrand 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Introduce wgRelevantPageIsProbablyEditable

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353848 )

Change subject: Introduce wgRelevantPageIsProbablyEditable
..


Introduce wgRelevantPageIsProbablyEditable

This is equivalent to the existing variable wgIsProbablyEditable and in
keeping with wgRelevantPageName/wgRelevantArticleId; this is done as an
alternative to making a breaking change to the semantics of the former,
as that might cause issues for users who expect wgIsProbablyEditable to
return true on [[Foo]], but false on [[Special:Move/Foo]] and similar.

Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
---
M includes/OutputPage.php
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Brion VIBBER: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 85610b9..bab52a3 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3221,6 +3221,10 @@
$vars['wgIsProbablyEditable'] = $title->quickUserCan( 'edit', 
$user )
&& ( $title->exists() || $title->quickUserCan( 
'create', $user ) );
 
+   $vars['wgRelevantPageIsProbablyEditable'] = $relevantTitle
+   && $relevantTitle->quickUserCan( 'edit', $user )
+   && ( $relevantTitle->exists() || 
$relevantTitle->quickUserCan( 'create', $user ) );
+
foreach ( $title->getRestrictionTypes() as $type ) {
$vars['wgRestriction' . ucfirst( $type )] = 
$title->getRestrictions( $type );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/353848
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Dashiki[master]: Downgrade extension.json to manifest_version 1

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354149 )

Change subject: Downgrade extension.json to manifest_version 1
..


Downgrade extension.json to manifest_version 1

To fix the incompatibility after the version 2 format changed in
fdb7e9410465fd8f2, downgrade to manifest_version 1.

Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/extension.json b/extension.json
index 45799a1..e1745a1 100644
--- a/extension.json
+++ b/extension.json
@@ -27,5 +27,5 @@
"isLocal": true
}
},
-   "manifest_version": 2
+   "manifest_version": 1
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/354149
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e79727094c4ec9b627c173bbe6db8cbdbcaa970
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Dashiki
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Umherirrender 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...CologneBlue[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354017 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I4485386f823d4a10cf69f5f08affdee0547fe175
---
M SkinCologneBlue.php
M composer.json
A phpcs.xml
3 files changed, 43 insertions(+), 31 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/SkinCologneBlue.php b/SkinCologneBlue.php
index ce93713..4a2b0e7 100644
--- a/SkinCologneBlue.php
+++ b/SkinCologneBlue.php
@@ -74,12 +74,12 @@
 * @return string
 */
function variantLinks() {
-   $s = array();
+   $s = [];
 
$variants = $this->data['content_navigation']['variants'];
 
foreach ( $variants as $key => $link ) {
-   $s[] = $this->makeListItem( $key, $link, array( 'tag' 
=> 'span' ) );
+   $s[] = $this->makeListItem( $key, $link, [ 'tag' => 
'span' ] );
}
 
return $this->getSkin()->getLanguage()->pipeList( $s );
@@ -96,9 +96,9 @@
// not to capitalize the language names.
$language_urls = $this->data['language_urls'];
if ( !empty( $language_urls ) ) {
-   $s = array();
+   $s = [];
foreach ( $language_urls as $key => $data ) {
-   $s[] = $this->makeListItem( $key, $data, array( 
'tag' => 'span' ) );
+   $s[] = $this->makeListItem( $key, $data, [ 
'tag' => 'span' ] );
}
 
$html = wfMessage( 'otherlanguages' )->text()
@@ -116,7 +116,7 @@
 */
protected function renderAfterPortlet( $name ) {
$content = '';
-   Hooks::run( 'BaseTemplateAfterPortlet', array( $this, $name, 
&$content ) );
+   Hooks::run( 'BaseTemplateAfterPortlet', [ $this, $name, 
&$content ] );
 
$html = $content !== '' ? "$content" : '';
 
@@ -124,7 +124,7 @@
}
 
function pageTitleLinks() {
-   $s = array();
+   $s = [];
$footlinks = $this->getFooterLinks();
 
foreach ( $footlinks['places'] as $item ) {
@@ -156,7 +156,7 @@
return $this->makeListItem(
$key,
$this->processNavlinkForDocument( $navlink ),
-   array( 'tag' => 'span' )
+   [ 'tag' => 'span' ]
);
}
 
@@ -164,11 +164,11 @@
$toolbox = $this->getToolbox();
$content_nav = $this->data['content_navigation'];
 
-   $lines = array();
+   $lines = [];
 
if ( $this->getSkin()->getOutput()->isArticleRelated() ) {
// First row. Regular actions.
-   $element = array();
+   $element = [];
 
$editLinkMessage = 
$this->getSkin()->getTitle()->exists() ? 'editthispage' : 'create-this-page';
$element[] = $this->processBottomLink( 'edit', 
$content_nav['views']['edit'], $editLinkMessage );
@@ -204,7 +204,7 @@
$lines[] = $this->getSkin()->getLanguage()->pipeList( 
array_filter( $element ) );
 
// Second row. Privileged actions.
-   $element = array();
+   $element = [];
 
$element[] = $this->processBottomLink(
'delete',
@@ -259,7 +259,7 @@
 
// TODO these messages are only be used by CologneBlue,
// kill and replace with something more sensibly named?
-   $nsToMessage = array(
+   $nsToMessage = [
NS_MAIN => 'articlepage',
NS_USER => 'userpage',
NS_PROJECT => 'projectpage',
@@ -269,7 +269,7 @@
NS_HELP => 'viewhelppage',
NS_CATEGORY => 'categorypage',
NS_FILE => 'imagepage',
-   );
+   ];
 
// Find out the message to use for link text. Use either the 
array above or,
// for non-talk pages, a generic "discuss this" message.
@@ -407,11 +407,11 @@
echo "\n";
 
// Footer and second searchbox
-   echo $this->getSkin()->getLanguage()->pipeList( 
array(
+   echo $this->getSkin()->getLanguage()->pipeList( 
[
$this->getSkin()->mainPageLink(),
$this->getSkin()->aboutLink(),

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: build: Update eslint to 0.4.0 and make a pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352014 )

Change subject: build: Update eslint to 0.4.0 and make a pass
..


build: Update eslint to 0.4.0 and make a pass

Change-Id: I444cfd511121a0547901ed87c9aedd410e7920bd
---
M package.json
M resources/mmv/model/mmv.model.ThumbnailWidth.js
M tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js
M tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js
4 files changed, 63 insertions(+), 62 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/package.json b/package.json
index e8b9142..9fddd4b 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
 "doc": "jsduck"
   },
   "devDependencies": {
-"eslint-config-wikimedia": "0.3.0",
+"eslint-config-wikimedia": "0.4.0",
 "grunt": "1.0.1",
 "grunt-banana-checker": "0.5.0",
 "grunt-eslint": "19.0.0",
diff --git a/resources/mmv/model/mmv.model.ThumbnailWidth.js 
b/resources/mmv/model/mmv.model.ThumbnailWidth.js
index b23c0cc..77df870 100644
--- a/resources/mmv/model/mmv.model.ThumbnailWidth.js
+++ b/resources/mmv/model/mmv.model.ThumbnailWidth.js
@@ -15,67 +15,68 @@
  * along with MultimediaViewer.  If not, see .
  */
 
-/**
- * Represents image width information.
- *
- * To utilize caching as much as possible, we use images which are displayed 
at a slightly
- * different size than their screen size. The ThumbnailWidth model stores the 
various types of
- * sizes and helps avoiding accidental incompatible assignments. (Think of it 
as a slightly
- * overcomplicated Hungarian notation)
- *
- * @class mw.mmv.model.ThumbnailWidth
- * @constructor
- * @param {number} cssWidth width in CSS pixels
- * @param {number} cssHeight height in CSS pixels
- * @param {number} screen width in screen pixels
- * @param {number} real width in real pixels
- */
-function ThumbnailWidth( cssWidth, cssHeight, screen, real ) {
-   if ( !cssWidth || !cssHeight || !screen || !real ) {
-   throw new Error( 'All parameters are required and cannot be 
empty or zero' );
+( function ( mw ) {
+   /**
+* Represents image width information.
+*
+* To utilize caching as much as possible, we use images which are 
displayed at a slightly
+* different size than their screen size. The ThumbnailWidth model 
stores the various types of
+* sizes and helps avoiding accidental incompatible assignments. (Think 
of it as a slightly
+* overcomplicated Hungarian notation)
+*
+* @class mw.mmv.model.ThumbnailWidth
+* @constructor
+* @param {number} cssWidth width in CSS pixels
+* @param {number} cssHeight height in CSS pixels
+* @param {number} screen width in screen pixels
+* @param {number} real width in real pixels
+*/
+   function ThumbnailWidth( cssWidth, cssHeight, screen, real ) {
+   if ( !cssWidth || !cssHeight || !screen || !real ) {
+   throw new Error( 'All parameters are required and 
cannot be empty or zero' );
+   }
+
+   /**
+* Width of the thumbnail on the screen, in CSS pixels. This is 
the number which can be plugged
+* into UI code like $element.width(x).
+*
+* @property {number}
+*/
+   this.cssWidth = cssWidth;
+
+   /**
+* Height of the thumbnail on the screen, in CSS pixels. This 
is the number which can be plugged
+* into UI code like $element.height(x).
+*
+* @property {number}
+*/
+   this.cssHeight = cssHeight;
+
+   /**
+* Width of the thumbnail on the screen, in device pixels. On 
most devices this is the same as
+* the CSS width, but devices with high pixel density displays 
have multiple screen pixels
+* in a CSS pixel.
+*
+* This value is mostly used internally; for most purposes you 
will need one of the others.
+*
+* @property {number}
+*/
+   this.screen = screen;
+
+   /**
+* "Real" width of the thumbnail. This is the number you need 
to use in API requests when
+* obtaining the thumbnail URL. This is usually larger than the 
screen width, since
+* downscaling images via CSS looks OK but upscaling them looks 
ugly. However, for images
+* where the full size itself is very small, this can be 
smaller than the screen width, since
+* we cannot create a thumbnail which is larger than the 
original image. (In such cases the
+* image is just positioned to the center of 

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Code lint: Throw errors, no strings

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/351597 )

Change subject: Code lint: Throw errors, no strings
..


Code lint: Throw errors, no strings

Change-Id: I4bb4de96a5e61b67b7a4c8f16a22f67f53cb034f
---
M resources/mmv/logging/mmv.logging.DurationLogger.js
M resources/mmv/mmv.HtmlUtils.js
M resources/mmv/mmv.ThumbnailWidthCalculator.js
M resources/mmv/mmv.js
M resources/mmv/model/mmv.model.EmbedFileInfo.js
M resources/mmv/model/mmv.model.Image.js
M resources/mmv/model/mmv.model.License.js
M resources/mmv/model/mmv.model.TaskQueue.js
M resources/mmv/model/mmv.model.Thumbnail.js
M resources/mmv/model/mmv.model.ThumbnailWidth.js
M resources/mmv/routing/mmv.routing.Router.js
M resources/mmv/routing/mmv.routing.ThumbnailRoute.js
M tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
13 files changed, 16 insertions(+), 16 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/resources/mmv/logging/mmv.logging.DurationLogger.js 
b/resources/mmv/logging/mmv.logging.DurationLogger.js
index 726eaa5..d2e0f91 100644
--- a/resources/mmv/logging/mmv.logging.DurationLogger.js
+++ b/resources/mmv/logging/mmv.logging.DurationLogger.js
@@ -63,7 +63,7 @@
start = $.now();
 
if ( !typeOrTypes ) {
-   throw 'Must specify type';
+   throw new Error( 'Must specify type' );
}
 
if ( !$.isArray( typeOrTypes ) ) {
@@ -92,7 +92,7 @@
var stop = $.now();
 
if ( !type ) {
-   throw 'Must specify type';
+   throw new Error( 'Must specify type' );
}
 
// Don't overwrite an existing value
@@ -120,7 +120,7 @@
var e, duration;
 
if ( !type ) {
-   throw 'Must specify type';
+   throw new Error( 'Must specify type' );
}
 
if ( !this.starts.hasOwnProperty( type ) || this.starts[ type ] 
=== undefined ) {
diff --git a/resources/mmv/mmv.HtmlUtils.js b/resources/mmv/mmv.HtmlUtils.js
index fd9610d..c3fffdc 100644
--- a/resources/mmv/mmv.HtmlUtils.js
+++ b/resources/mmv/mmv.HtmlUtils.js
@@ -55,7 +55,7 @@
return $( '' + html + '' );
} else {
mw.log.warn( 'wrapAndJquerify: unknown type', html );
-   throw 'wrapAndJquerify: unknown type';
+   throw new Error( 'wrapAndJquerify: unknown type' );
}
};
 
diff --git a/resources/mmv/mmv.ThumbnailWidthCalculator.js 
b/resources/mmv/mmv.ThumbnailWidthCalculator.js
index 7f856be..2087aa4 100644
--- a/resources/mmv/mmv.ThumbnailWidthCalculator.js
+++ b/resources/mmv/mmv.ThumbnailWidthCalculator.js
@@ -40,7 +40,7 @@
options = $.extend( {}, this.defaultOptions, options );
 
if ( !options.widthBuckets.length ) {
-   throw 'No buckets!';
+   throw new Error( 'No buckets!' );
}
 
/**
diff --git a/resources/mmv/mmv.js b/resources/mmv/mmv.js
index d6aa6f4..8d164ba 100644
--- a/resources/mmv/mmv.js
+++ b/resources/mmv/mmv.js
@@ -484,7 +484,7 @@
if ( recursion ) {
// this should not be possible, but an infinite 
recursion is nasty
// business, so we make a sanity check
-   throw 'MediaViewer internal error: 
displayPlaceholderThumbnail recursion';
+   throw new Error( 'MediaViewer internal error: 
displayPlaceholderThumbnail recursion' );
}
this.imageInfoProvider.get( image.filePageTitle ).done( 
function ( imageInfo ) {
// Make sure the user has not navigated away 
while we were waiting for the size
diff --git a/resources/mmv/model/mmv.model.EmbedFileInfo.js 
b/resources/mmv/model/mmv.model.EmbedFileInfo.js
index 69844d6..3e5378d 100644
--- a/resources/mmv/model/mmv.model.EmbedFileInfo.js
+++ b/resources/mmv/model/mmv.model.EmbedFileInfo.js
@@ -33,7 +33,7 @@
alt
) {
if ( !imageInfo || !repoInfo ) {
-   throw 'imageInfo and repoInfo are required and must 
have a value';
+   throw new Error( 'imageInfo and repoInfo are required 
and must have a value' );
}
 
/** @property {mw.mmv.model.Image} imageInfo The title of the 
file */
diff --git a/resources/mmv/model/mmv.model.Image.js 
b/resources/mmv/model/mmv.model.Image.js
index 27ad16f..03cf44e 100644
--- a/resources/mmv/model/mmv.model.Image.js
+++ b/resources/mmv/model/mmv.model.Image.js
@@ -297,7 +297,7 @@
} 

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.model.TaskQueue qunit tests

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354102 )

Change subject: Fix mmv.model.TaskQueue qunit tests
..


Fix mmv.model.TaskQueue qunit tests

Bug: T164473
Change-Id: Iaefae1d00a0469f11ddb3fcecb4f831346ac0eec
---
M tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js 
b/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
index 7284f00..bfbb67d 100644
--- a/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
+++ b/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
@@ -36,14 +36,15 @@
 
QUnit.test( 'State check', 3, function ( assert ) {
var taskQueue = new mw.mmv.model.TaskQueue(),
-   task = $.Deferred();
+   task = $.Deferred(),
+   promise;
 
taskQueue.push( function () { return task; } );
 
assert.strictEqual( taskQueue.state, 
mw.mmv.model.TaskQueue.State.NOT_STARTED,
'state is initially NOT_STARTED' );
 
-   taskQueue.execute().then( function () {
+   promise = taskQueue.execute().then( function () {
assert.strictEqual( taskQueue.state, 
mw.mmv.model.TaskQueue.State.FINISHED,
'state is FINISHED after execution finished' );
} );
@@ -51,7 +52,9 @@
assert.strictEqual( taskQueue.state, 
mw.mmv.model.TaskQueue.State.RUNNING,
'state is RUNNING after execution started' );
 
-   return task.resolve();
+   task.resolve();
+
+   return promise;
} );
 
QUnit.test( 'State check for cancellation', 1, function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/354102
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaefae1d00a0469f11ddb3fcecb4f831346ac0eec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Allow \r\n in wikilink titles.

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354235 )

Change subject: Allow \r\n in wikilink titles.
..


Allow \r\n in wikilink titles.

This fixes an RT testing regression on
[[it:Teenage Mutant Ninja Turtles - Tartarughe Ninja]]
caused by this fragment of (bogus) wikitext:

  |autori = [[  Ciro Nieli
  Joshua Sternin
  J. R. Ventimilia]]

In general our practice now is *not* to try to validate the title inside
the tokenizer, but instead to accept the same set of characters here that
the PHP preprocessor does and wait until later title validation to
unlink bogus titles.

Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
---
M lib/wt2html/pegTokenizer.pegjs
M tests/parserTests.txt
2 files changed, 16 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Arlolra: Looks good to me, approved



diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 2664c17..72b2d42 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -1950,7 +1950,7 @@
 wikilink_preprocessor_text
   = r:( t:$[^<[{\n\r\t|!\]}{ &\-]+
 // XXX gwicke: any more chars we need to allow here?
-/ !inline_breaks wr:( directive / $( !"]]" ( text_char / [!<\-\}\]] ) 
) )
+/ !inline_breaks wr:( directive / $( !"]]" ( text_char / 
[!<\-\}\]\n\r] ) ) )
 { return wr; }
 )+ {
   return tu.flattenStringlist(r);
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 2d107e7..0d93294 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -5332,6 +5332,21 @@
 !! end
 
 !! test
+Wikilinks with embedded newlines are not broken
+!! wikitext
+{{echo|[[ Foo
+B
+C]]}}
+!! html/php
+[[ Foo
+B
+C]]
+
+!! html/parsoid
+[[ Foo B C]]
+!! end
+
+!! test
 Broken templates
 !! options
 parsoid=wt2html

-- 
To view, visit https://gerrit.wikimedia.org/r/354235
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian 
Gerrit-Reviewer: Arlolra 
Gerrit-Reviewer: Subramanya Sastry 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: db-eqiad.php: Repool db1074, depool db1060

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354237 )

Change subject: db-eqiad.php: Repool db1074, depool db1060
..


db-eqiad.php: Repool db1074, depool db1060

db1074 finished alter table
db1060 needs alter table

Bug: T162611
Change-Id: I0d18868ed21e8412569aa70ebeb68073484b9bfe
---
M wmf-config/db-eqiad.php
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Marostegui: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php
index cd02ee6..51dd0af 100644
--- a/wmf-config/db-eqiad.php
+++ b/wmf-config/db-eqiad.php
@@ -110,8 +110,8 @@
 #  'db1018' => 0,   # B1 1.4TB  64GB, old master 2
'db1021' => 0,   # B1 1.4TB  64GB, vslow, dump
'db1036' => 1,   # B2 1.4TB  64GB, watchlist, recentchanges, 
contributions, logpager
-   'db1060' => 1,   # C2 2.8TB  96GB, api
-#  'db1074' => 300, # A2 3.6TB 512GB, api #T162611
+#  'db1060' => 1,   # C2 2.8TB  96GB, api #T162611
+   'db1074' => 300, # A2 3.6TB 512GB, api
'db1076' => 300, # B1 3.6TB 512GB  #temporary api #T162611
'db1090' => 500, # C3 3.6TB 512GB
],
@@ -274,7 +274,8 @@
'db1021' => 1,
],
'api' => [
-   'db1060' => 2,
+#  'db1060' => 2,
+   'db1074' => 1,
'db1076' => 1,
],
'watchlist' => [

-- 
To view, visit https://gerrit.wikimedia.org/r/354237
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d18868ed21e8412569aa70ebeb68073484b9bfe
Gerrit-PatchSet: 2
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Marostegui 
Gerrit-Reviewer: Jcrespo 
Gerrit-Reviewer: Marostegui 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.lightboxInterface qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353999 )

Change subject: Fix mmv.lightboxInterface qunit tests
..


Fix mmv.lightboxInterface qunit tests

Bug: T164473
Change-Id: I5d2ddba1e1a5cb69de276d790841536fde77d108
---
M tests/qunit/mmv/mmv.lightboxinterface.test.js
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/mmv.lightboxinterface.test.js 
b/tests/qunit/mmv/mmv.lightboxinterface.test.js
index 2922581..9003c38 100644
--- a/tests/qunit/mmv/mmv.lightboxinterface.test.js
+++ b/tests/qunit/mmv/mmv.lightboxinterface.test.js
@@ -56,7 +56,8 @@
 
QUnit.test( 'Handler registration and clearance work OK', 2, function ( 
assert ) {
var lightbox = new mw.mmv.LightboxInterface(),
-   handlerCalls = 0;
+   handlerCalls = 0,
+   clock = this.sandbox.useFakeTimers();
 
function handleEvent() {
handlerCalls++;
@@ -64,10 +65,16 @@
 
lightbox.handleEvent( 'test', handleEvent );
$( document ).trigger( 'test' );
+   clock.tick( 10 );
assert.strictEqual( handlerCalls, 1, 'The handler was called 
when we triggered the event.' );
+
lightbox.clearEvents();
+
$( document ).trigger( 'test' );
+   clock.tick( 10 );
assert.strictEqual( handlerCalls, 1, 'The handler was not 
called after calling lightbox.clearEvents().' );
+
+   clock.restore();
} );
 
QUnit.test( 'Fullscreen mode', 8, function ( assert ) {
@@ -98,7 +105,7 @@
$.support.fullscreen = true;
lightbox.setupCanvasButtons();
 
-   assert.strictEqual( lightbox.$fullscreenButton.css( 'display' 
), 'inline-block',
+   assert.strictEqual( lightbox.$fullscreenButton.css( 'display' 
), '',
'Fullscreen button is visible when fullscreen mode is 
available' );
 
// Entering fullscreen

-- 
To view, visit https://gerrit.wikimedia.org/r/353999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5d2ddba1e1a5cb69de276d790841536fde77d108
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.logging.DurationLogger qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353891 )

Change subject: Fix mmv.logging.DurationLogger qunit tests
..


Fix mmv.logging.DurationLogger qunit tests

Bug: T164473
Change-Id: I9787948e26d27e8fcee934e05e2c200eeec5d82f
---
M tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js
1 file changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js 
b/tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js
index 6ad8621..ea5caf5 100644
--- a/tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.DurationLogger.test.js
@@ -2,6 +2,18 @@
QUnit.module( 'mmv.logging.DurationLogger', QUnit.newMwEnvironment( {
setup: function () {
this.clock = this.sandbox.useFakeTimers();
+
+   // since jQuery 2/3, $.now will capture a reference to 
Date.now
+   // before above fake timer gets a chance to override 
it, so I'll
+   // override that new behavior in order to run these 
tests...
+   // @see https://github.com/sinonjs/lolex/issues/76
+   this.oldNow = $.now;
+   $.now = function() { return +( new Date() ); };
+   },
+
+   teardown: function () {
+   $.now = this.oldNow;
+   this.clock.restore();
}
} ) );
 
@@ -96,6 +108,7 @@
assert.ok( !fakeEventLog.logEvent.called, 'Event queued if 
dependencies not loaded' );
 
dependenciesDeferred.resolve();
+   this.clock.tick( 10 );
 
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 0 
], 'MultimediaViewerDuration', 'EventLogging schema is correct' );
assert.deepEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ], 
{ type: 'bar', duration: 1000, loggedIn: true, samplingFactor: 1 },
@@ -111,6 +124,7 @@
this.clock.tick( 3000 );
durationLogger.stop( 'foo' );
durationLogger.record( 'foo' );
+   this.clock.tick( 10 );
 
assert.strictEqual( fakeEventLog.logEvent.getCall( 2 ).args[ 0 
], 'MultimediaViewerDuration', 'EventLogging schema is correct' );
assert.deepEqual( fakeEventLog.logEvent.getCall( 2 ).args[ 1 ], 
{ type: 'foo', duration: 3000, loggedIn: true, samplingFactor: 1 },
@@ -126,6 +140,7 @@
this.clock.tick( 2000 );
durationLogger.stop( 'baz' );
durationLogger.record( 'baz' );
+   this.clock.tick( 10 );
 
assert.strictEqual( fakeEventLog.logEvent.getCall( 3 ).args[ 0 
], 'MultimediaViewerDuration', 'EventLogging schema is correct' );
assert.deepEqual( fakeEventLog.logEvent.getCall( 3 ).args[ 1 ], 
{ type: 'baz', duration: 2000, loggedIn: false, country: 'FR', samplingFactor: 
1 },
@@ -136,6 +151,7 @@
 
durationLogger.stop( 'fooz', $.now() - 9000 );
durationLogger.record( 'fooz' );
+   this.clock.tick( 10 );
 
assert.deepEqual( fakeEventLog.logEvent.getCall( 4 ).args[ 1 ], 
{ type: 'fooz', duration: 9000, loggedIn: false, country: 'FR', samplingFactor: 
1 },
'EventLogging data is correct' );
@@ -144,11 +160,13 @@
 
durationLogger.stop( 'foo' );
durationLogger.record( 'foo' );
+   this.clock.tick( 10 );
 
assert.strictEqual( fakeEventLog.logEvent.callCount, 5, 'Record 
without a start doesn\'t get logged' );
 
durationLogger.start( 'foofoo' );
durationLogger.record( 'foofoo' );
+   this.clock.tick( 10 );
 
assert.strictEqual( fakeEventLog.logEvent.callCount, 5, 'Record 
without a stop doesn\'t get logged' );
 
@@ -156,6 +174,7 @@
this.clock.tick( 5000 );
durationLogger.stop( 'extra' );
durationLogger.record( 'extra', { bim: 'bam' } );
+   this.clock.tick( 10 );
 
assert.deepEqual( fakeEventLog.logEvent.getCall( 5 ).args[ 1 ], 
{ type: 'extra', duration: 5000, loggedIn: false, country: 'FR', 
samplingFactor: 1, bim: 'bam' },
'EventLogging data is correct' );
@@ -170,6 +189,7 @@
mw.loader.using.withArgs( [ 'ext.eventLogging', 
'schema.MultimediaViewerDuration' ] ).throwsException( 'EventLogging is 
missing' );
 
promise = durationLogger.loadDependencies();
+   this.clock.tick( 10 );
 
assert.strictEqual( promise.state(), 'rejected', 'Promise is 
rejected' );
 
@@ -180,6 +200,7 @@

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.logging.PerformanceLogger qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353890 )

Change subject: Fix mmv.logging.PerformanceLogger qunit tests
..


Fix mmv.logging.PerformanceLogger qunit tests

Bug: T164473
Change-Id: I6ae5c0170bf12fb076ddc505299ceeb7b9c292e8
---
M resources/mmv/logging/mmv.logging.PerformanceLogger.js
M tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
2 files changed, 79 insertions(+), 61 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/resources/mmv/logging/mmv.logging.PerformanceLogger.js 
b/resources/mmv/logging/mmv.logging.PerformanceLogger.js
index fdbfd65..639e907 100644
--- a/resources/mmv/logging/mmv.logging.PerformanceLogger.js
+++ b/resources/mmv/logging/mmv.logging.PerformanceLogger.js
@@ -116,6 +116,7 @@
 * @param {string} url URL of that was measured
 * @param {XMLHttpRequest} request HTTP request that just completed
 * @param {jQuery.Deferred.} [extraStatsDeferred] A promise 
which resolves to extra stats to be included.
+* @return {jQuery.Promise}
 */
PL.recordEntry = function ( type, total, url, request, 
extraStatsDeferred ) {
var matches,
@@ -133,7 +134,7 @@
if ( url && url.length ) {
// There is no need to measure the same url more than 
once
if ( url in this.performanceChecked ) {
-   return;
+   return $.Deferred().reject();
}
 
this.performanceChecked[ url ] = true;
@@ -166,7 +167,7 @@
}
}
 
-   ( extraStatsDeferred || $.Deferred().reject() ).done( function 
( extraStats ) {
+   return ( extraStatsDeferred || $.Deferred().reject() ).done( 
function ( extraStats ) {
stats = $.extend( stats, extraStats );
} ).always( function () {
logger.log( stats );
diff --git a/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js 
b/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
index 006f392..777f129 100644
--- a/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js
@@ -40,7 +40,9 @@
var performance = new mw.mmv.logging.PerformanceLogger(),
fakeEventLog = { logEvent: this.sandbox.stub() },
type = 'gender',
-   total = 100;
+   total = 100,
+   // we'll be waiting for 4 promises to complete
+   asyncs = [ assert.async(), assert.async(), 
assert.async(), assert.async() ];
 
this.sandbox.stub( performance, 'loadDependencies' ).returns( 
$.Deferred().resolve() );
this.sandbox.stub( performance, 'isInSample' );
@@ -48,27 +50,30 @@
 
performance.isInSample.returns( false );
 
-   performance.recordEntry( type, total );
-
-   assert.strictEqual( fakeEventLog.logEvent.callCount, 0, 'No 
stats should be logged if not in sample' );
+   performance.recordEntry( type, total ).then( null, function () {
+   assert.strictEqual( fakeEventLog.logEvent.callCount, 0, 
'No stats should be logged if not in sample' );
+   asyncs.pop()();
+   } );
 
performance.isInSample.returns( true );
 
-   performance.recordEntry( type, total );
+   performance.recordEntry( type, total ).then( null, function () {
+   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 
).args[ 0 ], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is 
correct' );
+   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 
).args[ 1 ].type, type, 'type is correct' );
+   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 
).args[ 1 ].total, total, 'total is correct' );
+   assert.strictEqual( fakeEventLog.logEvent.callCount, 1, 
'Stats should be logged' );
+   asyncs.pop()();
+   } );
 
-   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 0 
], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is correct' );
-   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 
].type, type, 'type is correct' );
-   assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 
].total, total, 'total is correct' );
+   performance.recordEntry( type, total, 'URL' ).then( null, 
function () {
+   assert.strictEqual( fakeEventLog.logEvent.callCount, 2, 
'Stats should be logged' );
+   asyncs.pop()();
+

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.logging.ActionLogger qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353889 )

Change subject: Fix mmv.logging.ActionLogger qunit tests
..


Fix mmv.logging.ActionLogger qunit tests

Bug: T164473
Change-Id: I41f207519e27f63338298f68411fc2eb3eb7f13a
---
M tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js 
b/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
index 5d6b4c5..5337cb0 100644
--- a/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
@@ -8,7 +8,8 @@
action1value = 'Test',
action2key = 'test-2',
action2value = 'Foo $1 $2 bar',
-   unknownAction = 'test-3';
+   unknownAction = 'test-3',
+   clock = this.sandbox.useFakeTimers();
 
this.sandbox.stub( logger, 'loadDependencies' ).returns( 
$.Deferred().resolve() );
this.sandbox.stub( mw, 'log' );
@@ -20,6 +21,7 @@
logger.logActions[ action2key ] = action2value;
 
logger.log( unknownAction );
+   clock.tick( 10 );
 
assert.strictEqual( mw.log.lastCall.args[ 0 ], unknownAction, 
'Log message defaults to unknown key' );
assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
@@ -27,6 +29,7 @@
mw.log.reset();
fakeEventLog.logEvent.reset();
logger.log( action1key );
+   clock.tick( 10 );
 
assert.strictEqual( mw.log.lastCall.args[ 0 ], action1value, 
'Log message is translated to its text' );
assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
@@ -35,8 +38,11 @@
fakeEventLog.logEvent.reset();
logger.samplingFactorMap = { 'default': 0 };
logger.log( action1key, true );
+   clock.tick( 10 );
 
assert.ok( !mw.log.called, 'No logging when disabled' );
assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
+
+   clock.restore();
} );
 }( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/353889
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I41f207519e27f63338298f68411fc2eb3eb7f13a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.logging.ViewLogger qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353888 )

Change subject: Fix mmv.logging.ViewLogger qunit tests
..


Fix mmv.logging.ViewLogger qunit tests

Bug: T164473
Change-Id: I11849743773e0382354009ccec1c8cb39c466aef
---
M tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js 
b/tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js
index 539751a..4bac34f 100644
--- a/tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.ViewLogger.test.js
@@ -2,6 +2,18 @@
QUnit.module( 'mmv.logging.ViewLogger', QUnit.newMwEnvironment( {
setup: function () {
this.clock = this.sandbox.useFakeTimers();
+
+   // since jQuery 2/3, $.now will capture a reference to 
Date.now
+   // before above fake timer gets a chance to override 
it, so I'll
+   // override that new behavior in order to run these 
tests...
+   // @see https://github.com/sinonjs/lolex/issues/76
+   this.oldNow = $.now;
+   $.now = function() { return +( new Date() ); };
+   },
+
+   teardown: function () {
+   $.now = this.oldNow;
+   this.clock.restore();
}
} ) );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/353888
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I11849743773e0382354009ccec1c8cb39c466aef
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.model.TaskQueue qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353887 )

Change subject: Fix mmv.model.TaskQueue qunit tests
..


Fix mmv.model.TaskQueue qunit tests

Bug: T164473
Change-Id: I849a81c02886c8f80f7bedef40f7a4504d3632f7
---
M tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js 
b/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
index 2a2e7f3..7284f00 100644
--- a/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
+++ b/tests/qunit/mmv/model/mmv.model.TaskQueue.test.js
@@ -51,7 +51,7 @@
assert.strictEqual( taskQueue.state, 
mw.mmv.model.TaskQueue.State.RUNNING,
'state is RUNNING after execution started' );
 
-   task.resolve();
+   return task.resolve();
} );
 
QUnit.test( 'State check for cancellation', 1, function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/353887
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I849a81c02886c8f80f7bedef40f7a4504d3632f7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmw.ui.metadataPanel qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353886 )

Change subject: Fix mmw.ui.metadataPanel qunit tests
..


Fix mmw.ui.metadataPanel qunit tests

Bug: T164473
Change-Id: Iefad324be86c59ac9bf44363bcbbb98a70769499
---
M tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js 
b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
index cebc223..539bc09 100644
--- a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
@@ -113,7 +113,9 @@
getArticlePath: function () { return 'Foo'; },
isCommons: function () { return false; }
},
-   oldMoment = window.moment;
+   oldMoment = window.moment,
+   // custom clock will give MPP.formatDate some time to 
load moment.js
+   clock = this.sandbox.useFakeTimers();
 
/* window.moment = function ( date ) {
// This has no effect for now, since writing this test 
revealed that our moment.js
@@ -142,6 +144,7 @@
 
panel.setImageInfo( image, imageData, repoData );
creditPopupText = panel.creditField.$element.attr( 
'original-title' );
+   clock.tick( 10 );
 
assert.strictEqual( panel.$title.text(), title, 'Title is 
correctly set' );
assert.ok( !panel.$credit.hasClass( 'empty' ), 'Credit is not 
empty' );
@@ -157,10 +160,12 @@
 
imageData.creationDateTime = undefined;
panel.setImageInfo( image, imageData, repoData );
+   clock.tick( 10 );
 
assert.ok( panel.$datetime.text().indexOf( '25 August 2013' ) > 
0, 'Correct date is displayed' );
 
window.moment = oldMoment;
+   clock.restore();
} );
 
QUnit.test( 'Setting permission information works as expected', 1, 
function ( assert ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/353886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefad324be86c59ac9bf44363bcbbb98a70769499
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/353307 )

Change subject: Fix mmv qunit tests
..


Fix mmv qunit tests

This heavily relied on deferreds getting resolved synchroneously,
which (for .then) is no longer the case with jQuery 3.
There's also a difference in how chained .then's get resolved,
and $.when no longer propagates notify().

The changes in here are basically:
* fix use of $.when, manually passing along notify()
* use .then in some places, instead of .done, .fail, .progress
* fix progress bar hiding in setupProgressBar, which assumed sync
* fixed tests, mostly by using fake timers to give async stuff a
  chance to execute

Bug: T164473
Change-Id: Ib51ddd8bc6254a477861588fb16f57565353afe1
---
M resources/mmv/mmv.js
M tests/qunit/mmv/mmv.test.js
2 files changed, 168 insertions(+), 109 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/resources/mmv/mmv.js b/resources/mmv/mmv.js
index f7b2eee..d6aa6f4 100644
--- a/resources/mmv/mmv.js
+++ b/resources/mmv/mmv.js
@@ -288,63 +288,78 @@
 
metadataPromise = this.fetchSizeIndependentLightboxInfo( 
image.filePageTitle );
 
-   imagePromise.done( function ( thumbnail, imageElement ) {
-   if ( viewer.currentIndex !== image.index ) {
-   return;
-   }
+   imagePromise.then(
+   // done
+   function ( thumbnail, imageElement ) {
+   if ( viewer.currentIndex !== image.index ) {
+   return;
+   }
 
-   if ( viewer.imageDisplayedCount++ === 0 ) {
-   mw.mmv.durationLogger.stop( 
'click-to-first-image' );
+   if ( viewer.imageDisplayedCount++ === 0 ) {
+   mw.mmv.durationLogger.stop( 
'click-to-first-image' );
 
-   metadataPromise.done( function ( imageInfo ) {
-   if ( !imageInfo || 
!imageInfo.anonymizedUploadDateTime ) {
-   return;
-   }
+   metadataPromise.then( function ( 
imageInfo, repoInfo ) {
+   if ( imageInfo && 
imageInfo.anonymizedUploadDateTime ) {
+   
mw.mmv.durationLogger.record( 'click-to-first-image', {
+   
uploadTimestamp: imageInfo.anonymizedUploadDateTime
+   } );
+   }
 
-   mw.mmv.durationLogger.record( 
'click-to-first-image', {
-   uploadTimestamp: 
imageInfo.anonymizedUploadDateTime
+   return $.Deferred().resolve( 
imageInfo, repoInfo );
} );
+   }
+
+   imageElement.className = 'mw-mmv-final-image ' 
+ image.filePageTitle.ext.toLowerCase();
+   imageElement.alt = image.alt;
+
+   $.when( metadataPromise, pluginsPromise ).then( 
function ( metadata ) {
+   $( document ).trigger( $.Event( 
'mmv-metadata', { viewer: viewer, image: image, imageInfo: metadata[ 0 ] } ) );
} );
+
+   viewer.displayRealThumbnail( thumbnail, 
imageElement, imageWidths, $.now() - start );
+
+   return $.Deferred().resolve( thumbnail, 
imageElement );
+   },
+   // fail
+   function ( error ) {
+   viewer.ui.canvas.showError( error );
+   return $.Deferred().reject( error );
}
+   );
 
-   imageElement.className = 'mw-mmv-final-image ' + 
image.filePageTitle.ext.toLowerCase();
-   imageElement.alt = image.alt;
+   metadataPromise.then(
+   // done
+   function ( imageInfo, repoInfo ) {
+   extraStatsDeferred.resolve( { uploadTimestamp: 
imageInfo.anonymizedUploadDateTime } );
 
-   $.when( metadataPromise, pluginsPromise ).done( 
function ( metadata ) {
-   $( document ).trigger( $.Event( 'mmv-metadata', 
{ viewer: viewer, image: image, imageInfo: metadata[ 0 ] } ) );
-   } );
+  

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Fix mmv.bootstrap qunit tests

2017-05-18 Thread Jforrester (Code Review)
Jforrester has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352183 )

Change subject: Fix mmv.bootstrap qunit tests
..


Fix mmv.bootstrap qunit tests

This heavily relied on deferreds getting resolved synchroneously,
which (for .then) is no longer the case with jQuery 3.
There's also a difference in how chained .then's get resolved.

These tests did not wait for the deferreds to get resolved async,
so that had to change. Worse even: some functionality was tested
by assuming a handler would not be called (= the test in that
handler would not be called), which didn't make the test run,
because we never even waited for it to be called.

The changes in here are basically:
* make mmv.bootstrap.js correctly use .then instead of .done & fail
* let mmw.bootstrap.test.js tests wait for unresolved async promises
* check call counts instead of running tests inside of callbacks
* limit use of fake timer to the 1 test that needs it (it interferes
  with async, which otherwise don't get resolved)

Bug: T164473
Change-Id: I3ca4f786890ad1646f71fe336afdb61e5c3b01c7
---
M resources/mmv/mmv.bootstrap.js
M tests/qunit/mmv/mmv.bootstrap.test.js
M tests/qunit/mmv/mmv.testhelpers.js
3 files changed, 229 insertions(+), 122 deletions(-)

Approvals:
  Jforrester: Verified; Looks good to me, approved



diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js
index 4da5a9c..10d9e81 100644
--- a/resources/mmv/mmv.bootstrap.js
+++ b/resources/mmv/mmv.bootstrap.js
@@ -112,20 +112,26 @@
deferred.reject( error.message );
} );
 
-   return deferred.done( function ( viewer ) {
-   if ( !bs.viewerInitialized ) {
-   if ( bs.thumbs.length ) {
-   viewer.initWithThumbs( bs.thumbs );
-   }
+   return deferred.promise()
+   .then(
+   function ( viewer ) {
+   if ( !bs.viewerInitialized ) {
+   if ( bs.thumbs.length ) {
+   viewer.initWithThumbs( 
bs.thumbs );
+   }
 
-   bs.viewerInitialized = true;
-   }
-   } ).fail( function ( message ) {
-   mw.log.warn( message );
-   bs.cleanupOverlay();
-   bs.viewerIsBroken = true;
-   mw.notify( 'Error loading MediaViewer: ' + message );
-   } );
+   bs.viewerInitialized = true;
+   }
+   return viewer;
+   },
+   function ( message ) {
+   mw.log.warn( message );
+   bs.cleanupOverlay();
+   bs.viewerIsBroken = true;
+   mw.notify( 'Error loading MediaViewer: 
' + message );
+   return $.Deferred().reject( message );
+   }
+   );
};
 
/**
diff --git a/tests/qunit/mmv/mmv.bootstrap.test.js 
b/tests/qunit/mmv/mmv.bootstrap.test.js
index d8f64da..2821d78 100644
--- a/tests/qunit/mmv/mmv.bootstrap.test.js
+++ b/tests/qunit/mmv/mmv.bootstrap.test.js
@@ -4,7 +4,6 @@
mw.config.set( 'wgMediaViewer', true );
mw.config.set( 'wgMediaViewerOnClick', true );
this.sandbox.stub( mw.user, 'isAnon' ).returns( false );
-   this.clock = this.sandbox.useFakeTimers();
}
} ) );
 
@@ -67,80 +66,93 @@
}
 
function hashTest( prefix, bootstrap, assert ) {
-   var hash = prefix + '/foo';
+   var hash = prefix + '/foo',
+   callCount = 0;
+
+   bootstrap.loadViewer = function () {
+   callCount++;
+   return $.Deferred().reject();
+   };
+
+   // Hijack loadViewer, which will return a promise that we'll 
have to
+   // wait for if we want to see these tests through
+   mw.mmv.testHelpers.asyncMethod( bootstrap, 'loadViewer' );
 
bootstrap.setupEventHandlers();
 
-   bootstrap.loadViewer = function () {
-   assert.ok( false, 'Viewer should not be loaded' );
-   return $.Deferred().reject();
-   };
-
+   // invalid hash, should not trigger MMV load
window.location.hash = 'Foo';
 
-  

[MediaWiki-commits] [Gerrit] mediawiki...ParsoidBatchAPI[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354238 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I75faa8bd39e062b12d544c2f48d1998bbce68893
---
M composer.json
M includes/ApiParsoidBatch.php
A phpcs.xml
3 files changed, 53 insertions(+), 41 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParsoidBatchAPI 
refs/changes/38/354238/1

diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php
index 5d8e656..2af855d 100644
--- a/includes/ApiParsoidBatch.php
+++ b/includes/ApiParsoidBatch.php
@@ -10,7 +10,7 @@
$config = $context->getConfig();
$ipset = new IPSet( $config->get( 'ParsoidBatchAPI_AllowedIPs' 
) );
if ( !$ipset->match( $context->getRequest()->getIP() ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-notallowed', 'not_allowed' );
} else {
$this->dieUsage( "Client IP address not in 
ParsoidBatchAPI_AllowedIPs",
@@ -21,14 +21,14 @@
// Parameter validation
$batch = json_decode( $params['batch'], true );
if ( !is_array( $batch ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-invalidbatch', 'invalid_batch' );
} else {
$this->dieUsage( "Invalid batch, must be 
array", 'invalid_batch' );
}
}
if ( count( $batch ) > 500 ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-batchtoolarge', 'batch_too_large' );
} else {
$this->dieUsage( "Batch too large, limit is 
500", 'batch_too_large' );
@@ -38,7 +38,7 @@
wfIncrStats( 'ParsoidBatchAPI.items', count( $batch ) );
 
$size = 0;
-   $filenames = array();
+   $filenames = [];
foreach ( $batch as $itemIndex => $itemParams ) {
$action = $itemParams['action'];
$this->assertScalar( $itemParams, 'action' );
@@ -64,7 +64,7 @@
$filenames[] = 
$batch[$itemIndex]['filename'] = $title->getDBkey();
}
} else {
-   if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) 
{
$this->dieWithError(
[ 
'apierror-parsoid-batch-invalidaction', wfEscapeWikiText( $itemIndex ) ], 
'invalid_action'
);
@@ -74,7 +74,7 @@
}
}
if ( $size > 1024 * $config->get( 'MaxArticleSize' ) ) {
-   if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+   if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 
'apierror-parsoid-batch-texttoobig', 'text_too_big' );
} else {
$this->dieUsage( "Input text exceeds maximum 
article size", 'text_too_big' );
@@ -85,17 +85,17 @@
if ( count( $filenames ) ) {
$files = RepoGroup::singleton()->findFiles( $filenames 
);
} else {
-   $files = array();
+   $files = [];
}
 
-   $batchResult = array();
+   $batchResult = [];
$result = $this->getResult();
   

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: db-eqiad.php: Repool db1074, depool db1060

2017-05-18 Thread Marostegui (Code Review)
Marostegui has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354237 )

Change subject: db-eqiad.php: Repool db1074, depool db1060
..

db-eqiad.php: Repool db1074, depool db1060

db1074 finished alter table
db1060 needs alter table

Bug: T162611
Change-Id: I0d18868ed21e8412569aa70ebeb68073484b9bfe
---
M wmf-config/db-eqiad.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/37/354237/1

diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php
index 3d8389d..d1f3d6e 100644
--- a/wmf-config/db-eqiad.php
+++ b/wmf-config/db-eqiad.php
@@ -110,8 +110,8 @@
 #  'db1018' => 0,   # B1 1.4TB  64GB, old master 2
'db1021' => 0,   # B1 1.4TB  64GB, vslow, dump
'db1036' => 1,   # B2 1.4TB  64GB, watchlist, recentchanges, 
contributions, logpager
-   'db1060' => 1,   # C2 2.8TB  96GB, api
-#  'db1074' => 300, # A2 3.6TB 512GB, api #T162611
+#  'db1060' => 1,   # C2 2.8TB  96GB, api #T162611
+   'db1074' => 300, # A2 3.6TB 512GB, api
'db1076' => 300, # B1 3.6TB 512GB  #temporary api #T162611
'db1090' => 500, # C3 3.6TB 512GB
],
@@ -274,7 +274,8 @@
'db1021' => 1,
],
'api' => [
-   'db1060' => 2,
+#  'db1060' => 2,
+   'db1074' => 1,
'db1076' => 1,
],
'watchlist' => [

-- 
To view, visit https://gerrit.wikimedia.org/r/354237
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d18868ed21e8412569aa70ebeb68073484b9bfe
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Marostegui 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...NewUserMessage[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354236 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: Iafd01ef4008a7f763b2a0a6132fbe9148f5be823
---
M NewUserMessage.class.php
M composer.json
A phpcs.xml
3 files changed, 25 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/NewUserMessage 
refs/changes/36/354236/1

diff --git a/NewUserMessage.class.php b/NewUserMessage.class.php
index 48b4f62..512023e 100644
--- a/NewUserMessage.class.php
+++ b/NewUserMessage.class.php
@@ -24,7 +24,7 @@
$editor = User::newFromName( self::getMsg( 
'newusermessage-editor' )->text() );
 
if ( !$editor ) {
-   return false; # Invalid user name
+   return false; // Invalid user name
}
 
if ( !$editor->isLoggedIn() ) {
@@ -44,7 +44,7 @@
 
if ( !self::getMsg( 'newusermessage-signatures' )->isDisabled() 
) {
$pattern = '/^\* ?(.*?)$/m';
-   $signatureList = array();
+   $signatureList = [];
preg_match_all( $pattern, $signatures, $signatureList, 
PREG_SET_ORDER );
if ( count( $signatureList ) > 0 ) {
$rand = rand( 0, count( $signatureList ) - 1 );
@@ -110,8 +110,12 @@
global $wgNewUserMinorEdit, $wgNewUserSuppressRC;
 
$flags = EDIT_NEW;
-   if ( $wgNewUserMinorEdit ) $flags = $flags | EDIT_MINOR;
-   if ( $wgNewUserSuppressRC ) $flags = $flags | EDIT_SUPPRESS_RC;
+   if ( $wgNewUserMinorEdit ) {
+   $flags = $flags | EDIT_MINOR;
+   }
+   if ( $wgNewUserSuppressRC ) {
+   $flags = $flags | EDIT_SUPPRESS_RC;
+   }
 
return $flags;
}
@@ -125,7 +129,7 @@
 * @param $preparse bool If provided, then preparse the string using a 
Parser
 * @return string
 */
-   static private function substString( $str, $user, $editor, $talk, 
$preparse = null ) {
+   private static function substString( $str, $user, $editor, $talk, 
$preparse = null ) {
$realName = $user->getRealName();
$name = $user->getName();
 
@@ -258,7 +262,7 @@
 * @param $signature string the signature, if provided.
 * @return string in wiki text with complete user message
 */
-   static protected function formatUserMessage( $subject, $text, 
$signature ) {
+   protected static function formatUserMessage( $subject, $text, 
$signature ) {
$contents = "";
$signature = empty( $signature ) ? "" : "{$signature} 
~";
 
@@ -274,7 +278,7 @@
 * @param $name
 * @return Message
 */
-   static protected function getMsg( $name ) {
+   protected static function getMsg( $name ) {
return wfMessage( $name )->inContentLanguage();
}
 }
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafd01ef4008a7f763b2a0a6132fbe9148f5be823
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NewUserMessage
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Allow \r\n in wikilink titles.

2017-05-18 Thread C. Scott Ananian (Code Review)
C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354235 )

Change subject: Allow \r\n in wikilink titles.
..

Allow \r\n in wikilink titles.

This fixes an RT testing regression on
[[it:Teenage Mutant Ninja Turtles - Tartarughe Ninja]]
caused by this fragment of (bogus) wikitext:

  |autori = [[  Ciro Nieli
  Joshua Sternin
  J. R. Ventimilia]]

In general our practice now is *not* to try to validate the title inside
the tokenizer, but instead to accept the same set of characters here that
the PHP preprocessor does and wait until later title validation to
unlink bogus titles.

Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
---
M lib/wt2html/pegTokenizer.pegjs
M tests/parserTests.txt
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/35/354235/1

diff --git a/lib/wt2html/pegTokenizer.pegjs b/lib/wt2html/pegTokenizer.pegjs
index 2664c17..72b2d42 100644
--- a/lib/wt2html/pegTokenizer.pegjs
+++ b/lib/wt2html/pegTokenizer.pegjs
@@ -1950,7 +1950,7 @@
 wikilink_preprocessor_text
   = r:( t:$[^<[{\n\r\t|!\]}{ &\-]+
 // XXX gwicke: any more chars we need to allow here?
-/ !inline_breaks wr:( directive / $( !"]]" ( text_char / [!<\-\}\]] ) 
) )
+/ !inline_breaks wr:( directive / $( !"]]" ( text_char / 
[!<\-\}\]\n\r] ) ) )
 { return wr; }
 )+ {
   return tu.flattenStringlist(r);
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 2d107e7..0d93294 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -5332,6 +5332,21 @@
 !! end
 
 !! test
+Wikilinks with embedded newlines are not broken
+!! wikitext
+{{echo|[[ Foo
+B
+C]]}}
+!! html/php
+[[ Foo
+B
+C]]
+
+!! html/parsoid
+[[ Foo B C]]
+!! end
+
+!! test
 Broken templates
 !! options
 parsoid=wt2html

-- 
To view, visit https://gerrit.wikimedia.org/r/354235
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ed15d6e897d2734ad8436c73de2fdcc4d0f563a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...NavigationTiming[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354234 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: Id04068cb1eb56eef5ca5ba06b79295151c5b2dd6
---
M NavigationTiming.php
M composer.json
A phpcs.xml
3 files changed, 15 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/NavigationTiming 
refs/changes/34/354234/1

diff --git a/NavigationTiming.php b/NavigationTiming.php
index a0704e9..194fd72 100644
--- a/NavigationTiming.php
+++ b/NavigationTiming.php
@@ -25,4 +25,4 @@
return;
 } else {
die( 'This version of the NavigationTiming extension requires MediaWiki 
1.25+' );
-}
\ No newline at end of file
+}
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354234
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id04068cb1eb56eef5ca5ba06b79295151c5b2dd6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...MobileApp[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354233 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I668566534cbf54da053cc30353a57326974724e8
---
M MobileAppResourceLoaderModule.php
M composer.json
A phpcs.xml
3 files changed, 17 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileApp 
refs/changes/33/354233/1

diff --git a/MobileAppResourceLoaderModule.php 
b/MobileAppResourceLoaderModule.php
index 5c0346f..bc68a8d 100644
--- a/MobileAppResourceLoaderModule.php
+++ b/MobileAppResourceLoaderModule.php
@@ -8,9 +8,8 @@
 * @return array
 */
protected function getPages( ResourceLoaderContext $context ) {
-   return array(
-   'MediaWiki:Mobile.css'  => array( 'type' => 'style' 
),
-   );
+   return [
+   'MediaWiki:Mobile.css' => [ 'type' => 'style' ],
+   ];
}
 }
-
diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
-   "jakub-onderka/php-console-highlighter": "0.3.2"
+   "jakub-onderka/php-console-highlighter": "0.3.2",
+   "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
+   "fix": "phpcbf",
"test": [
-   "parallel-lint . --exclude vendor"
+   "parallel-lint . --exclude vendor",
+   "phpcs -p -s"
]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+
+
+   
+   .
+   
+   
+   vendor
+   node_modules
+

-- 
To view, visit https://gerrit.wikimedia.org/r/354233
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I668566534cbf54da053cc30353a57326974724e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileApp
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Listings[master]: Add phpcs and make pass

2017-05-18 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354232 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I3ac116bd7cc426253a7192cf71c2a1cc1420f19e
---
M Listings.body.php
M composer.json
A phpcs.xml
3 files changed, 48 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Listings 
refs/changes/32/354232/1

diff --git a/Listings.body.php b/Listings.body.php
index cba597e..e3f89ea 100644
--- a/Listings.body.php
+++ b/Listings.body.php
@@ -2,13 +2,13 @@
 
 class Listings {
public static function setupHooks( Parser $parser ) {
-   $parser->setHook( 'buy', array( 'Listings', 'buyListings'   
) );
-   $parser->setHook( 'do',  array( 'Listings', 'doListings'
) );
-   $parser->setHook( 'drink',   array( 'Listings', 'drinkListings' 
) );
-   $parser->setHook( 'eat', array( 'Listings', 'eatListings'   
) );
-   $parser->setHook( 'listing', array( 'Listings', 'otherlistings' 
) );
-   $parser->setHook( 'see', array( 'Listings', 'seeListings'   
) );
-   $parser->setHook( 'sleep',   array( 'Listings', 'sleepListings' 
) );
+   $parser->setHook( 'buy', [ 'Listings', 'buyListings' ] );
+   $parser->setHook( 'do', [ 'Listings', 'doListings' ] );
+   $parser->setHook( 'drink', [ 'Listings', 'drinkListings' ] );
+   $parser->setHook( 'eat', [ 'Listings', 'eatListings' ] );
+   $parser->setHook( 'listing', [ 'Listings', 'otherlistings' ] );
+   $parser->setHook( 'see', [ 'Listings', 'seeListings' ] );
+   $parser->setHook( 'sleep', [ 'Listings', 'sleepListings' ] );
 
return true;
}
@@ -93,7 +93,8 @@
private static function listingsTag( $aType, $input, $args, $parser ) {
 
/*
-* if a {{listings}} template exists, feed tag name and 
parameter list to template verbatim and exit
+* if a {{listings}} template exists,
+* feed tag name and parameter list to template verbatim and 
exit
 */
$ltemplate = '';
if ( !wfMessage( 'listings-template' 
)->inContentLanguage()->isDisabled() ) {
@@ -203,15 +204,15 @@
}
 
// @fixme: a lot of localisation-unfriendly patchwork below
-   $out = Html::element( 'strong', array(), $name );
+   $out = Html::element( 'strong', [], $name );
if ( $url != '' ) {
$sanitizedHref = Sanitizer::validateAttributes(
-   array( 'href' => $url ),
-   array( 'href' )
+   [ 'href' => $url ],
+   [ 'href' ]
);
if ( isset( $sanitizedHref['href'] ) ) {
$out = Html::rawElement( 'a',
-   $sanitizedHref + array( 'class' => 
'external text', 'rel' => 'nofollow', 'title' => $name ),
+   $sanitizedHref + [ 'class' => 'external 
text', 'rel' => 'nofollow', 'title' => $name ],
$out
);
}
@@ -236,27 +237,39 @@
}
}
 
-   $phoneSymbol = $parser->internalParse( wfMessage( 
'listings-phone-symbol' )->inContentLanguage()->text() );
+   $phoneSymbol = $parser->internalParse(
+   wfMessage( 'listings-phone-symbol' 
)->inContentLanguage()->text() );
if ( $phoneSymbol != '' ) {
-   $phoneSymbol = '' . $phoneSymbol . 
'';
+   $phoneSymbol = '' . $phoneSymbol . '';
} else {
$phoneSymbol = wfMessage( 'listings-phone' 
)->inContentLanguage()->escaped();
}
-   $faxSymbol = $parser->internalParse( wfMessage( 
'listings-fax-symbol' )->inContentLanguage()->text() );
+   $faxSymbol = $parser->internalParse(
+   wfMessage( 'listings-fax-symbol' 
)->inContentLanguage()->text() );
if ( $faxSymbol != '' ) {
-   $faxSymbol = '' . $faxSymbol . 
'';
+   $faxSymbol = '' . $faxSymbol . '';
} else {
$faxSymbol = wfMessage( 'listings-fax' 
)->inContentLanguage()->escaped();
}
-   $emailSymbol = $parser->internalParse( wfMessage( 
'listings-email-symbol' )->inContentLanguage()->text() );
+   $emailSymbol = $parser->internalParse(
+   wfMessage( 'listings-email-symbol' 
)->inContentLanguage()->text() );
 

  1   2   >