[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Implement sampling options

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: linter: Implement sampling options
..


linter: Implement sampling options

When enabling this in production, we want to be very careful not to
overload MediaWiki with a large number of lint errors. To do this, there
are two main linting features:

First, enable selective categories to be reported to MediaWiki. The
"linting" configuration setting can be a list of the names of lint
errors to enable, or true to enable everything.

Then is a per page sampling feature. Since we also log deletions, we
need this to be deterministic, so we use page_id % sampling === 0 to
check whether logs should be sent.

Change-Id: I2f939859a6f49b40aff93f3c07b11c64c0b00fc1
---
M lib/config/ParsoidConfig.js
M lib/logger/linter.js
2 files changed, 27 insertions(+), 3 deletions(-)

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



diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index dbf54c5..337923c 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -220,7 +220,8 @@
 ParsoidConfig.prototype.addHTMLTemplateParameters = false;
 
 /**
- * @property {boolean} linting Whether to enable linter Backend.
+ * @property {boolean|Array} linting Whether to enable linter Backend.
+ * Or an array of enabled lint types
  */
 ParsoidConfig.prototype.linting = false;
 
@@ -231,6 +232,14 @@
 ParsoidConfig.prototype.linterAPI = null;
 
 /**
+ * @property {number} linterSampling
+ *
+ * Ratio at which to sample linter errors, per page.
+ * This is deterministic and based on page_id.
+ */
+ParsoidConfig.prototype.linterAPISampling = 1;
+
+/**
  * @property {Function} loggerBackend
  * The logger output function.
  * By default, use stderr to output logs.
diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 97b8881..210e463 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -16,6 +16,22 @@
 
 Linter.prototype.logLintOutput = function(logData, cb) {
var env = this._env;
+   var enabledBuffer;
+   // Everything is enabled
+   if (env.conf.parsoid.linting === true) {
+   enabledBuffer = this.buffer;
+   } else if (Array.isArray(env.conf.parsoid.linting)) {
+   enabledBuffer = this.buffer.filter(function(item) {
+   return env.conf.parsoid.linting.indexOf(item.type) !== 
-1;
+   });
+   }
+
+   this.buffer = [];
+
+   if (env.page.id % env.conf.parsoid.linterAPISampling !== 0) {
+   return;
+   }
+
try {
if (env.conf.parsoid.linterAPI) {
// Only send the request if it is
@@ -24,7 +40,7 @@
request.post(
env.conf.parsoid.linterAPI,
{ form: {
-   data: 
JSON.stringify(this.buffer),
+   data: 
JSON.stringify(enabledBuffer),
page: env.page.name,
revision: 
env.page.meta.revision.revid,
action: 'record-lint',
@@ -37,7 +53,6 @@
);
}
}
-   this.buffer = [];
} catch (e) {
console.error("Error in logLintOutput: " + e);
} finally {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2f939859a6f49b40aff93f3c07b11c64c0b00fc1
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Arlolra 
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]: linter: Use already-configured MW API URL

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316215

Change subject: linter: Use already-configured MW API URL
..

linter: Use already-configured MW API URL

Parsoid already knows the MediaWiki API URL for the current wiki, so use
that instead of hardcoding it in the configuration. Instead, have a
"linterSendAPI" variable that controls whether lint errors are sent to
the API or not.

Change-Id: I85fde69ac712ec04f6a3ea73669c06200638df6f
---
M config.example.yaml
M lib/config/MWParserEnvironment.js
M lib/config/ParsoidConfig.js
M lib/logger/linter.js
M lib/utils/Util.js
M tests/mocha/apitest.localsettings.js
M tests/rttest.localsettings.js
7 files changed, 15 insertions(+), 13 deletions(-)


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

diff --git a/config.example.yaml b/config.example.yaml
index daafcc8..7bd7f26 100644
--- a/config.example.yaml
+++ b/config.example.yaml
@@ -81,8 +81,8 @@
 #serverPort: 8000
 #serverInterface: '127.0.0.1'
 
-# The URL of your LintBridge API endpoint
-#linterAPI: 'http://lintbridge.wmflabs.org/add'
+# Send lint errors to MW API
+#linterSendAPI: false
 
 # Require SSL certificates to be valid (default true)
 # Set to false when using self-signed SSL certificates
diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index d25f2e7..6e88edd 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -259,7 +259,7 @@
"fatal", "error", "warning", "info",
];
 
-   if (this.conf.parsoid.linting && !this.conf.parsoid.linterAPI) {
+   if (this.conf.parsoid.linting && !this.conf.parsoid.linterSendAPI) {
defaultLogLevels.push("lint");
}
 
diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index 337923c..66e291a 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -226,10 +226,12 @@
 ParsoidConfig.prototype.linting = false;
 
 /**
- * @property {String|null} linterAPI
- * The URL for LintBridge API endpoint
+ * @property {boolean} linterSendAPI
+ * Whether to send lint errors to the MW API
+ * Requires the MW Linter extension to be installed
+ * and configured.
  */
-ParsoidConfig.prototype.linterAPI = null;
+ParsoidConfig.prototype.linterSendAPI = false;
 
 /**
  * @property {number} linterSampling
diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 32d97bc..c86d640 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -33,12 +33,12 @@
}
 
try {
-   if (env.conf.parsoid.linterAPI) {
+   if (env.conf.parsoid.linterSendAPI) {
// Only send the request if it is
// the latest revision
if (env.page.meta.revision.revid === env.page.latest) {
request.post(
-   env.conf.parsoid.linterAPI,
+   env.conf.wiki.apiURI,
{ form: {
data: 
JSON.stringify(enabledBuffer),
page: env.page.name,
diff --git a/lib/utils/Util.js b/lib/utils/Util.js
index bcdfb93..e08430a 100644
--- a/lib/utils/Util.js
+++ b/lib/utils/Util.js
@@ -223,7 +223,7 @@
}
if (opts.lint) {
parsoidConfig.linting = true;
-   parsoidConfig.linterAPI = null;
+   parsoidConfig.linterSendAPI = false;
}
if (opts.useBatchAPI !== null) {
parsoidConfig.useBatchAPI = 
Util.booleanOption(opts.useBatchAPI);
diff --git a/tests/mocha/apitest.localsettings.js 
b/tests/mocha/apitest.localsettings.js
index 0a45c19..d99ee0f 100644
--- a/tests/mocha/apitest.localsettings.js
+++ b/tests/mocha/apitest.localsettings.js
@@ -39,8 +39,8 @@
//  parsoidConfig.serverPort = 8000;
//  parsoidConfig.serverInterface = '127.0.0.1';
 
-   // The URL of your LintBridge API endpoint
-   //  parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
+   // Send lint errors to MW API
+   //  parsoidConfig.linterSendAPI = false;
 
// Require SSL certificates to be valid (default true)
// Set to false when using self-signed SSL certificates
diff --git a/tests/rttest.localsettings.js b/tests/rttest.localsettings.js
index 4a92840..133f848 100644
--- a/tests/rttest.localsettings.js
+++ b/tests/rttest.localsettings.js
@@ -42,8 +42,8 @@
//  parsoidConfig.serverPort = 8000;
//  parsoidConfig.serverInterface = '127.0.0.1';
 
-   // The URL of your LintBridge API endpoint
-   //  parsoidConfig.linterAPI = 'http://lintbridge.wm

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Remove uncessary return; statements

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: linter: Remove uncessary return; statements
..


linter: Remove uncessary return; statements

Change-Id: I0a999624ab55a35b3aa4b0c04aa6388e399d295d
---
M lib/logger/linter.js
1 file changed, 0 insertions(+), 2 deletions(-)

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



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index c2ab554..97b8881 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -38,10 +38,8 @@
}
}
this.buffer = [];
-   return;
} catch (e) {
console.error("Error in logLintOutput: " + e);
-   return;
} finally {
cb();
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0a999624ab55a35b3aa4b0c04aa6388e399d295d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Arlolra 
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]: linter: Send logs through main logger instead of to the console

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: linter: Send logs through main logger instead of to the console
..


linter: Send logs through main logger instead of to the console

This allows us to send the linter logs through the main logging system,
so we can esitmate how many existing lint issues there are before
activating the linter API.

Change-Id: Ib3d6d445292d114240261b3a352acf63efc6d7cd
---
M lib/config/MWParserEnvironment.js
M lib/index.js
M lib/logger/linter.js
3 files changed, 16 insertions(+), 10 deletions(-)

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



diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index 234a288..d25f2e7 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -255,10 +255,16 @@
var logger = new ParsoidLogger(this);
this.setLogger(logger);
 
-   // Configure backends
-   logger.registerLoggingBackends([
+   var defaultLogLevels = [
"fatal", "error", "warning", "info",
-   ], this.conf.parsoid, this.linter);
+   ];
+
+   if (this.conf.parsoid.linting && !this.conf.parsoid.linterAPI) {
+   defaultLogLevels.push("lint");
+   }
+
+   // Configure backends
+   logger.registerLoggingBackends(defaultLogLevels, this.conf.parsoid, 
this.linter);
 };
 
 // The default page name (true name, without wikitext url encoding)
diff --git a/lib/index.js b/lib/index.js
index 79495c8..0850b6b 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -175,6 +175,7 @@
var parsoidOptions = {
loggerBackend: function(logData, cb) {
var type = logData.logType.replace(/^warning/, 'warn');
+   type = type.replace(/^lint/, 'info/lint');
options.logger.log(type, prepareLog(logData));
cb();
},
diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 81ecf51..c2ab554 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -15,19 +15,18 @@
 };
 
 Linter.prototype.logLintOutput = function(logData, cb) {
+   var env = this._env;
try {
-   if (!this._env.conf.parsoid.linterAPI) {
-   console.log(this.buffer);
-   } else {
+   if (env.conf.parsoid.linterAPI) {
// Only send the request if it is
// the latest revision
-   if (this._env.page.meta.revision.revid === 
this._env.page.latest) {
+   if (env.page.meta.revision.revid === env.page.latest) {
request.post(
-   this._env.conf.parsoid.linterAPI,
+   env.conf.parsoid.linterAPI,
{ form: {
data: 
JSON.stringify(this.buffer),
-   page: this._env.page.name,
-   revision: 
this._env.page.meta.revision.revid,
+   page: env.page.name,
+   revision: 
env.page.meta.revision.revid,
action: 'record-lint',
format: 'json',
formatversion: 2,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3d6d445292d114240261b3a352acf63efc6d7cd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Arlolra 
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]: linter: Provide name of enclosing template if possible

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: linter: Provide name of enclosing template if possible
..


linter: Provide name of enclosing template if possible

If the lint error is found inside a template, include the name of the
enclosing template to make it easier for editors to find the issue.

If it is not inside a template, the `templateInfo` variable will be
null.

Change-Id: I918de5a0a842e5e362a5c2a75d639c435f02dfa2
---
M lib/logger/linter.js
M lib/wt2html/pp/handlers/linter.js
M tests/mocha/lintertest.js
3 files changed, 28 insertions(+), 16 deletions(-)

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



diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 3ac42d6..81ecf51 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -56,7 +56,7 @@
var lintObj = logData.logObject[0];
var src = lintObj.src;
var dsr = lintObj.dsr;
-   var inTransclusion = lintObj.inTransclusion;
+   var templateInfo = lintObj.templateInfo;
var msg = {};
 
var re = /lint\/(.*)/;
@@ -75,8 +75,8 @@
msg.dsr = dsr;
}
 
-   if (inTransclusion) {
-   msg.inTransclusion = inTransclusion;
+   if (templateInfo) {
+   msg.templateInfo = templateInfo;
}
if (logType === 'lint/fostered' || logType === 
'lint/multi-template' || logType === 'lint/mixed-content') {
msg.src = src;
diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index 234e90d..6aeef8d 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -65,17 +65,19 @@
var cNodeName = c.nodeName.toLowerCase();
var dsr = dp.dsr;
var lintObj;
-   var inTransclusion = false;
+   var templateInfo;
 
if (tplInfo) {
dsr = tplInfo.dsr;
-   inTransclusion = true;
+   templateInfo = {
+   name: DU.findEnclosingTemplateName(tplInfo),
+   };
}
 
if (DU.hasNodeName(c, 'meta')) {
var type = c.getAttribute('typeof');
if (type === 'mw:Placeholder/StrippedTag') {
-   lintObj = { src: env.page.src, dsr: dsr, 
inTransclusion: inTransclusion };
+   lintObj = { src: env.page.src, dsr: dsr, templateInfo: 
templateInfo };
env.log('lint/stripped-tag', lintObj);
}
}
@@ -95,7 +97,7 @@
lintObj = {
src: env.page.src,
dsr: dsr,
-   inTransclusion: inTransclusion,
+   templateInfo: templateInfo,
};
env.log('lint/missing-end-tag', lintObj);
}
@@ -104,7 +106,7 @@
lintObj = {
src: env.page.src,
dsr: dsr,
-   inTransclusion: inTransclusion,
+   templateInfo: templateInfo,
};
env.log('lint/missing-start-tag', lintObj);
}
@@ -124,7 +126,7 @@
 */
 function logIgnoredTableAttr(env, c, dp, tplInfo) {
var dsr;
-   var inTransclusion = false;
+   var templateInfo;
if (DU.hasNodeName(c, "table")) {
var fc = c.firstChild;
while (fc) {
@@ -147,11 +149,11 @@
if (wc) {
if (tplInfo) {
dsr = 
tplInfo.dsr;
-   
inTransclusion = true;
+   
templateInfo = { name: DU.findEnclosingTemplateName(tplInfo) };
} else {
dsr = 
dp.dsr;
}
-   var lintObj = { 
src: env.page.src, dsr: dsr, inTransclusion: inTransclusion };
+   var lintObj = { 
src: env.page.src, dsr: dsr, templateInfo: templateInfo };

env.log('lint/ignored-table-attr', lintObj);
}
}
@@ -187,14 +189,14 @@
   

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Log API failures to env.log

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316214

Change subject: linter: Log API failures to env.log
..

linter: Log API failures to env.log

Change-Id: I24339bd2bf227e80a545cfa1aa0d9e7215e80513
---
M lib/logger/linter.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 210e463..32d97bc 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -48,7 +48,12 @@
formatversion: 2,
}, },
function(error, response, body) {
-   console.log(body);
+   if (response.statusCode !== 200 
) {
+   
env.log('error/lint-api', body);
+   } else {
+   // For debug
+   console.log(body);
+   }
}
);
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24339bd2bf227e80a545cfa1aa0d9e7215e80513
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: T147742: Trim template target after stripping comments

2016-10-15 Thread Subramanya Sastry (Code Review)
Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316213

Change subject: T147742: Trim template target after stripping comments
..

T147742: Trim template target after stripping comments

Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255
---
M lib/wt2html/tt/TemplateHandler.js
M tests/parserTests.txt
2 files changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/lib/wt2html/tt/TemplateHandler.js 
b/lib/wt2html/tt/TemplateHandler.js
index b26cea1..adac655 100644
--- a/lib/wt2html/tt/TemplateHandler.js
+++ b/lib/wt2html/tt/TemplateHandler.js
@@ -421,8 +421,11 @@
if (tgtInfo.isStr && !tgtInfo.isSimpleTgt) {
// resolvabilityInfo found a new target based on the target 
tokens. This
// happens when the target contains special characters, 
specially quotes.
-   // For an example look at T96090.
-   target = tgtInfo.newTarget;
+   // For an example, look at T96090.
+
+   // Without a trim(), we get bug T147742 because
+   // the prefix === target check below fails!
+   target = tgtInfo.newTarget.trim();
pieces = target.split(':');
prefix = pieces[0].trim();
lowerPrefix = prefix.toLowerCase();
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 536525a..750e590 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -2716,6 +2716,10 @@
 
 |foo}}
 
+{{echo
+
+  |foo}}
+
 {{echo
 |foo}}
 
@@ -2725,6 +2729,8 @@
 !!html/parsoid
 foo
 
+foo
+
 foo
 
 foo

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If69246776b165f833ae58fdaf72eaced0fd2f255
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry 

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Implement sampling options

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316212

Change subject: linter: Implement sampling options
..

linter: Implement sampling options

When enabling this in production, we want to be very careful not to
overload MediaWiki with a large number of lint errors. To do this, there
are two main linting features:

First, enable selective categories to be reported to MediaWiki. The
"linting" configuration setting can be a list of the names of lint
errors to enable, or true to enable everything.

Then is a per page sampling feature. Since we also log deletions, we
need this to be deterministic, so we use page_id % sampling === 0 to
check whether logs should be sent.

Change-Id: I2f939859a6f49b40aff93f3c07b11c64c0b00fc1
---
M lib/config/ParsoidConfig.js
M lib/logger/linter.js
2 files changed, 27 insertions(+), 3 deletions(-)


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

diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index dbf54c5..337923c 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -220,7 +220,8 @@
 ParsoidConfig.prototype.addHTMLTemplateParameters = false;
 
 /**
- * @property {boolean} linting Whether to enable linter Backend.
+ * @property {boolean|Array} linting Whether to enable linter Backend.
+ * Or an array of enabled lint types
  */
 ParsoidConfig.prototype.linting = false;
 
@@ -231,6 +232,14 @@
 ParsoidConfig.prototype.linterAPI = null;
 
 /**
+ * @property {number} linterSampling
+ *
+ * Ratio at which to sample linter errors, per page.
+ * This is deterministic and based on page_id.
+ */
+ParsoidConfig.prototype.linterAPISampling = 1;
+
+/**
  * @property {Function} loggerBackend
  * The logger output function.
  * By default, use stderr to output logs.
diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 7badefb..7267c19 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -16,6 +16,22 @@
 
 Linter.prototype.logLintOutput = function(logData, cb) {
var env = this._env;
+   var enabledBuffer;
+   // Everything is enabled
+   if (env.conf.parsoid.linting === true) {
+   enabledBuffer = this.buffer;
+   } else if (Array.isArray(env.conf.parsoid.linting)) {
+   enabledBuffer = this.buffer.filter(function(item) {
+   return env.conf.parsoid.linting.indexOf(item.type) !== 
-1;
+   });
+   }
+
+   this.buffer = [];
+
+   if (env.page.id % env.conf.parsoid.linterAPISampling !== 0) {
+   return;
+   }
+
try {
if (!env.conf.parsoid.linterAPI) {
env.log(this.buffer);
@@ -26,7 +42,7 @@
request.post(
env.conf.parsoid.linterAPI,
{ form: {
-   data: 
JSON.stringify(this.buffer),
+   data: 
JSON.stringify(enabledBuffer),
page: env.page.name,
revision: 
env.page.meta.revision.revid,
action: 'record-lint',
@@ -39,7 +55,6 @@
);
}
}
-   this.buffer = [];
} catch (e) {
console.error("Error in logLintOutput: " + e);
} finally {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f939859a6f49b40aff93f3c07b11c64c0b00fc1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Re-add human readable parser limit report

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Re-add human readable parser limit report
..


Re-add human readable parser limit report

This mostly reverts commit 1255654ed5a89ed57491bda38f544ed87e3bc601.

This re-adds the human readable parser limit report, and makes a few
adjustments necessary for it to work properly.

* In EditPage::getPreviewLimitReport(), only generate the HTML report,
  the JS variable will be added by OutputPage
* If there are multiple calls to OutputPage::addParserOutputMetadata(),
  only use the limit report data from the first one.
* Only add the wgPageParseReport variable if limit report data is
  available.

Bug: T142210
Change-Id: Iad2646acde79b8a59710bb9fd5fbbfea5a39c341
---
M includes/EditPage.php
M includes/OutputPage.php
2 files changed, 53 insertions(+), 15 deletions(-)

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



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 1c13d56..0d8def3 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2787,9 +2787,8 @@
$wgOut->addHTML( Html::rawElement( 'div', [ 'class' => 
'hiddencats' ],
Linker::formatHiddenCategories( 
$this->page->getHiddenCategories() ) ) );
 
-   if ( $this->mParserOutput ) {
-   $wgOut->setLimitReportData( 
$this->mParserOutput->getLimitReportData() );
-   }
+   $wgOut->addHTML( Html::rawElement( 'div', [ 'class' => 
'limitreport' ],
+   self::getPreviewLimitReport( $this->mParserOutput ) ) );
 
$wgOut->addModules( 'mediawiki.action.edit.collapsibleFooter' );
 
@@ -3567,12 +3566,47 @@
return '';
}
 
-   return ResourceLoader::makeInlineScript(
-   ResourceLoader::makeConfigSetScript(
-   [ 'wgPageParseReport' => 
$output->getLimitReportData() ],
-   true
-   )
+   $limitReport = Html::rawElement( 'div', [ 'class' => 
'mw-limitReportExplanation' ],
+   wfMessage( 'limitreport-title' )->parseAsBlock()
);
+
+   // Show/hide animation doesn't work correctly on a table, so 
wrap it in a div.
+   $limitReport .= Html::openElement( 'div', [ 'class' => 
'preview-limit-report-wrapper' ] );
+
+   $limitReport .= Html::openElement( 'table', [
+   'class' => 'preview-limit-report wikitable'
+   ] ) .
+   Html::openElement( 'tbody' );
+
+   foreach ( $output->getLimitReportData()['limitreport'] as $key 
=> $value ) {
+   if ( Hooks::run( 'ParserLimitReportFormat',
+   [ $key, &$value, &$limitReport, true, true ]
+   ) ) {
+   $keyMsg = wfMessage( "limitreport-$key" );
+   $valueMsg = wfMessage(
+   [ "limitreport-$key-value-html", 
"limitreport-$key-value" ]
+   );
+   if ( !$valueMsg->exists() ) {
+   $valueMsg = new RawMessage( '$1' );
+   }
+   if ( !$keyMsg->isDisabled() && 
!$valueMsg->isDisabled() ) {
+   // If it's a value/limit array, convert 
it for $1/$2
+   if ( is_array( $value ) && isset( 
$value['value'] ) ) {
+   $value = [ $value['value'], 
$value['limit'] ];
+   }
+   $limitReport .= Html::openElement( 'tr' 
) .
+   Html::rawElement( 'th', null, 
$keyMsg->parse() ) .
+   Html::rawElement( 'td', null, 
$valueMsg->params( $value )->parse() ) .
+   Html::closeElement( 'tr' );
+   }
+   }
+   }
+
+   $limitReport .= Html::closeElement( 'tbody' ) .
+   Html::closeElement( 'table' ) .
+   Html::closeElement( 'div' );
+
+   return $limitReport;
}
 
protected function showStandardInputs( &$tabindex = 2 ) {
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index a69c0e6..50f9eb9 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -1782,7 +1782,9 @@
}
 
// Include profiling data
-   $this->setLimitReportData( $parserOutput->getLimitReportData() 
);
+   if ( !$this->limitReportData ) {
+ 

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Remove uncessary return; statements

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316211

Change subject: linter: Remove uncessary return; statements
..

linter: Remove uncessary return; statements

Change-Id: I0a999624ab55a35b3aa4b0c04aa6388e399d295d
---
M lib/logger/linter.js
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index a6976cf..7badefb 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -40,10 +40,8 @@
}
}
this.buffer = [];
-   return;
} catch (e) {
console.error("Error in logLintOutput: " + e);
-   return;
} finally {
cb();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a999624ab55a35b3aa4b0c04aa6388e399d295d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Send logs to `env.log()` instead of `console.log()`

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316210

Change subject: linter: Send logs to `env.log()` instead of `console.log()`
..

linter: Send logs to `env.log()` instead of `console.log()`

Change-Id: Ib3d6d445292d114240261b3a352acf63efc6d7cd
---
M lib/logger/linter.js
1 file changed, 8 insertions(+), 7 deletions(-)


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

diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 81ecf51..a6976cf 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -15,25 +15,26 @@
 };
 
 Linter.prototype.logLintOutput = function(logData, cb) {
+   var env = this._env;
try {
-   if (!this._env.conf.parsoid.linterAPI) {
-   console.log(this.buffer);
+   if (!env.conf.parsoid.linterAPI) {
+   env.log(this.buffer);
} else {
// Only send the request if it is
// the latest revision
-   if (this._env.page.meta.revision.revid === 
this._env.page.latest) {
+   if (env.page.meta.revision.revid === env.page.latest) {
request.post(
-   this._env.conf.parsoid.linterAPI,
+   env.conf.parsoid.linterAPI,
{ form: {
data: 
JSON.stringify(this.buffer),
-   page: this._env.page.name,
-   revision: 
this._env.page.meta.revision.revid,
+   page: env.page.name,
+   revision: 
env.page.meta.revision.revid,
action: 'record-lint',
format: 'json',
formatversion: 2,
}, },
function(error, response, body) {
-   console.log(body);
+   env.log(body);
}
);
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3d6d445292d114240261b3a352acf63efc6d7cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: linter: Provide name of enclosing template if possible

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316209

Change subject: linter: Provide name of enclosing template if possible
..

linter: Provide name of enclosing template if possible

If the lint error is found inside a template, include the name of the
enclosing template to make it easier for editors to find the issue.

If it is not inside a template, the `templateInfo` variable will be
false.

Change-Id: I918de5a0a842e5e362a5c2a75d639c435f02dfa2
---
M lib/logger/linter.js
M lib/wt2html/pp/handlers/linter.js
M tests/mocha/lintertest.js
3 files changed, 28 insertions(+), 16 deletions(-)


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

diff --git a/lib/logger/linter.js b/lib/logger/linter.js
index 3ac42d6..81ecf51 100644
--- a/lib/logger/linter.js
+++ b/lib/logger/linter.js
@@ -56,7 +56,7 @@
var lintObj = logData.logObject[0];
var src = lintObj.src;
var dsr = lintObj.dsr;
-   var inTransclusion = lintObj.inTransclusion;
+   var templateInfo = lintObj.templateInfo;
var msg = {};
 
var re = /lint\/(.*)/;
@@ -75,8 +75,8 @@
msg.dsr = dsr;
}
 
-   if (inTransclusion) {
-   msg.inTransclusion = inTransclusion;
+   if (templateInfo) {
+   msg.templateInfo = templateInfo;
}
if (logType === 'lint/fostered' || logType === 
'lint/multi-template' || logType === 'lint/mixed-content') {
msg.src = src;
diff --git a/lib/wt2html/pp/handlers/linter.js 
b/lib/wt2html/pp/handlers/linter.js
index 234e90d..c6b3edb 100644
--- a/lib/wt2html/pp/handlers/linter.js
+++ b/lib/wt2html/pp/handlers/linter.js
@@ -65,17 +65,19 @@
var cNodeName = c.nodeName.toLowerCase();
var dsr = dp.dsr;
var lintObj;
-   var inTransclusion = false;
+   var templateInfo = false;
 
if (tplInfo) {
dsr = tplInfo.dsr;
-   inTransclusion = true;
+   templateInfo = {
+   name: DU.findEnclosingTemplateName(tplInfo),
+   };
}
 
if (DU.hasNodeName(c, 'meta')) {
var type = c.getAttribute('typeof');
if (type === 'mw:Placeholder/StrippedTag') {
-   lintObj = { src: env.page.src, dsr: dsr, 
inTransclusion: inTransclusion };
+   lintObj = { src: env.page.src, dsr: dsr, templateInfo: 
templateInfo };
env.log('lint/stripped-tag', lintObj);
}
}
@@ -95,7 +97,7 @@
lintObj = {
src: env.page.src,
dsr: dsr,
-   inTransclusion: inTransclusion,
+   templateInfo: templateInfo,
};
env.log('lint/missing-end-tag', lintObj);
}
@@ -104,7 +106,7 @@
lintObj = {
src: env.page.src,
dsr: dsr,
-   inTransclusion: inTransclusion,
+   templateInfo: templateInfo,
};
env.log('lint/missing-start-tag', lintObj);
}
@@ -124,7 +126,7 @@
 */
 function logIgnoredTableAttr(env, c, dp, tplInfo) {
var dsr;
-   var inTransclusion = false;
+   var templateInfo = false;
if (DU.hasNodeName(c, "table")) {
var fc = c.firstChild;
while (fc) {
@@ -147,11 +149,11 @@
if (wc) {
if (tplInfo) {
dsr = 
tplInfo.dsr;
-   
inTransclusion = true;
+   
templateInfo = { name: DU.findEnclosingTemplateName(tplInfo) };
} else {
dsr = 
dp.dsr;
}
-   var lintObj = { 
src: env.page.src, dsr: dsr, inTransclusion: inTransclusion };
+   var lintObj = { 
src: env.page.src, dsr: dsr, templateInfo: templateInfo };

env.log('lint/ignored-table-attr', lintObj);
}
  

[MediaWiki-commits] [Gerrit] mediawiki...GlobalUserPage[master]: Use LoadBalancer::getConnectionRef()

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316208

Change subject: Use LoadBalancer::getConnectionRef()
..

Use LoadBalancer::getConnectionRef()

So we don't have to call reuseConnection() manually afterwards.

And use the newer DB_REPLICA.

Change-Id: Id095ea0ae749ed869a00206b1c8af431fc729dca
---
M GlobalUserPage.body.php
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUserPage 
refs/changes/08/316208/1

diff --git a/GlobalUserPage.body.php b/GlobalUserPage.body.php
index 7e0504d..1538cdd 100644
--- a/GlobalUserPage.body.php
+++ b/GlobalUserPage.body.php
@@ -167,7 +167,7 @@
 
global $wgGlobalUserPageDBname;
$lb = wfGetLB( $wgGlobalUserPageDBname );
-   $dbr = $lb->getConnection( DB_SLAVE, array(), 
$wgGlobalUserPageDBname );
+   $dbr = $lb->getConnectionRef( DB_REPLICA, array(), 
$wgGlobalUserPageDBname );
$row = $dbr->selectRow(
[ 'page', 'page_props' ],
[ 'page_touched', 'pp_propname' ],
@@ -190,7 +190,6 @@
} else {
$touched = false;
}
-   $lb->reuseConnection( $dbr );
 
self::$touchedCache->set( $user->getName(), $touched );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id095ea0ae749ed869a00206b1c8af431fc729dca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUserPage
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Re-add human readable parser limit report

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316207

Change subject: Re-add human readable parser limit report
..

Re-add human readable parser limit report

This mostly reverts commit 1255654ed5a89ed57491bda38f544ed87e3bc601.

This re-adds the human readable parser limit report, and makes a few
adjustments necessary for it to work properly.

* In EditPage::getPreviewLimitReport(), only generate the HTML report,
  the JS variable will be added by OutputPage
* If there are multiple calls to OutputPage::addParserOutputMetadata(),
  only use the limit report data from the first one.
* Only add the wgPageParseReport variable if limit report data is
  available.

Change-Id: Iad2646acde79b8a59710bb9fd5fbbfea5a39c341
---
M includes/EditPage.php
M includes/OutputPage.php
2 files changed, 53 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/07/316207/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 1c13d56..0d8def3 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2787,9 +2787,8 @@
$wgOut->addHTML( Html::rawElement( 'div', [ 'class' => 
'hiddencats' ],
Linker::formatHiddenCategories( 
$this->page->getHiddenCategories() ) ) );
 
-   if ( $this->mParserOutput ) {
-   $wgOut->setLimitReportData( 
$this->mParserOutput->getLimitReportData() );
-   }
+   $wgOut->addHTML( Html::rawElement( 'div', [ 'class' => 
'limitreport' ],
+   self::getPreviewLimitReport( $this->mParserOutput ) ) );
 
$wgOut->addModules( 'mediawiki.action.edit.collapsibleFooter' );
 
@@ -3567,12 +3566,47 @@
return '';
}
 
-   return ResourceLoader::makeInlineScript(
-   ResourceLoader::makeConfigSetScript(
-   [ 'wgPageParseReport' => 
$output->getLimitReportData() ],
-   true
-   )
+   $limitReport = Html::rawElement( 'div', [ 'class' => 
'mw-limitReportExplanation' ],
+   wfMessage( 'limitreport-title' )->parseAsBlock()
);
+
+   // Show/hide animation doesn't work correctly on a table, so 
wrap it in a div.
+   $limitReport .= Html::openElement( 'div', [ 'class' => 
'preview-limit-report-wrapper' ] );
+
+   $limitReport .= Html::openElement( 'table', [
+   'class' => 'preview-limit-report wikitable'
+   ] ) .
+   Html::openElement( 'tbody' );
+
+   foreach ( $output->getLimitReportData()['limitreport'] as $key 
=> $value ) {
+   if ( Hooks::run( 'ParserLimitReportFormat',
+   [ $key, &$value, &$limitReport, true, true ]
+   ) ) {
+   $keyMsg = wfMessage( "limitreport-$key" );
+   $valueMsg = wfMessage(
+   [ "limitreport-$key-value-html", 
"limitreport-$key-value" ]
+   );
+   if ( !$valueMsg->exists() ) {
+   $valueMsg = new RawMessage( '$1' );
+   }
+   if ( !$keyMsg->isDisabled() && 
!$valueMsg->isDisabled() ) {
+   // If it's a value/limit array, convert 
it for $1/$2
+   if ( is_array( $value ) && isset( 
$value['value'] ) ) {
+   $value = [ $value['value'], 
$value['limit'] ];
+   }
+   $limitReport .= Html::openElement( 'tr' 
) .
+   Html::rawElement( 'th', null, 
$keyMsg->parse() ) .
+   Html::rawElement( 'td', null, 
$valueMsg->params( $value )->parse() ) .
+   Html::closeElement( 'tr' );
+   }
+   }
+   }
+
+   $limitReport .= Html::closeElement( 'tbody' ) .
+   Html::closeElement( 'table' ) .
+   Html::closeElement( 'div' );
+
+   return $limitReport;
}
 
protected function showStandardInputs( &$tabindex = 2 ) {
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index a69c0e6..50f9eb9 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -1782,7 +1782,9 @@
}
 
// Include profiling data
-   $this->setLimitReportData( $parserOutput->getLimitReportData() 
);
+   if ( !$this->limitReportData ) {

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Fix margins around progress dialog rows

2016-10-15 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316206

Change subject: Fix margins around progress dialog rows
..

Fix margins around progress dialog rows

Change-Id: I02fe4252ac34fd60cdcddebbf7b40942e998cd9d
---
M src/ui/styles/dialogs/ve.ui.ProgressDialog.css
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/06/316206/1

diff --git a/src/ui/styles/dialogs/ve.ui.ProgressDialog.css 
b/src/ui/styles/dialogs/ve.ui.ProgressDialog.css
index 0954c2e..b53f2f3 100644
--- a/src/ui/styles/dialogs/ve.ui.ProgressDialog.css
+++ b/src/ui/styles/dialogs/ve.ui.ProgressDialog.css
@@ -7,6 +7,9 @@
 .ve-ui-progressDialog-row {
display: table;
width: 100%;
+}
+
+.ve-ui-progressDialog-row:not( :last-child ) {
margin-bottom: 1em;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02fe4252ac34fd60cdcddebbf7b40942e998cd9d
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Display both subject and talk subpages for Special:MovePage

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Display both subject and talk subpages for Special:MovePage
..


Display both subject and talk subpages for Special:MovePage

Editors were only able to see current page subpages, not subpages of
the corresponding talk page (if there is one). Consolidate display
routine in showSubpagesList. Conditionally show as needed

Adds 'movesubpagetalktext' to en.json for description of second
bulleted list.

Bug: T140026
Change-Id: Id5bb52411ab8249eda180b13aef7d8884064b5db
---
M includes/specials/SpecialMovepage.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 42 insertions(+), 15 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialMovepage.php 
b/includes/specials/SpecialMovepage.php
index 7b7661d..298d6c4 100644
--- a/includes/specials/SpecialMovepage.php
+++ b/includes/specials/SpecialMovepage.php
@@ -783,32 +783,57 @@
LogEventsList::showLogExtract( $out, 'move', $title );
}
 
+   /**
+* Show subpages of the page being moved. Section is not shown if both 
current
+* namespace does not support subpages and no talk subpages were found.
+*
+* @param Title $title Page being moved.
+*/
function showSubpages( $title ) {
-   if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
-   return;
-   }
-
+   $nsHasSubpages = MWNamespace::hasSubpages( 
$title->getNamespace() );
$subpages = $title->getSubpages();
$count = $subpages instanceof TitleArray ? $subpages->count() : 
0;
 
-   $out = $this->getOutput();
-   $out->wrapWikiMsg( '== $1 ==', [ 'movesubpage', $count ] );
+   $titleIsTalk = $title->isTalkPage();
+   $subpagesTalk = $title->getTalkPage()->getSubpages();
+   $countTalk = $subpagesTalk instanceof TitleArray ? 
$subpagesTalk->count() : 0;
+   $totalCount = $count + $countTalk;
 
-   # No subpages.
-   if ( $count == 0 ) {
-   $out->addWikiMsg( 'movenosubpage' );
-
+   if ( !$nsHasSubpages && $countTalk == 0 ) {
return;
}
 
-   $out->addWikiMsg( 'movesubpagetext', 
$this->getLanguage()->formatNum( $count ) );
+   $this->getOutput()->wrapWikiMsg(
+   '== $1 ==',
+   [ 'movesubpage', ( $titleIsTalk ? $count : $totalCount 
) ]
+   );
+
+   if ( $nsHasSubpages ) {
+   $this->showSubpagesList( $subpages, $count, 
'movesubpagetext', true );
+   }
+
+   if ( !$titleIsTalk && $countTalk > 0 ) {
+   $this->showSubpagesList( $subpagesTalk, $countTalk, 
'movesubpagetalktext' );
+   }
+   }
+
+   function showSubpagesList( $subpages, $pagecount, $wikiMsg, 
$noSubpageMsg = false ) {
+   $out = $this->getOutput();
+
+   # No subpages.
+   if ( $pagecount == 0 && $noSubpageMsg ) {
+   $out->addWikiMsg( 'movenosubpage' );
+   return;
+   }
+
+   $out->addWikiMsg( $wikiMsg, $this->getLanguage()->formatNum( 
$pagecount ) );
$out->addHTML( "\n" );
 
$linkBatch = new LinkBatch( $subpages );
$linkBatch->setCaller( __METHOD__ );
$linkBatch->execute();
-
$linkRenderer = $this->getLinkRenderer();
+
foreach ( $subpages as $subpage ) {
$link = $linkRenderer->makeLink( $subpage );
$out->addHTML( "$link\n" );
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index d10749d..36f7461 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2505,6 +2505,7 @@
"movelogpagetext": "Below is a list of all page moves.",
"movesubpage": "{{PLURAL:$1|Subpage|Subpages}}",
"movesubpagetext": "This page has $1 {{PLURAL:$1|subpage|subpages}} 
shown below.",
+   "movesubpagetalktext": "The corresponding talk page has $1 
{{PLURAL:$1|subpage|subpages}} shown below.",
"movenosubpage": "This page has no subpages.",
"movereason": "Reason:",
"move-redirect-text": "",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 96f8c38..a124d83 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2687,9 +2687,10 @@
"movepage-max-pages": "PROBABLY (A GUESS): when moving a page, you can 
select an option of moving its subpages, but there is a maximum that can be 
moved automatically.\n\nParameters:\n* $1 - maximum moved pages, defined in the 
variable 
[[mw:Special:MyLangua

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: addRFCandPMIDInterwiki: Fix strict mode errors

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: addRFCandPMIDInterwiki: Fix strict mode errors
..


addRFCandPMIDInterwiki: Fix strict mode errors

Those columns have no defaults and cause errors if MySQL strict mode is
enabled.

Also make this maintenance script runnable standalone.

Bug: T147536
Change-Id: I0f0ba6fc4375c44b71852c5c2dad8336db17c479
---
M maintenance/addRFCandPMIDInterwiki.php
1 file changed, 10 insertions(+), 1 deletion(-)

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



diff --git a/maintenance/addRFCandPMIDInterwiki.php 
b/maintenance/addRFCandPMIDInterwiki.php
index 9740ef2..2262338 100644
--- a/maintenance/addRFCandPMIDInterwiki.php
+++ b/maintenance/addRFCandPMIDInterwiki.php
@@ -63,7 +63,10 @@
[ 'iw_prefix' ],
[
'iw_prefix' => 'rfc',
-   'iw_url' => 
'https://tools.ietf.org/html/rfc$1'
+   'iw_url' => 
'https://tools.ietf.org/html/rfc$1',
+   'iw_api' => '',
+   'iw_wikiid' => '',
+   'iw_local' => 0,
],
__METHOD__
);
@@ -74,6 +77,9 @@
[
'iw_prefix' => 'pmid',
'iw_url' => 
'https://www.ncbi.nlm.nih.gov/pubmed/$1?dopt=Abstract',
+   'iw_api' => '',
+   'iw_wikiid' => '',
+   'iw_local' => 0,
],
__METHOD__,
// If there's already a pmid interwiki link, don't
@@ -84,3 +90,6 @@
return true;
}
 }
+
+$maintClass = 'AddRFCAndPMIDInterwiki';
+require_once RUN_MAINTENANCE_IF_MAIN;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0f0ba6fc4375c44b71852c5c2dad8336db17c479
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Parent5446 
Gerrit-Reviewer: TTO 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] labs/striker[master]: Update client side validation for username and shellname

2016-10-15 Thread BryanDavis (Code Review)
BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316205

Change subject: Update client side validation for username and shellname
..

Update client side validation for username and shellname

* Add client side regex validation for shellname
* Check username for invalid characters in ajax callback. This makes the
  error message a little more vague, but it improves feedback generally
  so I think it's ok.

Change-Id: I312ae6ba3e33806778e1a95f0b7116262f274d22
---
M striker/register/forms.py
M striker/register/utils.py
M striker/register/views.py
3 files changed, 61 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/striker 
refs/changes/05/316205/1

diff --git a/striker/register/forms.py b/striker/register/forms.py
index 8f62a9b..8781da9 100644
--- a/striker/register/forms.py
+++ b/striker/register/forms.py
@@ -35,7 +35,6 @@
 
 @parsleyfy
 class LDAPUsername(forms.Form):
-IN_USE = _('Username is already in use.')
 username = forms.CharField(
 label=_('Username'),
 widget=forms.TextInput(
@@ -51,7 +50,8 @@
 'data-parsley-remote': mark_safe(
 '/register/api/username/{value}'),
 'data-parsley-trigger': 'focusin focusout input',
-'data-parsley-remote-message': IN_USE,
+'data-parsley-remote-message':  _(
+'Username is already in use or invalid.'),
 }
 ),
 max_length=255,
@@ -68,19 +68,8 @@
 regex='\S$',
 message=_('Must not end with whitespace')
 ),
-# See MediaWikiTitleCodec::getTitleInvalidRegex()
 validators.RegexValidator(
-regex=(
-# Any char that is not in $wgLegalTitleChars
-r'[^'
-r''' %!"$&'()*,\-./0-9:;=?@A-Z\^_`a-z~'''
-'\x80-\xFF'
-r'+]'
-# URL percent encoding sequences
-r'|%[0-9A-Fa-f]{2}'
-# XML/HTML entities
-'|&([A-Za-z0-9\x80-\xff]+|#([0-9]+|x[0-9A-Fa-f]+));'
-),
+regex=utils.get_username_invalid_regex(),
 inverse_match=True,
 message=_(
 'Value contains illegal characters or character sequences.'
@@ -97,7 +86,7 @@
 username = self.cleaned_data['username'].strip()
 username = username[0].upper() + username[1:]
 if not utils.username_available(username):
-raise forms.ValidationError(self.IN_USE)
+raise forms.ValidationError(_('Username is already in use.'))
 
 # Check that it isn't banned by some abusefilter type rule
 user = utils.check_username_create(username)
@@ -110,7 +99,14 @@
 
 @parsleyfy
 class ShellUsername(forms.Form):
-IN_USE = _('Shell username is already in use.')
+# Unix username regex suggested by useradd(8).
+# We don't allow a leading '_' or trailing '$' however.
+RE_NAME = r'^[a-z][a-z0-9_-]{0,31}$'
+NAME_ERR_MSG = _(
+'Must start with a-z, and can only contain '
+'lowercase a-z, 0-9, _, and - characters.'
+)
+
 shellname = forms.CharField(
 label=_('Shell username'),
 widget=forms.TextInput(
@@ -126,19 +122,15 @@
 'data-parsley-remote': mark_safe(
 '/register/api/shellname/{value}'),
 'data-parsley-trigger': 'focusin focusout input',
-'data-parsley-remote-message': IN_USE,
+'data-parsley-remote-message': _(
+'Shell username is already in use or invalid.'),
+'data-parsley-pattern': RE_NAME,
+'data-parsley-pattern-message': NAME_ERR_MSG,
 }
 ),
 max_length=32,
 validators=[
-validators.RegexValidator(
-# Unix username regex suggested by useradd(8).
-# We don't allow a leading '_' or trailing '$' however.
-regex=r'^[a-z][a-z0-9_-]{0,31}$',
-message=_(
-'Must start with a-z, and can only contain '
-'lowercase a-z, 0-9, _, and - characters.')
-)
+validators.RegexValidator(regex=RE_NAME, message=NAME_ERR_MSG),
 ]
 )
 
@@ -146,7 +138,7 @@
 """Validate that shellname is available."""
 shellname = self.cleaned_data['shellname']
 if not utils.shellname_available(shellname):
-raise forms.ValidationError(self.IN_USE)
+raise forms.ValidationError(_('Shell username is already in use.'))
 
 # Check that it isn't banned by some abusefilter type rule
 user = utils.check_username_create(shellname)
diff --git a/striker/register/utils.py b/striker/register/utils.py
inde

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Make $wgMessageCacheType on beta cluster the same as on prod...

2016-10-15 Thread AndyRussG (Code Review)
AndyRussG has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316204

Change subject: Make $wgMessageCacheType on beta cluster the same as on 
production
..

Make $wgMessageCacheType on beta cluster the same as on production

This is for debugging MessageCache issues.

Bug: T144952
Change-Id: I9e2844db4b619ac8af9bb0ba19d6b8913fb1b45a
---
M wmf-config/CommonSettings-labs.php
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index f6fe606..377736d 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -309,8 +309,6 @@
$wgDefaultUserOptions['compact-language-links'] = 0;
 }
 
-$wgMessageCacheType = CACHE_ACCEL;
-
 // Let Beta Cluster Commons do upload-from-URL from production Commons.
 if ( $wgDBname == 'commonswiki' ) {
$wgCopyUploadsDomains[] = 'upload.wikimedia.org';

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: SpecialBooksources: Fix submitting the form from a subpage link

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316203

Change subject: SpecialBooksources: Fix submitting the form from a subpage link
..

SpecialBooksources: Fix submitting the form from a subpage link

Visiting Special:Booksources/ and then trying to enter a new
ISBN in the form field didn't work because the $par would take
precedence over the query parameter.

Removing the subpage from the HTMLForm context apparently fixes this.

Change-Id: Ia007648e23beadcc017e117e59ce3df1b329dcdc
---
M includes/specials/SpecialBooksources.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/03/316203/1

diff --git a/includes/specials/SpecialBooksources.php 
b/includes/specials/SpecialBooksources.php
index 2fef725..72e0b88 100644
--- a/includes/specials/SpecialBooksources.php
+++ b/includes/specials/SpecialBooksources.php
@@ -133,7 +133,9 @@
],
];
 
-   HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() 
)
+   $context = new DerivativeContext( $this->getContext() );
+   $context->setTitle( $this->getPageTitle() );
+   HTMLForm::factory( 'ooui', $formDescriptor, $context )
->setWrapperLegendMsg( 'booksources-search-legend' )
->setSubmitTextMsg( 'booksources-search' )
->setMethod( 'get' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia007648e23beadcc017e117e59ce3df1b329dcdc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Special:SecurePoll should be listed on Special:SpecialPages

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Special:SecurePoll should be listed on Special:SpecialPages
..


Special:SecurePoll should be listed on Special:SpecialPages

Bug: T145342
Change-Id: I6a1c08b8ac49bc860ff0b10bb200f27b56e89568
---
M includes/main/SpecialSecurePoll.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/main/SpecialSecurePoll.php 
b/includes/main/SpecialSecurePoll.php
index 558f0d1..e6c59f3 100644
--- a/includes/main/SpecialSecurePoll.php
+++ b/includes/main/SpecialSecurePoll.php
@@ -5,7 +5,7 @@
  * Special:SecurePoll.  The actual pages are not actually subclasses of
  * this or of SpecialPage, they're subclassed from SecurePoll_ActionPage.
  */
-class SecurePoll_SpecialSecurePoll extends UnlistedSpecialPage {
+class SecurePoll_SpecialSecurePoll extends SpecialPage {
public static $pages = array(
'create' => 'SecurePoll_CreatePage',
'edit' => 'SecurePoll_CreatePage',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6a1c08b8ac49bc860ff0b10bb200f27b56e89568
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Huji 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Reedy 
Gerrit-Reviewer: Tim Starling 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] integration/docroot[master]: doc: Move VisualEditor under MediaWiki extensions

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316202

Change subject: doc: Move VisualEditor under MediaWiki extensions
..

doc: Move VisualEditor under MediaWiki extensions

The API documenation is for the MediaWiki extension, not the standalone
library (though we should publish separate documentation for that too).

Change-Id: Ic442351eeb6e91cf211e4f260b20d3b3a06f2d9a
---
M org/wikimedia/doc/default.html
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/docroot 
refs/changes/02/316202/1

diff --git a/org/wikimedia/doc/default.html b/org/wikimedia/doc/default.html
index 8ed31cb..b12d5f2 100644
--- a/org/wikimedia/doc/default.html
+++ b/org/wikimedia/doc/default.html
@@ -26,7 +26,6 @@
Timestamp
Unicode JS
utfnormal
-   VisualEditor
WaitConditionLoop
WrappedString
 
@@ -49,6 +48,7 @@

MultimediaViewer
TemplateData
+   VisualEditor
 
 Pywikibot
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic442351eeb6e91cf211e4f260b20d3b3a06f2d9a
Gerrit-PatchSet: 1
Gerrit-Project: integration/docroot
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...FlaggedRevs[master]: Convert FlaggedRevs to extension registration

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316201

Change subject: Convert FlaggedRevs to extension registration
..

Convert FlaggedRevs to extension registration

Bug: T87915
Change-Id: Iee3f6fa55da329f1e39feff93f9470b3af6cf86f
---
D FlaggedRevs.config.php
D FlaggedRevs.defines.php
M FlaggedRevs.php
M backend/FlaggedRevs.hooks.php
A extension.json
M tests/FRUserCountersTest.php
6 files changed, 535 insertions(+), 672 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlaggedRevs 
refs/changes/01/316201/1

diff --git a/FlaggedRevs.config.php b/FlaggedRevs.config.php
deleted file mode 100644
index 07f03b2..000
--- a/FlaggedRevs.config.php
+++ /dev/null
@@ -1,10 +0,0 @@
-http://www.gnu.org/copyleft/gpl.html
-*/
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo "FlaggedRevs extension\n";
-   exit( 1 );
+if ( function_exists( 'wfLoadExtension' ) ) {
+   wfLoadExtension( 'FlaggedRevs' );
+   // Keep i18n globals so mergeMessageFileList.php doesn't break
+   $wgMessagesDirs['FlaggedRevs'] = __DIR__ . '/i18n/flaggedrevs';
+   $wgExtensionMessagesFiles['FlaggedRevs'] = __DIR__ . 
"/frontend/language/FlaggedRevs.i18n.php";
+   $wgExtensionMessagesFiles['FlaggedRevsMagic'] = __DIR__ . 
"/frontend/language/FlaggedRevs.i18n.magic.php";
+   $wgExtensionMessagesFiles['FlaggedRevsAliases'] = __DIR__ . 
"/frontend/language/FlaggedRevs.alias.php";
+   /*wfWarn(
+   'Deprecated PHP entry point used for FlaggedRevs extension. ' .
+   'Please use wfLoadExtension instead, ' .
+   'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+   );*/
+   return;
+} else {
+   die( 'This version of the FlaggedRevs extension requires MediaWiki 
1.28+' );
 }
-
-# Stable constant to let extensions be aware that this is enabled
-define( 'FLAGGED_REVISIONS', true );
-
-$wgExtensionCredits['specialpage'][] = array(
-   'path'   => __FILE__,
-   'name'   => 'Flagged Revisions',
-   'author' => array( 'Aaron Schulz', 'Joerg Baach' ),
-   'url'=> 
'https://www.mediawiki.org/wiki/Extension:FlaggedRevs',
-   'descriptionmsg' => 'flaggedrevs-desc',
-   'license-name'   => 'GPL-2.0+',
-);
-
-# Load global constants
-require( dirname( __FILE__ ) . '/FlaggedRevs.defines.php' );
-
-# This will only distinguish "checked", "quality", and unreviewed
-# A small icon will show in the upper right hand corner
-$wgSimpleFlaggedRevsUI = true; // @TODO: remove when ready
-# For visitors, only show tags/icons for unreviewed/outdated pages
-$wgFlaggedRevsLowProfile = true; // @TODO: remove with new icon UI?
-
-# Allowed namespaces of reviewable pages
-$wgFlaggedRevsNamespaces = array( NS_MAIN, NS_FILE, NS_TEMPLATE );
-# Pages exempt from reviewing. No flagging UI will be shown for them.
-$wgFlaggedRevsWhitelist = array();
-# $wgFlaggedRevsWhitelist = array( 'Main_Page' );
-
-# Is a "stable version" used as the default display
-# version for all pages in reviewable namespaces?
-$wgFlaggedRevsOverride = true;
-# Below are groups that see the current revision by default.
-# This makes editing easier since the users always start off
-# viewing the latest version of pages.
-$wgFlaggedRevsExceptions = array( 'user' ); // @TODO: remove when ready (and 
expand pref)
-
-# Auto-review settings for edits/new pages:
-# FR_AUTOREVIEW_NONE
-#   Don't auto-review any edits or new pages
-# FR_AUTOREVIEW_CHANGES
-#   Auto-review the following types of edits (to existing pages):
-#   (a) changes directly to the stable version by users with 'autoreview'/'bot'
-#   (b) reversions to old reviewed versions by users with 'autoreview'/'bot'
-#   (c) self-reversions back to the stable version by any user
-# FR_AUTOREVIEW_CREATION
-#   Auto-review new pages as minimally "checked"
-# FR_AUTOREVIEW_CREATION_AND_CHANGES
-#   Combines FR_AUTOREVIEW_CHANGES and FR_AUTOREVIEW_CREATION
-$wgFlaggedRevsAutoReview = FR_AUTOREVIEW_CREATION_AND_CHANGES;
-
-# Define the tags we can use to rate an article, number of levels,
-# and set the minimum level to have it become a "quality" or "pristine" 
version.
-# NOTE: When setting up new dimensions or levels, you will need to add some
-#   MediaWiki messages for the UI to show properly; any sysop can do this.
-$wgFlaggedRevsTags = array(
-   'accuracy' => array( 'levels' => 3, 'quality' => 2, 'pristine' => 4 ),
-   'depth'=> array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
-   'style'=> array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
-);
-# For each tag, define the highest tag level that is unlocked by
-# having certain rights. For example, having 'review' rights may
-# allow for "depth" to be rated up to second level.
-# NOTE: Users cannot lower revision tags from a level they can't set.
-# NOTE: Users with 'validate' (Re

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Don't hardcode magic link URLs

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316200

Change subject: Don't hardcode magic link URLs
..

Don't hardcode magic link URLs

These are actually configurable via MediaWiki messages, so use those
instead of hardcoding the default URLs.

Change-Id: Ie66a1b53f9c011947fe9e8db198a5904373f3192
---
M extension.json
M modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/00/316200/1

diff --git a/extension.json b/extension.json
index efcc68f..c32e16a 100644
--- a/extension.json
+++ b/extension.json
@@ -1457,7 +1457,9 @@

"visualeditor-magiclinknodeinspector-convert-link",

"visualeditor-magiclinknodeinspector-title-isbn",

"visualeditor-magiclinknodeinspector-title-pmid",
-   "visualeditor-magiclinknodeinspector-title-rfc"
+   "visualeditor-magiclinknodeinspector-title-rfc",
+   "rfcurl",
+   "pubmedurl"
],
"targets": [
"desktop",
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js
index 8b6b3cd..e63fdf7 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWMagicLinkNode.js
@@ -386,7 +386,7 @@
 OO.inheritClass( ve.dm.MWMagicLinkPmidType, ve.dm.MWMagicLinkType );
 
 ve.dm.MWMagicLinkPmidType.prototype.getHref = function () {
-   return '//www.ncbi.nlm.nih.gov/pubmed/' + this.code + '?dopt=Abstract';
+   return mw.msg( 'pubmedurl', this.code );
 };
 
 /**
@@ -407,7 +407,7 @@
 OO.inheritClass( ve.dm.MWMagicLinkRfcType, ve.dm.MWMagicLinkType );
 
 ve.dm.MWMagicLinkRfcType.prototype.getHref = function () {
-   return '//tools.ietf.org/html/rfc' + this.code;
+   return mw.msg( 'rfcurl', this.code );
 };
 
 /* Registration */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie66a1b53f9c011947fe9e8db198a5904373f3192
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Cleanup ElementLinearData#sanitize

2016-10-15 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316198

Change subject: Cleanup ElementLinearData#sanitize
..

Cleanup ElementLinearData#sanitize

* Always decrement counter by one and continue when splicing forwards.
* Always test the character at 'i'.

Change-Id: I494c9b4d23ec3b0f97146c3beabc1d49e063b7a0
---
M src/dm/lineardata/ve.dm.ElementLinearData.js
M tests/dm/lineardata/ve.dm.ElementLinearData.test.js
2 files changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/98/316198/1

diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js 
b/src/dm/lineardata/ve.dm.ElementLinearData.js
index b080ed7..f573a93 100644
--- a/src/dm/lineardata/ve.dm.ElementLinearData.js
+++ b/src/dm/lineardata/ve.dm.ElementLinearData.js
@@ -1084,7 +1084,6 @@
type = this.getType( i );
canContainContent = 
ve.dm.nodeFactory.canNodeContainContent( type );
isOpen = this.isOpenElementData( i );
-
// Apply type conversions
if ( rules.conversions && rules.conversions[ type ] ) {
type = rules.conversions[ type ];
@@ -1105,33 +1104,38 @@
( rules.plainText && type !== 'paragraph' && 
type !== 'internalList' )
) {
this.splice( i, 1 );
+   len--;
// Make sure you haven't just unwrapped a 
wrapper paragraph
-   if ( ve.getProp( this.getData( i ), 'internal', 
'generated' ) ) {
+   if ( isOpen && ve.getProp( this.getData( i ), 
'internal', 'generated' ) ) {
delete this.getData( i 
).internal.generated;
if ( ve.isEmptyObject( this.getData( i 
).internal ) ) {
delete this.getData( i 
).internal;
}
}
+   // Move pointer back and continue
i--;
-   len--;
continue;
}
 
// Split on breaks
if ( !rules.allowBreaks && type === 'break' && 
contentElement ) {
this.splice( i, 2, { type: '/' + 
contentElement.type }, ve.copy( contentElement ) );
+   // Move pointer back and continue
+   i--;
+   continue;
}
 
// If a node is empty but can contain content, then 
just remove it
if (
!rules.keepEmptyContentBranches &&
-   i > 0 && !isOpen && this.isOpenElementData( i - 
1 ) &&
-   !ve.getProp( this.getData( i - 1 ), 'internal', 
'generated' ) &&
+   isOpen && this.isCloseElementData( i + 1 ) &&
+   !ve.getProp( this.getData( i ), 'internal', 
'generated' ) &&
canContainContent
) {
-   this.splice( i - 1, 2 );
-   i -= 2;
+   this.splice( i, 2 );
len -= 2;
+   // Move pointer back and continue
+   i--;
continue;
}
 
@@ -1159,8 +1163,9 @@
if ( this.getCharacterData( i + 1 ).match( /\s/ 
) || this.getCharacterData( i - 1 ).match( /\s/ ) ) {
// If whitespace-adjacent, remove the 
newline to avoid double spaces
this.splice( i, 1 );
-   i--;
len--;
+   // Move pointer back and continue
+   i--;
continue;
} else {
// ...otherwise replace it with a space
diff --git a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js 
b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
index 8d4f48a..d1ec7a2 100644
--- a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
+++ b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
@@ -1593,7 +1593,7 @@
{ type: '/internalList' }
],
rules: { plainText: tru

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Ignore s used to keep empty branch nodes open

2016-10-15 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316199

Change subject: Ignore s used to keep empty branch nodes open
..

Ignore s used to keep empty branch nodes open

These may appear in external HTML, e.g. empty cells from
LibreOffice Calc.

Change-Id: I6e82e3928c330da0a422e56a1b08942d078a45d8
---
M src/dm/lineardata/ve.dm.ElementLinearData.js
M tests/dm/lineardata/ve.dm.ElementLinearData.test.js
2 files changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/99/316199/1

diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js 
b/src/dm/lineardata/ve.dm.ElementLinearData.js
index f573a93..4ae5049 100644
--- a/src/dm/lineardata/ve.dm.ElementLinearData.js
+++ b/src/dm/lineardata/ve.dm.ElementLinearData.js
@@ -1119,7 +1119,13 @@
 
// Split on breaks
if ( !rules.allowBreaks && type === 'break' && 
contentElement ) {
-   this.splice( i, 2, { type: '/' + 
contentElement.type }, ve.copy( contentElement ) );
+   if ( this.isOpenElementData( i - 1 ) ) {
+   // If the break is the first element in 
another element, just remove it
+   this.splice( i, 2 );
+   len -= 2;
+   } else {
+   this.splice( i, 2, { type: '/' + 
contentElement.type }, ve.copy( contentElement ) );
+   }
// Move pointer back and continue
i--;
continue;
diff --git a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js 
b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
index d1ec7a2..1d30da4 100644
--- a/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
+++ b/tests/dm/lineardata/ve.dm.ElementLinearData.test.js
@@ -1637,6 +1637,20 @@
msg: 'Empty, but generated, content nodes are 
preserved'
},
{
+   html: '',
+   data: [
+   { type: 'list', attributes: { style: 
'bullet' } },
+   { type: 'listItem' },
+   { type: 'paragraph', internal: { 
generated: 'wrapper' } },
+   { type: '/paragraph' },
+   { type: '/listItem' },
+   { type: '/list' },
+   { type: 'internalList' },
+   { type: '/internalList' }
+   ],
+   msg: 'Line breaks in wrapper paragraphs are 
discarded'
+   },
+   {
html: 'Foo',
data: [
{ type: 'paragraph' },

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e82e3928c330da0a422e56a1b08942d078a45d8
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders 

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


[MediaWiki-commits] [Gerrit] mediawiki...CentralAuth[master]: Make CentralAuthHooks::onLocalUserCreated() trigger importLo...

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Make CentralAuthHooks::onLocalUserCreated() trigger 
importLocalNames()
..


Make CentralAuthHooks::onLocalUserCreated() trigger importLocalNames()

The update will be done post-send to avoid blocking the client.

This avoids having the import randomly happen on HTTP GET.

Bug: T92357
Change-Id: I769a75512fc523da94377098567b53d23a03cc38
---
M includes/CentralAuthHooks.php
M includes/CentralAuthPrimaryAuthenticationProvider.php
M includes/CentralAuthUser.php
M includes/CentralAuthUtils.php
M includes/LocalRenameJob/LocalPageMoveJob.php
M includes/specials/SpecialCentralAutoLogin.php
6 files changed, 25 insertions(+), 14 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/CentralAuthHooks.php b/includes/CentralAuthHooks.php
index eb6366a..81df7ff 100644
--- a/includes/CentralAuthHooks.php
+++ b/includes/CentralAuthHooks.php
@@ -279,9 +279,11 @@
if ( !$centralUser->exists() && !$centralUser->listUnattached() 
) {
if ( $centralUser->register( null, $user->getEmail() ) 
) {
$centralUser->attach( wfWikiID(), 'new' );
-   
CentralAuthUtils::getCentralDB()->onTransactionIdle( function () use ( 
$centralUser ) {
-   CentralAuthUtils::scheduleCreationJobs( 
$centralUser );
-   } );
+   
CentralAuthUtils::getCentralDB()->onTransactionIdle(
+   function () use ( $centralUser ) {
+   
CentralAuthUtils::scheduleCreationJobs( $centralUser );
+   }
+   );
}
}
 
diff --git a/includes/CentralAuthPrimaryAuthenticationProvider.php 
b/includes/CentralAuthPrimaryAuthenticationProvider.php
index 1f5d158..4b87861 100644
--- a/includes/CentralAuthPrimaryAuthenticationProvider.php
+++ b/includes/CentralAuthPrimaryAuthenticationProvider.php
@@ -448,6 +448,10 @@
 
public function finishAccountCreation( $user, $creator, 
AuthenticationResponse $response ) {
$centralUser = CentralAuthUser::getMasterInstance( $user );
+   // Populate the table of local users with this name post-send 
(if not done already)
+   DeferredUpdates::addCallableUpdate( function () use ( 
$centralUser ) {
+   $centralUser->lazyImportLocalNames();
+   } );
// Do the attach in finishAccountCreation instead of begin 
because now the user has been added
// to database and local ID exists (which is needed in attach)
$centralUser->attach( wfWikiID(), 'new' );
diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index 7a7b836..b2859e1 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -748,7 +748,7 @@
 * @param $email String
 * @return bool
 */
-   function register( $password, $email ) {
+   public function register( $password, $email ) {
$this->checkWriteMode();
$dbw = CentralAuthUtils::getCentralDB();
list( $salt, $hash ) = $this->saltedPassword( $password );
@@ -1831,6 +1831,7 @@
$engine->send( $rc, $formatter->getLine( 
$userpage, $wikiID ) );
}
}
+
}
 
/**
@@ -2082,7 +2083,7 @@
/**
 * @return bool
 */
-   function lazyImportLocalNames() {
+   public function lazyImportLocalNames() {
$known = 
(bool)CentralAuthUtils::getCentralSlaveDB()->selectField(
'globalnames', '1', [ 'gn_name' => $this->mName ], 
__METHOD__
);
@@ -2101,7 +2102,7 @@
 *
 * @return Bool whether any results were found
 */
-   function importLocalNames() {
+   protected function importLocalNames() {
$rows = [];
foreach ( self::getWikiList() as $wikiID ) {
$dbr = wfGetLB( $wikiID )->getConnectionRef( 
DB_REPLICA, array(), $wikiID );
diff --git a/includes/CentralAuthUtils.php b/includes/CentralAuthUtils.php
index 04d905f..e4b9367 100644
--- a/includes/CentralAuthUtils.php
+++ b/includes/CentralAuthUtils.php
@@ -266,7 +266,7 @@
Title::makeTitleSafe( NS_USER, $name ),
array( 'name' => $name, 'from' => $thisWiki, 
'session' => $session )
);
-   JobQueueGroup::singleton( $wiki )->push( $job );
+   JobQueueGroup::singleton( $wiki )->lazyPush( $job );
}
}
 }
diff --git a/inc

[MediaWiki-commits] [Gerrit] mediawiki...FlaggedRevs[master]: Simplify FR loading prior to extension registration

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316197

Change subject: Simplify FR loading prior to extension registration
..

Simplify FR loading prior to extension registration

Moving a lot of code back into FlaggedRevs.php

Change-Id: Idcb938498b8d5d5cecede45534464915dbdacb8c
---
M FlaggedRevs.config.php
M FlaggedRevs.php
M FlaggedRevs.setup.php
M backend/FlaggedRevs.hooks.php
M frontend/FlaggedRevsUI.setup.php
5 files changed, 518 insertions(+), 585 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlaggedRevs 
refs/changes/97/316197/1

diff --git a/FlaggedRevs.config.php b/FlaggedRevs.config.php
index 6525e57..07f03b2 100644
--- a/FlaggedRevs.config.php
+++ b/FlaggedRevs.config.php
@@ -4,178 +4,7 @@
 # IMPORTANT: DO NOT EDIT THIS FILE
 # When configuring globals, set them at LocalSettings.php instead
 
-# This will only distinguish "checked", "quality", and unreviewed
-# A small icon will show in the upper right hand corner
-$wgSimpleFlaggedRevsUI = true; // @TODO: remove when ready
-# For visitors, only show tags/icons for unreviewed/outdated pages
-$wgFlaggedRevsLowProfile = true; // @TODO: remove with new icon UI?
 
-# Allowed namespaces of reviewable pages
-$wgFlaggedRevsNamespaces = array( NS_MAIN, NS_FILE, NS_TEMPLATE );
-# Pages exempt from reviewing. No flagging UI will be shown for them.
-$wgFlaggedRevsWhitelist = array();
-# $wgFlaggedRevsWhitelist = array( 'Main_Page' );
-
-# Is a "stable version" used as the default display
-# version for all pages in reviewable namespaces?
-$wgFlaggedRevsOverride = true;
-# Below are groups that see the current revision by default.
-# This makes editing easier since the users always start off
-# viewing the latest version of pages.
-$wgFlaggedRevsExceptions = array( 'user' ); // @TODO: remove when ready (and 
expand pref)
-
-# Auto-review settings for edits/new pages:
-# FR_AUTOREVIEW_NONE
-#   Don't auto-review any edits or new pages
-# FR_AUTOREVIEW_CHANGES
-#   Auto-review the following types of edits (to existing pages):
-#   (a) changes directly to the stable version by users with 'autoreview'/'bot'
-#   (b) reversions to old reviewed versions by users with 'autoreview'/'bot'
-#   (c) self-reversions back to the stable version by any user
-# FR_AUTOREVIEW_CREATION
-#   Auto-review new pages as minimally "checked"
-# FR_AUTOREVIEW_CREATION_AND_CHANGES
-#   Combines FR_AUTOREVIEW_CHANGES and FR_AUTOREVIEW_CREATION
-$wgFlaggedRevsAutoReview = FR_AUTOREVIEW_CREATION_AND_CHANGES;
-
-# Define the tags we can use to rate an article, number of levels,
-# and set the minimum level to have it become a "quality" or "pristine" 
version.
-# NOTE: When setting up new dimensions or levels, you will need to add some
-#   MediaWiki messages for the UI to show properly; any sysop can do this.
-$wgFlaggedRevsTags = array(
-   'accuracy' => array( 'levels' => 3, 'quality' => 2, 'pristine' => 4 ),
-   'depth'=> array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
-   'style'=> array( 'levels' => 3, 'quality' => 1, 'pristine' => 4 ),
-);
-# For each tag, define the highest tag level that is unlocked by
-# having certain rights. For example, having 'review' rights may
-# allow for "depth" to be rated up to second level.
-# NOTE: Users cannot lower revision tags from a level they can't set.
-# NOTE: Users with 'validate' (Reviewers) can set all tags to all levels.
-$wgFlaggedRevsTagsRestrictions = array(
-   'accuracy' => array( 'review' => 1, 'autoreview' => 1 ),
-   'depth'=> array( 'review' => 2, 'autoreview' => 2 ),
-   'style'=> array( 'review' => 3, 'autoreview' => 3 ),
-);
-# For each tag, what is the highest level that it can be auto-reviewed to?
-# $wgFlaggedRevsAutoReview must be enabled for this to apply.
-$wgFlaggedRevsTagsAuto = array(
-   'accuracy' => 1, 'depth' => 1, 'style' => 1
-);
-
-# Restriction levels for 'autoreview'/'review' rights.
-# When a level is selected for a page, an edit made by a user
-# will not be auto-reviewed if the user lacks the specified permission.
-# Levels are set at the Stabilization special page.
-$wgFlaggedRevsRestrictionLevels = array( '', 'sysop' );
-# Set this to use FlaggedRevs *only* as a protection-like mechanism.
-# This will disable Stabilization and show the above restriction levels
-# on the protection form of pages. Each level has the stable version shown by 
default.
-# A "none" level will appear in the form as well, to disable the review 
process.
-# Pages will only be reviewable if manually restricted to a level above "none".
-$wgFlaggedRevsProtection = false;
-
-# Define our basic reviewer class of established editors (Editors)
-$wgGroupPermissions['editor']['review']= true;
-$wgGroupPermissions['editor']['autoreview']= true;
-$wgGroupPermissions['editor']['autoconfirmed'] = true;
-$wgGroupPermissions['editor']

[MediaWiki-commits] [Gerrit] mediawiki...PageTriage[master]: Convert PageTriage to extension registration

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Convert PageTriage to extension registration
..


Convert PageTriage to extension registration

Bug: T87875
Change-Id: I63346f46164a32e6750d8b97681ae369b25ff066
---
M PageTriage.php
A extension.json
2 files changed, 863 insertions(+), 664 deletions(-)

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



diff --git a/PageTriage.php b/PageTriage.php
index a9acaf1..ea42b43 100644
--- a/PageTriage.php
+++ b/PageTriage.php
@@ -1,666 +1,14 @@
 http://www.mediawiki.org/wiki/Extension:PageTriage
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * This program is distributed WITHOUT ANY WARRANTY.
- */
-
-/**
- * This file loads everything needed for the PageTriage extension to function.
- *
- * @file
- * @ingroup Extensions
- * @author Ryan Kaldari
- * @license MIT License
- */
-
-// Alert the user that this is not a valid entry point to MediaWiki if they 
try to access the
-// special pages file directly.
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo < __FILE__,
-   'name' => 'PageTriage',
-   'version' => '0.2.1',
-   'url' => 'https://www.mediawiki.org/wiki/Extension:PageTriage',
-   'author' => [
-   'Ryan Kaldari',
-   'Benny Situ',
-   'Ian Baker',
-   'Andrew Garrett',
-   ],
-   'descriptionmsg' => 'pagetriage-desc',
-   'license-name' => 'MIT',
-];
-
-// Begin configuration variables
-// Maximum number of articles for the API to retrieve at once
-$wgPageTriagePagesPerRequest = 20;
-// Whether or not to use infinite scrolling in the page list
-$wgPageTriageInfiniteScrolling = true;
-// Whether or not the top nav bar should float
-$wgPageTriageStickyControlNav = true;
-// Whether or not the bottom nav bar should float
-$wgPageTriageStickyStatsNav = true;
-// 1 day - How long after visiting Special:NewPagesFeed do we show review 
links on articles
-$wgPageTriageMarkPatrolledLinkExpiry = 3600 * 24;
-// Array of template names (without prefixes) that will trigger noindexing of
-// pages that include them, for example, speedy deletion templates. Note that
-// it isn't necessary to list redirects or subtemplates.
-$wgPageTriageNoIndexTemplates = [];
-// Set this to true if new, unreviewed articles should be set to noindex. In 
other
-// words, if they should not be indexed by search engines until they are 
reviewed.
-$wgPageTriageNoIndexUnreviewedNewArticles = false;
-$wgPageTriageLearnMoreUrl = 
'//en.wikipedia.org/wiki/Wikipedia:Page_Curation/Help';
-$wgPageTriageProjectLink = 'Wikipedia:Page Curation';
-$wgPageTriageFeedbackUrl = 
'//en.wikipedia.org/wiki/Wikipedia_talk:Page_Curation';
-// enable the curation toolbar?
-$wgPageTriageEnableCurationToolbar = true;
-$wgPageTriageCurationModules = [
-   'articleInfo' => [
-   'helplink' => 
'//en.wikipedia.org/wiki/Wikipedia:Page_Curation/Help#PageInfo',
-   'namespace' => [ NS_MAIN, NS_USER ],
-   ],
-   'mark' => [
-   'helplink' => 
'//en.wikipedia.org/wiki/Wikipedia:Page_Curation/Help#MarkReviewed',
-   'namespace' => [ NS_MAIN, NS_USER ],
-   'note' => [ NS_MAIN ],
-   ],
-   'tags' => [
-   'helplink' => 
'//en.wikipedia.org/wiki/Wikipedia:Page_Curation/Help#AddTags',
-   'namespace' => [ NS_MAIN ],
-   ],
-   'delete' => [
-   'helplink' => 
'//en.wikipedia.org/wiki/Wikipedia:Page_Curation/Help#MarkDeletion',
-   'namespace' => [ NS_MAIN, NS_USER ],
-   ],
-];
-// version number to be added to cache key so that cache can be refreshed 
easily
-$wgPageTriageCacheVersion = '1.4';
-// only include these namespaces for pagetriage
-$wgPageTriageNamespaces = [ NS_MAIN, NS_USER ];
-$wgTalkPageNoteTemplate = [
-   'Mark' => 'Reviewednote-NPF',
-   'UnMark' => [ 'note' => 'Unreviewednote-NPF', 'nonote' => 
'Unreviewednonote-NPF' ],
-   'Tags' => 'Taggednote-NPF'
-];
-// Set which PageTriage Echo events (defined in 
P

[MediaWiki-commits] [Gerrit] mediawiki...CollaborationKit[master]: When a CollaborationListContent page does not meet the schem...

2016-10-15 Thread Harej (Code Review)
Harej has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316196

Change subject: When a CollaborationListContent page does not meet the schema, 
instead of throwing an exception it returns the offending JSON.
..

When a CollaborationListContent page does not meet the schema, instead of 
throwing an exception it returns the offending JSON.

This introduces a new top-level property in the object called "displaymode" 
which is currently optional but will be required soon. The options are "normal" 
(the default), "error" (used for outputting the error) and "members" (not 
currently used but will replace the ismemberlist bool).

Bug: T148085
Change-Id: I4f76f8f43405cf81eb84108a848a76e0255a76b7
---
M i18n/en.json
M i18n/qqq.json
M includes/content/CollaborationListContent.php
M includes/content/CollaborationListContentHandler.php
M includes/content/CollaborationListContentSchema.php
5 files changed, 36 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/96/316196/1

diff --git a/i18n/en.json b/i18n/en.json
old mode 100644
new mode 100755
index 22e18d9..172cf4e
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -35,6 +35,7 @@
"collaborationkit-createhubfeature-freetext": "Generic wiki page",
"collaborationkit-createhubfeature-articlelist": "List of pages",
"collaborationkit-list-isempty": "This list has no items in it.",
+   "collaborationkit-list-invalid": "This content does not meet the 
requirements of the CollaborationListContent schema. This may happen as a 
result of a software update. The content is reproduced below.",
"collaborationkit-list-notlist": "[[$1]] is not a CollaborationKit list 
page",
"collaborationkit-list-taglist": "'''{{PLURAL:$2|Tagged:|Tags:}}''' $1 
",
"collaborationkit-list-toomanytags": "You are not allowed to specify 
more than {{PLURAL:$1|one tag|$1 tags}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
old mode 100644
new mode 100755
index a83df17..09e8229
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -35,6 +35,7 @@
"collaborationkit-createhubfeature-invalidcontenttype": "Error message 
on Special:CreateHubFeature in the unlikely event that an invalid content type 
is specified for a feature",
"collaborationkit-createhubfeature-editsummary": "Edit summary used by 
Special:CreateHubFeature when creating a new feature",
"collaborationkit-list-isempty": "Shown on lists that are empty 
immediately after the description",
+   "collaborationkit-list-invalid": "Message shown on lists that do not 
comply with the JSON Schema before showing the offending content",
"collaborationkit-list-notlist": "Error when 
{{#transcludelist:page}} is given a page that is not a 
CollaborationKit list page. $1 Name of page given.",
"collaborationkit-list-taglist": "Box for showing tags a specific item 
has on a list. $1 = comma separated list of tags. $2 = number of tags",
"collaborationkit-list-toomanytags": "Error if 
{{#transcludelist:...}} is given more than the allowed number 
of tag arguments. $1 - number of tags allowed. $2 - number of tags given.",
diff --git a/includes/content/CollaborationListContent.php 
b/includes/content/CollaborationListContent.php
old mode 100644
new mode 100755
index b45422b..b2d6b70
--- a/includes/content/CollaborationListContent.php
+++ b/includes/content/CollaborationListContent.php
@@ -22,6 +22,8 @@
protected $options;
/** @var $items Array List of items */
protected $items;
+   /** @var $displaymode String The variety of list */
+   protected $displaymode;
 
function __construct( $text, $type = 'CollaborationListContent' ) {
parent::__construct( $text, $type );
@@ -41,6 +43,10 @@
return false;
}
$data = $status->value;
+   // TODO: The schema should be checking for required fields but 
for some reason that doesn't work
+   if ( !isset( $data->description ) || !isset( $data->items ) || 
!isset( $data->options ) ) {
+   return false;
+   }
$jsonAsArray = json_decode( json_encode( $data ), true );
try {
EventLogging::schemaValidate( $jsonAsArray, $listSchema 
);
@@ -109,13 +115,16 @@
if ( $this->decoded ) {
return;
}
-   if ( !$this->isValid() ) {
-   throw new Exception( "Can't decode invalid content" );
-   }
$data = $this->getData()->value;
-   $this->description = $data->description;
-   $this->options = $data->options;
-   $this->items = $data->items;
+   if ( !$this->isValid() ) {
+   $this->displaymode = 'error';
+  

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Move findEnclosingTemplateName to DOMUtils

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Move findEnclosingTemplateName to DOMUtils
..


Move findEnclosingTemplateName to DOMUtils

So it can be used in the linter logging to provide the name of the
template that is causing the issue if it is in an transclusion.

Change-Id: I65e7d673729e47d540f14fd34b21dab58ee55599
---
M lib/utils/DOMUtils.js
M lib/wt2html/pp/handlers/cleanup.js
2 files changed, 16 insertions(+), 10 deletions(-)

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



diff --git a/lib/utils/DOMUtils.js b/lib/utils/DOMUtils.js
index 08c09cd..c2fbd0e 100644
--- a/lib/utils/DOMUtils.js
+++ b/lib/utils/DOMUtils.js
@@ -2717,6 +2717,21 @@
}).nodify(cb);
 };
 
+/**
+ * @method
+ *
+ * @param {Object} tplInfo Template info
+ * @return {string}
+ */
+DOMUtils.findEnclosingTemplateName = function(tplInfo) {
+   var dmw = DU.getDataMw(tplInfo.first);
+   if (dmw.parts && dmw.parts.length === 1) {
+   return dmw.parts[0].template.target.wt.trim();
+   } else {
+   return 'Multi-part-template: ' + JSON.stringify(dmw);
+   }
+};
+
 if (typeof module === "object") {
module.exports.DOMUtils = DOMUtils;
 }
diff --git a/lib/wt2html/pp/handlers/cleanup.js 
b/lib/wt2html/pp/handlers/cleanup.js
index 6b0eea6..3c86dd3 100644
--- a/lib/wt2html/pp/handlers/cleanup.js
+++ b/lib/wt2html/pp/handlers/cleanup.js
@@ -37,15 +37,6 @@
}
 }
 
-function findEnclosingTemplateName(tplInfo) {
-   var dmw = DU.getDataMw(tplInfo.first);
-   if (dmw.parts && dmw.parts.length === 1) {
-   return dmw.parts[0].template.target.wt.trim();
-   } else {
-   return 'Multi-part-template: ' + JSON.stringify(dmw);
-   }
-}
-
 function stripEmptyElements(node, env, atTopLevel, tplInfo) {
if (!atTopLevel || !tplInfo || !DU.isElt(node)) {
return true;
@@ -61,7 +52,7 @@
node.nodeName in {'TR': 1, 'LI': 1} && node.attributes.length 
=== 0
) {
env.log('warning/empty/' + node.nodeName.toLowerCase(),
-   'Template', findEnclosingTemplateName(tplInfo),
+   'Template', DU.findEnclosingTemplateName(tplInfo),
'produces stripped empty elements');
var nextNode = node.nextSibling;
DU.deleteNode(node);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I65e7d673729e47d540f14fd34b21dab58ee55599
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Arlolra 
Gerrit-Reviewer: Legoktm 
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] mediawiki...FileOgg[master]: Library bootstrap for Reedy

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316084

Change subject: Library bootstrap for Reedy
..

Library bootstrap for Reedy

Change-Id: I0faa3eff91744dd4a81e801b33ec23e65af7976a
---
A .editorconfig
A .gitattributes
A .gitignore
A .travis.yml
A COPYING
A Doxyfile
A composer.json
A phpcs.xml
A phpunit.xml.dist
A src/FileOgg.php
A tests/FileOggTest.php
11 files changed, 526 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/libs/FileOgg 
refs/changes/84/316084/1

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..c2dfc46
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,6 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+indent_size = tab
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000..b6fe658
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,10 @@
+.editorconfig export-ignore
+.gitattributes export-ignore
+.gitignore export-ignore
+.gitreview export-ignore
+.travis.yml export-ignore
+Doxyfile export-ignore
+composer.json export-ignore
+phpcs.xml export-ignore
+phpunit.xml.dist export-ignore
+tests/ export-ignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..c760786
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/coverage
+/doc
+/vendor
+/composer.lock
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000..8c4bb1f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+sudo: false
+language: php
+php:
+  - "5.3.3"
+  - "5.3"
+  - "5.4"
+  - "5.5"
+  - "5.6"
+  - "7.0"
+  - "hhvm"
+install:
+  - composer install
+script:
+  - composer test
diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by t

[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: Move pimple to composer dependency

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Move pimple to composer dependency
..


Move pimple to composer dependency

Bug: T1283
Change-Id: I416b6d0390f06ba642103798ec079a2403966fbb
Depends-On: If12b169606686f1c8004c2e9ac3be30f4a41c52f
---
M Flow.php
M autoload.php
M composer.json
D vendor/Pimple/Container.php
D vendor/Pimple/ServiceProviderInterface.php
5 files changed, 7 insertions(+), 330 deletions(-)

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



diff --git a/Flow.php b/Flow.php
index 813f92c..6ed46e7 100644
--- a/Flow.php
+++ b/Flow.php
@@ -417,3 +417,7 @@
 
 // Enable/Disable Opt-in beta feature
 $wgFlowEnableOptInBetaFeature = false;
+
+if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
+   require_once __DIR__ . '/vendor/autoload.php';
+}
diff --git a/autoload.php b/autoload.php
index a0d632a..c04890a 100644
--- a/autoload.php
+++ b/autoload.php
@@ -402,6 +402,4 @@
'Flow\\WorkflowLoader' => __DIR__ . '/includes/WorkflowLoader.php',
'Flow\\WorkflowLoaderFactory' => __DIR__ . 
'/includes/WorkflowLoaderFactory.php',
'MaintenanceDebugLogger' => __DIR__ . 
'/maintenance/MaintenanceDebugLogger.php',
-   'Pimple\\Container' => __DIR__ . '/vendor/Pimple/Container.php',
-   'Pimple\\ServiceProviderInterface' => __DIR__ . 
'/vendor/Pimple/ServiceProviderInterface.php',
 );
diff --git a/composer.json b/composer.json
index e38111e..7826aa5 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,9 @@
"name": "mediawiki/flow",
"description": "Discussion and collaboration system extension for 
MediaWiki",
"license": "GPL-2.0+",
-   "require": {},
+   "require": {
+   "pimple/pimple": "2.1.1"
+   },
"require-dev": {
"symfony/dom-crawler": "~2.5",
"symfony/css-selector": "~2.5",
diff --git a/vendor/Pimple/Container.php b/vendor/Pimple/Container.php
deleted file mode 100644
index 26edefc..000
--- a/vendor/Pimple/Container.php
+++ /dev/null
@@ -1,281 +0,0 @@
-factories = new \SplObjectStorage();
-$this->protected = new \SplObjectStorage();
-
-foreach ($values as $key => $value) {
-$this->offsetSet($key, $value);
-}
-}
-
-/**
- * Sets a parameter or an object.
- *
- * Objects must be defined as Closures.
- *
- * Allowing any PHP callable leads to difficult to debug problems
- * as function names (strings) are callable (creating a function with
- * the same name as an existing parameter would break your container).
- *
- * @param  string$idThe unique identifier for the 
parameter or object
- * @param  mixed $value The value of the parameter or a 
closure to define an object
- * @throws \RuntimeException Prevent override of a frozen service
- */
-public function offsetSet($id, $value)
-{
-if (isset($this->frozen[$id])) {
-throw new \RuntimeException(sprintf('Cannot override frozen 
service "%s".', $id));
-}
-
-$this->values[$id] = $value;
-$this->keys[$id] = true;
-}
-
-/**
- * Gets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return mixed The value of the parameter or an object
- *
- * @throws \InvalidArgumentException if the identifier is not defined
- */
-public function offsetGet($id)
-{
-if (!isset($this->keys[$id])) {
-throw new \InvalidArgumentException(sprintf('Identifier "%s" is 
not defined.', $id));
-}
-
-if (
-isset($this->raw[$id])
-|| !is_object($this->values[$id])
-|| isset($this->protected[$this->values[$id]])
-|| !method_exists($this->values[$id], '__invoke')
-) {
-return $this->values[$id];
-}
-
-if (isset($this->factories[$this->values[$id]])) {
-return $this->values[$id]($this);
-}
-
-$raw = $this->values[$id];
-$val = $this->values[$id] = $raw($this);
-$this->raw[$id] = $raw;
-
-$this->frozen[$id] = true;
-
-return $val;
-}
-
-/**
- * Checks if a parameter or an object is set.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return bool
- */
-public function offsetExists($id)
-{
-return isset($this->keys[$id]);
-}
-
-/**
- * Unsets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- */
-public function offsetUnset($id)
-{
-if (isset($this->keys[$id])) {
-if (is_object($this->values[$id])) {
-unset($this->factories[$this->values[$id]], 
$this->protected[$this->values[$id]]);
-  

[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Bump src to 37a109a + update packages

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Bump src to 37a109a + update packages
..


Bump src to 37a109a + update packages

 * Remove html5; mediawiki-title@0.5.6; domino@1.0.26

Change-Id: Id1ed363bffe79cb22be779c3ddd10c38cf0b511c
---
M node_modules/domino/CHANGELOG.md
M node_modules/domino/lib/DOMTokenList.js
M node_modules/domino/lib/Document.js
M node_modules/domino/lib/Element.js
M node_modules/domino/lib/HTMLParser.js
M node_modules/domino/lib/impl.js
M node_modules/domino/package.json
M node_modules/domino/test/htmlwg/harness/index.js
M 
node_modules/domino/test/htmlwg/submission/Ms2ger/dom-tree-accessors/document.title-06.html
M 
node_modules/domino/test/htmlwg/submission/Ms2ger/global-attributes/document-dir.html
A node_modules/domino/test/htmlwg/submission/Ms2ger/node/Element-closest.html
M node_modules/domino/test/w3c/harness/index.js
M node_modules/domino/test/w3c/level1/html/HTMLLabelElement01.js
D node_modules/html5/.npmignore
D node_modules/html5/.travis.yml
D node_modules/html5/COPYING
D node_modules/html5/History.md
D node_modules/html5/Makefile
D node_modules/html5/README.md
D node_modules/html5/doc/TODO.md
D node_modules/html5/doc/api.markdown
D node_modules/html5/doc/api_footer.html
D node_modules/html5/doc/api_header.html
D node_modules/html5/doc/doc.js
D node_modules/html5/doc/jquery.js
D node_modules/html5/doc/logo.png
D node_modules/html5/doc/sh_javascript.min.js
D node_modules/html5/doc/sh_main.js
D node_modules/html5/doc/sh_vim-dark.css
D node_modules/html5/doc/syntax.html
D node_modules/html5/example.js
D node_modules/html5/lib/ElementStack.js
D node_modules/html5/lib/EntityParser.js
D node_modules/html5/lib/InputStream.js
D node_modules/html5/lib/StackItem.js
D node_modules/html5/lib/Tokenizer.js
D node_modules/html5/lib/TreeBuilder.js
D node_modules/html5/lib/array-helpers.js
D node_modules/html5/lib/constants.js
D node_modules/html5/lib/dom/DOMParser.js
D node_modules/html5/lib/dom/DOMTreeBuilder.js
D node_modules/html5/lib/encodings.json
D node_modules/html5/lib/index.js
D node_modules/html5/lib/jsdom/JSDOMParser.js
D node_modules/html5/lib/jsdom/JSDOMTreeBuilder.js
D node_modules/html5/lib/messages.json
D node_modules/html5/lib/sax/SAXParser.js
D node_modules/html5/lib/sax/SAXTreeBuilder.js
D node_modules/html5/lib/sax/TreeParser.js
D node_modules/html5/node_modules/html5-entities/README.md
D node_modules/html5/node_modules/html5-entities/index.js
D node_modules/html5/node_modules/html5-entities/package.json
D node_modules/html5/node_modules/opts/.hgignore
D node_modules/html5/node_modules/opts/.hgtags
D node_modules/html5/node_modules/opts/LICENSE
D node_modules/html5/node_modules/opts/README
D node_modules/html5/node_modules/opts/examples/example1.js
D node_modules/html5/node_modules/opts/examples/example2.js
D node_modules/html5/node_modules/opts/examples/example3.js
D node_modules/html5/node_modules/opts/examples/example4.js
D node_modules/html5/node_modules/opts/js/opts.js
D node_modules/html5/node_modules/opts/package.json
D node_modules/html5/package.json
D node_modules/html5/t
D node_modules/html5/test/data/AUTHORS.rst
D node_modules/html5/test/data/LICENSE
D node_modules/html5/test/data/encoding/chardet/test_big5.txt
D node_modules/html5/test/data/encoding/test-yahoo-jp.dat
D node_modules/html5/test/data/encoding/tests1.dat
D node_modules/html5/test/data/encoding/tests2.dat
D node_modules/html5/test/data/sanitizer/tests1.dat
D node_modules/html5/test/data/serializer/core.test
D node_modules/html5/test/data/serializer/injectmeta.test
D node_modules/html5/test/data/serializer/optionaltags.test
D node_modules/html5/test/data/serializer/options.test
D node_modules/html5/test/data/serializer/whitespace.test
D node_modules/html5/test/data/sniffer/htmlOrFeed.json
D node_modules/html5/test/data/tokenizer/README.md
D node_modules/html5/test/data/tokenizer/contentModelFlags.test
D node_modules/html5/test/data/tokenizer/domjs.test
D node_modules/html5/test/data/tokenizer/entities.test
D node_modules/html5/test/data/tokenizer/escapeFlag.test
D node_modules/html5/test/data/tokenizer/namedEntities.test
D node_modules/html5/test/data/tokenizer/numericEntities.test
D node_modules/html5/test/data/tokenizer/pendingSpecChanges.test
D node_modules/html5/test/data/tokenizer/test1.test
D node_modules/html5/test/data/tokenizer/test2.test
D node_modules/html5/test/data/tokenizer/test3.test
D node_modules/html5/test/data/tokenizer/test4.test
D node_modules/html5/test/data/tokenizer/unicodeChars.test
D node_modules/html5/test/data/tokenizer/unicodeCharsProblematic.test
D node_modules/html5/test/data/tokenizer/xmlViolation.test
D node_modules/html5/test/data/tree-construction/README.md
D node_modules/html5/test/data/tree-construction/adoption01.dat
D node_modules/html5/test/data/tree-construction/adoption02.dat
D node_modules/html5/test/data/tree-construction/comments01.dat
D node_modules/html5

[MediaWiki-commits] [Gerrit] mediawiki...FileOgg[master]: Add .gitreview

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316082

Change subject: Add .gitreview
..

Add .gitreview

Change-Id: Ie6015893045739a576bab518ba7d939961155fc6
---
A .gitreview
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/libs/FileOgg 
refs/changes/82/316082/1

diff --git a/.gitreview b/.gitreview
new file mode 100644
index 000..9edfcee
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/libs/FileOgg.git
+defaultbranch=master
+defaultrebase=0

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6015893045739a576bab518ba7d939961155fc6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/libs/FileOgg
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...FileOgg[master]: Add .gitreview

2016-10-15 Thread Legoktm (Code Review)
Legoktm has submitted this change and it was merged.

Change subject: Add .gitreview
..


Add .gitreview

Change-Id: Ie6015893045739a576bab518ba7d939961155fc6
---
A .gitreview
1 file changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/.gitreview b/.gitreview
new file mode 100644
index 000..9edfcee
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.wikimedia.org
+port=29418
+project=mediawiki/libs/FileOgg.git
+defaultbranch=master
+defaultrebase=0

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6015893045739a576bab518ba7d939961155fc6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/libs/FileOgg
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Bump src to 37a109a + update packages

2016-10-15 Thread Arlolra (Code Review)
Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316081

Change subject: Bump src to 37a109a + update packages
..

Bump src to 37a109a + update packages

 * Remove html5; mediawiki-title@0.5.6; domino@1.0.26

Change-Id: Id1ed363bffe79cb22be779c3ddd10c38cf0b511c
---
M node_modules/domino/CHANGELOG.md
M node_modules/domino/lib/DOMTokenList.js
M node_modules/domino/lib/Document.js
M node_modules/domino/lib/Element.js
M node_modules/domino/lib/HTMLParser.js
M node_modules/domino/lib/impl.js
M node_modules/domino/package.json
M node_modules/domino/test/htmlwg/harness/index.js
M 
node_modules/domino/test/htmlwg/submission/Ms2ger/dom-tree-accessors/document.title-06.html
M 
node_modules/domino/test/htmlwg/submission/Ms2ger/global-attributes/document-dir.html
A node_modules/domino/test/htmlwg/submission/Ms2ger/node/Element-closest.html
M node_modules/domino/test/w3c/harness/index.js
M node_modules/domino/test/w3c/level1/html/HTMLLabelElement01.js
D node_modules/html5/.npmignore
D node_modules/html5/.travis.yml
D node_modules/html5/COPYING
D node_modules/html5/History.md
D node_modules/html5/Makefile
D node_modules/html5/README.md
D node_modules/html5/doc/TODO.md
D node_modules/html5/doc/api.markdown
D node_modules/html5/doc/api_footer.html
D node_modules/html5/doc/api_header.html
D node_modules/html5/doc/doc.js
D node_modules/html5/doc/jquery.js
D node_modules/html5/doc/logo.png
D node_modules/html5/doc/sh_javascript.min.js
D node_modules/html5/doc/sh_main.js
D node_modules/html5/doc/sh_vim-dark.css
D node_modules/html5/doc/syntax.html
D node_modules/html5/example.js
D node_modules/html5/lib/ElementStack.js
D node_modules/html5/lib/EntityParser.js
D node_modules/html5/lib/InputStream.js
D node_modules/html5/lib/StackItem.js
D node_modules/html5/lib/Tokenizer.js
D node_modules/html5/lib/TreeBuilder.js
D node_modules/html5/lib/array-helpers.js
D node_modules/html5/lib/constants.js
D node_modules/html5/lib/dom/DOMParser.js
D node_modules/html5/lib/dom/DOMTreeBuilder.js
D node_modules/html5/lib/encodings.json
D node_modules/html5/lib/index.js
D node_modules/html5/lib/jsdom/JSDOMParser.js
D node_modules/html5/lib/jsdom/JSDOMTreeBuilder.js
D node_modules/html5/lib/messages.json
D node_modules/html5/lib/sax/SAXParser.js
D node_modules/html5/lib/sax/SAXTreeBuilder.js
D node_modules/html5/lib/sax/TreeParser.js
D node_modules/html5/node_modules/html5-entities/README.md
D node_modules/html5/node_modules/html5-entities/index.js
D node_modules/html5/node_modules/html5-entities/package.json
D node_modules/html5/node_modules/opts/.hgignore
D node_modules/html5/node_modules/opts/.hgtags
D node_modules/html5/node_modules/opts/LICENSE
D node_modules/html5/node_modules/opts/README
D node_modules/html5/node_modules/opts/examples/example1.js
D node_modules/html5/node_modules/opts/examples/example2.js
D node_modules/html5/node_modules/opts/examples/example3.js
D node_modules/html5/node_modules/opts/examples/example4.js
D node_modules/html5/node_modules/opts/js/opts.js
D node_modules/html5/node_modules/opts/package.json
D node_modules/html5/package.json
D node_modules/html5/t
D node_modules/html5/test/data/AUTHORS.rst
D node_modules/html5/test/data/LICENSE
D node_modules/html5/test/data/encoding/chardet/test_big5.txt
D node_modules/html5/test/data/encoding/test-yahoo-jp.dat
D node_modules/html5/test/data/encoding/tests1.dat
D node_modules/html5/test/data/encoding/tests2.dat
D node_modules/html5/test/data/sanitizer/tests1.dat
D node_modules/html5/test/data/serializer/core.test
D node_modules/html5/test/data/serializer/injectmeta.test
D node_modules/html5/test/data/serializer/optionaltags.test
D node_modules/html5/test/data/serializer/options.test
D node_modules/html5/test/data/serializer/whitespace.test
D node_modules/html5/test/data/sniffer/htmlOrFeed.json
D node_modules/html5/test/data/tokenizer/README.md
D node_modules/html5/test/data/tokenizer/contentModelFlags.test
D node_modules/html5/test/data/tokenizer/domjs.test
D node_modules/html5/test/data/tokenizer/entities.test
D node_modules/html5/test/data/tokenizer/escapeFlag.test
D node_modules/html5/test/data/tokenizer/namedEntities.test
D node_modules/html5/test/data/tokenizer/numericEntities.test
D node_modules/html5/test/data/tokenizer/pendingSpecChanges.test
D node_modules/html5/test/data/tokenizer/test1.test
D node_modules/html5/test/data/tokenizer/test2.test
D node_modules/html5/test/data/tokenizer/test3.test
D node_modules/html5/test/data/tokenizer/test4.test
D node_modules/html5/test/data/tokenizer/unicodeChars.test
D node_modules/html5/test/data/tokenizer/unicodeCharsProblematic.test
D node_modules/html5/test/data/tokenizer/xmlViolation.test
D node_modules/html5/test/data/tree-construction/README.md
D node_modules/html5/test/data/tree-construction/adoption01.dat
D node_modules/html5/test/data/tree-construction/adoption02.dat
D node_modules/html5/test/data/tree-construction/commen

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: addRFCandPMIDInterwiki: Fix strict mode errors

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316080

Change subject: addRFCandPMIDInterwiki: Fix strict mode errors
..

addRFCandPMIDInterwiki: Fix strict mode errors

Those columns have no defaults and cause errors if MySQL strict mode is
enabled.

Also make this maintenance script runnable standalone.

Bug: T147536
Change-Id: I0f0ba6fc4375c44b71852c5c2dad8336db17c479
---
M maintenance/addRFCandPMIDInterwiki.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/80/316080/1

diff --git a/maintenance/addRFCandPMIDInterwiki.php 
b/maintenance/addRFCandPMIDInterwiki.php
index 9740ef2..2262338 100644
--- a/maintenance/addRFCandPMIDInterwiki.php
+++ b/maintenance/addRFCandPMIDInterwiki.php
@@ -63,7 +63,10 @@
[ 'iw_prefix' ],
[
'iw_prefix' => 'rfc',
-   'iw_url' => 
'https://tools.ietf.org/html/rfc$1'
+   'iw_url' => 
'https://tools.ietf.org/html/rfc$1',
+   'iw_api' => '',
+   'iw_wikiid' => '',
+   'iw_local' => 0,
],
__METHOD__
);
@@ -74,6 +77,9 @@
[
'iw_prefix' => 'pmid',
'iw_url' => 
'https://www.ncbi.nlm.nih.gov/pubmed/$1?dopt=Abstract',
+   'iw_api' => '',
+   'iw_wikiid' => '',
+   'iw_local' => 0,
],
__METHOD__,
// If there's already a pmid interwiki link, don't
@@ -84,3 +90,6 @@
return true;
}
 }
+
+$maintClass = 'AddRFCAndPMIDInterwiki';
+require_once RUN_MAINTENANCE_IF_MAIN;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f0ba6fc4375c44b71852c5c2dad8336db17c479
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Remove html5 treebuilder in favour of domino's

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove html5 treebuilder in favour of domino's
..


Remove html5 treebuilder in favour of domino's

 * The html5 library did the stripping of the leading newline following
   pre as part of tree building.  We worked around this by adding an
   extra newline after pre to compensate, which can now be removed.  In
   domino, correctly, this is part of tokenizing.

   https://html.spec.whatwg.org/multipage/semantics.html#the-pre-element

 * The blacklist changes are because the above hack was adding an extra
   newline when the pre was in a blockquote, and hence wouldn't have any
   stripping.  So, this fixes a bug.

Change-Id: I45ffb07723a6842be6a39d52ab0165676536be0a
---
M lib/wt2html/HTML5TreeBuilder.js
M npm-shrinkwrap.json
M package.json
M tests/parserTests-blacklist.js
4 files changed, 54 insertions(+), 75 deletions(-)

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



diff --git a/lib/wt2html/HTML5TreeBuilder.js b/lib/wt2html/HTML5TreeBuilder.js
index 9be9bf4..6a58fa5 100644
--- a/lib/wt2html/HTML5TreeBuilder.js
+++ b/lib/wt2html/HTML5TreeBuilder.js
@@ -7,8 +7,7 @@
 
 var events = require('events');
 var util = require('util');
-var DOMTreeBuilder = require('html5').DOMTreeBuilder;
-var domino = require('domino');
+var HTMLParser = require('domino').impl.HTMLParser;
 var defines = require('./parser.defines.js');
 var Util = require('../utils/Util.js').Util;
 var SanitizerConstants = require('./tt/Sanitizer.js').SanitizerConstants;
@@ -81,24 +80,44 @@
// We only need one for every run of strings and newline tokens.
this.haveTransclusionShadow = false;
 
-   if (!this._treeBuilder) {
-   // Set up a new tree builder.  Note that when adding attributes 
to
-   // elements, this will call the public DOM method 
`setAttributeNS`
-   // with all its checks that aren't part of the HTML5 parsing 
spec.
-   this._treeBuilder = new DOMTreeBuilder(domino);
-   this.addListener('token',
-   this._treeBuilder.processToken.bind(this._treeBuilder));
+   this.parser = new HTMLParser();
+   this.insertToken({ type: 'DOCTYPE', name: 'html' });
+   this.insertToken({ type: 'StartTag', name: 'body' });
+};
+
+var types = new Map(Object.entries({
+   EOF: -1,
+   Characters: 1,
+   StartTag: 2,
+   EndTag: 3,
+   Comment: 4,
+   DOCTYPE: 5,
+}));
+
+// FIXME: This conversion code can be eliminated by cleaning up processToken.
+TreeBuilder.prototype.insertToken = function(tok) {
+   var t = types.get(tok.type);
+   var value, arg3;
+   switch (tok.type) {
+   case 'StartTag':
+   case 'EndTag':
+   case 'DOCTYPE':
+   value = tok.name;
+   if (Array.isArray(tok.data)) {
+   arg3 = tok.data.map(function(a) {
+   return [a.nodeName, a.nodeValue];
+   });
+   }
+   break;
+   case 'Characters':
+   case 'Comment':
+   case 'EOF':
+   value = tok.data;
+   break;
+   default:
+   console.assert(false, "Unexpected type: " + tok.type);
}
-
-   // Reset the tree builder
-   this._treeBuilder.startTokenization(this);
-
-   // At this point, domino has already created a document element for us 
but
-   // the html5 library would like to use its own (keeps an internal state 
of
-   // open elements). Remove it and process a body token to trigger 
rebuilding.
-   this.doc = this._treeBuilder.document;
-   this.doc.removeChild(this.doc.lastChild);
-   this.processToken(new TagTk('body'));
+   this.parser.insertToken(t, value, arg3);
 };
 
 TreeBuilder.prototype.onChunk = function(tokens) {
@@ -116,7 +135,7 @@
if (this.lastToken && this.lastToken.constructor !== EOFTk) {
this.env.log("error", "EOFTk was lost in page", 
this.env.page.name);
}
-   this.emit('document', this.doc);
+   this.emit('document', this.parser.document());
this.emit('end');
this.resetState();
 };
@@ -171,12 +190,7 @@
case String:
case NlTk:
data = (token.constructor === NlTk) ? '\n' : token;
-   if (this.preceededByPre && data[0] === '\n') {
-   // Emit two newlines when preceded by a pre 
because the
-   // treebuilder will eat one.
-   data = '\n' + data;
-   }
-   this.emit('token', { type: 'Characters', data: data });
+

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Move findEnclosingTemplateName to DOMUtils

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316079

Change subject: Move findEnclosingTemplateName to DOMUtils
..

Move findEnclosingTemplateName to DOMUtils

So it can be used in the linter logging to provide the name of the
template that is causing the issue if it is in an transclusion.

Change-Id: I65e7d673729e47d540f14fd34b21dab58ee55599
---
M lib/utils/DOMUtils.js
M lib/wt2html/pp/handlers/cleanup.js
2 files changed, 16 insertions(+), 10 deletions(-)


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

diff --git a/lib/utils/DOMUtils.js b/lib/utils/DOMUtils.js
index 08c09cd..c2fbd0e 100644
--- a/lib/utils/DOMUtils.js
+++ b/lib/utils/DOMUtils.js
@@ -2717,6 +2717,21 @@
}).nodify(cb);
 };
 
+/**
+ * @method
+ *
+ * @param {Object} tplInfo Template info
+ * @return {string}
+ */
+DOMUtils.findEnclosingTemplateName = function(tplInfo) {
+   var dmw = DU.getDataMw(tplInfo.first);
+   if (dmw.parts && dmw.parts.length === 1) {
+   return dmw.parts[0].template.target.wt.trim();
+   } else {
+   return 'Multi-part-template: ' + JSON.stringify(dmw);
+   }
+};
+
 if (typeof module === "object") {
module.exports.DOMUtils = DOMUtils;
 }
diff --git a/lib/wt2html/pp/handlers/cleanup.js 
b/lib/wt2html/pp/handlers/cleanup.js
index 6b0eea6..3c86dd3 100644
--- a/lib/wt2html/pp/handlers/cleanup.js
+++ b/lib/wt2html/pp/handlers/cleanup.js
@@ -37,15 +37,6 @@
}
 }
 
-function findEnclosingTemplateName(tplInfo) {
-   var dmw = DU.getDataMw(tplInfo.first);
-   if (dmw.parts && dmw.parts.length === 1) {
-   return dmw.parts[0].template.target.wt.trim();
-   } else {
-   return 'Multi-part-template: ' + JSON.stringify(dmw);
-   }
-}
-
 function stripEmptyElements(node, env, atTopLevel, tplInfo) {
if (!atTopLevel || !tplInfo || !DU.isElt(node)) {
return true;
@@ -61,7 +52,7 @@
node.nodeName in {'TR': 1, 'LI': 1} && node.attributes.length 
=== 0
) {
env.log('warning/empty/' + node.nodeName.toLowerCase(),
-   'Template', findEnclosingTemplateName(tplInfo),
+   'Template', DU.findEnclosingTemplateName(tplInfo),
'produces stripped empty elements');
var nextNode = node.nextSibling;
DU.deleteNode(node);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65e7d673729e47d540f14fd34b21dab58ee55599
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

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


[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[REL1_27]: Remove erroneous break

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Remove erroneous break
..


Remove erroneous break

Bug: T148284
Change-Id: Ie081ac9f7d96dd58c399f3f73febe456353cca45
---
M libs/getid3/getid3.lib.php
1 file changed, 0 insertions(+), 1 deletion(-)

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



diff --git a/libs/getid3/getid3.lib.php b/libs/getid3/getid3.lib.php
index 16d5318..9410509 100644
--- a/libs/getid3/getid3.lib.php
+++ b/libs/getid3/getid3.lib.php
@@ -282,7 +282,6 @@
}
} else {
throw new Exception('ERROR: Cannot have signed 
integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in 
self::BigEndian2Int()');
-   break;
}
}
return self::CastAsInt($intvalue);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie081ac9f7d96dd58c399f3f73febe456353cca45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: REL1_27
Gerrit-Owner: Reedy 
Gerrit-Reviewer: TheDJ 
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...TimedMediaHandler[master]: Move videojs-replay dependecy to devDependencies

2016-10-15 Thread TheDJ (Code Review)
TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316078

Change subject: Move videojs-replay dependecy to devDependencies
..

Move videojs-replay dependecy to devDependencies

This is only required to run the grunt update-videojs

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


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

diff --git a/package.json b/package.json
index 86aa812..0998d9c 100644
--- a/package.json
+++ b/package.json
@@ -16,10 +16,10 @@
 "jscs-preset-wikimedia": "~1.0.0",
 "video.js": "^5.10.1",
 "videojs-ogvjs": "^1.3.1",
+"videojs-replay": "^1.1.0",
 "videojs-resolution-switcher": "^0.4.2",
 "videojs-responsive-layout": "^1.1.0"
   },
   "dependencies": {
-"videojs-replay": "^1.1.0"
   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc522f3fa31bfdbd14939af1362905ca4950ebe0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: MediaWiki.php: Make getUrlDomainDistance() actually static

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: MediaWiki.php: Make getUrlDomainDistance() actually static
..


MediaWiki.php: Make getUrlDomainDistance() actually static

It's only called once, and that call is static. It also doesn't use $this.

[error] /w/index.php?title=New_new_page&action=purge
ErrorException from line 610 of /vagrant/mediawiki/includes/MediaWiki.php: PHP 
Strict Standards: Non-static method MediaWiki::getUrlDomainDistance() should 
not be called statically

Change-Id: Ice66937a32193720c52df39bcea90659a8d9f653
---
M includes/MediaWiki.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 218337a..f21128e 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -678,7 +678,7 @@
 * @param IContextSource $context
 * @return string|bool Either "local" or "remote" if in the farm, false 
otherwise
 */
-   private function getUrlDomainDistance( $url, IContextSource $context ) {
+   private static function getUrlDomainDistance( $url, IContextSource 
$context ) {
static $relevantKeys = [ 'host' => true, 'port' => true ];
 
$infoCandidate = wfParseUrl( $url );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice66937a32193720c52df39bcea90659a8d9f653
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Catrope 
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/vagrant[master]: Update AUTHORS.txt

2016-10-15 Thread BryanDavis (Code Review)
BryanDavis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316077

Change subject: Update AUTHORS.txt
..

Update AUTHORS.txt

Change-Id: I1e642dc909642022fd41e2447e5f8f67ffe62719
---
M .mailmap
M AUTHORS.txt
2 files changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/77/316077/1

diff --git a/.mailmap b/.mailmap
index 5a6a036..f0971b7 100644
--- a/.mailmap
+++ b/.mailmap
@@ -12,6 +12,9 @@
  
  
 Adam Basso 
+Alex Monk  
+Amir E. Aharoni 
+Amir Sarabadani  
 Andrew Haberlandt 
 André Costa 
 Arthur Richards 
@@ -22,9 +25,12 @@
 Dan Andreescu 
 Dan Duvall 
 Dan Entous 
+Darian Anthony Patrick 
 David Causse 
+Elliott Eggleston  
 Erik Möller 
 Gergő Tisza 
+Gilles Dubuc  
 Grunny 
 Jan Zerebecki 
 Jeremy Baron 
@@ -36,6 +42,7 @@
 Moritz Schubotz 
 Nuria Ruiz 
 Ori Livneh 
+Rainer Rillke 
 Sage Ross 
 Sam Reed 
 Tyler Romeo 
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 655481c..4c929aa 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -4,6 +4,8 @@
 Adam Basso 
 Adam Roses Wight 
 Alex Monk 
+Amir E. Aharoni 
+Amir Sarabadani 
 Andrew Bogott 
 Andrew Garrett 
 Andrew Haberlandt 
@@ -20,6 +22,7 @@
 Chris McMahon 
 Chris Steipp 
 Christian Aistleitner 
+Cindy Cicalese 
 Dan Andreescu 
 Dan Duvall 
 Dan Entous 
@@ -36,7 +39,9 @@
 Erik Möller 
 Federico Leva 
 Filippo Giunchedi 
+frimelle 
 FunPika 
+Gabriel Wicke 
 Gergő Tisza 
 Gilles Dubuc 
 Grunny 
@@ -58,23 +63,27 @@
 Matthew Flaschen 
 Max Semenik 
 Mhutti1 
+Michael Holloway 
 Moriel Schottlender 
 Moritz Schubotz 
 Mr. Stradivarius 
 Mukunda Modell 
 Munaf Assaf 
 Neil Kandalgaonkar 
+Nemo bis 
 Nik Everett 
 Nuria Ruiz 
 Ori Livneh 
 Patrick Reilly 
 Pavel Astakhov 
+Peter Hedenskog 
 Petr Pchelko 
-Rillke 
+Rainer Rillke 
 Rob Moen 
 S Page 
 Sage Ross 
 Sam Reed 
+Sergey Leschina 
 Stanislav Malyshev 
 Stephane Bisson 
 Thibaut Horel 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e642dc909642022fd41e2447e5f8f67ffe62719
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: BryanDavis 

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: Add redirect for toolserver sulinfo tool

2016-10-15 Thread Dereckson (Code Review)
Dereckson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316076

Change subject: Add redirect for toolserver sulinfo tool
..

Add redirect for toolserver sulinfo tool

Some documentation pages still contain referecence to
https://toolserver.org/~quentinv57/sulinfo

This is a follow-up for 75ffc4d6 and b33d4924.

Change-Id: I4c2900580c7d5883141a6a3efc126cb938f54c7a
---
M modules/toolserver_legacy/templates/www.toolserver.org.erb
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/76/316076/1

diff --git a/modules/toolserver_legacy/templates/www.toolserver.org.erb 
b/modules/toolserver_legacy/templates/www.toolserver.org.erb
index dc4c4f0..4abb20b 100644
--- a/modules/toolserver_legacy/templates/www.toolserver.org.erb
+++ b/modules/toolserver_legacy/templates/www.toolserver.org.erb
@@ -251,6 +251,7 @@
 Redirect 301 /~phe/robot.php 
https://tools.wmflabs.org/phetools/match_and_split.php
 Redirect 301 /~phe https://tools.wmflabs.org/phetools
 Redirect 301 /~pietrodn/intersectContribs.php 
https://tools.wmflabs.org/intersect-contribs
+Redirect 301 /~quentinv57/sulinfo 
https://tools.wmflabs.org/quentinv57-tools/tools/sulinfo.php
 Redirect 301 /~quentinv57/tools 
https://tools.wmflabs.org/quentinv57-tools/tools
 Redirect 301 /~render https://tools.wmflabs.org/render
 Redirect 301 /~robin https://tools.wmflabs.org/robin

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix LoadBalancerSingle::reallyOpenConnection() signature

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix LoadBalancerSingle::reallyOpenConnection() signature
..


Fix LoadBalancerSingle::reallyOpenConnection() signature

Declaration of LoadBalancerSingle::reallyOpenConnection() should be
compatible with
LoadBalancer::reallyOpenConnection(array $server, $dbNameOverride = false) 

Caught in https://travis-ci.org/paladox/mediawiki/jobs/167910508

Change-Id: I9bc30249c3b43c3dd3b4eb6f3a70765ef428fd2c
---
M includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php 
b/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
index 9de4850..0dec95f 100644
--- a/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
+++ b/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
@@ -75,7 +75,7 @@
 *
 * @return IDatabase
 */
-   protected function reallyOpenConnection( $server, $dbNameOverride = 
false ) {
+   protected function reallyOpenConnection( array $server, $dbNameOverride 
= false ) {
return $this->db;
}
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9bc30249c3b43c3dd3b4eb6f3a70765ef428fd2c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: Florianschmidtwelzow 
Gerrit-Reviewer: Gergő Tisza 
Gerrit-Reviewer: Hashar 
Gerrit-Reviewer: JanZerebecki 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Ori.livneh 
Gerrit-Reviewer: Paladox 
Gerrit-Reviewer: Reedy 
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]: Fix LoadBalancerSingle::reallyOpenConnection()

2016-10-15 Thread Paladox (Code Review)
Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316075

Change subject: Fix LoadBalancerSingle::reallyOpenConnection() 
..

Fix LoadBalancerSingle::reallyOpenConnection() 

Declaration of LoadBalancerSingle::reallyOpenConnection() should be compatible 
with LoadBalancer::reallyOpenConnection(array $server, $dbNameOverride = false) 

Caught in https://travis-ci.org/paladox/mediawiki/jobs/167910508

221PHP Strict standards:  Declaration of 
LoadBalancerSingle::reallyOpenConnection() should be compatible with 
LoadBalancer::reallyOpenConnection(array $server, $dbNameOverride = false) in 
/home/travis/build/paladox/mediawiki/includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
 on line 81

Change-Id: I9bc30249c3b43c3dd3b4eb6f3a70765ef428fd2c
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/316075/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bc30249c3b43c3dd3b4eb6f3a70765ef428fd2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox 

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


[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: Move pimple to composer dependancy

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316074

Change subject: Move pimple to composer dependancy
..

Move pimple to composer dependancy

Bug: T1283
Change-Id: I416b6d0390f06ba642103798ec079a2403966fbb
Depends-On: If12b169606686f1c8004c2e9ac3be30f4a41c52f
---
M Flow.php
M autoload.php
M composer.json
D vendor/Pimple/Container.php
D vendor/Pimple/ServiceProviderInterface.php
5 files changed, 7 insertions(+), 330 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/74/316074/1

diff --git a/Flow.php b/Flow.php
index 813f92c..6ed46e7 100644
--- a/Flow.php
+++ b/Flow.php
@@ -417,3 +417,7 @@
 
 // Enable/Disable Opt-in beta feature
 $wgFlowEnableOptInBetaFeature = false;
+
+if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
+   require_once __DIR__ . '/vendor/autoload.php';
+}
diff --git a/autoload.php b/autoload.php
index a0d632a..c04890a 100644
--- a/autoload.php
+++ b/autoload.php
@@ -402,6 +402,4 @@
'Flow\\WorkflowLoader' => __DIR__ . '/includes/WorkflowLoader.php',
'Flow\\WorkflowLoaderFactory' => __DIR__ . 
'/includes/WorkflowLoaderFactory.php',
'MaintenanceDebugLogger' => __DIR__ . 
'/maintenance/MaintenanceDebugLogger.php',
-   'Pimple\\Container' => __DIR__ . '/vendor/Pimple/Container.php',
-   'Pimple\\ServiceProviderInterface' => __DIR__ . 
'/vendor/Pimple/ServiceProviderInterface.php',
 );
diff --git a/composer.json b/composer.json
index e38111e..7826aa5 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,9 @@
"name": "mediawiki/flow",
"description": "Discussion and collaboration system extension for 
MediaWiki",
"license": "GPL-2.0+",
-   "require": {},
+   "require": {
+   "pimple/pimple": "2.1.1"
+   },
"require-dev": {
"symfony/dom-crawler": "~2.5",
"symfony/css-selector": "~2.5",
diff --git a/vendor/Pimple/Container.php b/vendor/Pimple/Container.php
deleted file mode 100644
index 26edefc..000
--- a/vendor/Pimple/Container.php
+++ /dev/null
@@ -1,281 +0,0 @@
-factories = new \SplObjectStorage();
-$this->protected = new \SplObjectStorage();
-
-foreach ($values as $key => $value) {
-$this->offsetSet($key, $value);
-}
-}
-
-/**
- * Sets a parameter or an object.
- *
- * Objects must be defined as Closures.
- *
- * Allowing any PHP callable leads to difficult to debug problems
- * as function names (strings) are callable (creating a function with
- * the same name as an existing parameter would break your container).
- *
- * @param  string$idThe unique identifier for the 
parameter or object
- * @param  mixed $value The value of the parameter or a 
closure to define an object
- * @throws \RuntimeException Prevent override of a frozen service
- */
-public function offsetSet($id, $value)
-{
-if (isset($this->frozen[$id])) {
-throw new \RuntimeException(sprintf('Cannot override frozen 
service "%s".', $id));
-}
-
-$this->values[$id] = $value;
-$this->keys[$id] = true;
-}
-
-/**
- * Gets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return mixed The value of the parameter or an object
- *
- * @throws \InvalidArgumentException if the identifier is not defined
- */
-public function offsetGet($id)
-{
-if (!isset($this->keys[$id])) {
-throw new \InvalidArgumentException(sprintf('Identifier "%s" is 
not defined.', $id));
-}
-
-if (
-isset($this->raw[$id])
-|| !is_object($this->values[$id])
-|| isset($this->protected[$this->values[$id]])
-|| !method_exists($this->values[$id], '__invoke')
-) {
-return $this->values[$id];
-}
-
-if (isset($this->factories[$this->values[$id]])) {
-return $this->values[$id]($this);
-}
-
-$raw = $this->values[$id];
-$val = $this->values[$id] = $raw($this);
-$this->raw[$id] = $raw;
-
-$this->frozen[$id] = true;
-
-return $val;
-}
-
-/**
- * Checks if a parameter or an object is set.
- *
- * @param string $id The unique identifier for the parameter or object
- *
- * @return bool
- */
-public function offsetExists($id)
-{
-return isset($this->keys[$id]);
-}
-
-/**
- * Unsets a parameter or an object.
- *
- * @param string $id The unique identifier for the parameter or object
- */
-public function offsetUnset($id)
-{
-if (isset($this->keys[$id])) {
-if (is_object($this->values[$id])) {
-unset($this->factories[$this->values[$id]]

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Distinguish between content language and user language

2016-10-15 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Distinguish between content language and user language
..


Distinguish between content language and user language

Interface language should be based on the user language,
but the language of the labels and parameters on the content
language.

Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
---
M proveit.css
M proveit.js
2 files changed, 20 insertions(+), 4 deletions(-)

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



diff --git a/proveit.css b/proveit.css
index a04a98a..e809606 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,15 +74,18 @@
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   font-weight: bold;
margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-param-value {
-   margin-left: 10px;
+   display: inline-block;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-citations {
diff --git a/proveit.js b/proveit.js
index fac1f5c..9502207 100755
--- a/proveit.js
+++ b/proveit.js
@@ -86,6 +86,13 @@
userLanguage: 'en',
 
/**
+* Content language (may be different from the user language)
+*
+* @type {string} defaults to English
+*/
+   contentLanguage: 'en',
+
+   /**
 * Convenience method to get a ProveIt option
 *
 * @param {string} option key without the "proveit-" prefix
@@ -126,7 +133,13 @@
if ( userLanguage in proveit.messages ) {
proveit.userLanguage = userLanguage;
}
-   mw.messages.set( proveit.messages[ userLanguage ] );
+   mw.messages.set( proveit.messages[ proveit.userLanguage ] );
+
+   // Set the content language
+   var contentLanguage = mw.config.get( 'wgContentLanguage' );
+   if ( contentLanguage ) {
+   proveit.contentLanguage = contentLanguage;
+   }
 
// Build the interface
proveit.build();
@@ -932,7 +945,7 @@
 
// Override with template data
if ( paramData.label ) {
-   paramLabel = paramData.label[ 
proveit.userLanguage ];
+   paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
// If the parameter is a date, put the current 
date as a placeholder
@@ -946,7 +959,7 @@
}
 
if ( paramData.description ) {
-   paramDescription = 
paramData.description[ proveit.userLanguage ];
+   paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
 
// Extract the parameter value

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Distinguish between content language and user language

2016-10-15 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316072

Change subject: Distinguish between content language and user language
..

Distinguish between content language and user language

Interface language should be based on the user language,
but the language of the labels and parameters on the content
language.

Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
---
M proveit.css
M proveit.js
2 files changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/72/316072/1

diff --git a/proveit.css b/proveit.css
index a04a98a..e809606 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,15 +74,18 @@
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   font-weight: bold;
margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-param-value {
-   margin-left: 10px;
+   display: inline-block;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-citations {
diff --git a/proveit.js b/proveit.js
index fac1f5c..9502207 100755
--- a/proveit.js
+++ b/proveit.js
@@ -86,6 +86,13 @@
userLanguage: 'en',
 
/**
+* Content language (may be different from the user language)
+*
+* @type {string} defaults to English
+*/
+   contentLanguage: 'en',
+
+   /**
 * Convenience method to get a ProveIt option
 *
 * @param {string} option key without the "proveit-" prefix
@@ -126,7 +133,13 @@
if ( userLanguage in proveit.messages ) {
proveit.userLanguage = userLanguage;
}
-   mw.messages.set( proveit.messages[ userLanguage ] );
+   mw.messages.set( proveit.messages[ proveit.userLanguage ] );
+
+   // Set the content language
+   var contentLanguage = mw.config.get( 'wgContentLanguage' );
+   if ( contentLanguage ) {
+   proveit.contentLanguage = contentLanguage;
+   }
 
// Build the interface
proveit.build();
@@ -932,7 +945,7 @@
 
// Override with template data
if ( paramData.label ) {
-   paramLabel = paramData.label[ 
proveit.userLanguage ];
+   paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
// If the parameter is a date, put the current 
date as a placeholder
@@ -946,7 +959,7 @@
}
 
if ( paramData.description ) {
-   paramDescription = 
paramData.description[ proveit.userLanguage ];
+   paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
 
// Extract the parameter value

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Move self.site setting to Bot constructor

2016-10-15 Thread OdysseasKr (Code Review)
OdysseasKr has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316071

Change subject: Move self.site setting to Bot constructor
..

Move self.site setting to Bot constructor

The setting of self.site should be done in the constructor of Bot
class

Bug: T146580
Change-Id: Ia81bfe8a35997e829584cd931b0f0e2b489e1207
---
M scripts/image.py
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/71/316071/1

diff --git a/scripts/image.py b/scripts/image.py
index ff8517c..55af935 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+   #!/usr/bin/python
 # -*- coding: utf-8 -*-
 """
 This script can be used to change one image to another or remove an image.
@@ -58,7 +58,7 @@
 
 """This bot will replace or remove all occurrences of an old image."""
 
-def __init__(self, generator, site, old_image, new_image=None, **kwargs):
+def __init__(self, generator, old_image, new_image=None, **kwargs):
 """
 Constructor.
 
@@ -77,7 +77,6 @@
 
 Bot.__init__(self, generator=generator, **kwargs)
 
-   self.site = site
 self.old_image = old_image
 self.new_image = new_image
 param = {
@@ -121,6 +120,7 @@
 
 super(ImageRobot, self).__init__(self.generator, replacements,
  always=self.getOption('always'),
+ site=self.site,
  summary=summary)
 
 
@@ -157,8 +157,8 @@
 old_imagepage = pywikibot.FilePage(site, old_image)
 gen = pagegenerators.FileLinksGenerator(old_imagepage)
 preloadingGen = pagegenerators.PreloadingGenerator(gen)
-bot = ImageRobot(preloadingGen, old_image, new_image, **options)
-   bot.site = pywikibot.Site()
+bot = ImageRobot(preloadingGen, old_image, new_image,
+site=site, **options)
 bot.run()
 return True
 else:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia81bfe8a35997e829584cd931b0f0e2b489e1207
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: OdysseasKr 

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


[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[REL1_27]: Remove erroneous break

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316070

Change subject: Remove erroneous break
..

Remove erroneous break

Bug: T148284
Change-Id: Ie081ac9f7d96dd58c399f3f73febe456353cca45
---
M libs/getid3/getid3.lib.php
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/libs/getid3/getid3.lib.php b/libs/getid3/getid3.lib.php
index 16d5318..9410509 100644
--- a/libs/getid3/getid3.lib.php
+++ b/libs/getid3/getid3.lib.php
@@ -282,7 +282,6 @@
}
} else {
throw new Exception('ERROR: Cannot have signed 
integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in 
self::BigEndian2Int()');
-   break;
}
}
return self::CastAsInt($intvalue);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie081ac9f7d96dd58c399f3f73febe456353cca45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: REL1_27
Gerrit-Owner: Reedy 

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


[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[wmf/1.28.0-wmf.22]: Repair text track attributes

2016-10-15 Thread Brion VIBBER (Code Review)
Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316069

Change subject: Repair text track attributes
..

Repair text track attributes

This was broken in I4227b88ae94e3cfcfd62fb7fe221190d7fe33f71

Fixes regression in subtitles loading from Commons on the other sites.

Bug: T122737
Change-Id: I6498c32929892454700e852d412056a5acc2453a
(cherry picked from commit 3a4d3b54745a93def80a6b06b6d803f3663483f2)
---
M TimedMediaTransformOutput.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/69/316069/1

diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index b15ed68..215754d 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -334,11 +334,11 @@
foreach ( $mediaTracks as &$track ) {
foreach ( $track as $attr => $val ) {
if ( $attr === 'title' || $attr === 'provider' 
) {
-   $source[ 'data-mw' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-mw' . $attr ] = $val;
+   unset( $track[ $attr ] );
} elseif ( $attr === 'dir' ) {
-   $source[ 'data-' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-' . $attr ] = $val;
+   unset( $track[ $attr ] );
}
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6498c32929892454700e852d412056a5acc2453a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: wmf/1.28.0-wmf.22
Gerrit-Owner: Brion VIBBER 
Gerrit-Reviewer: TheDJ 

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


[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[master]: Repair text track attributes

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Repair text track attributes
..


Repair text track attributes

This was broken in I4227b88ae94e3cfcfd62fb7fe221190d7fe33f71

Relates to bug: T122737

Change-Id: I6498c32929892454700e852d412056a5acc2453a
---
M TimedMediaTransformOutput.php
1 file changed, 4 insertions(+), 4 deletions(-)

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



diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index b15ed68..215754d 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -334,11 +334,11 @@
foreach ( $mediaTracks as &$track ) {
foreach ( $track as $attr => $val ) {
if ( $attr === 'title' || $attr === 'provider' 
) {
-   $source[ 'data-mw' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-mw' . $attr ] = $val;
+   unset( $track[ $attr ] );
} elseif ( $attr === 'dir' ) {
-   $source[ 'data-' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-' . $attr ] = $val;
+   unset( $track[ $attr ] );
}
}
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6498c32929892454700e852d412056a5acc2453a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ 
Gerrit-Reviewer: Brion VIBBER 
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...Wikibase[master]: Use class message method instead of global

2016-10-15 Thread Code Review
Matěj Suchánek has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315326

Change subject: Use class message method instead of global
..

Use class message method instead of global

Change-Id: I1e746efafcfbc494fe6b704c222f7397e2b4d35b
---
M repo/includes/Actions/EditEntityAction.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/26/315326/2

diff --git a/repo/includes/Actions/EditEntityAction.php 
b/repo/includes/Actions/EditEntityAction.php
index b034617..3edada1 100644
--- a/repo/includes/Actions/EditEntityAction.php
+++ b/repo/includes/Actions/EditEntityAction.php
@@ -422,7 +422,7 @@
 
return Linker::linkKnown(
$this->getContext()->getTitle(),
-   wfMessage( 'cancel' )->parse(),
+   $this->msg( 'cancel' )->parse(),
array( 'id' => 'mw-editform-cancel' ),
$cancelParams
);
@@ -558,7 +558,7 @@
 
$this->getOutput()->addHTML( "\n" );
 
-   $labelText = wfMessage( 'wikibase-summary-generated' )->text();
+   $labelText = $this->msg( 'wikibase-summary-generated' )->text();
list( $label, $field ) = $this->getSummaryInput( $labelText );
$this->getOutput()->addHTML( $label . "\n" . Html::rawElement( 
'br' ) . "\n" . $field );
$this->getOutput()->addHTML( "\n" );
@@ -566,7 +566,7 @@
 
$cancel = $this->getCancelLink();
if ( $cancel !== '' ) {
-   $this->getOutput()->addHTML( wfMessage( 
'pipe-separator' )->escaped() );
+   $this->getOutput()->addHTML( $this->msg( 
'pipe-separator' )->escaped() );
$this->getOutput()->addHTML( $cancel );
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e746efafcfbc494fe6b704c222f7397e2b4d35b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek 
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...TimedMediaHandler[master]: Repair text track attributes

2016-10-15 Thread TheDJ (Code Review)
TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316068

Change subject: Repair text track attributes
..

Repair text track attributes

This was broken in I4227b88ae94e3cfcfd62fb7fe221190d7fe33f71

Relates to bug: T122737

Change-Id: I6498c32929892454700e852d412056a5acc2453a
---
M TimedMediaTransformOutput.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/68/316068/1

diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index b15ed68..215754d 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -334,11 +334,11 @@
foreach ( $mediaTracks as &$track ) {
foreach ( $track as $attr => $val ) {
if ( $attr === 'title' || $attr === 'provider' 
) {
-   $source[ 'data-mw' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-mw' . $attr ] = $val;
+   unset( $track[ $attr ] );
} elseif ( $attr === 'dir' ) {
-   $source[ 'data-' . $attr ] = $val;
-   unset( $source[ $attr ] );
+   $track[ 'data-' . $attr ] = $val;
+   unset( $track[ $attr ] );
}
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6498c32929892454700e852d412056a5acc2453a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ 

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


[MediaWiki-commits] [Gerrit] mediawiki/vendor[master]: Add james-heinrich/getid3 v1.9.12 for TMH

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316067

Change subject: Add james-heinrich/getid3 v1.9.12 for TMH
..

Add james-heinrich/getid3 v1.9.12 for TMH

Bug: T148285
Change-Id: Ia7c2a6005ebb64b2b70420fe99d3ac538acc740b
---
M composer.json
M composer.lock
M composer/autoload_classmap.php
M composer/installed.json
A james-heinrich/getid3/.gitattributes
A james-heinrich/getid3/.gitignore
A james-heinrich/getid3/README.md
A james-heinrich/getid3/changelog.txt
A james-heinrich/getid3/composer.json
A james-heinrich/getid3/demos/demo.audioinfo.class.php
A james-heinrich/getid3/demos/demo.basic.php
A james-heinrich/getid3/demos/demo.browse.php
A james-heinrich/getid3/demos/demo.cache.dbm.php
A james-heinrich/getid3/demos/demo.cache.mysql.php
A james-heinrich/getid3/demos/demo.joinmp3.php
A james-heinrich/getid3/demos/demo.mimeonly.php
A james-heinrich/getid3/demos/demo.mp3header.php
A james-heinrich/getid3/demos/demo.mysql.php
A james-heinrich/getid3/demos/demo.simple.php
A james-heinrich/getid3/demos/demo.simple.write.php
A james-heinrich/getid3/demos/demo.write.php
A james-heinrich/getid3/demos/demo.zip.php
A james-heinrich/getid3/demos/getid3.css
A james-heinrich/getid3/demos/getid3.demo.dirscan.php
A james-heinrich/getid3/demos/index.php
A james-heinrich/getid3/dependencies.txt
A james-heinrich/getid3/getid3/extension.cache.dbm.php
A james-heinrich/getid3/getid3/extension.cache.mysql.php
A james-heinrich/getid3/getid3/extension.cache.sqlite3.php
A james-heinrich/getid3/getid3/getid3.lib.php
A james-heinrich/getid3/getid3/getid3.php
A james-heinrich/getid3/getid3/module.archive.gzip.php
A james-heinrich/getid3/getid3/module.archive.rar.php
A james-heinrich/getid3/getid3/module.archive.szip.php
A james-heinrich/getid3/getid3/module.archive.tar.php
A james-heinrich/getid3/getid3/module.archive.zip.php
A james-heinrich/getid3/getid3/module.audio-video.asf.php
A james-heinrich/getid3/getid3/module.audio-video.bink.php
A james-heinrich/getid3/getid3/module.audio-video.flv.php
A james-heinrich/getid3/getid3/module.audio-video.matroska.php
A james-heinrich/getid3/getid3/module.audio-video.mpeg.php
A james-heinrich/getid3/getid3/module.audio-video.nsv.php
A james-heinrich/getid3/getid3/module.audio-video.quicktime.php
A james-heinrich/getid3/getid3/module.audio-video.real.php
A james-heinrich/getid3/getid3/module.audio-video.riff.php
A james-heinrich/getid3/getid3/module.audio-video.swf.php
A james-heinrich/getid3/getid3/module.audio-video.ts.php
A james-heinrich/getid3/getid3/module.audio.aa.php
A james-heinrich/getid3/getid3/module.audio.aac.php
A james-heinrich/getid3/getid3/module.audio.ac3.php
A james-heinrich/getid3/getid3/module.audio.amr.php
A james-heinrich/getid3/getid3/module.audio.au.php
A james-heinrich/getid3/getid3/module.audio.avr.php
A james-heinrich/getid3/getid3/module.audio.bonk.php
A james-heinrich/getid3/getid3/module.audio.dsf.php
A james-heinrich/getid3/getid3/module.audio.dss.php
A james-heinrich/getid3/getid3/module.audio.dts.php
A james-heinrich/getid3/getid3/module.audio.flac.php
A james-heinrich/getid3/getid3/module.audio.la.php
A james-heinrich/getid3/getid3/module.audio.lpac.php
A james-heinrich/getid3/getid3/module.audio.midi.php
A james-heinrich/getid3/getid3/module.audio.mod.php
A james-heinrich/getid3/getid3/module.audio.monkey.php
A james-heinrich/getid3/getid3/module.audio.mp3.php
A james-heinrich/getid3/getid3/module.audio.mpc.php
A james-heinrich/getid3/getid3/module.audio.ogg.php
A james-heinrich/getid3/getid3/module.audio.optimfrog.php
A james-heinrich/getid3/getid3/module.audio.rkau.php
A james-heinrich/getid3/getid3/module.audio.shorten.php
A james-heinrich/getid3/getid3/module.audio.tta.php
A james-heinrich/getid3/getid3/module.audio.voc.php
A james-heinrich/getid3/getid3/module.audio.vqf.php
A james-heinrich/getid3/getid3/module.audio.wavpack.php
A james-heinrich/getid3/getid3/module.graphic.bmp.php
A james-heinrich/getid3/getid3/module.graphic.efax.php
A james-heinrich/getid3/getid3/module.graphic.gif.php
A james-heinrich/getid3/getid3/module.graphic.jpg.php
A james-heinrich/getid3/getid3/module.graphic.pcd.php
A james-heinrich/getid3/getid3/module.graphic.png.php
A james-heinrich/getid3/getid3/module.graphic.svg.php
A james-heinrich/getid3/getid3/module.graphic.tiff.php
A james-heinrich/getid3/getid3/module.misc.cue.php
A james-heinrich/getid3/getid3/module.misc.exe.php
A james-heinrich/getid3/getid3/module.misc.iso.php
A james-heinrich/getid3/getid3/module.misc.msoffice.php
A james-heinrich/getid3/getid3/module.misc.par2.php
A james-heinrich/getid3/getid3/module.misc.pdf.php
A james-heinrich/getid3/getid3/module.tag.apetag.php
A james-heinrich/getid3/getid3/module.tag.id3v1.php
A james-heinrich/getid3/getid3/module.tag.id3v2.php
A james-heinrich/getid3/getid3/module.tag.lyrics3.php
A james-heinrich/getid3/getid3/module.tag.xmp.php
A james-heinrich/getid3/getid3/write.

[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[master]: [WIP] Bring in getid3 from composer

2016-10-15 Thread Reedy (Code Review)
Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316066

Change subject: [WIP] Bring in getid3 from composer
..

[WIP] Bring in getid3 from composer

Bug: T148285
Change-Id: Ia491a500f7ef21746975eb51cfa1c9629be6623f
---
M TimedMediaHandler.php
M composer.json
2 files changed, 7 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/66/316066/1

diff --git a/TimedMediaHandler.php b/TimedMediaHandler.php
index 66e42da..123e41e 100644
--- a/TimedMediaHandler.php
+++ b/TimedMediaHandler.php
@@ -363,3 +363,7 @@
'version' => '0.5.0',
'license-name' => 'GPL-2.0+',
 ];
+
+if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
+   require_once __DIR__ . '/vendor/autoload.php';
+}
diff --git a/composer.json b/composer.json
index 4653c05..4d2922c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,4 +1,7 @@
 {
+   "require": {
+   "james-heinrich/getid3": "v1.9.12"
+   },
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"mediawiki/mediawiki-codesniffer": "0.7.2"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia491a500f7ef21746975eb51cfa1c9629be6623f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Reedy 

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


[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceSkin[master]: Update skin

2016-10-15 Thread Paladox (Code Review)
Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316065

Change subject: Update skin
..

Update skin

Remove pre mw 1.22 and below compat.

Remove i18n shim

Replace wfSuppressWarnings and wfRestoreWarnings with
MediaWiki\suppressWarnings and MediaWiki\restoreWarnings only if they use
mediawiki 1.26 or above.

Also some minor php code changes such as adding missing braces to if and
also spaces in (

Also move class BlueSpiceSkinTemplate to it's own file.

Change-Id: Ifd3b951f3351c2181104dada9f0536fdf6ea11ba
---
D BlueSpiceSkin.i18n.php
M BlueSpiceSkin.php
M BlueSpiceSkin.skin.php
A BlueSpiceSkinTemplate.php
M includes/BlueSpiceSkinHooks.php
M skin.json
M views/view.StateBarTopElementWatch.php
7 files changed, 127 insertions(+), 139 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/BlueSpiceSkin 
refs/changes/65/316065/1

diff --git a/BlueSpiceSkin.i18n.php b/BlueSpiceSkin.i18n.php
deleted file mode 100644
index a534e15..000
--- a/BlueSpiceSkin.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShime82f6ce41a6a4c2e' ) ) {
-   function wfJsonI18nShime82f6ce41a6a4c2e( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-   if ( is_readable( $fileName ) ) {
-   $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-   foreach ( array_keys( $data ) as $key ) {
-   if ( $key === '' || $key[0] === '@' ) {
-   unset( $data[$key] );
-   }
-   }
-   $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
-   }
-
-   $cachedData['deps'][] = new FileDependency( $fileName );
-   }
-   return true;
-   }
-
-   $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShime82f6ce41a6a4c2e';
-}
diff --git a/BlueSpiceSkin.php b/BlueSpiceSkin.php
index 0714c86..adabc1b 100644
--- a/BlueSpiceSkin.php
+++ b/BlueSpiceSkin.php
@@ -8,8 +8,8 @@
  * @author Radovan Kubani, Robert Vogel, Patric Wirth, Tobias Weichart et. al.
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
-if (!defined('MEDIAWIKI')) {
-   die("This is an extension to the MediaWiki package and cannot be run 
standalone.");
+if ( !defined( 'MEDIAWIKI' ) ) {
+   die( "This is an extension to the MediaWiki package and cannot be run 
standalone." );
 }
 
-wfLoadSkin( 'BlueSpiceSkin' );
\ No newline at end of file
+wfLoadSkin( 'BlueSpiceSkin' );
diff --git a/BlueSpiceSkin.skin.php b/BlueSpiceSkin.skin.php
index 9f66124..d4fdbd5 100644
--- a/BlueSpiceSkin.skin.php
+++ b/BlueSpiceSkin.skin.php
@@ -33,23 +33,19 @@
/**
 * @param $out OutputPage object
 */
-   function initPage( \OutputPage $out ) {
-   parent::initPage($out);
+   public function initPage( OutputPage $out ) {
+   parent::initPage( $out );
 
-   $out->addModules('skins.bluespiceskin.scripts');
+   $out->addModules( 'skins.bluespiceskin.scripts' );
}
 
/**
 * Loads the styles
 * @param OutputPage $out
 */
-   function setupSkinUserCss( OutputPage $out ) {
-   parent::setupSkinUserCss($out);
-   $out->addModuleStyles( 'skins.bluespiceskin' );
-
-   if ( version_compare( $GLOBALS['wgVersion'], '1.23', '>=' ) ) {
-   $out->addModuleStyles( 'mediawiki.skinning.interface' );
-   }
+   public function setupSkinUserCss( OutputPage $out ) {
+   parent::setupSkinUserCss( $out );
+   $out->addModuleStyles( array( 'skins.bluespiceskin', 
'mediawiki.skinning.interface' ) );
}
 
public function addToSidebarPlain(&$bar, $text) {
@@ -59,78 +55,4 @@
return $item;
}
 
-}
-
-class BlueSpiceSkinTemplate extends BsBaseTemplate {
-
-   public function execute() {
-   parent::execute();
-
-

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [IMPR] Provide recentchanges tag filter

2016-10-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316064

Change subject: [IMPR] Provide recentchanges tag filter
..

[IMPR] Provide recentchanges tag filter

- Add tag filter to site.recentchanges() method
- Add 'tags' to rcprops
- Add tag filter to pagegenerators.RecentChangesPageGenerator
- Enable tag filtering with pagegenerators -recentchanges option
- Add tests for site and pagegenerators methods

Bug: T147416
Change-Id: Ia636aef46dd36b937a78cb71c9b98819753be2ff
---
M pywikibot/pagegenerators.py
M pywikibot/site.py
M tests/pagegenerators_tests.py
M tests/site_tests.py
4 files changed, 39 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/64/316064/1

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index e60c98f..94477f1 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -184,7 +184,8 @@
   given as -recentchanges:x, will work on the x most recently
   changed pages. If given as -recentchanges:offset,duration it
   will work on pages changed from 'offset' minutes with
-  'duration'  minutes of timespan.
+  'duration'  minutes of timespan. rctags are supported too.
+  The rctag must be the very first parameter part.
 
   By default, if no values follow -recentchanges, then we pass
   -recentchanges:x where x = 60
@@ -192,7 +193,11 @@
   Examples:
   -recentchanges:20 gives the 20 most recently changed pages
   -recentchanges:120,70 will give pages with 120 offset
-  minutes and 70 minutes of timespan
+  minutes and 70 minutes of timespan
+  -recentchanges:visualeditor,10 gives the 20 most recently
+  changed pages marked with 'visualeditor'
+  -recentchanges:"mobile edit,60,35" will retrieve pages marked
+  with 'mobile edit' for the given offset and timespan
 
 -unconnectedpages Work on the most recent unconnected pages to the Wikibase
   repository. Given as -unconnectedpages:x, will work on the
@@ -694,8 +699,11 @@
 elif arg == '-recentchanges':
 rcstart = None
 rcend = None
+rctag = None
 total = None
 params = value.split(',') if value else []
+if params and not params[0].isdigit():
+rctag = params.pop(0)
 if len(params) == 2:
 offset = float(params[0])
 duration = float(params[1])
@@ -704,7 +712,7 @@
 elif len(params) > 2:
 raise ValueError('More than two parameters passed.')
 else:
-total = int(value) if value else 60
+total = int(params[0]) if params else 60
 if len(params) == 2:
 ts_time = self.site.server_time()
 rcstart = ts_time + timedelta(minutes=-(offset + duration))
@@ -715,6 +723,7 @@
  end=rcend,
  site=self.site,
  reverse=True,
+ tag=rctag,
  
_filter_unique=self._filter_unique)
 
 elif arg == '-liverecentchanges':
@@ -1098,7 +1107,7 @@
showRedirects=None, showPatrolled=None,
topOnly=False, total=None,
user=None, excludeuser=None, site=None,
-   _filter_unique=None):
+   tag=None, _filter_unique=None):
 """
 Generate pages that are in the recent changes list, including duplicates.
 
@@ -1138,7 +1147,8 @@
 @type excludeuser: basestring|list
 @param site: Site for generator results.
 @type site: L{pywikibot.site.BaseSite}
-
+@param tag: a recent changes tag
+@type tag: str
 """
 if site is None:
 site = pywikibot.Site()
@@ -1150,7 +1160,7 @@
  showRedirects=showRedirects,
  showPatrolled=showPatrolled,
  topOnly=topOnly, total=total,
- user=user, excludeuser=excludeuser)
+ user=user, excludeuser=excludeuser, tag=tag)
 
 gen.request['rcprop'] = 'title'
 gen = (pywikibot.Page(site, x['title'])
diff --git a/pywikibot/site.py b/pywikibot/site.py
index f997020..7bc8e0d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4463,7 +4463,7 @@
   namespaces=None, pagelist=None, changetype=None,
   showMinor=None, showBot=None, showAnon=None,
   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ChangeTags::buildTagFilterSelector needs a context

2016-10-15 Thread Amritsreekumar (Code Review)
Amritsreekumar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316063

Change subject: ChangeTags::buildTagFilterSelector needs a context
..

ChangeTags::buildTagFilterSelector needs a context

ChangeTags::buildTagFilterSelector is using wfMessage which results in use of 
global $wgTitle. It also using a config variable as global. A IContextSource 
should be added as parameter to this static function, which can be used to 
avoid the globals

Bug: T105649
Change-Id: I50ca27c75b4807f5e4391648bfd5cac9169517e9
---
M includes/changetags/ChangeTags.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/316063/1

diff --git a/includes/changetags/ChangeTags.php 
b/includes/changetags/ChangeTags.php
index 76dd754..d220a57 100644
--- a/includes/changetags/ChangeTags.php
+++ b/includes/changetags/ChangeTags.php
@@ -669,7 +669,7 @@
 *You need to call OutputPage::enableOOUI() yourself.
 * @return array an array of (label, selector)
 */
-   public static function buildTagFilterSelector( $selected = '', $ooui = 
false ) {
+   public static function buildTagFilterSelector( $selected = '', $ooui = 
false, IContextSource $context = null) {
global $wgUseTagFilter;
 
if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) {
@@ -680,9 +680,11 @@
Html::rawElement(
'label',
[ 'for' => 'tagfilter' ],
-   wfMessage( 'tag-filter' )->parse()
+   $context->msg( 'tag-filter' )->parse()
)
];
+   if ( !$context ) {
+$context = RequestContext::getMain();
 
if ( $ooui ) {
$data[] = new OOUI\TextInputWidget( [

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50ca27c75b4807f5e4391648bfd5cac9169517e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Amritsreekumar 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Test: DO NOT MERGE

2016-10-15 Thread Paladox (Code Review)
Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316062

Change subject: Test: DO NOT MERGE
..

Test: DO NOT MERGE

Change-Id: I40fdd9502d4e36b9562c7131819db14323540579
---
M .travis.yml
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/62/316062/1

diff --git a/.travis.yml b/.travis.yml
index 9062194..7934069 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,7 @@
 
 services:
   - mysql
+  - postgres
 
 branches:
   # Test changes in master and arbitrary Travis CI branches only.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40fdd9502d4e36b9562c7131819db14323540579
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update lanaguage count in RELEASE NOTES

2016-10-15 Thread Paladox (Code Review)
Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316061

Change subject: Update lanaguage count in RELEASE NOTES
..

Update lanaguage count in RELEASE NOTES

We have 375 lanaguges not 350.

Change-Id: I5653274d9bec61c8b73a1ef0502ee7a56a058bcb
---
M RELEASE-NOTES-1.28
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/61/316061/1

diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28
index 75fc139..7117b72 100644
--- a/RELEASE-NOTES-1.28
+++ b/RELEASE-NOTES-1.28
@@ -167,7 +167,7 @@
 
 === Languages updated in 1.28 ===
 
-MediaWiki supports over 350 languages. Many localisations are updated
+MediaWiki supports over 375 languages. Many localisations are updated
 regularly. Below only new and removed languages are listed, as well as
 changes to languages because of Phabricator reports.
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5653274d9bec61c8b73a1ef0502ee7a56a058bcb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox 

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Silence warnings

2016-10-15 Thread OdysseasKr (Code Review)
OdysseasKr has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316060

Change subject: Silence warnings
..

Silence warnings

Set value of self.site before refering to it

Bug: T146580
Change-Id: I60f757a9281810453caea66f6a50a9200765a439
---
M scripts/image.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/60/316060/1

diff --git a/scripts/image.py b/scripts/image.py
index 59464b0..ff8517c 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -58,7 +58,7 @@
 
 """This bot will replace or remove all occurrences of an old image."""
 
-def __init__(self, generator, old_image, new_image=None, **kwargs):
+def __init__(self, generator, site, old_image, new_image=None, **kwargs):
 """
 Constructor.
 
@@ -77,6 +77,7 @@
 
 Bot.__init__(self, generator=generator, **kwargs)
 
+   self.site = site
 self.old_image = old_image
 self.new_image = new_image
 param = {
@@ -157,6 +158,7 @@
 gen = pagegenerators.FileLinksGenerator(old_imagepage)
 preloadingGen = pagegenerators.PreloadingGenerator(gen)
 bot = ImageRobot(preloadingGen, old_image, new_image, **options)
+   bot.site = pywikibot.Site()
 bot.run()
 return True
 else:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I60f757a9281810453caea66f6a50a9200765a439
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: OdysseasKr 

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: license: import licenses from wikipedia

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: license: import licenses from wikipedia
..


license: import licenses from wikipedia

Change-Id: Ia9f52d1a1cf60de4a2d098cfecf6e056b3ca24ba
Signed-off-by: Loic Dachary 
---
M FLOSSbot/bot.py
A FLOSSbot/license.py
A tests/test_license.py
3 files changed, 429 insertions(+), 1 deletion(-)

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



diff --git a/FLOSSbot/bot.py b/FLOSSbot/bot.py
index 8642759..6962b54 100644
--- a/FLOSSbot/bot.py
+++ b/FLOSSbot/bot.py
@@ -22,7 +22,7 @@
 import pywikibot
 from pywikibot import pagegenerators as pg
 
-from FLOSSbot import fsd, qa, repository
+from FLOSSbot import fsd, license, qa, repository
 from FLOSSbot.plugin import Plugin
 
 logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s')
@@ -32,6 +32,7 @@
 repository.Repository,
 qa.QA,
 fsd.FSD,
+license.License,
 ]
 
 name2plugin = dict([(p.__name__, p) for p in plugins])
diff --git a/FLOSSbot/license.py b/FLOSSbot/license.py
new file mode 100644
index 000..7f8fd09
--- /dev/null
+++ b/FLOSSbot/license.py
@@ -0,0 +1,291 @@
+#
+# Copyright (C) 2016 Loic Dachary 
+#
+#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 3 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, see .
+#
+import argparse
+import logging
+import re
+
+import pywikibot
+from pywikibot import pagegenerators as pg
+
+from FLOSSbot import plugin
+
+log = logging.getLogger(__name__)
+
+
+class License(plugin.Plugin):
+
+def __init__(self, *args):
+super(License, self).__init__(*args)
+self.license2item = None
+self.licenses = None
+
+@staticmethod
+def get_parser():
+parser = argparse.ArgumentParser(add_help=False)
+parser.add_argument(
+'--license',
+action='append',
+default=[],
+help='only consider this license (can be repeated)')
+return parser
+
+@staticmethod
+def filter_names():
+return ['license-verify', 'no-license']
+
+def get_query(self, filter):
+format_args = {
+'license': self.P_license,
+'subclass_of': self.P_subclass_of,
+'instance_of': self.P_instance_of,
+'open_source': self.Q_open_source_license.getID(),
+'free_software': self.Q_free_software_license.getID(),
+'retrieved': self.P_retrieved,
+'delay': self.args.verification_delay,
+}
+if filter == 'license-verify':
+query = """
+SELECT DISTINCT ?item WHERE {{
+  {{
+?item p:{license} ?license .
+?license ps:{license}/wdt:{instance_of}?/wdt:{subclass_of}*
+wd:{open_source}.
+  }} Union {{
+?item p:{license} ?license .
+?license ps:{license}/wdt:{instance_of}?/wdt:{subclass_of}*
+wd:{free_software}.
+  }}
+  OPTIONAL {{
+ ?license prov:wasDerivedFrom/
+ 
+ ?retrieved
+  }}
+  FILTER (!BOUND(?retrieved) ||
+  ?retrieved < (now() - "P{delay}D"^^xsd:duration))
+}} ORDER BY ?item
+""".format(**format_args)
+elif filter == 'no-license':
+format_args.update({
+'foss': self.Q_free_and_open_source_software.getID(),
+'free_software': self.Q_free_software.getID(),
+'open_source_software': self.Q_open_source_software.getID(),
+'public_domain': self.Q_public_domain.getID(),
+'software': self.Q_software.getID(),
+})
+query = """
+SELECT DISTINCT ?item WHERE {{
+   {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{foss}.
+   }} Union {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{free_software}.
+   }} Union {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{open_source_software}.
+   }} Union {{
+ ?item p:{instance_of}/ps:

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get template field values for all sitelinks

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: get template field values for all sitelinks
..


plugin: get template field values for all sitelinks

For a given item, extract the templates found in the interlink pages.
Extract the value of a given field and return a map that looks like:

   {
 'fr': 'License Publique Générale GNU',
 'en': 'GNU General Public License',
   }

Only consider the templates matching the pattern specified in
lang2pattern. For instance Infobox etc. To limit the chances of
conflicting values should another template have the same value for a
given field.

The value is extracted from the field named after the 'en' entry of
lang2field. For instance if lang2field['en'] = 'License', the license
field will be extracted. If lang2field['fr'] does not exist, the french
translation as returned by the translate_title method will be used. If
the lang2field['zh'] = 'license' exists, it is used and no attempt is
made to translate the english word. It is not uncommon for some
wikipedia to use fields that are not in the native language.

Change-Id: I43178b93a3e2e4445c2b73742bef6f072b65d3f2
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 45 insertions(+), 0 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index cba787e..7eefa2b 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -278,6 +278,37 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def get_template_field(self, item, lang2field, lang2pattern):
+lang2value = {}
+for dbname in item.sitelinks.keys():
+site = pywikibot.site.APISite.fromDBName(dbname)
+pattern = lang2pattern.get(site.code, lang2pattern['*'])
+p = pywikibot.Page(site, item.sitelinks[dbname])
+for (template, pairs) in p.templatesWithParams():
+self.debug(item, site.code + " template " + template.title())
+if pattern in template.title():
+for pair in pairs:
+found = pair.split('=', 1)
+if len(found) == 1:
+continue
+(name, value) = found
+if site.code in lang2field:
+translated = lang2field[site.code]
+elif 'en' in lang2field:
+translated = self.translate_title(lang2field['en'],
+  site.code)
+else:
+translated = None
+self.debug(item, site.code + " compare " +
+   str(translated).lower() + " and " +
+   name.lower())
+if (value and
+translated and
+name.lower() == translated.lower()):
+lang2value[site.code] = value
+self.debug(item, 'get_template_field ' + str(lang2value))
+return lang2value
+
 def translate_title(self, title, lang):
 if title not in self.title_translation:
 site = pywikibot.site.APISite.fromDBName('enwiki')
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 1edd2fa..8fe185a 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,20 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_get_template_field(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+item = plugin.Q_GNU_Emacs
+expected = {
+'fr': 'licence',
+'en': 'license',
+}
+item.get()
+lang2field = {'en': 'License'}
+lang2pattern = {'*': 'Infobox'}
+actual = plugin.get_template_field(item, lang2field, lang2pattern)
+assert actual.keys() == expected.keys()
+
 def test_translate_title(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I43178b93a3e2e4445c2b73742bef6f072b65d3f2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get the title of langlinks for a page

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: get the title of langlinks for a page
..


plugin: get the title of langlinks for a page

And assume this is a valid translation of the page title.

Change-Id: I62a2a5f41e75a79ddecec93463b302d546584cbd
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 20 insertions(+), 0 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index a0d309a..cba787e 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -32,6 +32,7 @@
 self.args = args
 self.bot = bot
 self.reset_cache()
+self.title_translation = {}
 self.dbname2item = {}
 
 @staticmethod
@@ -277,6 +278,17 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def translate_title(self, title, lang):
+if title not in self.title_translation:
+site = pywikibot.site.APISite.fromDBName('enwiki')
+translation = {'en': title}
+p = pywikibot.Page(site, title)
+for l in p.langlinks():
+# License (juridique): the (...) is for disambiguation
+translation[l.site.code] = re.sub('\s*\([^)]*\)', '', l.title)
+self.title_translation[title] = translation
+return self.title_translation[title].get(lang)
+
 def get_redirects(self, title, lang):
 log.debug("get_redirects " + title + " " + lang)
 site = pywikibot.site.APISite.fromDBName(lang + 'wiki')
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 8a8b367..1edd2fa 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,14 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_translate_title(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+assert 'GNU Emacs' == plugin.translate_title('GNU Emacs', 'fr')
+assert 'ГНУ Емакс' == plugin.translate_title('GNU Emacs', 'sr')
+assert 'Licence' == plugin.translate_title('License', 'fr')
+assert plugin.translate_title('License', '??') is None
+
 def test_get_redirects(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I62a2a5f41e75a79ddecec93463b302d546584cbd
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get redirects leading to a given page

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: get redirects leading to a given page
..


plugin: get redirects leading to a given page

Change-Id: I3a74f6e910e3c011d3dc9011946b653077ae14eb
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 15 insertions(+), 0 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 3ce2474..a0d309a 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -277,6 +277,15 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def get_redirects(self, title, lang):
+log.debug("get_redirects " + title + " " + lang)
+site = pywikibot.site.APISite.fromDBName(lang + 'wiki')
+p = pywikibot.Page(site, title)
+return [r.title() for r in p.getReferences(follow_redirects=False,
+   withTemplateInclusion=False,
+   redirectsOnly=True,
+   total=5000)]
+
 def get_sitelink_item(self, dbname):
 if dbname not in self.dbname2item:
 query = """
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index f4cb5b5..8a8b367 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,12 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_get_redirects(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+titles = plugin.get_redirects('GNU General Public License', 'en')
+assert 'GPL' in titles
+
 def test_get_sitelink_item(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a74f6e910e3c011d3dc9011946b653077ae14eb
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: util, fsd: re-order imports

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: util, fsd: re-order imports
..


util, fsd: re-order imports

Change-Id: I5e62395d84afe5ab8193273390f363a2b11630ef
Signed-off-by: Loic Dachary 
---
M tests/test_fsd.py
M tests/test_util.py
2 files changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/tests/test_fsd.py b/tests/test_fsd.py
index 3e7f655..1396193 100644
--- a/tests/test_fsd.py
+++ b/tests/test_fsd.py
@@ -16,8 +16,8 @@
 #along with this program.  If not, see .
 #
 import logging
-import mock
 
+import mock
 import pywikibot
 
 from FLOSSbot.bot import Bot
diff --git a/tests/test_util.py b/tests/test_util.py
index 2f6f953..362535e 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -15,9 +15,10 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see .
 #
-import pytest
 import subprocess
 
+import pytest
+
 from FLOSSbot import util
 
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5e62395d84afe5ab8193273390f363a2b11630ef
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: lookup wikipedia item from dbname

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: lookup wikipedia item from dbname
..


plugin: lookup wikipedia item from dbname

Helper for adding "import from" sources.

Change-Id: Ibe282bbdd82015566bb28d945efd163e0e935ab6
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 28 insertions(+), 0 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 0be598c..3ce2474 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -21,6 +21,7 @@
 
 import pywikibot
 import requests
+from pywikibot import pagegenerators as pg
 
 log = logging.getLogger(__name__)
 
@@ -31,6 +32,7 @@
 self.args = args
 self.bot = bot
 self.reset_cache()
+self.dbname2item = {}
 
 @staticmethod
 def get_parser():
@@ -274,3 +276,21 @@
 except Exception as e:
 log.debug("GET failed with " + str(e))
 return None
+
+def get_sitelink_item(self, dbname):
+if dbname not in self.dbname2item:
+query = """
+SELECT DISTINCT ?item WHERE {{
+  ?item wdt:{Wikimedia_database_name} '{dbname}'.
+}}
+""".format(
+Wikimedia_database_name=self.P_Wikimedia_database_name,
+dbname=dbname,
+)
+for item in pg.WikidataSPARQLPageGenerator(
+query, site=self.bot.site):
+item.get()
+assert dbname == item.claims[
+self.P_Wikimedia_database_name][0].getTarget()
+self.dbname2item[dbname] = item
+return self.dbname2item[dbname]
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 1a45398..f4cb5b5 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -150,3 +150,11 @@
 Plugin.authoritative['test'][name] = second.getID()
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
+
+def test_get_sitelink_item(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+enwiki = plugin.get_sitelink_item('enwiki')
+assert 'English Wikipedia' == enwiki.labels['en']
+frwiki = plugin.get_sitelink_item('frwiki')
+assert 'French Wikipedia' == frwiki.labels['en']

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe282bbdd82015566bb28d945efd163e0e935ab6
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: s/clear_entity_label/set_entity_label/

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: s/clear_entity_label/set_entity_label/
..


plugin: s/clear_entity_label/set_entity_label/

Clearing an entity label is setting it with an empty string.

Change-Id: I36aeacb17965e2ac6b393482e13439903358a19f
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
1 file changed, 8 insertions(+), 3 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 7c6dcc1..0be598c 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -172,15 +172,18 @@
 self.bot.site.editEntity({'new': type}, entity)
 
 def clear_entity_label(self, id):
+self.set_entity_label(id, '')
+
+def set_entity_label(self, id, label):
 data = {
 "labels": {
 "en": {
 "language": "en",
-"value": "",
+"value": label,
 }
 }
 }
-log.debug("clear " + id + " label")
+log.debug("set " + id + " label to '" + label + "'")
 self.bot.site.editEntity({'id': id}, data)
 while True:
 if id.startswith('P'):
@@ -188,7 +191,9 @@
 else:
 entity = pywikibot.ItemPage(self.bot.site, id, 0)
 entity.get(force=True)
-if entity.labels.get('en') is None:
+if label == '' and entity.labels.get('en') is None:
+break
+if label != '' and label == entity.labels.get('en'):
 break
 self.reset_cache()
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I36aeacb17965e2ac6b393482e13439903358a19f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: make sure - _ are treated as space

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: plugin: make sure - _ are treated as space
..


plugin: make sure - _ are treated as space

When used as attributes self.P_* or self.Q_*

Change-Id: I0968477939d7226a35ba27f2c29e39b358a84976
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 10 insertions(+), 2 deletions(-)

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



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 6f86d7b..7c6dcc1 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -16,6 +16,7 @@
 #
 import argparse
 import logging
+import re
 from datetime import datetime, timedelta
 
 import pywikibot
@@ -104,6 +105,10 @@
 },
 }
 
+@staticmethod
+def normalize_name(name):
+return re.sub('[-_]', ' ', name)
+
 def search_entity(self, site, name, **kwargs):
 if name in Plugin.authoritative[site.code]:
 candidate = pywikibot.ItemPage(
@@ -113,7 +118,8 @@
 candidates = []
 for p in site.search_entities(name, 'en', **kwargs):
 log.debug("looking for entity " + name + ", found " + str(p))
-if p.get('label') == name:
+if (Plugin.normalize_name(p.get('label')) ==
+Plugin.normalize_name(name)):
 if kwargs['type'] == 'property':
 candidates.append(p)
 else:
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 90a0e9e..1a45398 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -112,9 +112,11 @@
 bot = Bot.factory([
 '--test',
 '--user=FLOSSbotCI',
+'--verbose',
 ])
 plugin = Plugin(bot, bot.args)
-name = WikidataHelper.random_name()
+# ensure space, - and _ are accepted
+name = WikidataHelper.random_name() + "-some thing_else"
 entity = {
 "labels": {
 "en": {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0968477939d7226a35ba27f2c29e39b358a84976
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 
Gerrit-Reviewer: Dachary 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: license: import licenses from wikipedia

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316059

Change subject: license: import licenses from wikipedia
..

license: import licenses from wikipedia

Change-Id: Ia9f52d1a1cf60de4a2d098cfecf6e056b3ca24ba
Signed-off-by: Loic Dachary 
---
M FLOSSbot/bot.py
A FLOSSbot/license.py
A tests/test_license.py
3 files changed, 429 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/59/316059/1

diff --git a/FLOSSbot/bot.py b/FLOSSbot/bot.py
index 8642759..6962b54 100644
--- a/FLOSSbot/bot.py
+++ b/FLOSSbot/bot.py
@@ -22,7 +22,7 @@
 import pywikibot
 from pywikibot import pagegenerators as pg
 
-from FLOSSbot import fsd, qa, repository
+from FLOSSbot import fsd, license, qa, repository
 from FLOSSbot.plugin import Plugin
 
 logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s')
@@ -32,6 +32,7 @@
 repository.Repository,
 qa.QA,
 fsd.FSD,
+license.License,
 ]
 
 name2plugin = dict([(p.__name__, p) for p in plugins])
diff --git a/FLOSSbot/license.py b/FLOSSbot/license.py
new file mode 100644
index 000..7f8fd09
--- /dev/null
+++ b/FLOSSbot/license.py
@@ -0,0 +1,291 @@
+#
+# Copyright (C) 2016 Loic Dachary 
+#
+#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 3 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, see .
+#
+import argparse
+import logging
+import re
+
+import pywikibot
+from pywikibot import pagegenerators as pg
+
+from FLOSSbot import plugin
+
+log = logging.getLogger(__name__)
+
+
+class License(plugin.Plugin):
+
+def __init__(self, *args):
+super(License, self).__init__(*args)
+self.license2item = None
+self.licenses = None
+
+@staticmethod
+def get_parser():
+parser = argparse.ArgumentParser(add_help=False)
+parser.add_argument(
+'--license',
+action='append',
+default=[],
+help='only consider this license (can be repeated)')
+return parser
+
+@staticmethod
+def filter_names():
+return ['license-verify', 'no-license']
+
+def get_query(self, filter):
+format_args = {
+'license': self.P_license,
+'subclass_of': self.P_subclass_of,
+'instance_of': self.P_instance_of,
+'open_source': self.Q_open_source_license.getID(),
+'free_software': self.Q_free_software_license.getID(),
+'retrieved': self.P_retrieved,
+'delay': self.args.verification_delay,
+}
+if filter == 'license-verify':
+query = """
+SELECT DISTINCT ?item WHERE {{
+  {{
+?item p:{license} ?license .
+?license ps:{license}/wdt:{instance_of}?/wdt:{subclass_of}*
+wd:{open_source}.
+  }} Union {{
+?item p:{license} ?license .
+?license ps:{license}/wdt:{instance_of}?/wdt:{subclass_of}*
+wd:{free_software}.
+  }}
+  OPTIONAL {{
+ ?license prov:wasDerivedFrom/
+ 
+ ?retrieved
+  }}
+  FILTER (!BOUND(?retrieved) ||
+  ?retrieved < (now() - "P{delay}D"^^xsd:duration))
+}} ORDER BY ?item
+""".format(**format_args)
+elif filter == 'no-license':
+format_args.update({
+'foss': self.Q_free_and_open_source_software.getID(),
+'free_software': self.Q_free_software.getID(),
+'open_source_software': self.Q_open_source_software.getID(),
+'public_domain': self.Q_public_domain.getID(),
+'software': self.Q_software.getID(),
+})
+query = """
+SELECT DISTINCT ?item WHERE {{
+   {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{foss}.
+   }} Union {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{free_software}.
+   }} Union {{
+ ?item p:{instance_of}/ps:{instance_of}/wdt:{subclass_of}*
+wd:{open_source_software}.
+   }} Uni

[MediaWiki-commits] [Gerrit] mediawiki...Wikidata[master]: New Wikidata Build - 2016-10-15T10:00:01+0000

2016-10-15 Thread WikidataBuilder (Code Review)
WikidataBuilder has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316058

Change subject: New Wikidata Build - 2016-10-15T10:00:01+
..

New Wikidata Build - 2016-10-15T10:00:01+

Change-Id: Ie15c031c6eb74ccf5db80dc8493fd807906a8049
---
M composer.lock
M extensions/ValueView/RELEASE-NOTES.md
M extensions/ValueView/ValueView.php
M extensions/ValueView/i18n/en.json
M extensions/ValueView/i18n/qqq.json
M extensions/ValueView/lib/jquery.ui/jquery.ui.commonssuggester.js
M extensions/ValueView/src/experts/GlobeCoordinateInput.js
M extensions/ValueView/src/experts/resources.php
M extensions/ValueView/src/jquery.valueview.valueview.js
A extensions/ValueView/tests/lib/jquery.ui/jquery.ui.commonssuggester.tests.js
M extensions/ValueView/tests/lib/jquery.ui/jquery.ui.suggester.tests.js
M extensions/ValueView/tests/lib/resources.php
M extensions/Wikibase/client/i18n/vro.json
M extensions/Wikibase/client/i18n/zh-hant.json
M extensions/Wikibase/client/includes/Specials/SpecialEntityUsage.php
M 
extensions/Wikibase/client/tests/phpunit/includes/Specials/SpecialEntityUsageTest.php
M extensions/Wikibase/composer.json
M extensions/Wikibase/lib/includes/Store/Sql/SqlEntityInfoBuilder.php
M extensions/Wikibase/lib/tests/phpunit/Store/EntityInfoBuilderTest.php
M extensions/Wikibase/repo/i18n/de.json
M extensions/Wikibase/repo/i18n/en.json
M extensions/Wikibase/repo/i18n/pt.json
M extensions/Wikibase/repo/i18n/qqq.json
M extensions/Wikibase/repo/includes/Actions/SubmitEntityAction.php
M 
extensions/Wikibase/view/resources/jquery/wikibase/jquery.wikibase.statementview.RankSelector.js
M extensions/Wikibase/view/resources/jquery/wikibase/resources.php
M vendor/composer/installed.json
27 files changed, 401 insertions(+), 70 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index 9cadb17..fd65a2a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -674,16 +674,16 @@
 },
 {
 "name": "data-values/value-view",
-"version": "0.17.4",
+"version": "0.18.0",
 "source": {
 "type": "git",
 "url": 
"https://github.com/wikimedia/data-values-value-view.git";,
-"reference": "094a35216990d62daf104037edd3d593d406d80d"
+"reference": "5938027bbbad63e54cfa0266db211bac5fa902b2"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/wikimedia/data-values-value-view/zipball/094a35216990d62daf104037edd3d593d406d80d";,
-"reference": "094a35216990d62daf104037edd3d593d406d80d",
+"url": 
"https://api.github.com/repos/wikimedia/data-values-value-view/zipball/5938027bbbad63e54cfa0266db211bac5fa902b2";,
+"reference": "5938027bbbad63e54cfa0266db211bac5fa902b2",
 "shasum": ""
 },
 "require": {
@@ -721,7 +721,7 @@
 ],
 "description": "Provides JS widgets to edit values defined by the 
DataValues library",
 "homepage": "https://www.mediawiki.org/wiki/Extension:ValueView";,
-"time": "2016-10-05 14:27:34"
+"time": "2016-10-14 12:19:21"
 },
 {
 "name": "diff/diff",
@@ -1574,12 +1574,12 @@
 "source": {
 "type": "git",
 "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-"reference": "7f7a926567984089c1c157da35f19260d18bd7c9"
+"reference": "925de4a0469c5fe4727eba81704ce67833f8e78c"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/7f7a926567984089c1c157da35f19260d18bd7c9";,
-"reference": "7f7a926567984089c1c157da35f19260d18bd7c9",
+"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/925de4a0469c5fe4727eba81704ce67833f8e78c";,
+"reference": "925de4a0469c5fe4727eba81704ce67833f8e78c",
 "shasum": ""
 },
 "require": {
@@ -1593,7 +1593,7 @@
 "data-values/serialization": "~1.1",
 "data-values/time": "~0.8.4",
 "data-values/validators": "~0.1.0",
-"data-values/value-view": "~0.17.3",
+"data-values/value-view": "~0.18.0",
 "diff/diff": "~2.0",
 "php": ">=5.5.0",
 "wikibase/data-model": "~6.1",
@@ -1653,7 +1653,7 @@
 "wikibaserepo",
 "wikidata"
 ],
-"time": "2016-10-13 08:27:02"
+"time": "2016-10-14 15:29:48"
 },
 {
 "name": "wikibase/wikimedia-badges",

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get template field values for all sitelinks

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316057

Change subject: plugin: get template field values for all sitelinks
..

plugin: get template field values for all sitelinks

For a given item, extract the templates found in the interlink pages.
Extract the value of a given field and return a map that looks like:

   {
 'fr': 'License Publique Générale GNU',
 'en': 'GNU General Public License',
   }

Only consider the templates matching the pattern specified in
lang2pattern. For instance Infobox etc. To limit the chances of
conflicting values should another template have the same value for a
given field.

The value is extracted from the field named after the 'en' entry of
lang2field. For instance if lang2field['en'] = 'License', the license
field will be extracted. If lang2field['fr'] does not exist, the french
translation as returned by the translate_title method will be used. If
the lang2field['zh'] = 'license' exists, it is used and no attempt is
made to translate the english word. It is not uncommon for some
wikipedia to use fields that are not in the native language.

Change-Id: I43178b93a3e2e4445c2b73742bef6f072b65d3f2
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 45 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/57/316057/1

diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index cba787e..7eefa2b 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -278,6 +278,37 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def get_template_field(self, item, lang2field, lang2pattern):
+lang2value = {}
+for dbname in item.sitelinks.keys():
+site = pywikibot.site.APISite.fromDBName(dbname)
+pattern = lang2pattern.get(site.code, lang2pattern['*'])
+p = pywikibot.Page(site, item.sitelinks[dbname])
+for (template, pairs) in p.templatesWithParams():
+self.debug(item, site.code + " template " + template.title())
+if pattern in template.title():
+for pair in pairs:
+found = pair.split('=', 1)
+if len(found) == 1:
+continue
+(name, value) = found
+if site.code in lang2field:
+translated = lang2field[site.code]
+elif 'en' in lang2field:
+translated = self.translate_title(lang2field['en'],
+  site.code)
+else:
+translated = None
+self.debug(item, site.code + " compare " +
+   str(translated).lower() + " and " +
+   name.lower())
+if (value and
+translated and
+name.lower() == translated.lower()):
+lang2value[site.code] = value
+self.debug(item, 'get_template_field ' + str(lang2value))
+return lang2value
+
 def translate_title(self, title, lang):
 if title not in self.title_translation:
 site = pywikibot.site.APISite.fromDBName('enwiki')
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 1edd2fa..8fe185a 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,20 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_get_template_field(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+item = plugin.Q_GNU_Emacs
+expected = {
+'fr': 'licence',
+'en': 'license',
+}
+item.get()
+lang2field = {'en': 'License'}
+lang2pattern = {'*': 'Infobox'}
+actual = plugin.get_template_field(item, lang2field, lang2pattern)
+assert actual.keys() == expected.keys()
+
 def test_translate_title(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43178b93a3e2e4445c2b73742bef6f072b65d3f2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get the title of langlinks for a page

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316056

Change subject: plugin: get the title of langlinks for a page
..

plugin: get the title of langlinks for a page

And assume this is a valid translation of the page title.

Change-Id: I62a2a5f41e75a79ddecec93463b302d546584cbd
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/56/316056/1

diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index a0d309a..cba787e 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -32,6 +32,7 @@
 self.args = args
 self.bot = bot
 self.reset_cache()
+self.title_translation = {}
 self.dbname2item = {}
 
 @staticmethod
@@ -277,6 +278,17 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def translate_title(self, title, lang):
+if title not in self.title_translation:
+site = pywikibot.site.APISite.fromDBName('enwiki')
+translation = {'en': title}
+p = pywikibot.Page(site, title)
+for l in p.langlinks():
+# License (juridique): the (...) is for disambiguation
+translation[l.site.code] = re.sub('\s*\([^)]*\)', '', l.title)
+self.title_translation[title] = translation
+return self.title_translation[title].get(lang)
+
 def get_redirects(self, title, lang):
 log.debug("get_redirects " + title + " " + lang)
 site = pywikibot.site.APISite.fromDBName(lang + 'wiki')
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 8a8b367..1edd2fa 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,14 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_translate_title(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+assert 'GNU Emacs' == plugin.translate_title('GNU Emacs', 'fr')
+assert 'ГНУ Емакс' == plugin.translate_title('GNU Emacs', 'sr')
+assert 'Licence' == plugin.translate_title('License', 'fr')
+assert plugin.translate_title('License', '??') is None
+
 def test_get_redirects(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62a2a5f41e75a79ddecec93463b302d546584cbd
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] labs...ptable[master]: Drop explicit SPARQL prefixes from queries

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Drop explicit SPARQL prefixes from queries
..


Drop explicit SPARQL prefixes from queries

Most prefixes that are used in common queries are supported by the
engine without the need to explicitly specify them.

Change-Id: I9e6566fb223dd6feaab7da654b0e032b5fd48e64
---
M nuclides.py
1 file changed, 5 insertions(+), 22 deletions(-)

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



diff --git a/nuclides.py b/nuclides.py
index 76e83ae..6660201 100644
--- a/nuclides.py
+++ b/nuclides.py
@@ -117,10 +117,7 @@
 """Load nuclide info from Wikidata Sparql endpoint."""
 def __iter__(self):
 nuclides = defaultdict(Nuclide)
-nuclides_query = "PREFIX wdt:  \
-PREFIX rdfs:  \
-PREFIX wd:  \
-SELECT ?nuclide ?atomic_number ?neutron_number ?label WHERE {{ \
+nuclides_query = "SELECT ?nuclide ?atomic_number ?neutron_number 
?label WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  wdt:P{3} ?atomic_number ; \
  wdt:P{4} ?neutron_number ; \
@@ -142,9 +139,7 @@
 nuclides[nuclide_uri].half_life = None
 nuclides[nuclide_uri].item_id = nuclide_uri.split('/')[-1]
 
-stable_query = "PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?nuclide WHERE {{ \
+stable_query = "SELECT ?nuclide WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  wdt:P{0} wd:Q{3} . \
 }}".format(Nuclide.instance_pid, Nuclide.subclass_pid, Nuclide.isotope_qid,
@@ -155,12 +150,7 @@
 if nuclide_uri in nuclides:
 nuclides[nuclide_uri].classes.append('stable')
 
-hl_query = "PREFIX wdt:  \
-PREFIX wd:  \
-PREFIX wikibase:  \
-PREFIX psv:  \
-PREFIX p:  \
-SELECT ?nuclide ?half_life ?half_life_unit WHERE {{ \
+hl_query = "SELECT ?nuclide ?half_life ?half_life_unit WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  p:P{3} ?hl_statement . \
 ?hl_statement psv:P{3} ?hl_value . \
@@ -181,12 +171,7 @@
 nuclide_result['half_life_unit']['value'])
 # else - sparql returned more than 1 half-life value - problem?
 
-decay_query = "PREFIX ps:  \
-PREFIX pq:  \
-PREFIX p:  \
-PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?nuclide ?decay_to ?decay_mode ?fraction WHERE {{ \
+decay_query = "SELECT ?nuclide ?decay_to ?decay_mode ?fraction WHERE 
{{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  p:P{3} ?decay_statement . \
 ?decay_statement ps:P{3} ?decay_to ; \
@@ -206,9 +191,7 @@
 yield nuclide
 
 def get_magic_numbers(self):
-magic_query = "PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?magic_number WHERE {{ \
+magic_query = "SELECT ?magic_number WHERE {{ \
 ?number wdt:P{0} wd:Q{1} ; \
 wdt:P{2} ?magic_number . \
 }} ORDER by ?magic_number".format(Nuclide.instance_pid, Nuclide.magic_qid,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e6566fb223dd6feaab7da654b0e032b5fd48e64
Gerrit-PatchSet: 2
Gerrit-Project: labs/tools/ptable
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa 
Gerrit-Reviewer: ArthurPSmith 
Gerrit-Reviewer: Ricordisamoa 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: get redirects leading to a given page

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316055

Change subject: plugin: get redirects leading to a given page
..

plugin: get redirects leading to a given page

Change-Id: I3a74f6e910e3c011d3dc9011946b653077ae14eb
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/55/316055/1

diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 3ce2474..a0d309a 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -277,6 +277,15 @@
 log.debug("GET failed with " + str(e))
 return None
 
+def get_redirects(self, title, lang):
+log.debug("get_redirects " + title + " " + lang)
+site = pywikibot.site.APISite.fromDBName(lang + 'wiki')
+p = pywikibot.Page(site, title)
+return [r.title() for r in p.getReferences(follow_redirects=False,
+   withTemplateInclusion=False,
+   redirectsOnly=True,
+   total=5000)]
+
 def get_sitelink_item(self, dbname):
 if dbname not in self.dbname2item:
 query = """
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index f4cb5b5..8a8b367 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -151,6 +151,12 @@
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
 
+def test_get_redirects(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+titles = plugin.get_redirects('GNU General Public License', 'en')
+assert 'GPL' in titles
+
 def test_get_sitelink_item(self):
 bot = Bot.factory(['--verbose'])
 plugin = Plugin(bot, bot.args)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a74f6e910e3c011d3dc9011946b653077ae14eb
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: util, fsd: re-order imports

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316054

Change subject: util, fsd: re-order imports
..

util, fsd: re-order imports

Change-Id: I5e62395d84afe5ab8193273390f363a2b11630ef
Signed-off-by: Loic Dachary 
---
M tests/test_fsd.py
M tests/test_util.py
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/54/316054/1

diff --git a/tests/test_fsd.py b/tests/test_fsd.py
index 3e7f655..1396193 100644
--- a/tests/test_fsd.py
+++ b/tests/test_fsd.py
@@ -16,8 +16,8 @@
 #along with this program.  If not, see .
 #
 import logging
-import mock
 
+import mock
 import pywikibot
 
 from FLOSSbot.bot import Bot
diff --git a/tests/test_util.py b/tests/test_util.py
index 2f6f953..362535e 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -15,9 +15,10 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see .
 #
-import pytest
 import subprocess
 
+import pytest
+
 from FLOSSbot import util
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e62395d84afe5ab8193273390f363a2b11630ef
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: pywikibot:image.py site warnings. First move user-config.py...

2016-10-15 Thread JameerBabu (Code Review)
JameerBabu has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316053

Change subject: pywikibot:image.py site warnings.  First move user-config.py 
file to scripts directory.Add site=site line in the if condition.  Bug:T146580. 
 ID:96de789d448f3f5d73dea63c1c65cb2973efaa9c
..

pywikibot:image.py site warnings.
 First move user-config.py file to scripts directory.Add site=site line in the 
if condition.
 Bug:T146580.
 ID:96de789d448f3f5d73dea63c1c65cb2973efaa9c

Change-Id: I4395d2c8e41d8d2154cd4c78840989470585f0ca
---
A git_repos/pywikibot-core/scripts/image.py
1 file changed, 167 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/53/316053/1

diff --git a/git_repos/pywikibot-core/scripts/image.py 
b/git_repos/pywikibot-core/scripts/image.py
new file mode 100755
index 000..f26322b
--- /dev/null
+++ b/git_repos/pywikibot-core/scripts/image.py
@@ -0,0 +1,167 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+This script can be used to change one image to another or remove an image.
+
+Syntax:
+
+python pwb.py image image_name [new_image_name]
+
+If only one command-line parameter is provided then that image will be removed;
+if two are provided, then the first image will be replaced by the second one on
+all pages.
+
+Command line options:
+
+-summary:  Provide a custom edit summary.  If the summary includes spaces,
+   surround it with single quotes, such as:
+   -summary:'My edit summary'
+-alwaysDon't prompt to make changes, just do them.
+-loose Do loose replacements.  This will replace all occurrences of the 
name
+   of the image (and not just explicit image syntax).  This should work
+   to catch all instances of the image, including where it is used as a
+   template parameter or in image galleries.  However, it can also make
+   more mistakes.  This only works with image replacement, not image
+   removal.
+
+Examples:
+
+The image "FlagrantCopyvio.jpg" is about to be deleted, so let's first remove 
it
+from everything that displays it:
+
+python pwb.py image FlagrantCopyvio.jpg
+
+The image "Flag.svg" has been uploaded, making the old "Flag.jpg" obsolete:
+
+python pwb.py image Flag.jpg Flag.svg
+
+"""
+#
+# (C) Pywikibot team, 2013-2016
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import absolute_import, unicode_literals
+
+__version__ = '$Id$'
+#
+import re
+
+import pywikibot
+
+from pywikibot import i18n, pagegenerators, Bot
+
+from scripts.replace import ReplaceRobot as ReplaceBot
+
+
+class ImageRobot(ReplaceBot):
+
+"""This bot will replace or remove all occurrences of an old image."""
+
+def __init__(self, generator, old_image, new_image=None, **kwargs):
+"""
+Constructor.
+
+@param generator: the pages to work on
+@type  generator: iterable
+@param old_image: the title of the old image (without namespace)
+@type  old_image: unicode
+@param new_image: the title of the new image (without namespace), or
+  None if you want to remove the image
+@type  new_image: unicode or None
+"""
+self.availableOptions.update({
+'summary': None,
+'loose': False,
+})
+
+Bot.__init__(self, generator=generator, **kwargs)
+
+self.old_image = old_image
+self.new_image = new_image
+param = {
+'old': self.old_image,
+'new': self.new_image,
+'file': self.old_image,
+}
+
+summary = self.getOption('summary') or i18n.twtranslate(
+self.site, 'image-replace' if self.new_image else 'image-remove',
+param)
+
+namespace = self.site.namespaces[6]
+if namespace.case == 'first-letter':
+case = re.escape(self.old_image[0].upper() +
+ self.old_image[0].lower())
+escaped = '[' + case + ']' + re.escape(self.old_image[1:])
+else:
+escaped = re.escape(self.old_image)
+
+# Be careful, spaces and _ have been converted to '\ ' and '\_'
+escaped = re.sub('[_ ]', '[_ ]', escaped)
+if not self.getOption('loose') or not self.new_image:
+image_regex = re.compile(
+r'\[\[ *(?:%s)\s*:\s*%s *(?P\|[^\n]+|) *\]\]'
+% ('|'.join(namespace), escaped))
+else:
+image_regex = re.compile(r'' + escaped)
+
+replacements = []
+if self.new_image:
+if not self.getOption('loose'):
+replacements.append((image_regex,
+ u'[[%s:%s\\g]]'
+ % (self.site.namespaces.FILE.custom_name,
+self.new_image)))
+else:
+r

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: lookup wikipedia item from dbname

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316052

Change subject: plugin: lookup wikipedia item from dbname
..

plugin: lookup wikipedia item from dbname

Helper for adding "import from" sources.

Change-Id: Ibe282bbdd82015566bb28d945efd163e0e935ab6
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
M tests/test_plugin.py
2 files changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/52/316052/1

diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 0be598c..5ee7ea4 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -21,6 +21,7 @@
 
 import pywikibot
 import requests
+from pywikibot import pagegenerators as pg
 
 log = logging.getLogger(__name__)
 
@@ -31,6 +32,7 @@
 self.args = args
 self.bot = bot
 self.reset_cache()
+self.dbname2item = {}
 
 @staticmethod
 def get_parser():
@@ -274,3 +276,20 @@
 except Exception as e:
 log.debug("GET failed with " + str(e))
 return None
+def get_sitelink_item(self, dbname):
+if dbname not in self.dbname2item:
+query = """
+SELECT DISTINCT ?item WHERE {{
+  ?item wdt:{Wikimedia_database_name} '{dbname}'.
+}}
+""".format(
+Wikimedia_database_name=self.P_Wikimedia_database_name,
+dbname=dbname,
+)
+for item in pg.WikidataSPARQLPageGenerator(
+query, site=self.bot.site):
+item.get()
+assert dbname == item.claims[
+self.P_Wikimedia_database_name][0].getTarget()
+self.dbname2item[dbname] = item
+return self.dbname2item[dbname]
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 1a45398..f4cb5b5 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -150,3 +150,11 @@
 Plugin.authoritative['test'][name] = second.getID()
 found = plugin.search_entity(plugin.bot.site, name, type='item')
 assert found.getID() == second.getID()
+
+def test_get_sitelink_item(self):
+bot = Bot.factory(['--verbose'])
+plugin = Plugin(bot, bot.args)
+enwiki = plugin.get_sitelink_item('enwiki')
+assert 'English Wikipedia' == enwiki.labels['en']
+frwiki = plugin.get_sitelink_item('frwiki')
+assert 'French Wikipedia' == frwiki.labels['en']

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe282bbdd82015566bb28d945efd163e0e935ab6
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] labs...ptable[master]: Drop WdqBase and subclasses

2016-10-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Drop WdqBase and subclasses
..


Drop WdqBase and subclasses

The Wikidata Query Service is reliable and preferred to WikidataQuery.
Dropping support for the latter significantly decreases the amount of
unreachable code.

https://phabricator.wikimedia.org/T122706#2718182

Change-Id: I16584ba1304f306b54da0f9e6e21782a8f1e4a5f
---
M base.py
M chemistry.py
M nuclides.py
M units.py
4 files changed, 3 insertions(+), 161 deletions(-)

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



diff --git a/base.py b/base.py
index bc01b1a..6d878f7 100644
--- a/base.py
+++ b/base.py
@@ -90,20 +90,6 @@
 raise NotImplementedError()
 
 
-class WdqBase:
-"""Load items from Wikidata Query."""
-
-WDQ_API = 'http://wdq.wmflabs.org/api'
-
-@classmethod
-def get_wdq(cls):
-return get_json(cls.WDQ_API, cls.get_query())
-
-@classmethod
-def get_query(cls):
-raise NotImplementedError()
-
-
 class SparqlBase:
 """Load items from Wikidata SPARQL query service."""
 
diff --git a/chemistry.py b/chemistry.py
index 9ea7ac7..434634c 100644
--- a/chemistry.py
+++ b/chemistry.py
@@ -22,7 +22,7 @@
 from collections import defaultdict
 
 import data
-from base import BaseProvider, PropertyAlreadySetException, SparqlBase, 
TableCell, WdqBase, get_json
+from base import BaseProvider, PropertyAlreadySetException, SparqlBase, 
TableCell, get_json
 
 
 class ElementProvider(BaseProvider):
@@ -82,55 +82,6 @@
 specials[period][i].__class__ = ElementCell  # XXX
 special_series[sindex].append(specials[period][i])
 return elements, table, special_series, incomplete
-
-
-class WdqElementProvider(WdqBase, ElementProvider):
-"""Load elements from Wikidata Query."""
-def __iter__(self):
-wdq = self.get_wdq()
-ids = ['Q%d' % item_id for item_id in wdq['items']]
-entities = self.get_entities(ids, props='labels',
- languages=self.language, 
languagefallback=1)
-elements = defaultdict(Element)
-subclass_of = defaultdict(list)
-wdq['props'] = defaultdict(list, wdq.get('props', {}))
-for item_id, datatype, value in wdq['props'][str(Element.number_pid)]:
-if datatype != 'quantity':
-continue
-value = value.split('|')
-if len(value) == 4:
-value = list(map(float, value))
-if len(set(value[:3])) == 1 and value[3] == 1 and value[0] == 
int(value[0]):
-elements[item_id].number = int(value[0])
-for item_id, datatype, value in wdq['props'][str(Element.symbol_pid)]:
-if datatype != 'string':
-continue
-elements[item_id].symbol = value
-for item_id, datatype, value in 
wdq['props'][str(Element.subclass_pid)]:
-if datatype != 'item':
-continue
-subclass_of[item_id].append(value)
-for item_id, element in elements.items():
-element.item_id = 'Q%d' % item_id
-for prop in ('number', 'symbol'):
-if not hasattr(element, prop):
-setattr(element, prop, None)
-element.load_data_from_superclasses(subclass_of[item_id])
-label = None
-entity = entities.get(element.item_id)
-if entity and 'labels' in entity and len(entity['labels']) == 1:
-label = list(entity['labels'].values())[0]['value']
-element.label = label
-yield element
-
-@classmethod
-def get_query(cls):
-pids = [str(getattr(Element, name))
-for name in ('symbol_pid', 'subclass_pid', 'number_pid')]
-return {
-'q': 'claim[%d]' % Element.symbol_pid,
-'props': ','.join(pids)
-}
 
 
 class SparqlElementProvider(SparqlBase, ElementProvider):
diff --git a/nuclides.py b/nuclides.py
index d094b0c..76e83ae 100644
--- a/nuclides.py
+++ b/nuclides.py
@@ -22,8 +22,8 @@
 import operator
 from collections import defaultdict
 
-from base import BaseProvider, WdqBase, SparqlBase, 
PropertyAlreadySetException, TableCell
-from units import time_in_seconds_from_claim, time_in_seconds
+from base import BaseProvider, SparqlBase, PropertyAlreadySetException, 
TableCell
+from units import time_in_seconds
 
 
 class NuclideProvider(BaseProvider):
@@ -219,92 +219,6 @@
 magic_number = magic_result['magic_number']['value']
 magic_numbers.append(int(magic_number))
 return magic_numbers
-
-
-class WdqNuclideProvider(WdqBase, NuclideProvider):
-"""Load nuclides from Wikidata Query."""
-def __iter__(self):
-wdq = self.get_wdq()
-ids = ['Q%d' % item_id for item_id in wdq['items']]
-entities = self.get_entities(id

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: plugin: s/clear_entity_label/set_entity_label/

2016-10-15 Thread Dachary (Code Review)
Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316051

Change subject: plugin: s/clear_entity_label/set_entity_label/
..

plugin: s/clear_entity_label/set_entity_label/

Clearing an entity label is setting it with an empty string.

Change-Id: I36aeacb17965e2ac6b393482e13439903358a19f
Signed-off-by: Loic Dachary 
---
M FLOSSbot/plugin.py
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/51/316051/1

diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index 7c6dcc1..0be598c 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -172,15 +172,18 @@
 self.bot.site.editEntity({'new': type}, entity)
 
 def clear_entity_label(self, id):
+self.set_entity_label(id, '')
+
+def set_entity_label(self, id, label):
 data = {
 "labels": {
 "en": {
 "language": "en",
-"value": "",
+"value": label,
 }
 }
 }
-log.debug("clear " + id + " label")
+log.debug("set " + id + " label to '" + label + "'")
 self.bot.site.editEntity({'id': id}, data)
 while True:
 if id.startswith('P'):
@@ -188,7 +191,9 @@
 else:
 entity = pywikibot.ItemPage(self.bot.site, id, 0)
 entity.get(force=True)
-if entity.labels.get('en') is None:
+if label == '' and entity.labels.get('en') is None:
+break
+if label != '' and label == entity.labels.get('en'):
 break
 self.reset_cache()
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36aeacb17965e2ac6b393482e13439903358a19f
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary 

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


[MediaWiki-commits] [Gerrit] labs...ptable[master]: Drop WdqBase and subclasses

2016-10-15 Thread Ricordisamoa (Code Review)
Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316050

Change subject: Drop WdqBase and subclasses
..

Drop WdqBase and subclasses

The Wikidata Query Service is reliable and preferred to WikidataQuery.
Dropping support for the latter significantly decreases the amount of
unreachable code.

https://phabricator.wikimedia.org/T122706#2718182

Change-Id: I16584ba1304f306b54da0f9e6e21782a8f1e4a5f
---
M base.py
M chemistry.py
M nuclides.py
3 files changed, 2 insertions(+), 151 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/ptable 
refs/changes/50/316050/1

diff --git a/base.py b/base.py
index bc01b1a..6d878f7 100644
--- a/base.py
+++ b/base.py
@@ -90,20 +90,6 @@
 raise NotImplementedError()
 
 
-class WdqBase:
-"""Load items from Wikidata Query."""
-
-WDQ_API = 'http://wdq.wmflabs.org/api'
-
-@classmethod
-def get_wdq(cls):
-return get_json(cls.WDQ_API, cls.get_query())
-
-@classmethod
-def get_query(cls):
-raise NotImplementedError()
-
-
 class SparqlBase:
 """Load items from Wikidata SPARQL query service."""
 
diff --git a/chemistry.py b/chemistry.py
index 9ea7ac7..434634c 100644
--- a/chemistry.py
+++ b/chemistry.py
@@ -22,7 +22,7 @@
 from collections import defaultdict
 
 import data
-from base import BaseProvider, PropertyAlreadySetException, SparqlBase, 
TableCell, WdqBase, get_json
+from base import BaseProvider, PropertyAlreadySetException, SparqlBase, 
TableCell, get_json
 
 
 class ElementProvider(BaseProvider):
@@ -82,55 +82,6 @@
 specials[period][i].__class__ = ElementCell  # XXX
 special_series[sindex].append(specials[period][i])
 return elements, table, special_series, incomplete
-
-
-class WdqElementProvider(WdqBase, ElementProvider):
-"""Load elements from Wikidata Query."""
-def __iter__(self):
-wdq = self.get_wdq()
-ids = ['Q%d' % item_id for item_id in wdq['items']]
-entities = self.get_entities(ids, props='labels',
- languages=self.language, 
languagefallback=1)
-elements = defaultdict(Element)
-subclass_of = defaultdict(list)
-wdq['props'] = defaultdict(list, wdq.get('props', {}))
-for item_id, datatype, value in wdq['props'][str(Element.number_pid)]:
-if datatype != 'quantity':
-continue
-value = value.split('|')
-if len(value) == 4:
-value = list(map(float, value))
-if len(set(value[:3])) == 1 and value[3] == 1 and value[0] == 
int(value[0]):
-elements[item_id].number = int(value[0])
-for item_id, datatype, value in wdq['props'][str(Element.symbol_pid)]:
-if datatype != 'string':
-continue
-elements[item_id].symbol = value
-for item_id, datatype, value in 
wdq['props'][str(Element.subclass_pid)]:
-if datatype != 'item':
-continue
-subclass_of[item_id].append(value)
-for item_id, element in elements.items():
-element.item_id = 'Q%d' % item_id
-for prop in ('number', 'symbol'):
-if not hasattr(element, prop):
-setattr(element, prop, None)
-element.load_data_from_superclasses(subclass_of[item_id])
-label = None
-entity = entities.get(element.item_id)
-if entity and 'labels' in entity and len(entity['labels']) == 1:
-label = list(entity['labels'].values())[0]['value']
-element.label = label
-yield element
-
-@classmethod
-def get_query(cls):
-pids = [str(getattr(Element, name))
-for name in ('symbol_pid', 'subclass_pid', 'number_pid')]
-return {
-'q': 'claim[%d]' % Element.symbol_pid,
-'props': ','.join(pids)
-}
 
 
 class SparqlElementProvider(SparqlBase, ElementProvider):
diff --git a/nuclides.py b/nuclides.py
index d094b0c..bdc5fc6 100644
--- a/nuclides.py
+++ b/nuclides.py
@@ -22,7 +22,7 @@
 import operator
 from collections import defaultdict
 
-from base import BaseProvider, WdqBase, SparqlBase, 
PropertyAlreadySetException, TableCell
+from base import BaseProvider, SparqlBase, PropertyAlreadySetException, 
TableCell
 from units import time_in_seconds_from_claim, time_in_seconds
 
 
@@ -219,92 +219,6 @@
 magic_number = magic_result['magic_number']['value']
 magic_numbers.append(int(magic_number))
 return magic_numbers
-
-
-class WdqNuclideProvider(WdqBase, NuclideProvider):
-"""Load nuclides from Wikidata Query."""
-def __iter__(self):
-wdq = self.get_wdq()
-ids = ['Q%d' % item_id for item_id in wdq['items']]
-entities = self.get_entities(ids, props='labels|claims',
-  

[MediaWiki-commits] [Gerrit] labs...ptable[master]: Drop explicit SPARQL prefixes from queries

2016-10-15 Thread Ricordisamoa (Code Review)
Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316049

Change subject: Drop explicit SPARQL prefixes from queries
..

Drop explicit SPARQL prefixes from queries

Most prefixes that are used in common queries are supported by the
engine without the need to explicitly specify them.

Change-Id: I9e6566fb223dd6feaab7da654b0e032b5fd48e64
---
M nuclides.py
1 file changed, 5 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/ptable 
refs/changes/49/316049/1

diff --git a/nuclides.py b/nuclides.py
index d094b0c..c270e7f 100644
--- a/nuclides.py
+++ b/nuclides.py
@@ -117,10 +117,7 @@
 """Load nuclide info from Wikidata Sparql endpoint."""
 def __iter__(self):
 nuclides = defaultdict(Nuclide)
-nuclides_query = "PREFIX wdt:  \
-PREFIX rdfs:  \
-PREFIX wd:  \
-SELECT ?nuclide ?atomic_number ?neutron_number ?label WHERE {{ \
+nuclides_query = "SELECT ?nuclide ?atomic_number ?neutron_number 
?label WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  wdt:P{3} ?atomic_number ; \
  wdt:P{4} ?neutron_number ; \
@@ -142,9 +139,7 @@
 nuclides[nuclide_uri].half_life = None
 nuclides[nuclide_uri].item_id = nuclide_uri.split('/')[-1]
 
-stable_query = "PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?nuclide WHERE {{ \
+stable_query = "SELECT ?nuclide WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  wdt:P{0} wd:Q{3} . \
 }}".format(Nuclide.instance_pid, Nuclide.subclass_pid, Nuclide.isotope_qid,
@@ -155,12 +150,7 @@
 if nuclide_uri in nuclides:
 nuclides[nuclide_uri].classes.append('stable')
 
-hl_query = "PREFIX wdt:  \
-PREFIX wd:  \
-PREFIX wikibase:  \
-PREFIX psv:  \
-PREFIX p:  \
-SELECT ?nuclide ?half_life ?half_life_unit WHERE {{ \
+hl_query = "SELECT ?nuclide ?half_life ?half_life_unit WHERE {{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  p:P{3} ?hl_statement . \
 ?hl_statement psv:P{3} ?hl_value . \
@@ -181,12 +171,7 @@
 nuclide_result['half_life_unit']['value'])
 # else - sparql returned more than 1 half-life value - problem?
 
-decay_query = "PREFIX ps:  \
-PREFIX pq:  \
-PREFIX p:  \
-PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?nuclide ?decay_to ?decay_mode ?fraction WHERE {{ \
+decay_query = "SELECT ?nuclide ?decay_to ?decay_mode ?fraction WHERE 
{{ \
 ?nuclide wdt:P{0}/wdt:P{1}* wd:Q{2} ; \
  p:P{3} ?decay_statement . \
 ?decay_statement ps:P{3} ?decay_to ; \
@@ -206,9 +191,7 @@
 yield nuclide
 
 def get_magic_numbers(self):
-magic_query = "PREFIX wdt:  \
-PREFIX wd:  \
-SELECT ?magic_number WHERE {{ \
+magic_query = "SELECT ?magic_number WHERE {{ \
 ?number wdt:P{0} wd:Q{1} ; \
 wdt:P{2} ?magic_number . \
 }} ORDER by ?magic_number".format(Nuclide.instance_pid, Nuclide.magic_qid,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e6566fb223dd6feaab7da654b0e032b5fd48e64
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/ptable
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa 

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


[MediaWiki-commits] [Gerrit] mediawiki...deploy[master]: Send celery logs to /srv/logs/ores/app.log

2016-10-15 Thread Ladsgroup (Code Review)
Ladsgroup has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316048

Change subject: Send celery logs to /srv/logs/ores/app.log
..

Send celery logs to /srv/logs/ores/app.log

Bug: T147898
Change-Id: Iaf7d1335c5ad983355f75e02570c4cab7532a8cb
---
M config/00-main.yaml
M logging_config.yaml
2 files changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/ores/deploy 
refs/changes/48/316048/1

diff --git a/config/00-main.yaml b/config/00-main.yaml
index 48454b4..cc1c316 100644
--- a/config/00-main.yaml
+++ b/config/00-main.yaml
@@ -75,7 +75,7 @@
 CELERYD_MAX_TASKS_PER_CHILD: 100
 timeout: 15 # seconds
 queue_maxsize: 100 # pending tasks
-
+CELERYD_HIJACK_ROOT_LOGGER: FALSE
 
 # Scorers
 scoring_contexts:
diff --git a/logging_config.yaml b/logging_config.yaml
index 9fdac18..f38b247 100644
--- a/logging_config.yaml
+++ b/logging_config.yaml
@@ -3,19 +3,24 @@
 loggers:
   revscoring:
 level: ERROR
-handlers: [stdout]
+handlers: [file]
   ores:
 level: ERROR
-handlers: [stdout]
+handlers: [file]
   celery:
 level: ERROR
-handlers: [stdout]
+handlers: [file]
 
 handlers:
   stdout:
 class: logging.StreamHandler
 formatter: basic_human
 stream: ext://sys.stdout
+  file:
+class: logging.handlers.TimedRotatingFileHandler
+filename: /srv/logs/ores/app.log
+when: midnight
+backupCount: 7
 
 formatters:
   basic_human: 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf7d1335c5ad983355f75e02570c4cab7532a8cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/ores/deploy
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Improve Special:BookSources validation and error messages

2016-10-15 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316047

Change subject: Improve Special:BookSources validation and error messages
..

Improve Special:BookSources validation and error messages

Visiting Special:BookSources/invalid would not show any error message
because "invalid" would get stripped away by cleanIsbn(), and then
appear as the empty string.

Instead, first validate the provided ISBN (if any), and display the
error message if invalid. Then show the form and book details.

Tests included.

Also remove an unused variable.

Change-Id: I40b703eace956ebbcdc0a2c2986b2c10474dd1fd
---
M includes/specials/SpecialBooksources.php
M tests/phpunit/includes/specials/SpecialBooksourcesTest.php
2 files changed, 37 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/316047/1

diff --git a/includes/specials/SpecialBooksources.php 
b/includes/specials/SpecialBooksources.php
index 11faa28..2fef725 100644
--- a/includes/specials/SpecialBooksources.php
+++ b/includes/specials/SpecialBooksources.php
@@ -29,11 +29,6 @@
  * @ingroup SpecialPage
  */
 class SpecialBookSources extends SpecialPage {
-   /**
-* ISBN passed to the page, if any
-*/
-   protected $isbn = '';
-
public function __construct() {
parent::__construct( 'Booksources' );
}
@@ -49,19 +44,21 @@
$this->setHeaders();
$this->outputHeader();
 
-   $this->isbn = self::cleanIsbn( $isbn ?: 
$this->getRequest()->getText( 'isbn' ) );
+   // User provided ISBN
+   $isbn = $isbn ?: $this->getRequest()->getText( 'isbn' );
+   $isbn = trim( $isbn );
 
-   $this->buildForm();
+   $this->buildForm( $isbn );
 
-   if ( $this->isbn !== '' ) {
-   if ( !self::isValidISBN( $this->isbn ) ) {
+   if ( $isbn !== '' ) {
+   if ( !self::isValidISBN( $isbn ) ) {
$out->wrapWikiMsg(
"\n$1\n",
'booksources-invalid-isbn'
);
}
 
-   $this->showList();
+   $this->showList( $isbn );
}
}
 
@@ -121,20 +118,22 @@
 
/**
 * Generate a form to allow users to enter an ISBN
+*
+* @param string $isbn
 */
-   private function buildForm() {
+   private function buildForm( $isbn ) {
$formDescriptor = [
'isbn' => [
'type' => 'text',
'name' => 'isbn',
'label-message' => 'booksources-isbn',
-   'default' => $this->isbn,
+   'default' => $isbn,
'autofocus' => true,
'required' => true,
],
];
 
-   $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, 
$this->getContext() )
+   HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() 
)
->setWrapperLegendMsg( 'booksources-search-legend' )
->setSubmitTextMsg( 'booksources-search' )
->setMethod( 'get' )
@@ -146,17 +145,19 @@
 * Determine where to get the list of book sources from,
 * format and output them
 *
+* @param string $isbn
 * @throws MWException
 * @return bool
 */
-   private function showList() {
+   private function showList( $isbn ) {
$out = $this->getOutput();
 
global $wgContLang;
 
+   $isbn = self::cleanIsbn( $isbn );
# Hook to allow extensions to insert additional HTML,
# e.g. for API-interacting plugins and so on
-   Hooks::run( 'BookInformation', [ $this->isbn, $out ] );
+   Hooks::run( 'BookInformation', [ $isbn, $out ] );
 
# Check for a local page such as Project:Book_sources and use 
that if available
$page = $this->msg( 'booksources' 
)->inContentLanguage()->text();
@@ -169,7 +170,7 @@
// XXX: in the future, this could be stored as 
structured data, defining a list of book sources
 
$text = $content->getNativeData();
-   $out->addWikiText( str_replace( 'MAGICNUMBER', 
$this->isbn, $text ) );
+   $out->addWikiText( str_replace( 'MAGICNUMBER', 
$isbn, $text ) );
 
return true;
} else {
@@ -182,7 +183,7 @@
$o