[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Parser test file editor

2016-09-26 Thread Tim Starling (Code Review)
Tim Starling has uploaded a new change for review.

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

Change subject: Parser test file editor
..

Parser test file editor

* Add editTests.php, which provides an interactive interface to the
  parser tests, with semi-automated editing.
* If a test has only a tidy version and no non-tidy version, do actually
  run the test, don't just silently skip it.

Change-Id: I1a20d007ba4627d562a16c03849bbad7aec0e516
---
M maintenance/Maintenance.php
M tests/common/TestsAutoLoader.php
A tests/parser/TestFileEditor.php
M tests/parser/TestFileReader.php
M tests/parser/TestRecorder.php
A tests/parser/editTests.php
6 files changed, 723 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/312969/1

diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index e1a4dc6..f0bea76 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -1501,6 +1501,36 @@
}
 
/**
+* Get the terminal size as a two-element array where the first element
+* is the width (number of columns) and the second element is the height
+* (number of rows).
+*
+* @return array
+*/
+   public static function getTermSize() {
+   $default = [ 80, 50 ];
+   if ( wfIsWindows() ) {
+   return $default;
+   }
+   // It's possible to get the screen size with VT-100 terminal 
escapes,
+   // but reading the responses is not possible without setting 
raw mode
+   // (unless you want to require the user to press enter), and 
that
+   // requires an ioctl(), which we can't do. So we have to shell 
out to
+   // something that can do the relevant syscalls. There are a few
+   // options. Linux and Mac OS X both have "stty size" which does 
the
+   // job directly.
+   $retval = false;
+   $size = wfShellExec( 'stty size', $retval );
+   if ( $retval !== 0 ) {
+   return $default;
+   }
+   if ( !preg_match( '/^(\d+) (\d+)$/', $size, $m ) ) {
+   return $default;
+   }
+   return [ intval( $m[2] ), intval( $m[1] ) ];
+   }
+
+   /**
 * Call this to set up the autoloader to allow classes to be used from 
the
 * tests directory.
 */
diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php
index a19fea1..0bfa318 100644
--- a/tests/common/TestsAutoLoader.php
+++ b/tests/common/TestsAutoLoader.php
@@ -41,6 +41,7 @@
'ParserTestResult' => "$testDir/parser/ParserTestResult.php",
'ParserTestResultNormalizer' => 
"$testDir/parser/ParserTestResultNormalizer.php",
'PhpunitTestRecorder' => "$testDir/parser/PhpunitTestRecorder.php",
+   'TestFileEditor' => "$testDir/parser/TestFileEditor.php",
'TestFileReader' => "$testDir/parser/TestFileReader.php",
'TestRecorder' => "$testDir/parser/TestRecorder.php",
'TidySupport' => "$testDir/parser/TidySupport.php",
diff --git a/tests/parser/TestFileEditor.php b/tests/parser/TestFileEditor.php
new file mode 100644
index 000..05b1216
--- /dev/null
+++ b/tests/parser/TestFileEditor.php
@@ -0,0 +1,196 @@
+execute();
+   return $editor->result;
+   }
+
+   private function __construct( $text, array $deletions, array $changes, 
$warningCallback ) {
+   $this->lines = explode( "\n", $text );
+   $this->numLines = count( $this->lines );
+   $this->deletions = array_flip( $deletions );
+   $this->changes = $changes;
+   $this->pos = 0;
+   $this->warningCallback = $warningCallback;
+   $this->result = '';
+   }
+
+   private function execute() {
+   while ( $this->pos < $this->numLines ) {
+   $line = $this->lines[$this->pos];
+   switch ( $this->getHeading( $line ) ) {
+   case 'test':
+   $this->parseTest();
+   break;
+   case 'hooks':
+   case 'functionhooks':
+   case 'transparenthooks':
+   $this->parseHooks();
+   break;
+   default:
+   if ( $this->pos < $this->numLines - 1 ) 
{
+   $line .= "\n";
+   }
+   $this->emitComment( $line );
+   $this->pos++;
+   }
+   

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Shorten clickable link text in HTML credit lines

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

Change subject: Shorten clickable link text in HTML credit lines
..


Shorten clickable link text in HTML credit lines

Previously, the clickable text in the generated HTML credit lines
was the entire link to the article. This is shortened to a localized
version of "Link".

Bug: T119686
Change-Id: I708f65a85bfa26c264cdd06a265096027266240c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/mmv/mmv.EmbedFileFormatter.js
M tests/qunit/mmv/mmv.EmbedFileFormatter.test.js
5 files changed, 9 insertions(+), 6 deletions(-)

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



diff --git a/extension.json b/extension.json
index f4b1b20..0beefd2 100644
--- a/extension.json
+++ b/extension.json
@@ -232,7 +232,8 @@
"multimediaviewer-text-embed-credit-text-l",
"multimediaviewer-html-embed-credit-text-bl",
"multimediaviewer-html-embed-credit-text-b",
-   "multimediaviewer-html-embed-credit-text-l"
+   "multimediaviewer-html-embed-credit-text-l",
+   "multimediaviewer-html-embed-credit-link-text"
]
},
"mmv.ui.download.pane": {
diff --git a/i18n/en.json b/i18n/en.json
index 17fc6f2..e7d7ac5 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -96,6 +96,7 @@
"multimediaviewer-html-embed-credit-text-bl": "By $1, $2, $3",
"multimediaviewer-html-embed-credit-text-b": "By $1, $2",
"multimediaviewer-html-embed-credit-text-l": "$1, $2",
+   "multimediaviewer-html-embed-credit-link-text": "Link",
"multimediaviewer-embed-byline": "By $1",
"multimediaviewer-embed-license": "Licensed under $1.",
"multimediaviewer-embed-license-nonfree": "$1.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index dda5c8e..bc0d0d3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -105,6 +105,7 @@
"multimediaviewer-html-embed-credit-text-bl": "Credit text, used when 
generating HTML to reuse an image - used as a caption, not in the middle of a 
sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* 
messages is used will depend on what information about the image is 
available.\n\nParameters:\n* $1 - name of the author\n* $2 - copyright tag 
(usually a license)\n* $3 - URL to the image source\nEach of the parameters 
could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-html-embed-credit-text-b": "Credit text, used when 
generating HTML to reuse an image - used as a caption, not in the middle of a 
sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* 
messages is used will depend on what information about the image is 
available.\n\nParameters:\n* $1 - name of the author\n* $2 - URL to the image 
source\nEach of the parameters could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-html-embed-credit-text-l": "{{optional}}\nCredit 
text, used when generating HTML to reuse an image - used as a caption, not in 
the middle of a sentence.\n\nWhich one of the 
multimediaviewer-html-embed-credit-text-* messages is used will depend on what 
information about the image is available.\n\nParameters:\n* $1 - copyright tag 
(usually a license)\n* $2 - URL to the image source\nEach of the parameters 
could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
+   "multimediaviewer-html-embed-credit-link-text": "The clickable text of 
a link in a credit line, used when generating HTML to reuse an 
image.\n{{Related|Multimediaviewer-embed-credit-text}}",
"multimediaviewer-embed-byline": "Byline (author credit) text, used 
when generating wikitext/HTML to reuse the image. $1 is author 
name.\n{{Identical|By}}",
"multimediaviewer-embed-license": "License information, used when 
generating wikitext/HTML to reuse the image. $1 is the license name.",
"multimediaviewer-embed-license-nonfree": "Like 
{{msg-mw|multimediaviewer-embed-license}}, but for non-free images (where $1 is 
typically not a license name but something like \"Fair use\").",
diff --git a/resources/mmv/mmv.EmbedFileFormatter.js 
b/resources/mmv/mmv.EmbedFileFormatter.js
index 0756238..e0cdc06 100644
--- a/resources/mmv/mmv.EmbedFileFormatter.js
+++ b/resources/mmv/mmv.EmbedFileFormatter.js
@@ -163,7 +163,7 @@
EFFP.getCreditHtml = function ( info ) {
var creditText, creditParams,
shortURL = info.imageInfo.descriptionShortUrl,
-   shortLink = this.htmlUtils.makeLinkText( shortURL, { 
href: shortURL } ),
+   shortLink = this.htmlUtils.makeLinkText( mw.message( 

[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Upgrade stylelint

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

Change subject: Upgrade stylelint
..


Upgrade stylelint

The old version is throwing errors.

Change-Id: Ibd708045ab7c9f09f664f1b1099bb4d490ab0151
---
M package.json
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/package.json b/package.json
index 237f80c..fd369c2 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
 "grunt-contrib-jshint": "1.0.0",
 "grunt-jscs": "2.8.0",
 "grunt-jsonlint": "1.0.8",
-"grunt-stylelint": "0.4.0",
-"stylelint-config-wikimedia": "0.2.2"
+"grunt-stylelint": "^0.6.0",
+"stylelint-config-wikimedia": "^0.3.0"
   }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd708045ab7c9f09f664f1b1099bb4d490ab0151
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: Gergő Tisza 
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]: Clean up array() syntax in docs, part VII

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

Change subject: Clean up array() syntax in docs, part VII
..


Clean up array() syntax in docs, part VII

Last part

Change-Id: I38f015e2122ef4fd2d2141718bd889794c29f06c
---
M includes/Html.php
M includes/OutputPage.php
M includes/TemplateParser.php
M includes/htmlform/OOUIHTMLForm.php
M includes/media/MediaHandler.php
M includes/media/TransformationalImageHandler.php
M languages/Language.php
M languages/LanguageConverter.php
M languages/classes/LanguageKm.php
M languages/classes/LanguageMy.php
M languages/messages/MessagesEn.php
M maintenance/language/checkDupeMessages.php
M maintenance/language/digit2html.php
M maintenance/preprocessorFuzzTest.php
M maintenance/storage/compressOld.php
M tests/phpunit/includes/api/RandomImageGenerator.php
16 files changed, 58 insertions(+), 58 deletions(-)

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



diff --git a/includes/Html.php b/includes/Html.php
index 2ef891d..48b30c7 100644
--- a/includes/Html.php
+++ b/includes/Html.php
@@ -155,8 +155,8 @@
 *
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
-* @param array $attrs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attrs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string[] $modifiers classes to add to the button
 * @see http://tools.wmflabs.org/styleguide/desktop/index.html for 
guidance on available modifiers
@@ -175,8 +175,8 @@
 *
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
-* @param array $attrs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attrs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string[] $modifiers classes to add to the button
 * @see http://tools.wmflabs.org/styleguide/desktop/index.html for 
guidance on available modifiers
@@ -199,8 +199,8 @@
 * content model.
 *
 * @param string $element The element's name, e.g., 'a'
-* @param array $attribs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attribs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
@@ -320,8 +320,8 @@
 * to the input array (currently per the HTML 5 draft as of 2009-09-06).
 *
 * @param string $element Name of the element, e.g., 'a'
-* @param array $attribs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ).  See expandAttributes() 
for
+* @param array $attribs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ].  See expandAttributes() 
for
 *   further documentation.
 * @return array An array of attributes functionally identical to 
$attribs
 */
@@ -430,8 +430,8 @@
 
/**
 * Given an associative array of element attributes, generate a string
-* to stick after the element name in HTML output.  Like array( 'href' 
=>
-* 'http://www.mediawiki.org/' ) becomes something like
+* to stick after the element name in HTML output.  Like [ 'href' =>
+* 'http://www.mediawiki.org/' ] becomes something like
 * ' href="http://www.mediawiki.org;'.  Again, this is like
 * Xml::expandAttributes(), but it implements some HTML-specific logic.
 *
@@ -443,25 +443,25 @@
 *
 * @par Numerical array
 * @code
-* Html::element( 'em', array(
-* 'class' => array( 'foo', 'bar' )
-* ) );
+* Html::element( 'em', [
+* 'class' => [ 'foo', 'bar' ]
+* ] );
 * // gives ''
 * @endcode
 *
 * @par Associative array
 * @code
-* Html::element( 'em', array(
-* 'class' => array( 'foo', 'bar', 'foo' => false, 'quux' => 
true )
-* ) );
+* Html::element( 'em', [
+* 'class' => [ 'foo', 'bar', 'foo' => false, 'quux' => true ]
+* ] );
 * // gives ''
 * @endcode
 *
-* @param array $attribs 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace DatabaseBase:: with Database:: and update type hints

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

Change subject: Replace DatabaseBase:: with Database:: and update type hints
..


Replace DatabaseBase:: with Database:: and update type hints

Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
---
M includes/MergeHistory.php
M includes/WatchedItemQueryService.php
M includes/WatchedItemStore.php
M includes/cache/LinkBatch.php
M includes/changes/ChangesFeed.php
M includes/changetags/ChangeTags.php
M includes/dao/DBAccessBase.php
M includes/db/DatabaseMssql.php
M includes/filerepo/ForeignDBRepo.php
M includes/filerepo/file/LocalFile.php
M includes/installer/DatabaseUpdater.php
M includes/installer/MssqlInstaller.php
M includes/installer/MysqlInstaller.php
M includes/installer/PostgresInstaller.php
M includes/installer/SqliteInstaller.php
M includes/libs/lockmanager/DBLockManager.php
M includes/libs/rdbms/TransactionProfiler.php
M includes/libs/rdbms/database/Database.php
M includes/libs/rdbms/database/DatabaseSqlite.php
M includes/libs/rdbms/database/IDatabase.php
M includes/libs/rdbms/encasing/LikeMatch.php
M includes/libs/rdbms/exception/DBQueryError.php
M includes/libs/rdbms/loadbalancer/LoadBalancer.php
M includes/objectcache/SqlBagOStuff.php
M includes/page/WikiPage.php
M includes/user/User.php
M tests/parser/ParserTestRunner.php
M tests/phpunit/MediaWikiTestCase.php
M tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
M tests/phpunit/includes/db/DatabaseMysqlBaseTest.php
M tests/phpunit/includes/db/DatabaseSQLTest.php
M tests/phpunit/includes/db/DatabaseSqliteTest.php
M tests/phpunit/includes/db/DatabaseTest.php
M tests/phpunit/includes/db/DatabaseTestHelper.php
M tests/phpunit/includes/db/LBFactoryTest.php
M tests/phpunit/includes/installer/DatabaseUpdaterTest.php
M tests/phpunit/includes/utils/BatchRowUpdateTest.php
37 files changed, 139 insertions(+), 141 deletions(-)

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



diff --git a/includes/MergeHistory.php b/includes/MergeHistory.php
index dd1fd37..f797fe3 100644
--- a/includes/MergeHistory.php
+++ b/includes/MergeHistory.php
@@ -42,7 +42,7 @@
/** @var Title Page to which history will be merged */
protected $dest;
 
-   /** @var DatabaseBase Database that we are using */
+   /** @var IDatabase Database that we are using */
protected $dbw;
 
/** @var MWTimestamp Maximum timestamp that we can use (oldest 
timestamp of dest) */
diff --git a/includes/WatchedItemQueryService.php 
b/includes/WatchedItemQueryService.php
index 4ac4dea..c040fb1 100644
--- a/includes/WatchedItemQueryService.php
+++ b/includes/WatchedItemQueryService.php
@@ -63,10 +63,10 @@
}
 
/**
-* @param DatabaseBase $connection
+* @param Database $connection
 * @throws MWException
 */
-   private function reuseConnection( DatabaseBase $connection ) {
+   private function reuseConnection( Database $connection ) {
$this->loadBalancer->reuseConnection( $connection );
}
 
@@ -337,7 +337,7 @@
}
 
private function getWatchedItemsWithRCInfoQueryConds(
-   DatabaseBase $db,
+   Database $db,
User $user,
array $options
) {
@@ -445,7 +445,7 @@
return $conds;
}
 
-   private function getStartEndConds( DatabaseBase $db, array $options ) {
+   private function getStartEndConds( Database $db, array $options ) {
if ( !isset( $options['start'] ) && ! isset( $options['end'] ) 
) {
return [];
}
@@ -464,7 +464,7 @@
return $conds;
}
 
-   private function getUserRelatedConds( DatabaseBase $db, User $user, 
array $options ) {
+   private function getUserRelatedConds( Database $db, User $user, array 
$options ) {
if ( !array_key_exists( 'onlyByUser', $options ) && 
!array_key_exists( 'notByUser', $options ) ) {
return [];
}
@@ -491,7 +491,7 @@
return $conds;
}
 
-   private function getExtraDeletedPageLogEntryRelatedCond( DatabaseBase 
$db, User $user ) {
+   private function getExtraDeletedPageLogEntryRelatedCond( Database $db, 
User $user ) {
// LogPage::DELETED_ACTION hides the affected page, too. So 
hide those
// entirely from the watchlist, or someone could guess the 
title.
$bitmask = 0;
@@ -509,7 +509,7 @@
return '';
}
 
-   private function getStartFromConds( DatabaseBase $db, array $options ) {
+   private function getStartFromConds( Database $db, array $options ) {
$op = $options['dir'] === self::DIR_OLDER ? '<' : '>';
list( $rcTimestamp, $rcId ) = $options['startFrom'];
$rcTimestamp = $db->addQuotes( 

[MediaWiki-commits] [Gerrit] mediawiki...MediaWikiFarm[master]: Add standalone PHPUnit and make some tests more robust

2016-09-26 Thread Seb35 (Code Review)
Seb35 has submitted this change and it was merged.

Change subject: Add standalone PHPUnit and make some tests more robust
..


Add standalone PHPUnit and make some tests more robust

Code:
* Replaced the previous parameter $entryPoint in constructor
  by an array $parameters with EntryPoint (string) and
  ExtensionRegistry (bool) keys; the second allow to test
  a specific environment
* By default, the parameter ExtensionRegistry is computed
  just before its use, i.e. in the heuristic about the
  extension loading mechanism

Tests:
* Add some tests with a fixed ExtensionRegistry parameter to
  avoid relying on the underlying MediaWiki
* Changed the default environment from the underlying MediaWiki
  to a mocked MediaWiki installation

Testing:
* PHPUnit can still be called as a standard MediaWiki script
  `mwscript --wiki mywiki.org tests/phpunit/phpunit.php` and
  can also be called with a standalone PHPUnit; in this case
  it is easier to call `composer phpunit` or `composer unit`
  because a light change must be done on the testing code,
  automatically done with the Composer command
  NB: there is a bit less tests with standalone PHPUnit because
  some tests are automatically added in MW framework and the
  ExtensionRegistry class is missing
* Tested with processIsolation; adapted a bit to get successes
  in MultiversionInstallationTest
* Tested with PHP 7.1RC1 (cli and phpdbg) 7.0.10 (cli+Xdebug
  and phpdbg), and PHP 5.6 (cli): 100% line code coverage in
  PHP 7 but two lines wrongly missing in PHP 5.6.
* Approximative duration:
  * Standalone PHPUnit: 200ms for tests alone with PHP 7,
1.7s with code coverage
  * MediaWiki PHPUnit: 11s with PHP 7, 15s with code coverage,
30s with PHP 5.6

Change-Id: I55a468292bb37b4fc89934f1b6f32e4139581f7e
---
M .gitignore
M composer.json
A phpunit.xml
M src/MediaWikiFarm.php
M src/MediaWikiFarmScript.php
M tests/perfs/MediaWikiFarmTestPerfs.php
M tests/phpunit/ConfigurationTest.php
M tests/phpunit/ConstructionTest.php
M tests/phpunit/FunctionsTest.php
M tests/phpunit/InstallationIndependantTest.php
M tests/phpunit/LoadingTest.php
M tests/phpunit/MediaWikiFarmScriptTest.php
M tests/phpunit/MediaWikiFarmTestCase.php
M tests/phpunit/MonoversionInstallationTest.php
M tests/phpunit/MultiversionInstallationTest.php
A tests/phpunit/data/config/varwikiversions.php
A tests/phpunit/data/config/versions.php
A tests/phpunit/data/mediawiki/vstub/maintenance/showJobs.php
A tests/phpunit/data/mediawiki/vstub2/maintenance/showJobs.php
19 files changed, 451 insertions(+), 171 deletions(-)

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



diff --git a/.gitignore b/.gitignore
index fa4674d..9a307b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,11 +12,10 @@
 /vendor
 
 # Tests
-/tests/phpunit/data/config/versions.php
-/tests/phpunit/data/config/varwikiversions.php
 /tests/phpunit/data/config/deployments.php
 /tests/phpunit/data/config/testdeploymentsfarmversions.php
 /tests/perfs/results
 
 # Compiled code documentation
 /docs/code
+/docs/coverage
diff --git a/composer.json b/composer.json
index 7eb1384..00903f4 100644
--- a/composer.json
+++ b/composer.json
@@ -26,8 +26,20 @@
"lint": "parallel-lint --exclude vendor .",
"phpcs": "phpcs -p -s",
"phpdoc": "phpdoc -d bin,src -t ./docs/code",
+   "phpunit": [
+   "sed -i 's/extends MediaWikiTestCase/extends 
PHPUnit_Framework_TestCase/' tests/phpunit/MediaWikiFarmTestCase.php",
+   "phpdbg -qrr `which phpunit` --strict-coverage",
+   "sed -i 's/extends PHPUnit_Framework_TestCase/extends 
MediaWikiTestCase/' tests/phpunit/MediaWikiFarmTestCase.php"
+   ],
+   "unit": [
+   "sed -i 's/extends MediaWikiTestCase/extends 
PHPUnit_Framework_TestCase/' tests/phpunit/MediaWikiFarmTestCase.php",
+   "phpunit --no-coverage",
+   "sed -i 's/extends PHPUnit_Framework_TestCase/extends 
MediaWikiTestCase/' tests/phpunit/MediaWikiFarmTestCase.php"
+   ],
"test": [
"composer lint",
+   "composer unit",
+   "composer phpunit",
"composer phpcs",
"composer phpdoc"
]
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 000..aeeb9e1
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,35 @@
+http://www.w3.org/2001/XMLSchema-instance;
+ 
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd;
+ backupGlobals="false"
+ backupStaticAttributes="false"
+ cacheTokens="false"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ forceCoversAnnotation="true"
+ 

[MediaWiki-commits] [Gerrit] mediawiki...MediaWikiFarm[master]: Add standalone PHPUnit and make some tests more robust

2016-09-26 Thread Seb35 (Code Review)
Seb35 has uploaded a new change for review.

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

Change subject: Add standalone PHPUnit and make some tests more robust
..

Add standalone PHPUnit and make some tests more robust

Code:
* Replaced the previous parameter $entryPoint in constructor
  by an array $parameters with EntryPoint (string) and
  ExtensionRegistry (bool) keys; the second allow to test
  a specific environment
* By default, the parameter ExtensionRegistry is computed
  just before its use, i.e. in the heuristic about the
  extension loading mechanism

Tests:
* Add some tests with a fixed ExtensionRegistry parameter to
  avoid relying on the underlying MediaWiki
* Changed the default environment from the underlying MediaWiki
  to a mocked MediaWiki installation

Testing:
* PHPUnit can still be called as a standard MediaWiki script
  `mwscript --wiki mywiki.org tests/phpunit/phpunit.php` and
  can also be called with a standalone PHPUnit; in this case
  it is easier to call `composer phpunit` or `composer unit`
  because a light change must be done on the testing code,
  automatically done with the Composer command
  NB: there is a bit less tests with standalone PHPUnit because
  some tests are automatically added in MW framework and the
  ExtensionRegistry class is missing
* Tested with processIsolation; adapted a bit to get successes
  in MultiversionInstallationTest
* Tested with PHP 7.1RC1 (cli and phpdbg) 7.0.10 (cli+Xdebug
  and phpdbg), and PHP 5.6 (cli): 100% line code coverage in
  PHP 7 but two lines wrongly missing in PHP 5.6.
* Approximative duration:
  * Standalone PHPUnit: 200ms for tests alone with PHP 7,
1.7s with code coverage
  * MediaWiki PHPUnit: 11s with PHP 7, 15s with code coverage,
30s with PHP 5.6

Change-Id: I55a468292bb37b4fc89934f1b6f32e4139581f7e
---
M .gitignore
M composer.json
A phpunit.xml
M src/MediaWikiFarm.php
M src/MediaWikiFarmScript.php
M tests/perfs/MediaWikiFarmTestPerfs.php
M tests/phpunit/ConfigurationTest.php
M tests/phpunit/ConstructionTest.php
M tests/phpunit/FunctionsTest.php
M tests/phpunit/InstallationIndependantTest.php
M tests/phpunit/LoadingTest.php
M tests/phpunit/MediaWikiFarmScriptTest.php
M tests/phpunit/MediaWikiFarmTestCase.php
M tests/phpunit/MonoversionInstallationTest.php
M tests/phpunit/MultiversionInstallationTest.php
A tests/phpunit/data/config/varwikiversions.php
A tests/phpunit/data/config/versions.php
A tests/phpunit/data/mediawiki/vstub/maintenance/showJobs.php
A tests/phpunit/data/mediawiki/vstub2/maintenance/showJobs.php
19 files changed, 451 insertions(+), 171 deletions(-)


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

diff --git a/.gitignore b/.gitignore
index fa4674d..9a307b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,11 +12,10 @@
 /vendor
 
 # Tests
-/tests/phpunit/data/config/versions.php
-/tests/phpunit/data/config/varwikiversions.php
 /tests/phpunit/data/config/deployments.php
 /tests/phpunit/data/config/testdeploymentsfarmversions.php
 /tests/perfs/results
 
 # Compiled code documentation
 /docs/code
+/docs/coverage
diff --git a/composer.json b/composer.json
index 7eb1384..00903f4 100644
--- a/composer.json
+++ b/composer.json
@@ -26,8 +26,20 @@
"lint": "parallel-lint --exclude vendor .",
"phpcs": "phpcs -p -s",
"phpdoc": "phpdoc -d bin,src -t ./docs/code",
+   "phpunit": [
+   "sed -i 's/extends MediaWikiTestCase/extends 
PHPUnit_Framework_TestCase/' tests/phpunit/MediaWikiFarmTestCase.php",
+   "phpdbg -qrr `which phpunit` --strict-coverage",
+   "sed -i 's/extends PHPUnit_Framework_TestCase/extends 
MediaWikiTestCase/' tests/phpunit/MediaWikiFarmTestCase.php"
+   ],
+   "unit": [
+   "sed -i 's/extends MediaWikiTestCase/extends 
PHPUnit_Framework_TestCase/' tests/phpunit/MediaWikiFarmTestCase.php",
+   "phpunit --no-coverage",
+   "sed -i 's/extends PHPUnit_Framework_TestCase/extends 
MediaWikiTestCase/' tests/phpunit/MediaWikiFarmTestCase.php"
+   ],
"test": [
"composer lint",
+   "composer unit",
+   "composer phpunit",
"composer phpcs",
"composer phpdoc"
]
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 000..aeeb9e1
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,35 @@
+http://www.w3.org/2001/XMLSchema-instance;
+ 
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd;
+ backupGlobals="false"
+ backupStaticAttributes="false"
+ cacheTokens="false"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ 

[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: Make user rights notifications link to added/removed group

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

Change subject: Make user rights notifications link to added/removed group
..


Make user rights notifications link to added/removed group

This change was made to direct users to the added/removed group.
Notification about the change in the user's right will route the user
to a page about the group.

Bug: T55860
Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
---
M includes/formatters/UserRightsPresentationModel.php
1 file changed, 10 insertions(+), 1 deletion(-)

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



diff --git a/includes/formatters/UserRightsPresentationModel.php 
b/includes/formatters/UserRightsPresentationModel.php
index 106b829..9801134 100644
--- a/includes/formatters/UserRightsPresentationModel.php
+++ b/includes/formatters/UserRightsPresentationModel.php
@@ -58,8 +58,17 @@
}
 
public function getPrimaryLink() {
+   $addedGroups = array_values( $this->event->getExtraParam( 
'add', array() ) );
+   $removedGroups = array_values( $this->event->getExtraParam( 
'remove', array() ) );
+   if ( count( $addedGroups ) >= 1 && count( $removedGroups ) === 
0 ) {
+   $fragment = $addedGroups[0];
+   } elseif ( count( $addedGroups ) === 0 && count( $removedGroups 
) >= 1 ) {
+   $fragment = $removedGroups[0];
+   } else {
+   $fragment = '';
+   }
return array(
-   'url' => SpecialPage::getTitleFor( 'Listgrouprights' 
)->getLocalURL(),
+   'url' => SpecialPage::getTitleFor( 'Listgrouprights', 
false, $fragment )->getFullURL(),
'label' => $this->msg( 'echo-learn-more' )->text()
);
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Kmuthu 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Set language on copyright warning to RL default

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

Change subject: Set language on copyright warning to RL default
..


Set language on copyright warning to RL default

Bug: T146686
Depends-On: I80a813a76b551643b68430e6a0ab553b2e1dfb11
Change-Id: I282b8674a3a6554a50a196e784975740cd9dfc19
---
M VisualEditorDataModule.php
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/VisualEditorDataModule.php b/VisualEditorDataModule.php
index 7fa83a5..c26aede 100644
--- a/VisualEditorDataModule.php
+++ b/VisualEditorDataModule.php
@@ -53,7 +53,9 @@
$parsedMsgs = [
'copyrightwarning' => EditPage::getCopyrightWarning(
// Use a dummy title
-   Title::newFromText( 'Dwimmerlaik' ), 'parse'
+   Title::newFromText( 'Dwimmerlaik' ),
+   'parse',
+   $context->getLanguage()
),
];
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I282b8674a3a6554a50a196e784975740cd9dfc19
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk 
Gerrit-Reviewer: Krinkle 
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/core[master]: EditPage: Allow language of copyright warning to be specified

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

Change subject: EditPage: Allow language of copyright warning to be specified
..


EditPage: Allow language of copyright warning to be specified

This avoids global state, and is necessary in places where the
global user language cannot be used, such as load.php.

Bug: T146686
Change-Id: I80a813a76b551643b68430e6a0ab553b2e1dfb11
---
M includes/EditPage.php
1 file changed, 6 insertions(+), 2 deletions(-)

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



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 406673d..9116d4f 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3496,7 +3496,7 @@
 * @param string $format Output format, valid values are any function 
of a Message object
 * @return string
 */
-   public static function getCopyrightWarning( $title, $format = 'plain' ) 
{
+   public static function getCopyrightWarning( $title, $format = 'plain', 
$langcode = null ) {
global $wgRightsText;
if ( $wgRightsText ) {
$copywarnMsg = [ 'copyrightwarning',
@@ -3509,8 +3509,12 @@
// Allow for site and per-namespace customization of 
contribution/copyright notice.
Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg 
] );
 
+   $msg = call_user_func_array( 'wfMessage', $copywarnMsg 
)->title( $title );
+   if ( $langcode ) {
+   $msg->inLanguage( $langcode );
+   }
return "\n" .
-   call_user_func_array( 'wfMessage', $copywarnMsg 
)->title( $title )->$format() . "\n";
+   $msg->$format() . "\n";
}
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I80a813a76b551643b68430e6a0ab553b2e1dfb11
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alex Monk 
Gerrit-Reviewer: Jackmcbarn 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Tpt 
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...GlobalUserPage[master]: Clean up remote parsing of wikitext

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

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

Change subject: Clean up remote parsing of wikitext
..

Clean up remote parsing of wikitext

* Use formatversion=2, use a different cache key to invalidate cache
* Use BagOStuff::makeGlobalCacheKey()
* Add 'jsconfigvars' from the API/remote ParserOutput

Bug: T146729
Change-Id: I15bc51207f7ea564800cc4dfe9a4b3e3ca93b1ec
---
M GlobalUserPage.body.php
1 file changed, 15 insertions(+), 4 deletions(-)


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

diff --git a/GlobalUserPage.body.php b/GlobalUserPage.body.php
index 71804db..419a74c 100644
--- a/GlobalUserPage.body.php
+++ b/GlobalUserPage.body.php
@@ -3,6 +3,12 @@
 class GlobalUserPage extends Article {
 
/**
+* Cache version of action=parse
+* output
+*/
+   const PARSED_CACHE_VERSION = 2;
+
+   /**
 * @var Config
 */
private $config;
@@ -44,11 +50,11 @@
 
// If the user page is empty or the API request failed, show 
the normal
// missing article page
-   if ( !$parsedOutput || !trim( $parsedOutput['text']['*'] ) ) {
+   if ( !$parsedOutput || !trim( $parsedOutput['text'] ) ) {
parent::showMissingArticle();
return;
}
-   $out->addHTML( $parsedOutput['text']['*'] );
+   $out->addHTML( $parsedOutput['text'] );
$out->addModuleStyles( 'ext.GlobalUserPage' );
 
$footerKey = $this->config->get( 'GlobalUserPageFooterKey' );
@@ -86,6 +92,8 @@
}
}
}
+
+   $out->addJsConfigVars( $parsedOutput['jsconfigvars'] );
}
 
/**
@@ -226,7 +234,9 @@
$langCode = $this->getContext()->getLanguage()->getCode();
 
// Need language code in the key since we pass = to the 
API.
-   $key = "globaluserpage:parsed:$touched:$langCode:" . md5( 
$this->getUsername() );
+   $key = $this->cache->makeGlobalKey( 'globaluserpage', 'parsed',
+   self::PARSED_CACHE_VERSION, $touched, $langCode, md5( 
$this->getUsername() )
+   );
$data = $this->cache->get( $key );
if ( $data === false ){
$data = $this->parseWikiText( $this->getTitle(), 
$langCode );
@@ -363,7 +373,8 @@
'disableeditsection' => 1,
'disablelimitreport' => 1,
'uselang' => $langCode,
-   'prop' => 'text|modules'
+   'prop' => 'text|modules|jsconfigvars',
+   'formatversion' => 2
);
$data = $this->makeAPIRequest( $params );
return $data !== false ? $data['parse'] : false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15bc51207f7ea564800cc4dfe9a4b3e3ca93b1ec
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]: Clean up array() syntax in docs, part VII

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

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

Change subject: Clean up array() syntax in docs, part VII
..

Clean up array() syntax in docs, part VII

Last part

Change-Id: I38f015e2122ef4fd2d2141718bd889794c29f06c
---
M includes/Html.php
M includes/OutputPage.php
M includes/TemplateParser.php
M includes/htmlform/OOUIHTMLForm.php
M includes/media/MediaHandler.php
M includes/media/TransformationalImageHandler.php
M languages/Language.php
M languages/LanguageConverter.php
M languages/classes/LanguageKm.php
M languages/classes/LanguageMy.php
M languages/messages/MessagesEn.php
M maintenance/language/checkDupeMessages.php
M maintenance/language/digit2html.php
M maintenance/preprocessorFuzzTest.php
M maintenance/storage/compressOld.php
M tests/phpunit/includes/api/RandomImageGenerator.php
16 files changed, 58 insertions(+), 58 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/66/312966/1

diff --git a/includes/Html.php b/includes/Html.php
index 2ef891d..da26280 100644
--- a/includes/Html.php
+++ b/includes/Html.php
@@ -155,8 +155,8 @@
 *
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
-* @param array $attrs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attrs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string[] $modifiers classes to add to the button
 * @see http://tools.wmflabs.org/styleguide/desktop/index.html for 
guidance on available modifiers
@@ -175,8 +175,8 @@
 *
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
-* @param array $attrs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attrs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string[] $modifiers classes to add to the button
 * @see http://tools.wmflabs.org/styleguide/desktop/index.html for 
guidance on available modifiers
@@ -199,8 +199,8 @@
 * content model.
 *
 * @param string $element The element's name, e.g., 'a'
-* @param array $attribs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+* @param array $attribs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
 *   further documentation.
 * @param string $contents The raw HTML contents of the element: *not*
 *   escaped!
@@ -320,8 +320,8 @@
 * to the input array (currently per the HTML 5 draft as of 2009-09-06).
 *
 * @param string $element Name of the element, e.g., 'a'
-* @param array $attribs Associative array of attributes, e.g., array(
-*   'href' => 'http://www.mediawiki.org/' ).  See expandAttributes() 
for
+* @param array $attribs Associative array of attributes, e.g., [
+*   'href' => 'http://www.mediawiki.org/' ].  See expandAttributes() 
for
 *   further documentation.
 * @return array An array of attributes functionally identical to 
$attribs
 */
@@ -430,8 +430,8 @@
 
/**
 * Given an associative array of element attributes, generate a string
-* to stick after the element name in HTML output.  Like array( 'href' 
=>
-* 'http://www.mediawiki.org/' ) becomes something like
+* to stick after the element name in HTML output.  Like [ 'href' =>
+* 'http://www.mediawiki.org/' ] becomes something like
 * ' href="http://www.mediawiki.org;'.  Again, this is like
 * Xml::expandAttributes(), but it implements some HTML-specific logic.
 *
@@ -443,25 +443,25 @@
 *
 * @par Numerical array
 * @code
-* Html::element( 'em', array(
-* 'class' => array( 'foo', 'bar' )
-* ) );
+* Html::element( 'em', [
+* 'class' => [ 'foo', 'bar' ]
+* ] ];
 * // gives ''
 * @endcode
 *
 * @par Associative array
 * @code
-* Html::element( 'em', array(
-* 'class' => array( 'foo', 'bar', 'foo' => false, 'quux' => 
true )
-* ) );
+* Html::element( 'em', [
+* 'class' => [ 'foo', 'bar', 'foo' => false, 'quux' => true ]
+* ] ];
 * // gives ''
 * @endcode
 *

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Replace extractColumn functions by using Database::selectFie...

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

Change subject: Replace extractColumn functions by using 
Database::selectFieldValues
..


Replace extractColumn functions by using Database::selectFieldValues

Change-Id: I40692a99f0873058aa9c37ae1aeb52259eb578e8
---
M client/includes/Usage/Sql/SqlSubscriptionManager.php
M repo/includes/Store/Sql/SqlSubscriptionLookup.php
2 files changed, 3 insertions(+), 42 deletions(-)

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



diff --git a/client/includes/Usage/Sql/SqlSubscriptionManager.php 
b/client/includes/Usage/Sql/SqlSubscriptionManager.php
index e02f5b2..18381c0 100644
--- a/client/includes/Usage/Sql/SqlSubscriptionManager.php
+++ b/client/includes/Usage/Sql/SqlSubscriptionManager.php
@@ -126,7 +126,7 @@
 */
private function querySubscriptions( DatabaseBase $db, $subscriber, 
array $subscriptions ) {
if ( $subscriptions ) {
-   $rows = $db->select(
+   $subscriptions = $db->selectFieldValues(
'wb_changes_subscription',
'cs_entity_id',
array(
@@ -135,8 +135,6 @@
),
__METHOD__
);
-
-   $subscriptions = $this->extractField( $rows, 
'cs_entity_id' );
}
 
return $subscriptions;
@@ -200,22 +198,6 @@
}
 
return $rows;
-   }
-
-   /**
-* @param object[]|ResultWrapper $rows Plain objects
-* @param string $field The name of the field to extract from each 
plain object
-*
-* @return array
-*/
-   private function extractField( $rows, $field ) {
-   $values = array();
-
-   foreach ( $rows as $row ) {
-   $values[] = $row->$field;
-   }
-
-   return $values;
}
 
 }
diff --git a/repo/includes/Store/Sql/SqlSubscriptionLookup.php 
b/repo/includes/Store/Sql/SqlSubscriptionLookup.php
index acc95e4..bad3eee 100644
--- a/repo/includes/Store/Sql/SqlSubscriptionLookup.php
+++ b/repo/includes/Store/Sql/SqlSubscriptionLookup.php
@@ -74,14 +74,13 @@
$where = [ 'cs_entity_id' => $idToCheck->getSerialization() ];
$dbr = $this->dbLoadBalancer->getConnection( DB_REPLICA );
 
-   $rows = $dbr->select(
+   $subscriptions = $dbr->selectFieldValues(
'wb_changes_subscription',
'cs_subscriber_id',
$where,
__METHOD__
);
 
-   $subscriptions = $this->extractColumn( $rows, 
'cs_subscriber_id' );
$this->dbLoadBalancer->reuseConnection( $dbr );
 
return $subscriptions;
@@ -105,16 +104,12 @@
$where['cs_entity_id'] = $idsToCheck;
}
 
-   $rows = $db->select(
+   return $db->selectFieldValues(
'wb_changes_subscription',
'cs_entity_id',
$where,
__METHOD__
);
-
-   $subscriptions = $this->extractColumn( $rows, 'cs_entity_id' );
-
-   return $subscriptions;
}
 
/**
@@ -131,22 +126,6 @@
}
 
return $reindexed;
-   }
-
-   /**
-* @param object[]|ResultWrapper $rows Plain objects
-* @param string $field The name of the field to extract from each 
plain object
-*
-* @return array
-*/
-   private function extractColumn( $rows, $field ) {
-   $values = array();
-
-   foreach ( $rows as $row ) {
-   $values[] = $row->$field;
-   }
-
-   return $values;
}
 
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I40692a99f0873058aa9c37ae1aeb52259eb578e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: Ladsgroup 
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...FlaggedRevs[master]: Pass new stable revision to review log for dis-approvals

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

Change subject: Pass new stable revision to review log for dis-approvals
..


Pass new stable revision to review log for dis-approvals

Currently, the old stable revision is passed to the review log when a
revision is unreviewed, same as when a revision is reviewed. But then
the changes that were unreviewed are never shown in the log, since the
old stable revision is the same as the unreviewed revision, or more recent.
Instead it should be the new stable revision that gets pased. This way,
the log will show which changes were unreviewed. The fix doesn't work for
old revisions that get unreviewed, but in that case it would be a pain to
know which prior revision to base the diff on.

Change-Id: Ib3d709679396ace8b794648c827685b209a7e5f7
---
M business/RevisionReviewForm.php
1 file changed, 6 insertions(+), 5 deletions(-)

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



diff --git a/business/RevisionReviewForm.php b/business/RevisionReviewForm.php
index 69e7a49..1992955 100644
--- a/business/RevisionReviewForm.php
+++ b/business/RevisionReviewForm.php
@@ -496,13 +496,14 @@
# Delete from flaggedrevs table
$frev->delete();
 
-   # Update the article review log
-   $oldSvId = $oldSv ? $oldSv->getRevId() : 0;
-   FlaggedRevsLog::updateReviewLog( $this->page, $this->dims, 
$this->oldFlags,
-   $this->comment, $this->oldid, $oldSvId, false );
-
# Get the new stable version as of now
$sv = FlaggedRevision::determineStable( $this->page, FR_MASTER 
/*consistent*/ );
+
+   # Update the article review log
+   $svId = $sv ? $sv->getRevId() : 0;
+   FlaggedRevsLog::updateReviewLog( $this->page, $this->dims, 
$this->oldFlags,
+   $this->comment, $this->oldid, $svId, false );
+
# Update recent changes
self::updateRecentChanges( $frev->getRevision(), 'unpatrol', 
$sv );
# Update page and tracking tables and clear cache

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3d709679396ace8b794648c827685b209a7e5f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FlaggedRevs
Gerrit-Branch: master
Gerrit-Owner: Cenarium 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Jackmcbarn 
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...Wikibase[master]: Replace extractColumn functions by using Database::selectFie...

2016-09-26 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review.

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

Change subject: Replace extractColumn functions by using 
Database::selectFieldValues
..

Replace extractColumn functions by using Database::selectFieldValues

Change-Id: I40692a99f0873058aa9c37ae1aeb52259eb578e8
---
M client/includes/Usage/Sql/SqlSubscriptionManager.php
M repo/includes/Store/Sql/SqlSubscriptionLookup.php
2 files changed, 3 insertions(+), 42 deletions(-)


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

diff --git a/client/includes/Usage/Sql/SqlSubscriptionManager.php 
b/client/includes/Usage/Sql/SqlSubscriptionManager.php
index e02f5b2..18381c0 100644
--- a/client/includes/Usage/Sql/SqlSubscriptionManager.php
+++ b/client/includes/Usage/Sql/SqlSubscriptionManager.php
@@ -126,7 +126,7 @@
 */
private function querySubscriptions( DatabaseBase $db, $subscriber, 
array $subscriptions ) {
if ( $subscriptions ) {
-   $rows = $db->select(
+   $subscriptions = $db->selectFieldValues(
'wb_changes_subscription',
'cs_entity_id',
array(
@@ -135,8 +135,6 @@
),
__METHOD__
);
-
-   $subscriptions = $this->extractField( $rows, 
'cs_entity_id' );
}
 
return $subscriptions;
@@ -200,22 +198,6 @@
}
 
return $rows;
-   }
-
-   /**
-* @param object[]|ResultWrapper $rows Plain objects
-* @param string $field The name of the field to extract from each 
plain object
-*
-* @return array
-*/
-   private function extractField( $rows, $field ) {
-   $values = array();
-
-   foreach ( $rows as $row ) {
-   $values[] = $row->$field;
-   }
-
-   return $values;
}
 
 }
diff --git a/repo/includes/Store/Sql/SqlSubscriptionLookup.php 
b/repo/includes/Store/Sql/SqlSubscriptionLookup.php
index acc95e4..bad3eee 100644
--- a/repo/includes/Store/Sql/SqlSubscriptionLookup.php
+++ b/repo/includes/Store/Sql/SqlSubscriptionLookup.php
@@ -74,14 +74,13 @@
$where = [ 'cs_entity_id' => $idToCheck->getSerialization() ];
$dbr = $this->dbLoadBalancer->getConnection( DB_REPLICA );
 
-   $rows = $dbr->select(
+   $subscriptions = $dbr->selectFieldValues(
'wb_changes_subscription',
'cs_subscriber_id',
$where,
__METHOD__
);
 
-   $subscriptions = $this->extractColumn( $rows, 
'cs_subscriber_id' );
$this->dbLoadBalancer->reuseConnection( $dbr );
 
return $subscriptions;
@@ -105,16 +104,12 @@
$where['cs_entity_id'] = $idsToCheck;
}
 
-   $rows = $db->select(
+   return $db->selectFieldValues(
'wb_changes_subscription',
'cs_entity_id',
$where,
__METHOD__
);
-
-   $subscriptions = $this->extractColumn( $rows, 'cs_entity_id' );
-
-   return $subscriptions;
}
 
/**
@@ -131,22 +126,6 @@
}
 
return $reindexed;
-   }
-
-   /**
-* @param object[]|ResultWrapper $rows Plain objects
-* @param string $field The name of the field to extract from each 
plain object
-*
-* @return array
-*/
-   private function extractColumn( $rows, $field ) {
-   $values = array();
-
-   foreach ( $rows as $row ) {
-   $values[] = $row->$field;
-   }
-
-   return $values;
}
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40692a99f0873058aa9c37ae1aeb52259eb578e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man 

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


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add InfoAction handler in repo for tracking subscriptions

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

Change subject: Add InfoAction handler in repo for tracking subscriptions
..


Add InfoAction handler in repo for tracking subscriptions

Bug: T145189
Change-Id: I24e9a01e71a99cd5f8789ccd141872ecb014dbed
---
M repo/Wikibase.hooks.php
M repo/Wikibase.php
M repo/i18n/en.json
M repo/i18n/qqq.json
A repo/includes/Hooks/InfoActionHookHandler.php
M repo/includes/Store/Sql/SqlSubscriptionLookup.php
M repo/includes/Store/SubscriptionLookup.php
A repo/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php
M repo/tests/phpunit/includes/Store/Sql/SqlSubscriptionLookupTest.php
9 files changed, 459 insertions(+), 0 deletions(-)

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



diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index ed95f95..3446bbd 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -11,8 +11,10 @@
 use ExtensionRegistry;
 use HistoryPager;
 use Html;
+use IContextSource;
 use Linker;
 use LogEntry;
+use MediaWiki\MediaWikiServices;
 use MWException;
 use MWExceptionHandler;
 use OutOfBoundsException;
@@ -28,12 +30,15 @@
 use StubUserLang;
 use Title;
 use User;
+use wfGetLB;
 use Wikibase\DataModel\Term\DescriptionsProvider;
 use Wikibase\Lib\AutoCommentFormatter;
 use Wikibase\Lib\Store\EntityChangeLookup;
 use Wikibase\Repo\Content\EntityHandler;
+use Wikibase\Repo\Hooks\InfoActionHookHandler;
 use Wikibase\Repo\Hooks\OutputPageEntityIdReader;
 use Wikibase\Repo\WikibaseRepo;
+use Wikibase\Store\Sql\SqlSubscriptionLookup;
 use WikiPage;
 
 /**
@@ -1136,4 +1141,43 @@
return true;
}
 
+   /**
+* Adds the Wikis using the entity in action=info
+*
+* @param IContextSource $context
+* @param array $pageInfo
+*
+* @return bool
+*/
+   public static function onInfoAction( IContextSource $context, array 
&$pageInfo ) {
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+
+   $namespaceChecker = $wikibaseRepo->getEntityNamespaceLookup();
+   $mediaWikiServices = MediaWikiServices::getInstance();
+   $loadBalancer = $mediaWikiServices->getDBLoadBalancer();
+   $subscriptionLookup = new SqlSubscriptionLookup( $loadBalancer 
);
+   $entityIdLookup = $wikibaseRepo->getEntityIdLookup();
+
+   if ( !$namespaceChecker->isEntityNamespace( 
$context->getTitle()->getNamespace() ) ) {
+   // shorten out
+   return true;
+   }
+
+   $siteLookup = $mediaWikiServices->getSiteLookup();
+   $linkRender = $mediaWikiServices->getLinkRenderer();
+
+   $infoActionHookHandler = new InfoActionHookHandler(
+   $namespaceChecker,
+   $subscriptionLookup,
+   $siteLookup,
+   $entityIdLookup,
+   $linkRender,
+   $context
+   );
+
+   $pageInfo = $infoActionHookHandler->handle( $context, $pageInfo 
);
+
+   return true;
+   }
+
 }
diff --git a/repo/Wikibase.php b/repo/Wikibase.php
index ec403ca..660eb98 100644
--- a/repo/Wikibase.php
+++ b/repo/Wikibase.php
@@ -252,6 +252,7 @@
$wgHooks['ResourceLoaderRegisterModules'][] = 
'Wikibase\RepoHooks::onResourceLoaderRegisterModules';
$wgHooks['ContentHandlerForModelID'][] = 
'Wikibase\RepoHooks::onContentHandlerForModelID';
$wgHooks['BeforeDisplayNoArticleText'][] = 
'Wikibase\ViewEntityAction::onBeforeDisplayNoArticleText';
+   $wgHooks['InfoAction'][] = '\Wikibase\RepoHooks::onInfoAction';
 
// CirrusSearch hooks
$wgHooks['CirrusSearchMappingConfig'][] = 
'Wikibase\Repo\Hooks\CirrusSearchHookHandlers::onCirrusSearchMappingConfig';
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 2d2555a..dfc728b 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -381,6 +381,8 @@
"wikibase-entity-not-viewable": "The given content of type \"$1\" is 
not an Entity and cannot be displayed by Wikibase.",
"action-item-merge": "merge items",
"action-property-create": "create properties",
+   "wikibase-pageinfo-subscription": "Wikis subscribed to this entity",
+   "wikibase-pageinfo-subscription-none": "None",
"apihelp-wbavailablebadges-description": "Queries available badge 
items.",
"apihelp-wbavailablebadges-example-1": "Queries all available badge 
items",
"apihelp-wbcreateclaim-description": "Creates Wikibase claims.",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index ea25caf..83197e3 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -412,6 +412,8 @@
"wikibase-entity-not-viewable": "Error message saying that some content 
can't be rendered. $1 is the content model of 

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Let LabelDescriptionLookup work in action=info in client for...

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

Change subject: Let LabelDescriptionLookup work in action=info in client for 
EntityUsage
..


Let LabelDescriptionLookup work in action=info in client for EntityUsage

Bug: T145965
Change-Id: I6c03dd7ef67471e51807048816769a496fc1d931
---
M client/WikibaseClient.hooks.php
M client/includes/Hooks/InfoActionHookHandler.php
M client/includes/RepoLinker.php
M client/tests/phpunit/includes/Hooks/InfoActionHookHandlerTest.php
4 files changed, 195 insertions(+), 45 deletions(-)

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



diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 476e209..1a5ee70 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -31,6 +31,7 @@
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\Lib\AutoCommentFormatter;
+use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory;
 
 /**
  * File defining the hook handlers for the Wikibase Client extension.
@@ -409,6 +410,12 @@
 
$namespaceChecker = $wikibaseClient->getNamespaceChecker();
$usageLookup = $wikibaseClient->getStore()->getUsageLookup();
+   $labelDescriptionLookupFactory = new 
LanguageFallbackLabelDescriptionLookupFactory(
+   $wikibaseClient->getLanguageFallbackChainFactory(),
+   $wikibaseClient->getTermLookup(),
+   $wikibaseClient->getTermBuffer()
+   );
+   $idParser = $wikibaseClient->getEntityIdParser();
 
if ( !$namespaceChecker->isWikibaseEnabled( 
$context->getTitle()->getNamespace() ) ) {
// shorten out
@@ -420,7 +427,9 @@
$wikibaseClient->newRepoLinker(),
$wikibaseClient->getStore()->getSiteLinkLookup(),
$settings->getSetting( 'siteGlobalID' ),
-   $usageLookup
+   $usageLookup,
+   $labelDescriptionLookupFactory,
+   $idParser
);
 
$pageInfo = $infoActionHookHandler->handle( $context, $pageInfo 
);
diff --git a/client/includes/Hooks/InfoActionHookHandler.php 
b/client/includes/Hooks/InfoActionHookHandler.php
index 874fc4b..0c5f1e1 100644
--- a/client/includes/Hooks/InfoActionHookHandler.php
+++ b/client/includes/Hooks/InfoActionHookHandler.php
@@ -7,8 +7,10 @@
 use Title;
 use Wikibase\Client\RepoLinker;
 use Wikibase\Client\Usage\UsageLookup;
+use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Lib\Store\SiteLinkLookup;
+use Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookupFactory;
 use Wikibase\NamespaceChecker;
 
 /**
@@ -44,13 +46,32 @@
 */
private $usageLookup;
 
-   public function __construct( NamespaceChecker $namespaceChecker, 
RepoLinker $repoLinker,
-   SiteLinkLookup $siteLinkLookup, $siteId, UsageLookup 
$usageLookup ) {
+   /**
+* @var LanguageFallbackLabelDescriptionLookupFactory
+*/
+   private $labelDescriptionLookupFactory;
+
+   /**
+* @var EntityIdParser
+*/
+   private $idParser;
+
+   public function __construct(
+   NamespaceChecker $namespaceChecker,
+   RepoLinker $repoLinker,
+   SiteLinkLookup $siteLinkLookup,
+   $siteId,
+   UsageLookup $usageLookup,
+   LanguageFallbackLabelDescriptionLookupFactory 
$labelDescriptionLookupFactory,
+   EntityIdParser $idParser
+   ) {
$this->namespaceChecker = $namespaceChecker;
$this->repoLinker = $repoLinker;
$this->siteLinkLookup = $siteLinkLookup;
$this->siteId = $siteId;
$this->usageLookup = $usageLookup;
+   $this->labelDescriptionLookupFactory = 
$labelDescriptionLookupFactory;
+   $this->idParser = $idParser;
}
 
/**
@@ -165,12 +186,25 @@
];
}
$output = '';
-
+   $entityIds = array_map(
+   function( $entityId ) {
+   return $this->idParser->parse( $entityId );
+   },
+   array_keys( $usageAspectsByEntity )
+   );
+   $labelLookup = 
$this->labelDescriptionLookupFactory->newLabelDescriptionLookup(
+   $context->getLanguage(),
+   $entityIds
+   );
foreach ( $usageAspectsByEntity as $entityId => $aspects ) {
+   $label = $labelLookup->getLabel( 
$this->idParser->parse( $entityId ) );
+   $text = $label === null ? 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove a few unused variables

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

Change subject: Remove a few unused variables
..


Remove a few unused variables

Change-Id: Ibfc4c6cbbc08b5917f1a84d86d2d4a0855e371a1
---
M includes/api/ApiAuthManagerHelper.php
M includes/api/ApiCSPReport.php
M includes/db/DatabaseMssql.php
M includes/media/Bitmap.php
M maintenance/cleanupEmptyCategories.php
M maintenance/initEditCount.php
M maintenance/rebuildFileCache.php
7 files changed, 2 insertions(+), 9 deletions(-)

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



diff --git a/includes/api/ApiAuthManagerHelper.php 
b/includes/api/ApiAuthManagerHelper.php
index 8e57f93..1a42ccc 100644
--- a/includes/api/ApiAuthManagerHelper.php
+++ b/includes/api/ApiAuthManagerHelper.php
@@ -191,8 +191,6 @@
 * @return array
 */
public function formatAuthenticationResponse( AuthenticationResponse 
$res ) {
-   $params = $this->module->extractRequestParams();
-
$ret = [
'status' => $res->status,
];
diff --git a/includes/api/ApiCSPReport.php b/includes/api/ApiCSPReport.php
index 407ae71..5a0edfc 100644
--- a/includes/api/ApiCSPReport.php
+++ b/includes/api/ApiCSPReport.php
@@ -85,7 +85,6 @@
 */
private function getFlags( $report ) {
$reportOnly = $this->getParameter( 'reportonly' );
-   $userAgent = $this->getRequest()->getHeader( 'user-agent' );
$source = $this->getParameter( 'source' );
$falsePositives = $this->getConfig()->get( 
'CSPFalsePositiveUrls' );
 
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index eb061d8..6c87a00 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -771,7 +771,7 @@
 
$this->mScrollableCursor = false;
try {
-   $ret = $this->query( $sql );
+   $this->query( $sql );
} catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index ccd345c..c86eabd 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -276,7 +276,7 @@
 */
protected function transformImageMagickExt( $image, $params ) {
global $wgSharpenReductionThreshold, $wgSharpenParameter, 
$wgMaxAnimatedGifArea,
-   $wgMaxInterlacingAreas, $wgJpegPixelFormat;
+   $wgJpegPixelFormat;
 
try {
$im = new Imagick();
diff --git a/maintenance/cleanupEmptyCategories.php 
b/maintenance/cleanupEmptyCategories.php
index b8a246e..8672223 100644
--- a/maintenance/cleanupEmptyCategories.php
+++ b/maintenance/cleanupEmptyCategories.php
@@ -147,7 +147,6 @@
} else {
$where = [];
}
-   $i = 0;
 
$this->output( "Removing empty categories without 
description pages...\n" );
while ( true ) {
diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php
index 6b06da7..96aea03 100644
--- a/maintenance/initEditCount.php
+++ b/maintenance/initEditCount.php
@@ -42,8 +42,6 @@
$user = $dbw->tableName( 'user' );
$revision = $dbw->tableName( 'revision' );
 
-   $dbver = $dbw->getServerVersion();
-
// Autodetect mode...
if ( $this->hasOption( 'background' ) ) {
$backgroundMode = true;
diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php
index 2287559..da8a6bc 100644
--- a/maintenance/rebuildFileCache.php
+++ b/maintenance/rebuildFileCache.php
@@ -96,7 +96,6 @@
$blockEnd = $start + $this->mBatchSize - 1;
 
$dbw = $this->getDB( DB_MASTER );
-   $mainContext = RequestContext::getMain();
// Go through each page and save the output
while ( $blockEnd <= $end ) {
// Get the pages

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibfc4c6cbbc08b5917f1a84d86d2d4a0855e371a1
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Parent5446 
Gerrit-Reviewer: Skizzerz 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove/actualize unused imports

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

Change subject: Remove/actualize unused imports
..


Remove/actualize unused imports

Change-Id: I6ef19d5d982aa45dbf5554107ad9ee720442f466
---
M includes/api/ApiQuerySearch.php
M includes/content/WikiTextStructure.php
M includes/context/ContextSource.php
M includes/parser/Parser.php
4 files changed, 3 insertions(+), 7 deletions(-)

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



diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index 606dee0..ba60da9 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -24,8 +24,6 @@
  * @file
  */
 
-use MediaWiki\MediaWikiServices;
-
 /**
  * Query module to perform full text search within wiki titles and content
  *
diff --git a/includes/content/WikiTextStructure.php 
b/includes/content/WikiTextStructure.php
index 55c4ad5..fe12ff7 100644
--- a/includes/content/WikiTextStructure.php
+++ b/includes/content/WikiTextStructure.php
@@ -1,7 +1,6 @@
 mLinkRenderer ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ef19d5d982aa45dbf5554107ad9ee720442f466
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: C. Scott Ananian 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: Jackmcbarn 
Gerrit-Reviewer: MaxSem 
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]: Make Parser::guessSectionNameFromWikiText() static

2016-09-26 Thread Catrope (Code Review)
Catrope has uploaded a new change for review.

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

Change subject: Make Parser::guessSectionNameFromWikiText() static
..

Make Parser::guessSectionNameFromWikiText() static

It doesn't use any real parser state, and it's a useful utility.

Change-Id: If059563b5b84685bcaad1cf312ac2e319244cf33
---
M includes/parser/Parser.php
1 file changed, 9 insertions(+), 8 deletions(-)


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

diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 7c18798..e9b095e 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1604,7 +1604,7 @@
 *
 * @return string
 */
-   public function doQuotes( $text ) {
+   public static function doQuotes( $text ) {
$arr = preg_split( "/(''+)/", $text, -1, 
PREG_SPLIT_DELIM_CAPTURE );
$countarr = count( $arr );
if ( $countarr == 1 ) {
@@ -5710,9 +5710,9 @@
 *
 * @return string
 */
-   public function guessSectionNameFromWikiText( $text ) {
+   public static function guessSectionNameFromWikiText( $text ) {
# Strip out wikitext links(they break the anchor)
-   $text = $this->stripSectionName( $text );
+   $text = self::stripSectionName( $text );
$text = Sanitizer::normalizeSectionNameWhitespace( $text );
return '#' . Sanitizer::escapeId( $text, 'noninitial' );
}
@@ -5725,9 +5725,9 @@
 * @param string $text The section name
 * @return string An anchor
 */
-   public function guessLegacySectionNameFromWikiText( $text ) {
+   public static function guessLegacySectionNameFromWikiText( $text ) {
# Strip out wikitext links(they break the anchor)
-   $text = $this->stripSectionName( $text );
+   $text = self::stripSectionName( $text );
$text = Sanitizer::normalizeSectionNameWhitespace( $text );
return '#' . Sanitizer::escapeId( $text, [ 'noninitial', 
'legacy' ] );
}
@@ -5746,7 +5746,8 @@
 * for use in a Section anchor
 * @return string Filtered text string
 */
-   public function stripSectionName( $text ) {
+   public static function stripSectionName( $text ) {
+   static $urlProtocols = wfUrlProtocols();
# Strip internal link markup
$text = preg_replace( '/\[\[:?([^[|]+)\|([^[]+)\]\]/', '$2', 
$text );
$text = preg_replace( '/\[\[:?([^[]+)\|?\]\]/', '$1', $text );
@@ -5755,10 +5756,10 @@
# @todo FIXME: Not tolerant to blank link text
# I.E. [https://www.mediawiki.org] will render as [1] or 
something depending
# on how many empty links there are on the page - need to 
figure that out.
-   $text = preg_replace( '/\[(?i:' . $this->mUrlProtocols . ')([^ 
]+?) ([^[]+)\]/', '$2', $text );
+   $text = preg_replace( '/\[(?i:' . $urlProtocols . ')([^ ]+?) 
([^[]+)\]/', '$2', $text );
 
# Parse wikitext quotes (italics & bold)
-   $text = $this->doQuotes( $text );
+   $text = self::doQuotes( $text );
 
# Strip HTML tags
$text = StringUtils::delimiterReplace( '<', '>', '', $text );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: Use static Parser::guessSectionNameFromWikiText()

2016-09-26 Thread Catrope (Code Review)
Catrope has uploaded a new change for review.

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

Change subject: Use static Parser::guessSectionNameFromWikiText()
..

Use static Parser::guessSectionNameFromWikiText()

Change-Id: I16a9dae2da6708f1a65ff77e15869348c64db571
Depends-On: If059563b5b84685bcaad1cf312ac2e319244cf33
---
M includes/formatters/PresentationModelSectionTrait.php
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/64/312964/1

diff --git a/includes/formatters/PresentationModelSectionTrait.php 
b/includes/formatters/PresentationModelSectionTrait.php
index a286330..d8f272e 100644
--- a/includes/formatters/PresentationModelSectionTrait.php
+++ b/includes/formatters/PresentationModelSectionTrait.php
@@ -45,11 +45,10 @@
 * @return Title
 */
protected function getTitleWithSection() {
-   global $wgParser;
$title = $this->event->getTitle();
$section = $this->getSection();
// guessSectionNameFromWikiText() returns '#foo', strip the '#'
-   $fragment = substr( $wgParser->guessSectionNameFromWikiText( 
$section ), 1 );
+   $fragment = substr( Parser::guessSectionNameFromWikiText( 
$section ), 1 );
if ( $section ) {
$title = Title::makeTitle(
$title->getNamespace(),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16a9dae2da6708f1a65ff77e15869348c64db571
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: MWExceptionRenderer::useOutputPage: Don't bother in RL code

2016-09-26 Thread Alex Monk (Code Review)
Alex Monk has uploaded a new change for review.

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

Change subject: MWExceptionRenderer::useOutputPage: Don't bother in RL code
..

MWExceptionRenderer::useOutputPage: Don't bother in RL code

Change-Id: Ieb6d682a9f2fb4def4c01908ccd035fcce2e1895
---
M includes/exception/MWExceptionRenderer.php
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/includes/exception/MWExceptionRenderer.php 
b/includes/exception/MWExceptionRenderer.php
index e242da3..d5df8dd 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -134,8 +134,12 @@
 */
private static function useOutputPage( $e ) {
// Can the extension use the Message class/wfMessage to get 
i18n-ed messages?
+   // Don't even bother with OutputPage if the exception occurred 
in ResourceLoader,
+   // it won't have Title context set so the Skin system (and 
probably most of MediaWiki)
+   // won't work.
+   $badClasses = [ 'LocalisationCache', 'ResourceLoader' ];
foreach ( $e->getTrace() as $frame ) {
-   if ( isset( $frame['class'] ) && $frame['class'] === 
'LocalisationCache' ) {
+   if ( isset( $frame['class'] )  && in_array( 
$frame['class'], $badClasses ) ) {
return false;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb6d682a9f2fb4def4c01908ccd035fcce2e1895
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alex Monk 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Set language on copyright warning to RL default

2016-09-26 Thread Alex Monk (Code Review)
Alex Monk has uploaded a new change for review.

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

Change subject: Set language on copyright warning to RL default
..

Set language on copyright warning to RL default

Bug: T146686
Depends-On: I80a813a76b551643b68430e6a0ab553b2e1dfb11
Change-Id: I282b8674a3a6554a50a196e784975740cd9dfc19
---
M VisualEditorDataModule.php
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/VisualEditorDataModule.php b/VisualEditorDataModule.php
index 7fa83a5..c26aede 100644
--- a/VisualEditorDataModule.php
+++ b/VisualEditorDataModule.php
@@ -53,7 +53,9 @@
$parsedMsgs = [
'copyrightwarning' => EditPage::getCopyrightWarning(
// Use a dummy title
-   Title::newFromText( 'Dwimmerlaik' ), 'parse'
+   Title::newFromText( 'Dwimmerlaik' ),
+   'parse',
+   $context->getLanguage()
),
];
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I282b8674a3a6554a50a196e784975740cd9dfc19
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: EditPage: Allow language of copyright warning to be specified

2016-09-26 Thread Alex Monk (Code Review)
Alex Monk has uploaded a new change for review.

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

Change subject: EditPage: Allow language of copyright warning to be specified
..

EditPage: Allow language of copyright warning to be specified

For VE

Bug: T146686
Change-Id: I80a813a76b551643b68430e6a0ab553b2e1dfb11
---
M includes/EditPage.php
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/312960/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 406673d..9116d4f 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3496,7 +3496,7 @@
 * @param string $format Output format, valid values are any function 
of a Message object
 * @return string
 */
-   public static function getCopyrightWarning( $title, $format = 'plain' ) 
{
+   public static function getCopyrightWarning( $title, $format = 'plain', 
$langcode = null ) {
global $wgRightsText;
if ( $wgRightsText ) {
$copywarnMsg = [ 'copyrightwarning',
@@ -3509,8 +3509,12 @@
// Allow for site and per-namespace customization of 
contribution/copyright notice.
Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg 
] );
 
+   $msg = call_user_func_array( 'wfMessage', $copywarnMsg 
)->title( $title );
+   if ( $langcode ) {
+   $msg->inLanguage( $langcode );
+   }
return "\n" .
-   call_user_func_array( 'wfMessage', $copywarnMsg 
)->title( $title )->$format() . "\n";
+   $msg->$format() . "\n";
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I80a813a76b551643b68430e6a0ab553b2e1dfb11
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alex Monk 

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


[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Move caching TTL into SearchContext

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

Change subject: Move caching TTL into SearchContext
..


Move caching TTL into SearchContext

In preperation for converting morelike to a keyword feature move
the caching TTL into SearchContext.

Change-Id: I81a3d15bd4c718e592303ba7e21ad16cdf8b090c
---
M includes/Search/SearchContext.php
M includes/Searcher.php
2 files changed, 28 insertions(+), 10 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/Search/SearchContext.php 
b/includes/Search/SearchContext.php
index d788f4a..f8d0204 100644
--- a/includes/Search/SearchContext.php
+++ b/includes/Search/SearchContext.php
@@ -165,6 +165,11 @@
private $limitSearchToLocalWiki = false;
 
/**
+* @param int The number of seconds to cache results for
+*/
+   private $cacheTtl = 0;
+
+   /**
 * @param SearchConfig $config
 * @param int[]|null $namespaces
 */
@@ -620,4 +625,19 @@
public function setLimitSearchToLocalWiki( $localWikiOnly ) {
$this->limitSearchToLocalWiki = $localWikiOnly;
}
+
+   /**
+* @return int The number of seconds to cache results for
+*/
+   public function getCacheTtl() {
+   return $this->cacheTtl;
+   }
+
+   /**
+* @param int $ttl The number of seconds to cache results for
+*/
+   public function setCacheTtl( $ttl ) {
+   $this->cacheTtl = $ttl;
+   }
+
 }
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 7610b71..6d1f145 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -439,10 +439,9 @@
// to save cpu cycles
$this->searchContext->setHighlightQuery( new 
\Elastica\Query\MatchAll() );
 
-   return $this->search(
-   implode( ', ', $titles ),
-   $this->config->get( 'CirrusSearchMoreLikeThisTTL' )
-   );
+   $this->searchContext->setCacheTtl( $this->config->get( 
'CirrusSearchMoreLikeThisTTL' ) );
+
+   return $this->search( implode( ', ', $titles ) );
}
 
/**
@@ -541,10 +540,9 @@
 * Powers full-text-like searches including prefix search.
 *
 * @param string $for
-* @param int $cacheTTL Cache results into ObjectCache for $cacheTTL 
seconds
 * @return Status results from the query transformed by the resultsType
 */
-   private function search( $for, $cacheTTL = 0 ) {
+   private function search( $for ) {
if ( $this->limit <= 0 && ! $this->returnQuery ) {
if ( $this->returnResult ) {
return Status::newGood( [
@@ -680,11 +678,11 @@
}
if ( $this->returnResult || $this->returnExplain ) {
// don't cache debugging queries
-   $cacheTTL = 0;
+   $this->searchContext->setCacheTtl( 0 );
}
 
$requestStats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
-   if ( $cacheTTL > 0 ) {
+   if ( $this->searchContext->getCacheTtl() > 0 ) {
$cache = ObjectCache::getLocalClusterInstance();
$key = $cache->makeKey( 'cirrussearch', 'search', md5(
$search->getPath() .
@@ -768,11 +766,11 @@
}
}
 
-   if ( $cacheTTL > 0 && !$isPartialResult ) {
+   if ( $this->searchContext->getCacheTtl() > 0 && 
!$isPartialResult ) {
/** @suppress PhanUndeclaredVariable */

$requestStats->increment("CirrusSearch.query_cache.$type.set");
/** @suppress PhanUndeclaredVariable */
-   $cache->set( $key, $result, $cacheTTL );
+   $cache->set( $key, $result, 
$this->searchContext->getCacheTtl() );
}
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I81a3d15bd4c718e592303ba7e21ad16cdf8b090c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 
Gerrit-Reviewer: Cindy-the-browser-test-bot 
Gerrit-Reviewer: DCausse 
Gerrit-Reviewer: Gehel 
Gerrit-Reviewer: Manybubbles 
Gerrit-Reviewer: Smalyshev 
Gerrit-Reviewer: 

[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: Fix links to sections with [[links]] in their title

2016-09-26 Thread Catrope (Code Review)
Catrope has uploaded a new change for review.

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

Change subject: Fix links to sections with [[links]] in their title
..

Fix links to sections with [[links]] in their title

We would generate things like #Foo_.5B.5Bbar.5D.5D
instead of #Foo_bar . Unfortunately this doesn't
fix section titles with templates / magic words
in them, because those are parsed at notification render
time instead of at notification generation time.

Bug: T134216
Change-Id: Ia171324a4a616c956ab08fcff38293f18dc765fa
---
M includes/formatters/PresentationModelSectionTrait.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/59/312959/1

diff --git a/includes/formatters/PresentationModelSectionTrait.php 
b/includes/formatters/PresentationModelSectionTrait.php
index f09e75a..a286330 100644
--- a/includes/formatters/PresentationModelSectionTrait.php
+++ b/includes/formatters/PresentationModelSectionTrait.php
@@ -45,13 +45,16 @@
 * @return Title
 */
protected function getTitleWithSection() {
+   global $wgParser;
$title = $this->event->getTitle();
$section = $this->getSection();
+   // guessSectionNameFromWikiText() returns '#foo', strip the '#'
+   $fragment = substr( $wgParser->guessSectionNameFromWikiText( 
$section ), 1 );
if ( $section ) {
$title = Title::makeTitle(
$title->getNamespace(),
$title->getDBkey(),
-   $section
+   $fragment
);
}
return $title;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia171324a4a616c956ab08fcff38293f18dc765fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Added exportPageDeletions script.

2016-09-26 Thread Ppchelko (Code Review)
Ppchelko has uploaded a new change for review.

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

Change subject: Added exportPageDeletions script.
..

Added exportPageDeletions script.

In order to move the deletions to RESTBase we need to run
this maintanance script across all wikis.

Change-Id: I093bde4b7ad43691e966369e47188436a379916b
---
A maintenance/exportDeletions.php
1 file changed, 73 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/312958/1

diff --git a/maintenance/exportDeletions.php b/maintenance/exportDeletions.php
new file mode 100644
index 000..a40ce69
--- /dev/null
+++ b/maintenance/exportDeletions.php
@@ -0,0 +1,73 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Petr Pchelko 
+ */
+
+require_once __DIR__ . '/Maintenance.php';
+
+/**
+ * Maintenance script to dump revision restrictions, one JSON object per batch
+ * and line.
+ *
+ * @ingroup Maintenance
+ */
+class ExportRevisionRestrictions extends Maintenance {
+
+public function __construct() {
+parent::__construct();
+$this->addDescription( 'Dump page deletions, one batch at a time' );
+$this->addOption( 'start', 'Start from this page title in alphabetical 
order.' );
+$this->addOption( 'limit', 'Limit the batch size to this value.' );
+}
+
+public function execute() {
+// Delay for replication lag
+wfWaitForSlaves();
+
+$start = $this->getOption( 'start' );
+$limit = intval( $this->getOption( 'limit', 1000 ) );
+
+do {
+$dbr = $this->getDB( DB_SLAVE, 'vslow' );
+$sql = "SELECT ar_title as title, MAX(ar_rev_id) as rev_id "
+. "FROM archive ";
+
+if ( !is_null($start) ) {
+$sql = $sql . "WHERE ar_title > \"{$start}\" ";
+}
+$sql = $sql . "GROUP BY ar_title ORDER BY ar_title ASC LIMIT 
{$limit}";
+
+
+$batchResult = $dbr->query( $sql );
+$rows = [];
+foreach ( $batchResult as $row ) {
+$rows[] = $row;
+$start = $row->title;
+}
+// Emit one JSON object per line.
+$this->output( json_encode( $rows ) . "\n" );
+} while ( count( $rows ) );
+}
+}
+
+$maintClass = "ExportRevisionRestrictions";
+require_once RUN_MAINTENANCE_IF_MAIN;
\ No newline at end of file

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...MultimediaViewer[master]: Upgrade stylelint

2016-09-26 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: Upgrade stylelint
..

Upgrade stylelint

The old version is throwing errors.

Change-Id: Ibd708045ab7c9f09f664f1b1099bb4d490ab0151
---
M package.json
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/package.json b/package.json
index 237f80c..fd369c2 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
 "grunt-contrib-jshint": "1.0.0",
 "grunt-jscs": "2.8.0",
 "grunt-jsonlint": "1.0.8",
-"grunt-stylelint": "0.4.0",
-"stylelint-config-wikimedia": "0.2.2"
+"grunt-stylelint": "^0.6.0",
+"stylelint-config-wikimedia": "^0.3.0"
   }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd708045ab7c9f09f664f1b1099bb4d490ab0151
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikimediaMaintenance[master]: Remove mentions of DatabaseBase

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

Change subject: Remove mentions of DatabaseBase
..


Remove mentions of DatabaseBase

Change-Id: I252279f776d7c10d28375f69ff6949e0988989c5
---
M migrateWlmUploads.php
M removeDeletedWikis.php
2 files changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/migrateWlmUploads.php b/migrateWlmUploads.php
index 2488d23..07e3ee2 100644
--- a/migrateWlmUploads.php
+++ b/migrateWlmUploads.php
@@ -41,12 +41,12 @@
$tmpDir,
$deletingUser;
 
-   /* @var DatabaseBase */
+   /* @var IDatabase */
private $commonsDbw;
 
public function __construct() {
parent::__construct();
-   $this->addDescription = 'Migrate botched up uploads from 
testwiki to Commons';
+   $this->addDescription( 'Migrate botched up uploads from 
testwiki to Commons' );
$this->addOption( 'do-it', 'Actually perform the migration 
(otherwise a dry run will be performed)' );
}
 
diff --git a/removeDeletedWikis.php b/removeDeletedWikis.php
index d359ebd..6906597 100644
--- a/removeDeletedWikis.php
+++ b/removeDeletedWikis.php
@@ -51,7 +51,7 @@
}
 
/**
-* @param DatabaseBase $dbw
+* @param IDatabase $dbw
 * @param string $table
 * @param string $column
 * @param string $wiki

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I252279f776d7c10d28375f69ff6949e0988989c5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Aaron Schulz 
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 function name case

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

Change subject: Fix function name case
..


Fix function name case

Change-Id: Ibd4f682d2ed8500a50d85aae38f17281646f7c2d
---
M includes/EditPage.php
M includes/MovePage.php
M includes/api/ApiQuerySearch.php
M includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
M includes/exception/MWExceptionRenderer.php
M includes/libs/virtualrest/VirtualRESTServiceClient.php
M includes/logging/LogEventsList.php
M includes/specials/SpecialPreferences.php
M includes/specials/SpecialRandomInCategory.php
M includes/specials/SpecialUserrights.php
M includes/tidy/Balancer.php
11 files changed, 12 insertions(+), 12 deletions(-)

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



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 406673d..7f01643 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -4263,7 +4263,7 @@
protected function safeUnicodeOutput( $text ) {
return $this->checkUnicodeCompliantBrowser()
? $text
-   : $this->makesafe( $text );
+   : $this->makeSafe( $text );
}
 
/**
diff --git a/includes/MovePage.php b/includes/MovePage.php
index d17f234..5f1dd3f 100644
--- a/includes/MovePage.php
+++ b/includes/MovePage.php
@@ -446,7 +446,7 @@
$status = $newpage->doDeleteArticleReal(
$overwriteMessage,
/* $suppress */ false,
-   $nt->getArticleId(),
+   $nt->getArticleID(),
/* $commit */ false,
$errs,
$user
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index f46b5d2..606dee0 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -235,7 +235,7 @@
$vals = [
'namespace' => 
$result->getInterwikiNamespaceText(),
'title' => 
$title->getText(),
-   'url' => 
$title->getFullUrl(),
+   'url' => 
$title->getFullURL(),
];
 
// Add item to results and see 
whether it fits
diff --git a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php 
b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
index f16423d..9962fa3 100644
--- a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
+++ b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
@@ -140,7 +140,7 @@
}
 
$status = $this->checkPasswordValidity( $username, 
$req->password );
-   if ( !$status->isOk() ) {
+   if ( !$status->isOK() ) {
// Fatal, can't log in
return AuthenticationResponse::newFail( 
$status->getMessage() );
}
diff --git a/includes/exception/MWExceptionRenderer.php 
b/includes/exception/MWExceptionRenderer.php
index e242da3..aba131d 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -172,7 +172,7 @@
} else {
// Show any custom GUI message before the 
details
if ( $e instanceof MessageSpecifier ) {
-   $wgOut->addHtml( 
Message::newFromSpecifier( $e )->escaped() );
+   $wgOut->addHTML( 
Message::newFromSpecifier( $e )->escaped() );
}
$wgOut->addHTML( self::getHTML( $e ) );
}
diff --git a/includes/libs/virtualrest/VirtualRESTServiceClient.php 
b/includes/libs/virtualrest/VirtualRESTServiceClient.php
index 0864e5c..1b7545a 100644
--- a/includes/libs/virtualrest/VirtualRESTServiceClient.php
+++ b/includes/libs/virtualrest/VirtualRESTServiceClient.php
@@ -304,7 +304,7 @@
 */
private function getInstance( $prefix ) {
if ( !isset( $this->instances[$prefix] ) ) {
-   throw new RunTimeException( "No service registered at 
prefix '{$prefix}'." );
+   throw new RuntimeException( "No service registered at 
prefix '{$prefix}'." );
}
 
if ( !( $this->instances[$prefix] instanceof VirtualRESTService 
) ) {
diff --git a/includes/logging/LogEventsList.php 
b/includes/logging/LogEventsList.php
index f29c9e4..0cf584b 100644
--- a/includes/logging/LogEventsList.php
+++ 

[MediaWiki-commits] [Gerrit] mediawiki...WikimediaMaintenance[master]: Remove mentions of DatbaseBase

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Remove mentions of DatbaseBase
..

Remove mentions of DatbaseBase

Change-Id: I252279f776d7c10d28375f69ff6949e0988989c5
---
M migrateWlmUploads.php
M removeDeletedWikis.php
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/migrateWlmUploads.php b/migrateWlmUploads.php
index 2488d23..07e3ee2 100644
--- a/migrateWlmUploads.php
+++ b/migrateWlmUploads.php
@@ -41,12 +41,12 @@
$tmpDir,
$deletingUser;
 
-   /* @var DatabaseBase */
+   /* @var IDatabase */
private $commonsDbw;
 
public function __construct() {
parent::__construct();
-   $this->addDescription = 'Migrate botched up uploads from 
testwiki to Commons';
+   $this->addDescription( 'Migrate botched up uploads from 
testwiki to Commons' );
$this->addOption( 'do-it', 'Actually perform the migration 
(otherwise a dry run will be performed)' );
}
 
diff --git a/removeDeletedWikis.php b/removeDeletedWikis.php
index d359ebd..6906597 100644
--- a/removeDeletedWikis.php
+++ b/removeDeletedWikis.php
@@ -51,7 +51,7 @@
}
 
/**
-* @param DatabaseBase $dbw
+* @param IDatabase $dbw
 * @param string $table
 * @param string $column
 * @param string $wiki

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I252279f776d7c10d28375f69ff6949e0988989c5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: MaxSem 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove a few unused variables

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Remove a few unused variables
..

Remove a few unused variables

Change-Id: Ibfc4c6cbbc08b5917f1a84d86d2d4a0855e371a1
---
M includes/api/ApiAuthManagerHelper.php
M includes/api/ApiCSPReport.php
M includes/db/DatabaseMssql.php
M includes/media/Bitmap.php
M maintenance/cleanupEmptyCategories.php
M maintenance/initEditCount.php
M maintenance/rebuildFileCache.php
7 files changed, 2 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/55/312955/1

diff --git a/includes/api/ApiAuthManagerHelper.php 
b/includes/api/ApiAuthManagerHelper.php
index 8e57f93..1a42ccc 100644
--- a/includes/api/ApiAuthManagerHelper.php
+++ b/includes/api/ApiAuthManagerHelper.php
@@ -191,8 +191,6 @@
 * @return array
 */
public function formatAuthenticationResponse( AuthenticationResponse 
$res ) {
-   $params = $this->module->extractRequestParams();
-
$ret = [
'status' => $res->status,
];
diff --git a/includes/api/ApiCSPReport.php b/includes/api/ApiCSPReport.php
index 407ae71..5a0edfc 100644
--- a/includes/api/ApiCSPReport.php
+++ b/includes/api/ApiCSPReport.php
@@ -85,7 +85,6 @@
 */
private function getFlags( $report ) {
$reportOnly = $this->getParameter( 'reportonly' );
-   $userAgent = $this->getRequest()->getHeader( 'user-agent' );
$source = $this->getParameter( 'source' );
$falsePositives = $this->getConfig()->get( 
'CSPFalsePositiveUrls' );
 
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index eb061d8..6c87a00 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -771,7 +771,7 @@
 
$this->mScrollableCursor = false;
try {
-   $ret = $this->query( $sql );
+   $this->query( $sql );
} catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index ccd345c..c86eabd 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -276,7 +276,7 @@
 */
protected function transformImageMagickExt( $image, $params ) {
global $wgSharpenReductionThreshold, $wgSharpenParameter, 
$wgMaxAnimatedGifArea,
-   $wgMaxInterlacingAreas, $wgJpegPixelFormat;
+   $wgJpegPixelFormat;
 
try {
$im = new Imagick();
diff --git a/maintenance/cleanupEmptyCategories.php 
b/maintenance/cleanupEmptyCategories.php
index b8a246e..8672223 100644
--- a/maintenance/cleanupEmptyCategories.php
+++ b/maintenance/cleanupEmptyCategories.php
@@ -147,7 +147,6 @@
} else {
$where = [];
}
-   $i = 0;
 
$this->output( "Removing empty categories without 
description pages...\n" );
while ( true ) {
diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php
index 6b06da7..96aea03 100644
--- a/maintenance/initEditCount.php
+++ b/maintenance/initEditCount.php
@@ -42,8 +42,6 @@
$user = $dbw->tableName( 'user' );
$revision = $dbw->tableName( 'revision' );
 
-   $dbver = $dbw->getServerVersion();
-
// Autodetect mode...
if ( $this->hasOption( 'background' ) ) {
$backgroundMode = true;
diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php
index 2287559..da8a6bc 100644
--- a/maintenance/rebuildFileCache.php
+++ b/maintenance/rebuildFileCache.php
@@ -96,7 +96,6 @@
$blockEnd = $start + $this->mBatchSize - 1;
 
$dbw = $this->getDB( DB_MASTER );
-   $mainContext = RequestContext::getMain();
// Go through each page and save the output
while ( $blockEnd <= $end ) {
// Get the pages

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove unused imports

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Remove unused imports
..

Remove unused imports

Change-Id: I6ef19d5d982aa45dbf5554107ad9ee720442f466
---
M includes/api/ApiQuerySearch.php
M includes/content/WikiTextStructure.php
M includes/context/ContextSource.php
M includes/parser/Parser.php
4 files changed, 0 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/54/312954/1

diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index 606dee0..ba60da9 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -24,8 +24,6 @@
  * @file
  */
 
-use MediaWiki\MediaWikiServices;
-
 /**
  * Query module to perform full text search within wiki titles and content
  *
diff --git a/includes/content/WikiTextStructure.php 
b/includes/content/WikiTextStructure.php
index 55c4ad5..fe12ff7 100644
--- a/includes/content/WikiTextStructure.php
+++ b/includes/content/WikiTextStructure.php
@@ -1,7 +1,6 @@
 https://gerrit.wikimedia.org/r/312954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix function name case

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Fix function name case
..

Fix function name case

Change-Id: Ibd4f682d2ed8500a50d85aae38f17281646f7c2d
---
M includes/EditPage.php
M includes/MovePage.php
M includes/api/ApiQuerySearch.php
M includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
M includes/exception/MWExceptionRenderer.php
M includes/libs/virtualrest/VirtualRESTServiceClient.php
M includes/logging/LogEventsList.php
M includes/specials/SpecialPreferences.php
M includes/specials/SpecialRandomInCategory.php
M includes/specials/SpecialUserrights.php
M includes/tidy/Balancer.php
11 files changed, 12 insertions(+), 12 deletions(-)


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

diff --git a/includes/EditPage.php b/includes/EditPage.php
index 406673d..7f01643 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -4263,7 +4263,7 @@
protected function safeUnicodeOutput( $text ) {
return $this->checkUnicodeCompliantBrowser()
? $text
-   : $this->makesafe( $text );
+   : $this->makeSafe( $text );
}
 
/**
diff --git a/includes/MovePage.php b/includes/MovePage.php
index d17f234..5f1dd3f 100644
--- a/includes/MovePage.php
+++ b/includes/MovePage.php
@@ -446,7 +446,7 @@
$status = $newpage->doDeleteArticleReal(
$overwriteMessage,
/* $suppress */ false,
-   $nt->getArticleId(),
+   $nt->getArticleID(),
/* $commit */ false,
$errs,
$user
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index f46b5d2..606dee0 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -235,7 +235,7 @@
$vals = [
'namespace' => 
$result->getInterwikiNamespaceText(),
'title' => 
$title->getText(),
-   'url' => 
$title->getFullUrl(),
+   'url' => 
$title->getFullURL(),
];
 
// Add item to results and see 
whether it fits
diff --git a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php 
b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
index f16423d..9962fa3 100644
--- a/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
+++ b/includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
@@ -140,7 +140,7 @@
}
 
$status = $this->checkPasswordValidity( $username, 
$req->password );
-   if ( !$status->isOk() ) {
+   if ( !$status->isOK() ) {
// Fatal, can't log in
return AuthenticationResponse::newFail( 
$status->getMessage() );
}
diff --git a/includes/exception/MWExceptionRenderer.php 
b/includes/exception/MWExceptionRenderer.php
index e242da3..aba131d 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -172,7 +172,7 @@
} else {
// Show any custom GUI message before the 
details
if ( $e instanceof MessageSpecifier ) {
-   $wgOut->addHtml( 
Message::newFromSpecifier( $e )->escaped() );
+   $wgOut->addHTML( 
Message::newFromSpecifier( $e )->escaped() );
}
$wgOut->addHTML( self::getHTML( $e ) );
}
diff --git a/includes/libs/virtualrest/VirtualRESTServiceClient.php 
b/includes/libs/virtualrest/VirtualRESTServiceClient.php
index 0864e5c..1b7545a 100644
--- a/includes/libs/virtualrest/VirtualRESTServiceClient.php
+++ b/includes/libs/virtualrest/VirtualRESTServiceClient.php
@@ -304,7 +304,7 @@
 */
private function getInstance( $prefix ) {
if ( !isset( $this->instances[$prefix] ) ) {
-   throw new RunTimeException( "No service registered at 
prefix '{$prefix}'." );
+   throw new RuntimeException( "No service registered at 
prefix '{$prefix}'." );
}
 
if ( !( $this->instances[$prefix] instanceof VirtualRESTService 
) ) {
diff --git a/includes/logging/LogEventsList.php 
b/includes/logging/LogEventsList.php
index f29c9e4..0cf584b 100644
--- 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix previous update query.

2016-09-26 Thread Eileen (Code Review)
Eileen has uploaded a new change for review.

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

Change subject: Fix previous update query.
..

Fix previous update query.

Bug:  T96410
Change-Id: Iaa57186d2ba1d0ffe5ab4ff163a5cc73b1224d3c
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/51/312951/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index f192e69..fbe6365 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2236,6 +2236,7 @@
  * Bug: T96410
  */
 function wmf_civicrm_update_7270() {
+  civicrm_initialize();
   $nonUsefulEnglishes = array(
 // these ones have information in CldrData.php so don't alter.
 //'en_BE', 'en_ZA', 'en_BW', 'en_BZ', 'en_HK', 'en_IN', 'en_JM', 'en_NA', 
'en_PK', 'en_SG', 'en_TT', 'en_ZW',
@@ -2265,8 +2266,8 @@
 'en_KI', 'en_NU', 'en_SY', 'en_SO', 'en_TG', 'en_CU', 'en_HM', 'en_BV', 
'en_MS',
   );
   CRM_Core_DAO::executeQuery("UPDATE civicrm_contact SET preferred_language = 
'en' WHERE preferred_language IN('"
-. implode("',", $nonUsefulEnglishes) . "')");
+. implode("', '", $nonUsefulEnglishes) . "')");
   // This only needs to run on production so hard-coding option_group_id seems 
OK.
   CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value SET is_active = 0 
WHERE option_group_id = 86 AND value IN('"
-. implode("',", $nonUsefulEnglishes) . "')");
+. implode("', '", $nonUsefulEnglishes) . "')");
 }

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

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

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update backoffice message template to allow receipt resends.

2016-09-26 Thread Eileen (Code Review)
Eileen has uploaded a new change for review.

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

Change subject: Update backoffice message template to allow receipt resends.
..

Update backoffice message template to allow receipt resends.

Bug: T137496
Change-Id: I023e75b855b862e110234dedd6cd47faf2092832
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 82 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/52/312952/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index fbe6365..b29bd0f 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -59,6 +59,7 @@
 wmf_civicrm_update_7220();
 wmf_civicrm_update_7230();
 wmf_civicrm_update_7235();
+wmf_civicrm_update_7275();
 }
 
 /**
@@ -2271,3 +2272,84 @@
   CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value SET is_active = 0 
WHERE option_group_id = 86 AND value IN('"
 . implode("', '", $nonUsefulEnglishes) . "')");
 }
+
+/**
+ * Update offline message template to match thank you letter.
+ *
+ * The template is cut down from our standard thank you in the following ways
+ *
+ * 1) I pretty much by-passed translation - I’m thinking this is mostly for a 
small number of English language receipts
+ * to be manually generated. I’d need to do something more complex to get it 
translating well
+ * 2) I ditched the RecurringRestarted & UnrecordedCharge logic. I figured you 
would be sending these on request.
+ * 3)I have assumed we have a first name & not done the fall-back to donor (on 
assumption manual sends know the name).
+ * 4) I did not include "{% if recurring %} This donation is part of a 
recurring subscription.
+ * Monthly payments will be debited by the Wikimedia Foundation until you 
notify us to stop.
+ * If you’d like to cancel the payments please see our
+ * https://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Cancel_or_change_recurring_payment..
+ *
+ * In other words this is a pretty-simple English language solution.
+ *
+ * Bug T137496
+ */
+function wmf_civicrm_update_7275() {
+  civicrm_initialize();
+  $msg_html = '
+Dear {contact.first_name},
+
+Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most accessible and comprehensive source of free knowledge in the world.
+
+We believe that knowledge is a fundamental human right. As humanity rushes 
into our digital future, we need open, accessible, public spaces to access 
knowledge online. Wikimedia is such a space. Wikipedia delivers free knowledge 
to people, by people, in hundreds of languages around our planet.
+
+Over the course of a year, Wikipedia is edited and read by people on every 
continent, including Antarctica. Nearly half a billion people visit Wikipedia 
every month for everything from preserving cultural heritage, to improving 
cancer detection, to researching homework. They come to learn. They stay and 
discover.
+
+Everyone is a potential Wikipedian. If you don\\\'t find what you\\\'re 
looking for on Wikipedia, you can https://en.wikipedia.org/wiki/Special:UserLogin?type=signupcampaign=lila2015\;>start
 creating it yourself. The articles, words, pictures and data are created 
by a diverse community of people who volunteer to share their knowledge with 
the world.
+
+Every day, we ask ourselves how we can increase our impact, and ensure 
Wikipedia and its sister projects are even more accurate, rich, and accessible 
tomorrow than they are today. Your donation will help us get there.
+
+Thank you for keeping us growing and impacting lives another year.
+
+Wikimedia Foundation
+
+Many employers will match employee contributions: please check with your 
company to see if they have a https://wikimediafoundation.org/wiki/Matching_Gifts/form\;>corporate 
matching gift program.
+
+For your records: Your donation, number CNT-{
+$contactID}, on {
+$receive_date | truncate:10:\\\'\\\' | crmDate} was {
+$formValues . total_amount - $totalTaxAmount | crmMoney:$currency}.
+
+
+This letter may serve as a record of your donation. No goods or services 
were provided, in whole or in part, for this contribution. The Wikimedia 
Foundation, Inc. is a non-profit charitable corporation with 501(c)(3) tax 
exempt status in the United States. Our address is 149 New Montgomery, 6th 
Floor, San Francisco, CA, 94105. U.S. tax-exempt number: 20-0049703
+
+';
+
+  $msg_text = 'Dear {contact.first_name},
+
+Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the 

[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Always render tagline container

2016-09-26 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: Always render tagline container
..

Always render tagline container

I considered moving the margin-bottom from the tagline to the h1 but
for pages with a tagline the margin between the tagline and page actions
is wrong.

Rather than have to manage 2 different scenarios and introduce a "has-tagline"
or similar class it seemed neater and more consistent to always render the 
tagline container.

When taglines are available everywhere this will also provide a useful signal 
to bots that
scrape the html or JavaScript gadgets that a tagline for the page is needed.

Bug: T143533
Change-Id: I52576a6e744cbfb533032c7326f5f6e28631c202
---
M includes/skins/SkinMinerva.php
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index d85f9b1..f39ddf0 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -721,7 +721,7 @@
 * @returns string html for tagline
 */
protected function getTaglineHtml() {
-   $tagline = false;
+   $tagline = '';
if ( $this->isUserPage ) {
$fromDate = $this->pageUser->getRegistration();
if ( is_string( $fromDate ) ) {
@@ -738,8 +738,7 @@
}
}
}
-   return $tagline ?
-   Html::element( 'div', [ 'class' => 'tagline' ], 
$tagline ) : '';
+   return Html::element( 'div', [ 'class' => 'tagline' ], $tagline 
);
}
/**
 * Returns the HTML representing the heading.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52576a6e744cbfb533032c7326f5f6e28631c202
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 

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


[MediaWiki-commits] [Gerrit] mediawiki...CentralNotice[master]: Cleanup: Use helper functions

2016-09-26 Thread Awight (Code Review)
Awight has uploaded a new change for review.

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

Change subject: Cleanup: Use helper functions
..

Cleanup: Use helper functions

Change-Id: Ie54b91fecb2b764a620fc673e72fd81477044466
---
M includes/Banner.php
M special/SpecialCentralNoticeBanners.php
2 files changed, 4 insertions(+), 4 deletions(-)


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

diff --git a/includes/Banner.php b/includes/Banner.php
index e91dc10..5cf1159 100644
--- a/includes/Banner.php
+++ b/includes/Banner.php
@@ -931,6 +931,7 @@
 
try {
// Don't move this to saveBannerInternal--can't be in a 
transaction
+   // TODO: explain why not.  Is text in another database?
$this->saveBodyContent( $summary );
 
// Open a transaction so that everything is consistent
@@ -1083,9 +1084,7 @@
);
 
// Delete the MediaWiki page that contains the banner 
source
-   $article = new Article(
-   Title::newFromText( 
"centralnotice-template-{$name}", NS_MEDIAWIKI )
-   );
+   $article = new Article( $bannerObj->getTitle() );
$pageId = $article->getPage()->getId();
 
// TODO Inconsistency: deletion of banner content is 
not recorded
diff --git a/special/SpecialCentralNoticeBanners.php 
b/special/SpecialCentralNoticeBanners.php
index f8359a9..cf18795 100755
--- a/special/SpecialCentralNoticeBanners.php
+++ b/special/SpecialCentralNoticeBanners.php
@@ -377,7 +377,8 @@
)
);
 
-   $bannerTitle = Title::newFromText( 
"Centralnotice-template-{$this->bannerName}", NS_MEDIAWIKI );
+   $bannerObj = Banner::fromName( $this->bannerName );
+   $bannerTitle = $bannerObj->getTitle();
// $bannerTitle can be null sometimes
if ( $bannerTitle && $this->getUser()->isAllowed( 
'editinterface' ) ) {
$links[] = Linker::link(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie54b91fecb2b764a620fc673e72fd81477044466
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight 

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


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Blank user pages should be editable

2016-09-26 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: Blank user pages should be editable
..

Blank user pages should be editable

* Untangle checking if a page is editable from display of the edit icon.
* Improve existing isCurrentPageEditable method to also consider content type - 
benefit of this
is editor code will now not load for pages with incompatible content types
* Use existing method in page action logic
* Add a browser test to avoid this regression in future.

Bug: T143854
Change-Id: Ice5f5b8fd93c5f541d4877b1baca08719e9df484
---
M includes/skins/SkinMinerva.php
M tests/browser/features/step_definitions/user_page_steps.rb
M tests/browser/features/support/pages/user_page.rb
M tests/browser/features/user_page.feature
4 files changed, 29 insertions(+), 7 deletions(-)


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

diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index d85f9b1..1f27e50 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -163,10 +163,7 @@
}
 
if ( $action === 'edit' ) {
-   $contentHandler = $this->getContentHandler();
-
-   return $contentHandler->supportsDirectEditing() &&
-   $contentHandler->supportsDirectApiEditing();
+   return $this->isCurrentPageEditable();
}
 
if ( $action === 'switch-language' ) {
@@ -1064,17 +1061,22 @@
}
 
/**
-* Checks to see if the current page is (probably) editable.
+* Checks to see if the current page is (probably) editable and it is 
possible for the
+* editor to handle the existing content handler type.
 *
-* This is the same check that sets wgIsProbablyEditable later in the 
page output
+* This is the mostly the same check that sets wgIsProbablyEditable 
later in the page output
 * process.
 *
 * @return boolean
 */
protected function isCurrentPageEditable() {
+   $contentHandler = $this->getContentHandler();
+
$title = $this->getTitle();
$user = $this->getUser();
return $title->quickUserCan( 'edit', $user )
+   && $contentHandler->supportsDirectEditing()
+   && $contentHandler->supportsDirectApiEditing()
&& ( $title->exists() || $title->quickUserCan( 
'create', $user ) );
}
 
@@ -1170,7 +1172,7 @@
// Explicitly add the mobile watchstar code.
$modules[] = 'skins.minerva.watchstar';
}
-   if ( $this->isAllowedPageAction( 'edit' ) ) {
+   if ( $this->isCurrentPageEditable() ) {
$modules[] = 'skins.minerva.editor';
}
}
diff --git a/tests/browser/features/step_definitions/user_page_steps.rb 
b/tests/browser/features/step_definitions/user_page_steps.rb
index a10c0cd..d846823 100644
--- a/tests/browser/features/step_definitions/user_page_steps.rb
+++ b/tests/browser/features/step_definitions/user_page_steps.rb
@@ -22,3 +22,13 @@
 Then(/^there should be a link to my uploads$/) do
   expect(on(UserPage).uploads_link_element).to be_visible
 end
+
+Then(/^there should be a link to create my user page$/) do
+  expect(on(UserPage).edit_link_element).to be_visible
+end
+When(/^I click the create my user page link$/) do
+  on(UserPage) do |page|
+page.wait_until_rl_module_ready('skins.minerva.editor')
+page.edit_link_element.click
+  end
+end
diff --git a/tests/browser/features/support/pages/user_page.rb 
b/tests/browser/features/support/pages/user_page.rb
index 1c82d8e..8489a39 100644
--- a/tests/browser/features/support/pages/user_page.rb
+++ b/tests/browser/features/support/pages/user_page.rb
@@ -5,6 +5,7 @@
 
   h1(:heading, css: '#section_0')
   ul(:user_links, css: '.user-links')
+  div(:cta_holder, css: '.cta-holder')
   a(:talk_link) do |page|
 page.user_links_element.element.a(href: /User_talk:/)
   end
@@ -14,4 +15,7 @@
   a(:uploads_link) do |page|
 page.user_links_element.element.a(href: /Special:Uploads\//)
   end
+  a(:edit_link) do |page|
+page.cta_holder_element.element.a(href: /\#\/editor\/0/)
+  end
 end
diff --git a/tests/browser/features/user_page.feature 
b/tests/browser/features/user_page.feature
index fb5bfb8..29fd9c1 100644
--- a/tests/browser/features/user_page.feature
+++ b/tests/browser/features/user_page.feature
@@ -10,3 +10,9 @@
 And there should be a link to my talk page
 And there should be a link to my contributions
 And there should be a link to my uploads
+
+  Scenario: Check user 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Fix failing keyholder arming check

2016-09-26 Thread Thcipriani (Code Review)
Thcipriani has uploaded a new change for review.

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

Change subject: Fix failing keyholder arming check
..

Fix failing keyholder arming check

The latest version of openssh-client no longer stores or outputs the
key filenames along with the ssh public-key fingerprint as part of
ssh-add -l.

This changes the keyholder check script to just compare public key
fingerprints rather than private-key filenames.

Change-Id: Ic6784e505d4734a725bda2a278745cf53575c11f
---
M modules/keyholder/files/check_keyholder
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/modules/keyholder/files/check_keyholder 
b/modules/keyholder/files/check_keyholder
index 448d645..2361ddf 100755
--- a/modules/keyholder/files/check_keyholder
+++ b/modules/keyholder/files/check_keyholder
@@ -5,12 +5,14 @@
 
 configured_keys() {
   # Get a sorted list of all key files in /etc/keyholder.d
-  /usr/bin/find /etc/keyholder.d -type f -not -name '*.pub' 2>/dev/null | 
/usr/bin/sort
+  for key in /etc/keyholder.d/*.pub; do
+  /usr/bin/ssh-keygen -l -f "$key" | /usr/bin/cut -d' ' -f2 2>/dev/null;
+  done | sort
 }
 
 active_keys() {
   # Get a sorted list of all keys currently represented by the agent.
-  /usr/bin/ssh-add -l 2>/dev/null | /usr/bin/cut -d' ' -f 3 | /usr/bin/sort
+  /usr/bin/ssh-add -l 2>/dev/null | /usr/bin/cut -d' ' -f 2 | /usr/bin/sort
 }
 
 [ -S "$SSH_AUTH_SOCK" ] || {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Be explicit with dependency

2016-09-26 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: Be explicit with dependency
..

Be explicit with dependency

If skins.minerva.scripts is top loaded
(ie. a module is added with position:top which specifies it as a dependency)
then it is highly possible this module will finish loading before 
skins.minerva.scripts.top

I've run into this issue a few times today, but it appears to be hard to 
replicate

(PS. Can't find the bug anymore which reported this - if someone finds it
can they tag it correctly)

Change-Id: Ia2f8c90815bda38bf458b3d27be4b53aee7c35b6
---
M extension.json
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/extension.json b/extension.json
index ba9b3ea..a33b50a 100644
--- a/extension.json
+++ b/extension.json
@@ -1598,6 +1598,7 @@
"desktop"
],
"dependencies": [
+   "skins.minerva.scripts.top",
"mediawiki.util",
"mediawiki.router",
"mobile.startup",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2f8c90815bda38bf458b3d27be4b53aee7c35b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace DatabaseBase:: with Database::

2016-09-26 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review.

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

Change subject: Replace DatabaseBase:: with Database::
..

Replace DatabaseBase:: with Database::

Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
---
M includes/changetags/ChangeTags.php
M includes/db/DatabaseMssql.php
M includes/filerepo/ForeignDBRepo.php
M includes/installer/MssqlInstaller.php
M includes/installer/MysqlInstaller.php
M includes/installer/PostgresInstaller.php
M includes/installer/SqliteInstaller.php
M includes/libs/lockmanager/DBLockManager.php
M includes/libs/rdbms/database/Database.php
M includes/libs/rdbms/database/DatabaseSqlite.php
M includes/libs/rdbms/database/IDatabase.php
M includes/libs/rdbms/encasing/LikeMatch.php
M includes/objectcache/SqlBagOStuff.php
M includes/page/WikiPage.php
M includes/user/User.php
M tests/phpunit/includes/WatchedItemQueryServiceUnitTest.php
M tests/phpunit/includes/db/DatabaseSQLTest.php
M tests/phpunit/includes/db/DatabaseSqliteTest.php
M tests/phpunit/includes/db/DatabaseTest.php
M tests/phpunit/includes/installer/DatabaseUpdaterTest.php
M tests/phpunit/includes/utils/BatchRowUpdateTest.php
21 files changed, 82 insertions(+), 82 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/45/312945/1

diff --git a/includes/changetags/ChangeTags.php 
b/includes/changetags/ChangeTags.php
index 6455a3a..955e972 100644
--- a/includes/changetags/ChangeTags.php
+++ b/includes/changetags/ChangeTags.php
@@ -608,10 +608,10 @@
 * Handles selecting tags, and filtering.
 * Needs $tables to be set up properly, so we can figure out which join 
conditions to use.
 *
-* @param string|array $tables Table names, see DatabaseBase::select
-* @param string|array $fields Fields used in query, see 
DatabaseBase::select
-* @param string|array $conds Conditions used in query, see 
DatabaseBase::select
-* @param array $join_conds Join conditions, see DatabaseBase::select
+* @param string|array $tables Table names, see Database::select
+* @param string|array $fields Fields used in query, see 
Database::select
+* @param string|array $conds Conditions used in query, see 
Database::select
+* @param array $join_conds Join conditions, see Database::select
 * @param array $options Options, see Database::select
 * @param bool|string $filter_tag Tag to select on
 *
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index eb061d8..45ea54c 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -737,15 +737,15 @@
 * UPDATE wrapper. Takes a condition array and a SET array.
 *
 * @param string $table Name of the table to UPDATE. This will be 
passed through
-*DatabaseBase::tableName().
+*Database::tableName().
 *
 * @param array $values An array of values to SET. For each array 
element,
 *the key gives the field name, and the value gives the 
data
 *to set that field to. The data will be quoted by
-*DatabaseBase::addQuotes().
+*Database::addQuotes().
 *
 * @param array $conds An array of conditions (WHERE). See
-*DatabaseBase::select() for the details of the format 
of
+*Database::select() for the details of the format of
 *condition arrays. Use '*' to update all rows.
 *
 * @param string $fname The function name of the caller (from 
__METHOD__),
@@ -786,7 +786,7 @@
 * @param int $mode Constant
 *  - LIST_COMMA:  comma separated, no field names
 *  - LIST_AND:ANDed WHERE clause (without the WHERE). 
See
-*the documentation for $conds in DatabaseBase::select().
+*the documentation for $conds in Database::select().
 *  - LIST_OR: ORed WHERE clause (without the WHERE)
 *  - LIST_SET:comma separated with field names, like a 
SET clause
 *  - LIST_NAMES:  comma separated field names
diff --git a/includes/filerepo/ForeignDBRepo.php 
b/includes/filerepo/ForeignDBRepo.php
index 001800f..be046bd 100644
--- a/includes/filerepo/ForeignDBRepo.php
+++ b/includes/filerepo/ForeignDBRepo.php
@@ -106,7 +106,7 @@
];
 
return function ( $index ) use ( $type, $params ) {
-   return DatabaseBase::factory( $type, $params );
+   return Database::factory( $type, $params );
};
}
 
diff --git a/includes/installer/MssqlInstaller.php 
b/includes/installer/MssqlInstaller.php
index 62cd883..cd67c16 100644
--- 

[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: Remove use of a removed function

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

Change subject: Remove use of a removed function
..


Remove use of a removed function

Change-Id: Iac8bec0a0a2625e40c5c70a715ffb4784224f164
---
M includes/ApiQueryExtracts.php
1 file changed, 1 insertion(+), 6 deletions(-)

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



diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index 0fe7a86..944b649 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -180,12 +180,7 @@
$this->parserOptions = new ParserOptions( new User( 
'127.0.0.1' ) );
}
// first try finding full page in parser cache
-   if ( method_exists( $page, 'isParserCachedUsed' ) ) {
-   $useCache = $page->isParserCacheUsed( 
$this->parserOptions, 0 );
-   } else {
-   $useCache = $page->shouldCheckParserCache( 
$this->parserOptions, 0 );
-   }
-   if ( $useCache ) {
+   if ( $page->shouldCheckParserCache( $this->parserOptions, 0 ) ) 
{
$pout = ParserCache::singleton()->get( $page, 
$this->parserOptions );
if ( $pout ) {
$pout->setTOCEnabled( false );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac8bec0a0a2625e40c5c70a715ffb4784224f164
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Aaron Schulz 
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...TextExtracts[master]: CodeSniffer fixes

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

Change subject: CodeSniffer fixes
..


CodeSniffer fixes

Change-Id: I8bdcd2250bd3163fe40ce4685eb04bffe53afdca
---
M includes/ApiQueryExtracts.php
M includes/ExtractFormatter.php
M includes/Hooks.php
M tests/phpunit/ExtractFormatterTest.php
4 files changed, 83 insertions(+), 84 deletions(-)

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



diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index ce7f70a..e704cef 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -48,7 +48,7 @@
/**
 * @var array
 */
-   private $supportedContentModels  = array( 'wikitext' );
+   private $supportedContentModels = [ 'wikitext' ];
 
public function __construct( $query, $moduleName, Config $conf ) {
parent::__construct( $query, $moduleName, 'ex' );
@@ -91,9 +91,9 @@
}
 
if ( $isXml ) {
-   $fit = $result->addValue( array( 'query', 
'pages', $id ), 'extract', array( '*' => $text ) );
+   $fit = $result->addValue( [ 'query', 'pages', 
$id ], 'extract', [ '*' => $text ] );
} else {
-   $fit = $result->addValue( array( 'query', 
'pages', $id ), 'extract', $text );
+   $fit = $result->addValue( [ 'query', 'pages', 
$id ], 'extract', $text );
}
if ( !$fit ) {
$this->setContinueEnumParameter( 'continue', 
$continue + $count - 1 );
@@ -196,33 +196,33 @@
return $text;
}
}
-   $request = array(
+   $request = [
'action' => 'parse',
'page' => $page->getTitle()->getPrefixedText(),
'prop' => 'text'
-   );
+   ];
if ( $this->params['intro'] ) {
$request['section'] = 0;
}
// in case of cache miss, render just the needed section
-   $api = new ApiMain( new FauxRequest( $request ) );
+   $api = new ApiMain( new FauxRequest( $request ) );
try {
$api->execute();
-   $data = $api->getResult()->getResultData( null, array(
-   'BC' => array(),
-   'Types' => array(),
-   ) );
+   $data = $api->getResult()->getResultData( null, [
+   'BC' => [],
+   'Types' => [],
+   ] );
} catch ( UsageException $e ) {
if ( $e->getCodeString() === 'nosuchsection' ) {
// Looks like we tried to get the intro to a 
page without
// sections!  Lets just grab what we can get.
unset( $request['section'] );
-   $api = new ApiMain( new FauxRequest( $request ) 
);
+   $api = new ApiMain( new FauxRequest( $request ) 
);
$api->execute();
-   $data = $api->getResult()->getResultData( null, 
array(
-   'BC' => array(),
-   'Types' => array(),
-   ) );
+   $data = $api->getResult()->getResultData( null, 
[
+   'BC' => [],
+   'Types' => [],
+   ] );
} else {
// Some other unexpected error - lets just 
report it to the user
// on the off chance that is the right thing.
@@ -304,7 +304,7 @@
 */
private function tidy( $text ) {
if ( $this->getConfig()->get( 'UseTidy' ) && 
!$this->params['plaintext'] ) {
-   $text = trim ( MWTidy::tidy( $text ) );
+   $text = trim( MWTidy::tidy( $text ) );
}
return $text;
}
@@ -312,7 +312,7 @@
private function doSections( $text ) {
$text = preg_replace_callback(
"/" . ExtractFormatter::SECTION_MARKER_START . '(\d)'. 
ExtractFormatter::SECTION_MARKER_END . "(.*?)$/m",
-   array( $this, 'sectionCallback' ),
+   [ $this, 'sectionCallback' ],
$text
);
return $text;
@@ -336,44 +336,44 @@
}
 
public 

[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: Minor fixes

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

Change subject: Minor fixes
..


Minor fixes

* Annotations
* Deprecated functions
* Namespace tests

Change-Id: I521f6af6074a454cec5322ab4cd46db08350c2c3
---
M includes/ApiQueryExtracts.php
M includes/ExtractFormatter.php
M includes/Hooks.php
M tests/phpunit/ExtractFormatterTest.php
4 files changed, 14 insertions(+), 7 deletions(-)

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



diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index e704cef..0fe7a86 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -22,8 +22,8 @@
 use ApiMain;
 use ApiQueryBase;
 use Config;
-use ConfigFactory;
 use FauxRequest;
+use MediaWiki\MediaWikiServices;
 use MWTidy;
 use ParserCache;
 use ParserOptions;
@@ -131,7 +131,7 @@
}
if ( $text === false ) {
$text = $this->parse( $page );
-   $text = $this->convertText( $text, $title, 
$this->params['plaintext'] );
+   $text = $this->convertText( $text );
$this->setCache( $page, $text );
}
return $text;
@@ -238,7 +238,7 @@
 * @return ApiQueryExtracts
 */
public static function factory( $query, $action ) {
-   $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'textextracts' );
+   $config = 
MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 
'textextracts' );
return new self( $query, $action, $config );
}
 
diff --git a/includes/ExtractFormatter.php b/includes/ExtractFormatter.php
index 30a88f0..3f1c4af 100644
--- a/includes/ExtractFormatter.php
+++ b/includes/ExtractFormatter.php
@@ -3,6 +3,7 @@
 namespace TextExtracts;
 
 use Config;
+use DOMElement;
 use HtmlFormatter\HtmlFormatter;
 use Exception;
 
@@ -136,6 +137,7 @@
$doc = $this->getDoc();
$spans = $doc->getElementsByTagName( 'span' );
 
+   /** @var DOMElement $span */
foreach ( $spans as $span ) {
$span->removeAttribute( 'class' );
$span->removeAttribute( 'style' );
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 7aabce2..36f8905 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -4,8 +4,8 @@
 
 use ApiMain;
 use ApiResult;
-use ConfigFactory;
 use FauxRequest;
+use MediaWiki\MediaWikiServices;
 
 class Hooks {
 
@@ -15,7 +15,7 @@
 * @return bool
 */
public static function onApiOpenSearchSuggest( &$results ) {
-   $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'textextracts' );
+   $config = 
MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 
'textextracts' );
if ( !$config->get( 'ExtractsExtendOpenSearchXml' ) || !count( 
$results ) ) {
return true;
}
diff --git a/tests/phpunit/ExtractFormatterTest.php 
b/tests/phpunit/ExtractFormatterTest.php
index 07366e8..c633fb3 100644
--- a/tests/phpunit/ExtractFormatterTest.php
+++ b/tests/phpunit/ExtractFormatterTest.php
@@ -1,4 +1,10 @@
 setEditSection( true );
-   $config = ConfigFactory::getDefaultInstance()->makeConfig( 
'textextracts' );
+   $config = 
MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 
'textextracts' );
$fmt = new ExtractFormatter( $text, $plainText, $config );
$fmt->remove( '.metadata' ); // Will be added via 
$wgExtractsRemoveClasses on WMF
$text = trim( $fmt->getText() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I521f6af6074a454cec5322ab4cd46db08350c2c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Adding language name configuration for Wikidata

2016-09-26 Thread Code Review
Jon Harald Søby has uploaded a new change for review.

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

Change subject: Adding language name configuration for Wikidata
..

Adding language name configuration for Wikidata

* sje: bidumsámegiella
* smj: julevsámegiella

Bug: T146707
Change-Id: I22f88b5e71880049e117ef45ce7345652fd4f3be
---
M wmf-config/InitialiseSettings.php
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 7b8fc72..83b3aae 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -16196,6 +16196,8 @@
'nod' => 'ᨣᩴᩤᨾᩮᩥᩬᨦ',// T93880
'ota' => 'لسان توركى',  // T59342
'rwr' => 'मारवाड़ी',   // T61905
+   'sje' => 'bidumsámegiella', // T146707
+   'smj' => 'julevsámegiella', // T146707
],
 ],
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22f88b5e71880049e117ef45ce7345652fd4f3be
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Jon Harald Søby 

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: bitbucket has hg and git

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

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

Change subject: repository: bitbucket has hg and git
..

repository: bitbucket has hg and git

Let auto detection do the work.

Change-Id: I3faaace8ca7616b9c87c5d52d993dbc24de1b447
Signed-off-by: Loic Dachary 
---
M FLOSSbot/repository.py
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index c18ea51..41ec3c7 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -189,8 +189,6 @@
 return self.Q_git
 if 'code.launchpad.net' in url:
 return self.Q_GNU_Bazaar
-if 'bitbucket.org' in url:
-return self.Q_git
 if url.lower().startswith('http'):
 known = (
 'http://bxr.su/',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3faaace8ca7616b9c87c5d52d993dbc24de1b447
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]: AuthManager phpdoc cleanup

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

Change subject: AuthManager phpdoc cleanup
..


AuthManager phpdoc cleanup

Change-Id: Ib6fa897e76ae479de68acaeb16708c2bdf15ae5f
---
M includes/auth/ButtonAuthenticationRequest.php
M includes/auth/PasswordDomainAuthenticationRequest.php
M includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
M includes/specialpage/AuthManagerSpecialPage.php
4 files changed, 8 insertions(+), 1 deletion(-)

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



diff --git a/includes/auth/ButtonAuthenticationRequest.php 
b/includes/auth/ButtonAuthenticationRequest.php
index 055d7ea..d274e18 100644
--- a/includes/auth/ButtonAuthenticationRequest.php
+++ b/includes/auth/ButtonAuthenticationRequest.php
@@ -81,6 +81,8 @@
 
/**
 * @codeCoverageIgnore
+* @param array $data
+* @return AuthenticationRequest|static
 */
public static function __set_state( $data ) {
if ( !isset( $data['label'] ) ) {
diff --git a/includes/auth/PasswordDomainAuthenticationRequest.php 
b/includes/auth/PasswordDomainAuthenticationRequest.php
index ddad54b..3db7e21 100644
--- a/includes/auth/PasswordDomainAuthenticationRequest.php
+++ b/includes/auth/PasswordDomainAuthenticationRequest.php
@@ -70,6 +70,8 @@
 
/**
 * @codeCoverageIgnore
+* @param array $data
+* @return AuthenticationRequest|static
 */
public static function __set_state( $data ) {
$ret = new static( $data['domainList'] );
diff --git a/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php 
b/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
index f11a12c..45ac3aa 100644
--- a/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
+++ b/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
@@ -58,6 +58,7 @@
 
/**
 * Try to reset the password
+* @param \User $user
 * @param AuthenticationRequest[] $reqs
 * @return AuthenticationResponse
 */
diff --git a/includes/specialpage/AuthManagerSpecialPage.php 
b/includes/specialpage/AuthManagerSpecialPage.php
index 3adf5a6..bdf7638 100644
--- a/includes/specialpage/AuthManagerSpecialPage.php
+++ b/includes/specialpage/AuthManagerSpecialPage.php
@@ -43,7 +43,7 @@
 * Change the form descriptor that determines how a field will look in 
the authentication form.
 * Called from fieldInfoToFormDescriptor().
 * @param AuthenticationRequest[] $requests
-* @param string $fieldInfo Field information array (union of all
+* @param array $fieldInfo Field information array (union of all
 *AuthenticationRequest::getFieldInfo() responses).
 * @param array $formDescriptor HTMLForm descriptor. The special key 
'weight' can be set to
 *change the order of the fields.
@@ -205,6 +205,7 @@
/**
 * Return custom message key.
 * Allows subclasses to customize messages.
+* @param string $defaultKey
 * @return string
 */
protected function messageKey( $defaultKey ) {
@@ -668,6 +669,7 @@
 * Maps an authentication field configuration for a single field (as 
returned by
 * AuthenticationRequest::getFieldInfo()) to a HTMLForm field 
descriptor.
 * @param array $singleFieldInfo
+* @param string $fieldName
 * @return array
 */
protected static function mapSingleFieldInfo( $singleFieldInfo, 
$fieldName ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6fa897e76ae479de68acaeb16708c2bdf15ae5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Gergő Tisza 
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...AbuseFilter[master]: Lower stash logging to debug()

2016-09-26 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review.

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

Change subject: Lower stash logging to debug()
..

Lower stash logging to debug()

Change-Id: I480b491d788e2ce970238c103b2ff05167312513
---
M AbuseFilter.class.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php
index bbb5b30..f816525 100644
--- a/AbuseFilter.class.php
+++ b/AbuseFilter.class.php
@@ -933,7 +933,7 @@
// Save the filter stash result and do nothing further
$cacheData = [ 'matches' => $filter_matched, 'tags' => 
self::$tagsToSet ];
$cache->set( $stashKey, $cacheData, $cache::TTL_MINUTE 
);
-   $logger->info( __METHOD__ . ": cache store for '$title' 
(key $stashKey)." );
+   $logger->debug( __METHOD__ . ": cache store for 
'$title' (key $stashKey)." );
$statsd->increment( 'abusefilter.check-stash.store' );
 
return Status::newGood();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I480b491d788e2ce970238c103b2ff05167312513
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

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


[MediaWiki-commits] [Gerrit] mediawiki...OAuth[master]: Set doesWrites() for special pages

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

Change subject: Set doesWrites() for special pages
..


Set doesWrites() for special pages

Change-Id: I554beb5a2d322e0e0402d9f94bc555d544fbd46f
---
M frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
M frontend/specialpages/SpecialMWOAuthManageConsumers.php
M frontend/specialpages/SpecialMWOAuthManageMyGrants.php
3 files changed, 12 insertions(+), 0 deletions(-)

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



diff --git a/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php 
b/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
index bd94eeb..a3143e1 100644
--- a/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
+++ b/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php
@@ -29,6 +29,10 @@
parent::__construct( 'OAuthConsumerRegistration' );
}
 
+   public function doesWrites() {
+   return true;
+   }
+
public function execute( $par ) {
global $wgMWOAuthSecureTokenTransfer, $wgMWOAuthReadOnly;
 
diff --git a/frontend/specialpages/SpecialMWOAuthManageConsumers.php 
b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
index 7ae0d52..ee662b0 100755
--- a/frontend/specialpages/SpecialMWOAuthManageConsumers.php
+++ b/frontend/specialpages/SpecialMWOAuthManageConsumers.php
@@ -49,6 +49,10 @@
parent::__construct( 'OAuthManageConsumers', 
'mwoauthmanageconsumer' );
}
 
+   public function doesWrites() {
+   return true;
+   }
+
public function execute( $par ) {
global $wgMWOAuthReadOnly;
 
diff --git a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php 
b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
index e753172..d869f37 100644
--- a/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
+++ b/frontend/specialpages/SpecialMWOAuthManageMyGrants.php
@@ -32,6 +32,10 @@
parent::__construct( 'OAuthManageMyGrants', 
'mwoauthmanagemygrants' );
}
 
+   public function doesWrites() {
+   return true;
+   }
+
public function execute( $par ) {
global $wgMWOAuthReadOnly;
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I554beb5a2d322e0e0402d9f94bc555d544fbd46f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Always throw exception on execute failure

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

Change subject: Always throw exception on execute failure
..


Always throw exception on execute failure

Run everything through prepareAndExecute, make it return the
executed statement for retrieval.

Change-Id: I7d9763bc499f3c3fc447f76c32aadf9bc6040e8a
---
M Core/DataStores/DamagedDatabase.php
M Core/DataStores/PaymentsInitialDatabase.php
M Core/DataStores/PendingDatabase.php
M Core/DataStores/SmashPigDatabase.php
4 files changed, 63 insertions(+), 64 deletions(-)

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



diff --git a/Core/DataStores/DamagedDatabase.php 
b/Core/DataStores/DamagedDatabase.php
index c5498ba..09edde3 100644
--- a/Core/DataStores/DamagedDatabase.php
+++ b/Core/DataStores/DamagedDatabase.php
@@ -2,7 +2,6 @@
 namespace SmashPig\Core\DataStores;
 
 use PDO;
-use SmashPig\Core\SmashPigException;
 use SmashPig\Core\UtcDate;
 
 /**
@@ -20,7 +19,6 @@
 * @param int|null $retryDate When provided, re-process message after
 *  this timestamp
 * @return int ID of message in damaged database
-* @throws SmashPigException if insert fails
 */
public function storeMessage(
$message,
@@ -66,10 +64,7 @@
$insert = "INSERT INTO damaged ( $fieldList )
VALUES ( $paramList );";
 
-   if ( $this->prepareAndExecute( $insert, $dbRecord ) ) {
-   return $this->getDatabase()->lastInsertId();
-   }
-   throw new SmashPigException( 'Unable to insert into damaged db' 
);
+   $this->prepareAndExecute( $insert, $dbRecord );
}
 
/**
@@ -79,20 +74,18 @@
 * @return array|null Records with retry_date prior to now
 */
public function fetchRetryMessages( $limit ) {
-   $prepared = self::$db->prepare(
-   '
-   SELECT * FROM damaged
+   $sql = 'SELECT * FROM damaged
WHERE retry_date < :now
ORDER BY retry_date ASC
-   LIMIT ' . $limit
+   LIMIT ' . $limit;
+
+   $params = array(
+   'now' => UtcDate::getUtcDatabaseString()
);
-   $prepared->bindValue(
-   ':now',
-   UtcDate::getUtcDatabaseString(),
-   PDO::PARAM_STR
-   );
-   $prepared->execute();
-   $rows = $prepared->fetchAll( PDO::FETCH_ASSOC );
+
+   $executed = $this->prepareAndExecute( $sql, $params);
+
+   $rows = $executed->fetchAll( PDO::FETCH_ASSOC );
return array_map(
array( $this, 'messageFromDbRow' ),
$rows
@@ -105,13 +98,12 @@
 * @param array $message
 */
public function deleteMessage( $message ) {
-   $prepared = self::$db->prepare(
-   '
-   DELETE FROM damaged
-   WHERE id = :id'
+   $sql = 'DELETE FROM damaged
+   WHERE id = :id';
+   $params = array(
+   'id' => $message['damaged_id']
);
-   $prepared->bindValue( ':id', $message['damaged_id'], 
PDO::PARAM_STR );
-   $prepared->execute();
+   $this->prepareAndExecute( $sql, $params );
}
 
/**
@@ -125,16 +117,13 @@
if ( $queue ) {
$sql .= ' AND original_queue = :queue';
}
-   $prepared = self::$db->prepare( $sql );
-   $prepared->bindValue(
-   ':date',
-   UtcDate::getUtcDatabaseString( $originalDate ),
-   PDO::PARAM_STR
+   $params = array(
+   'date' => UtcDate::getUtcDatabaseString( $originalDate 
),
);
if ( $queue ) {
-   $prepared->bindValue( ':queue', $queue, PDO::PARAM_STR 
);
+   $params['queue'] = $queue;
}
-   $prepared->execute();
+   $this->prepareAndExecute( $sql, $params );
}
 
/**
diff --git a/Core/DataStores/PaymentsInitialDatabase.php 
b/Core/DataStores/PaymentsInitialDatabase.php
index 490b6f5..5411c58 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -38,15 +38,16 @@
 * @return array|null Record related to a transaction, or null if 
nothing matches
 */
public function fetchMessageByGatewayOrderId( $gatewayName, $orderId ) {
-   $prepared = self::$db->prepare( '
-   select * from payments_initial
+  

[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: (re)Add JavaScript hooks to Notifications

2016-09-26 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: (re)Add JavaScript hooks to Notifications
..

(re)Add JavaScript hooks to Notifications

Added the following Javascript hooks:
* ext.echo.notifications.beforeRender: Firing before a group of
  notification widgets are rendered, whether in the popup, in
  the special page, or in a cross-wiki bundle (which requires
  async loading)
* ext.echo.badge.countChange: Fired when the badge count changes
  with the notification type, count and the label count for
  display purposes.
* ext.echo.popup.onInitialize: Fired when the popup is opened and
  after notifications were fetched, with the context of the popup
  notification type.

The hooks were also documented in hooks.txt

Bug: T146296
Change-Id: Ie3dc97f97e8d1f90b67f62fcdc65dd29cb379aad
---
M modules/hooks.txt
M modules/ui/mw.echo.ui.BadgeLinkWidget.js
M modules/ui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ui/mw.echo.ui.NotificationsListWidget.js
M modules/ui/mw.echo.ui.SubGroupListWidget.js
5 files changed, 64 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/40/312940/1

diff --git a/modules/hooks.txt b/modules/hooks.txt
index bad428a..bbd3b98 100644
--- a/modules/hooks.txt
+++ b/modules/hooks.txt
@@ -2,6 +2,18 @@
 
 This documents Echo's client-side hooks:
 
-'ext.echo.overlay.beforeShowingOverlay': Before showing the Echo overlay, it is
-passed to this hook, which can modify the DOM or take other actions.
-$overlay: the jQuery-wrapped element for the overlay
+'ext.echo.notifications.beforeRender': Before notification widgets are rendered
+the wrapper of the notifications and the individual notification jQuery 
elements
+are passed to this hook, which can modify the DOM or take other actions.
+* $wrapper: The jQuery object that is the wrapper for the notification items
+* $elements: A jQuery group of all notification elements that are about to be 
rendered.
+
+'ext.echo.badge.countChange': When the count changes in the Notifications popup
+badge, this hook is fired with the new count.
+* types: Notifications type that the badge represents. Can be 'message', 
'alert' or 'all'
+* count: The new numerical count in the notifications popup.
+* label: The label for this number, for presentation purposes.
+
+'ext.echo.popup.onInitialize': Fired when the popup is opened and after 
notifications
+were fetched from the API.
+* types: Notifications type that the badge represents. Can be 'message', 
'alert' or 'all'
diff --git a/modules/ui/mw.echo.ui.BadgeLinkWidget.js 
b/modules/ui/mw.echo.ui.BadgeLinkWidget.js
index 9eabb67..f7cecf0 100644
--- a/modules/ui/mw.echo.ui.BadgeLinkWidget.js
+++ b/modules/ui/mw.echo.ui.BadgeLinkWidget.js
@@ -7,6 +7,8 @@
 *
 * @constructor
 * @param {Object} [config] Configuration object
+* @cfg {string} [types] The notification types this button represents;
+*  'message', 'alert' or 'all'
 * @cfg {string} [href] URL the badge links to
 */
mw.echo.ui.BadgeLinkWidget = function MwEchoUiBadgeLinkWidget( config ) 
{
@@ -24,6 +26,8 @@
this.$element
.addClass( 'mw-echo-notifications-badge' );
 
+   this.count = 0;
+   this.types = config.type || 'alert';
this.setCount( config.numItems, config.label );
 
if ( config.href !== undefined && OO.ui.isSafeUrl( config.href 
) ) {
@@ -48,6 +52,13 @@
mw.echo.ui.BadgeLinkWidget.prototype.setCount = function ( numItems, 
label ) {
label = label || numItems;
 
+   if ( this.count !== numItems ) {
+   this.count = numItems;
+
+   // Fire badge count change hook
+   mw.hook( 'ext.echo.badge.countChange' ).fire( 
this.types, this.count, label );
+   }
+
this.$element
.toggleClass( 'mw-echo-notifications-badge-all-read', 
!numItems )
.attr( 'data-counter-num', numItems )
diff --git a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js 
b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
index d7dcbdb..d5c1f5d 100644
--- a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js
@@ -61,6 +61,7 @@
 
this.badgeButton = new mw.echo.ui.BadgeLinkWidget( {
label: this.badgeLabel,
+   types: this.manager.getTypeString(),
numItems: this.numItems,
flags: buttonFlags,
// The following messages can be used here:
@@ -330,6 +331,10 @@
// Always populate on popup open. The model and widget should 
handle
// the case where the promise is already underway.
   

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Just respond 200 to GET requests

2016-09-26 Thread Cdentinger (Code Review)
Cdentinger has uploaded a new change for review.

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

Change subject: Just respond 200 to GET requests
..

Just respond 200 to GET requests

The app monitor software is spamming redis

Change-Id: If2d3d6337c850d3ffbcca8217dbdeecf6b5d5fb1
---
M PaymentProviders/PayPal/Listener.php
M PaymentProviders/PayPal/PayPalPaymentsAPI.php
M PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
M PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
4 files changed, 32 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/41/312941/1

diff --git a/PaymentProviders/PayPal/Listener.php 
b/PaymentProviders/PayPal/Listener.php
index 62cece9..0e1ed0d 100644
--- a/PaymentProviders/PayPal/Listener.php
+++ b/PaymentProviders/PayPal/Listener.php
@@ -9,6 +9,17 @@
 
public function execute( Request $request, Response $response ) {
$this->config = Configuration::getDefaultConfig();
+
+   // FIXME hacky af, don't process watchmouse heartbeat. fix this 
by
+   // having them send something specific and ignore app-wide.
+   if (
+   is_array( $_SERVER ) &&
+   array_key_exists( 'REQUEST_METHOD', $_SERVER ) &&
+   $_SERVER['REQUEST_METHOD'] === 'GET'
+   ) {
+   $this->config->object( 'api' )->respond_to_monitor();
+   }
+
// Dump the request right into the queue with no validation.
$job = new Job;
$job->payload = $request->getValues();
diff --git a/PaymentProviders/PayPal/PayPalPaymentsAPI.php 
b/PaymentProviders/PayPal/PayPalPaymentsAPI.php
index 9dac247..ab5db49 100644
--- a/PaymentProviders/PayPal/PayPalPaymentsAPI.php
+++ b/PaymentProviders/PayPal/PayPalPaymentsAPI.php
@@ -11,6 +11,11 @@
return curl_exec( $ch );
}
 
+   // Another, afaict you literally can't test code that calls header()
+   public function respond_to_monitor () {
+   header( 'X-PHP-Response-Code: 200', true, 200 );
+   }
+
/**
 * @return boolean
 */
diff --git a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php 
b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
index ac0ef67..883b30e 100644
--- a/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
+++ b/PaymentProviders/PayPal/Tests/MockPayPalPaymentsAPI.php
@@ -9,4 +9,7 @@
}
return 'VERIFIED';
}
+   public function respond_to_monitor() {
+   throw new \Exception( 'X-PHP-Response-Code: 200' );
+   }
 }
diff --git 
a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php 
b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
index 8b7e59f..0b451a6 100644
--- a/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
+++ b/PaymentProviders/PayPal/Tests/phpunit/CaptureIncomingMessageTest.php
@@ -44,7 +44,7 @@
}
}
 
-   private function capture ( $msg ) {
+   private function capture( $msg ) {
$request = new Request( $msg );
$response = new Response;
$listener = new Listener;
@@ -67,7 +67,17 @@
}
}
 
-   public function testConsume () {
+   public function testMonitorResponse() {
+   $_SERVER['REQUEST_METHOD'] = 'GET';
+   try {
+   $this->capture( array() );
+   } catch ( \Exception $e ) {
+   // TODO how to verify that *no* queue was written to
+   $this->assertEquals( $e->getMessage(), 
'X-PHP-Response-Code: 200' );
+   }
+   }
+
+   public function testConsume() {
foreach ( self::$messages as $type => $msg ) {
$this->capture( $msg );
 
@@ -89,7 +99,7 @@
}
}
 
-   public function testFailedConsume () {
+   public function testFailedConsume() {
self::$fail_verification = true;
$jobMessage = array( 'txn_type' => 'fail' );
$jobClass = 'SmashPig\PaymentProviders\PayPal\Job';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If2d3d6337c850d3ffbcca8217dbdeecf6b5d5fb1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Cdentinger 

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Remove underscores from video filenames when loading in gallery

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

Change subject: Remove underscores from video filenames when loading in gallery
..


Remove underscores from video filenames when loading in gallery

It seems that a video's being playable in the Gallery activity depends
on its filename NOT containing underscores in place of spaces.  Use
StringUtil.removeUnderscores to remove them when loading from the content
service.  (They're already absent when coming from mobileview HTML.)

Bug: T140905
Change-Id: I3a7eceb55051adf3f40cd583ef2d661141894236
---
M app/src/main/java/org/wikipedia/page/PageFragment.java
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 1b84651..a1af473 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -72,6 +72,7 @@
 import org.wikipedia.util.FeedbackUtil;
 import org.wikipedia.util.ResourceUtil;
 import org.wikipedia.util.ShareUtil;
+import org.wikipedia.util.StringUtil;
 import org.wikipedia.util.ThrowableUtil;
 import org.wikipedia.util.UriUtil;
 import org.wikipedia.util.log.L;
@@ -1067,7 +1068,7 @@
 public void onMessage(String messageType, JSONObject 
messagePayload) {
 try {
 String href = decodeURL(messagePayload.getString("href"));
-String filename = UriUtil.removeInternalLinkPrefix(href);
+String filename = 
StringUtil.removeUnderscores(UriUtil.removeInternalLinkPrefix(href));
 Site site = model.getTitle().getSite();
 
startActivityForResult(GalleryActivity.newIntent(getContext(),
 model.getTitleOriginal(), filename, site,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a7eceb55051adf3f40cd583ef2d661141894236
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Dbrant 
Gerrit-Reviewer: Niedzielski 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Refactor common database code

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

Change subject: Refactor common database code
..


Refactor common database code

Identical calls to create parameter lists and bind values

Change-Id: I22e2d3101383be42286e66b69dfd80c2a463e3c5
---
M Core/DataStores/DamagedDatabase.php
M Core/DataStores/PaymentsInitialDatabase.php
M Core/DataStores/PendingDatabase.php
M Core/DataStores/SmashPigDatabase.php
4 files changed, 63 insertions(+), 55 deletions(-)

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



diff --git a/Core/DataStores/DamagedDatabase.php 
b/Core/DataStores/DamagedDatabase.php
index fb85a16..c5498ba 100644
--- a/Core/DataStores/DamagedDatabase.php
+++ b/Core/DataStores/DamagedDatabase.php
@@ -58,26 +58,16 @@
$dbRecord[$fieldName] = $message[$fieldName];
}
}
-   $fieldList = implode( ',', array_keys( $dbRecord ) );
 
-   // Build a list of parameter names for safe db insert. Same as
-   // the field list, but each parameter is prefixed with a colon.
-   $paramList = ':' . implode( ', :', array_keys( $dbRecord ) );
+   list( $fieldList, $paramList ) = self::formatInsertParameters(
+   $dbRecord
+   );
 
$insert = "INSERT INTO damaged ( $fieldList )
VALUES ( $paramList );";
 
-   $prepared = self::$db->prepare( $insert );
-
-   foreach ( $dbRecord as $field => $value ) {
-   $prepared->bindValue(
-   ':' . $field,
-   $value,
-   PDO::PARAM_STR
-   );
-   }
-   if ( $prepared->execute() ) {
-   return self::$db->lastInsertId();
+   if ( $this->prepareAndExecute( $insert, $dbRecord ) ) {
+   return $this->getDatabase()->lastInsertId();
}
throw new SmashPigException( 'Unable to insert into damaged db' 
);
}
diff --git a/Core/DataStores/PaymentsInitialDatabase.php 
b/Core/DataStores/PaymentsInitialDatabase.php
index d18701f..490b6f5 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -53,24 +53,13 @@
return $row;
}
 
-   /**
-* TODO: reuse vs PendingDatabase::storeMessage
-*/
public function storeMessage( $message ) {
-$fieldList = implode( ',', array_keys( $message ) );
-$paramList = ':' . implode( ', :', array_keys( $message ) );
+list( $fieldList, $paramList ) = self::formatInsertParameters(
+   $message
+   );
 
 $sql = "INSERT INTO payments_initial ( $fieldList ) VALUES ( 
$paramList )";
-   $prepared = self::$db->prepare( $sql );
-
-   foreach ( $message as $field => $value ) {
-   $prepared->bindValue(
-   ':' . $field,
-   $value,
-   PDO::PARAM_STR
-   );
-   }
-   $prepared->execute();
+   $this->prepareAndExecute( $sql, $message );
}
 
protected function getConfigKey() {
diff --git a/Core/DataStores/PendingDatabase.php 
b/Core/DataStores/PendingDatabase.php
index c006595..80bb327 100644
--- a/Core/DataStores/PendingDatabase.php
+++ b/Core/DataStores/PendingDatabase.php
@@ -3,10 +3,8 @@
 
 use PDO;
 use RuntimeException;
-use SmashPig\Core\Logging\Logger;
 use SmashPig\Core\SmashPigException;
 use SmashPig\Core\UtcDate;
-use SmashPig\CrmLink\Messages\DonationInterfaceMessage;
 
 /**
  * Data store containing messages waiting to be finalized.
@@ -53,23 +51,13 @@
// Dump the whole message into a text column
$dbRecord['message'] = json_encode( $message );
 
-   $fields = array_keys( $dbRecord );
if ( isset( $message['pending_id'] ) ) {
-   $sql = $this->getUpdateStatement( $fields );
+   $sql = $this->getUpdateStatement( $dbRecord );
$dbRecord['id'] = $message['pending_id'];
} else {
-   $sql = $this->getInsertStatement( $fields );
+   $sql = $this->getInsertStatement( $dbRecord );
}
-   $prepared = self::$db->prepare( $sql );
-
-   foreach ( $dbRecord as $field => $value ) {
-   $prepared->bindValue(
-   ':' . $field,
-   $value,
-   PDO::PARAM_STR
-   );
-   }
-   $prepared->execute();
+   

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Payments-init consumer only deletes pending on fail

2016-09-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review.

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

Change subject: Payments-init consumer only deletes pending on fail
..

Payments-init consumer only deletes pending on fail

DonationQueueConsumer will take care of completed.

Change-Id: I826fccb804235bbc5abc626c53064ad90db03628
---
M sites/all/modules/queue2civicrm/fredge/PaymentsInitQueueConsumer.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/39/312939/1

diff --git 
a/sites/all/modules/queue2civicrm/fredge/PaymentsInitQueueConsumer.php 
b/sites/all/modules/queue2civicrm/fredge/PaymentsInitQueueConsumer.php
index 3d115fc..9590deb 100644
--- a/sites/all/modules/queue2civicrm/fredge/PaymentsInitQueueConsumer.php
+++ b/sites/all/modules/queue2civicrm/fredge/PaymentsInitQueueConsumer.php
@@ -25,9 +25,11 @@
$id = 0;
$inserting = true;
 
-   // Delete corresponding pending rows if this message is 
finished.
-   if ( in_array( $message['payments_final_status'], array( 
'complete', 'failed' ) ) ) {
-   watchdog( 'fredge', "Deleting pending row for finalized 
message {$logId}", array(), WATCHDOG_INFO );
+   // Delete corresponding pending rows if this contribution 
failed.
+   // The DonationQueueConsumer will delete pending rows for 
successful
+   // contributions, and we don't want to be too hasty.
+   if ( $message['payments_final_status'] === 'failed' ) {
+   watchdog( 'fredge', "Deleting pending row for failed 
message {$logId}", array(), WATCHDOG_INFO );
PendingDatabase::get()->deleteMessage( $message );
}
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Remove unused uses

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

Change subject: Remove unused uses
..


Remove unused uses

Change-Id: Ib3f093e747a1c0dc220d6440b2296d69453cc9a6
---
M includes/DataModuleLinks.php
1 file changed, 0 insertions(+), 5 deletions(-)

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



diff --git a/includes/DataModuleLinks.php b/includes/DataModuleLinks.php
index a010fd1..e67010c 100644
--- a/includes/DataModuleLinks.php
+++ b/includes/DataModuleLinks.php
@@ -9,14 +9,9 @@
 namespace Kartographer;
 
 use FormatJson;
-use Language;
-use Parser;
-use ParserOptions;
 use ResourceLoader;
 use ResourceLoaderContext;
 use ResourceLoaderModule;
-use stdClass;
-use Title;
 
 class DataModuleLinks extends ResourceLoaderModule {
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3f093e747a1c0dc220d6440b2296d69453cc9a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Yurik 
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...WikimediaEvents[master]: Ignore null values when sending to EventLogging

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

Change subject: Ignore null values when sending to EventLogging
..


Ignore null values when sending to EventLogging

Apparently, optional parameters are supposed to not be sent in if
they have null values, rather than being recognized as optional if
their value is null.

Adding a check to ignore null value parameters when building the
logging parameter list.

Bug: T146674
Change-Id: I5c8b564974490df93bb303652b7e478955b9bcd5
---
M WikimediaEventsHooks.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index 8ba1267..352accd 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -596,7 +596,7 @@
 
$webParams = $special->getRequest()->getQueryValues();
foreach ( $webParams as $param => $value ) {
-   if ( array_key_exists( $param, $knownFilters ) && 
$value !== '' ) {
+   if ( array_key_exists( $param, $knownFilters ) && 
$value !== '' && $value !== null ) {
$logData[ $param ] = $knownFilters[ $param ] 
=== 'bool' ?
(bool)$value : $value;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c8b564974490df93bb303652b7e478955b9bcd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Error-check the rest of the db calls

2016-09-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review.

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

Change subject: Error-check the rest of the db calls
..

Error-check the rest of the db calls

Make prepareAndExecute return the executed statement for retrieval

Change-Id: I818d42b43e9b782bf1b74c0a673a13aea75df453
---
M Core/DataStores/DamagedDatabase.php
M Core/DataStores/PaymentsInitialDatabase.php
M Core/DataStores/PendingDatabase.php
M Core/DataStores/SmashPigDatabase.php
4 files changed, 56 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/38/312938/1

diff --git a/Core/DataStores/DamagedDatabase.php 
b/Core/DataStores/DamagedDatabase.php
index 6b806c0..09edde3 100644
--- a/Core/DataStores/DamagedDatabase.php
+++ b/Core/DataStores/DamagedDatabase.php
@@ -74,20 +74,18 @@
 * @return array|null Records with retry_date prior to now
 */
public function fetchRetryMessages( $limit ) {
-   $prepared = self::$db->prepare(
-   '
-   SELECT * FROM damaged
+   $sql = 'SELECT * FROM damaged
WHERE retry_date < :now
ORDER BY retry_date ASC
-   LIMIT ' . $limit
+   LIMIT ' . $limit;
+
+   $params = array(
+   'now' => UtcDate::getUtcDatabaseString()
);
-   $prepared->bindValue(
-   ':now',
-   UtcDate::getUtcDatabaseString(),
-   PDO::PARAM_STR
-   );
-   $prepared->execute();
-   $rows = $prepared->fetchAll( PDO::FETCH_ASSOC );
+
+   $executed = $this->prepareAndExecute( $sql, $params);
+
+   $rows = $executed->fetchAll( PDO::FETCH_ASSOC );
return array_map(
array( $this, 'messageFromDbRow' ),
$rows
@@ -100,13 +98,12 @@
 * @param array $message
 */
public function deleteMessage( $message ) {
-   $prepared = self::$db->prepare(
-   '
-   DELETE FROM damaged
-   WHERE id = :id'
+   $sql = 'DELETE FROM damaged
+   WHERE id = :id';
+   $params = array(
+   'id' => $message['damaged_id']
);
-   $prepared->bindValue( ':id', $message['damaged_id'], 
PDO::PARAM_STR );
-   $prepared->execute();
+   $this->prepareAndExecute( $sql, $params );
}
 
/**
@@ -120,16 +117,13 @@
if ( $queue ) {
$sql .= ' AND original_queue = :queue';
}
-   $prepared = self::$db->prepare( $sql );
-   $prepared->bindValue(
-   ':date',
-   UtcDate::getUtcDatabaseString( $originalDate ),
-   PDO::PARAM_STR
+   $params = array(
+   'date' => UtcDate::getUtcDatabaseString( $originalDate 
),
);
if ( $queue ) {
-   $prepared->bindValue( ':queue', $queue, PDO::PARAM_STR 
);
+   $params['queue'] = $queue;
}
-   $prepared->execute();
+   $this->prepareAndExecute( $sql, $params );
}
 
/**
diff --git a/Core/DataStores/PaymentsInitialDatabase.php 
b/Core/DataStores/PaymentsInitialDatabase.php
index 490b6f5..5411c58 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -38,15 +38,16 @@
 * @return array|null Record related to a transaction, or null if 
nothing matches
 */
public function fetchMessageByGatewayOrderId( $gatewayName, $orderId ) {
-   $prepared = self::$db->prepare( '
-   select * from payments_initial
+   $sql = 'select * from payments_initial
where gateway = :gateway
and order_id = :order_id
-   limit 1' );
-   $prepared->bindValue( ':gateway', $gatewayName, PDO::PARAM_STR 
);
-   $prepared->bindValue( ':order_id', $orderId, PDO::PARAM_STR );
-   $prepared->execute();
-   $row = $prepared->fetch( PDO::FETCH_ASSOC );
+   limit 1';
+   $params = array(
+   'gateway' => $gatewayName,
+   'order_id' => $orderId,
+   );
+   $executed = $this->prepareAndExecute( $sql, $params );
+   $row = $executed->fetch( PDO::FETCH_ASSOC );
if ( !$row ) {
return null;
}
diff --git 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Fix home-as-up behavior when launched from external intent.

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

Change subject: Fix home-as-up behavior when launched from external intent.
..


Fix home-as-up behavior when launched from external intent.

Here's what happens:
- When our MainActivity is started from the Launcher, it automatically jumps
  to PageActivity if the user was reading a page within the last 24 hours.
- When the user presses the home-as-up button in PageActivity, we actually
  launch MainActivity with the same intent as the Launcher uses to launch
  it from the home screen.
- Taking the above two facts together, this results in a weird circular
  behavior where pressing the home-as-up button launches MainActivity,
  which immediately launches PageActivity again.

This patch adds an "extra" parameter to the intent when launching
MainActivity from pressing the home-as-up button, so that MainActivity can
differentiate it from a regular intent triggered from the Launcher.

Bug: T145831
Change-Id: I7ade14e3900d774126d47eeeda3be103fa478fa4
---
M app/src/main/java/org/wikipedia/Constants.java
M app/src/main/java/org/wikipedia/MainFragment.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
3 files changed, 4 insertions(+), 2 deletions(-)

Approvals:
  BearND: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Niedzielski: Looks good to me, approved



diff --git a/app/src/main/java/org/wikipedia/Constants.java 
b/app/src/main/java/org/wikipedia/Constants.java
index c2bbb63..e83961f 100644
--- a/app/src/main/java/org/wikipedia/Constants.java
+++ b/app/src/main/java/org/wikipedia/Constants.java
@@ -17,6 +17,7 @@
 public static final int ACTIVITY_REQUEST_GALLERY = 52;
 public static final int ACTIVITY_REQUEST_LOGIN = 53;
 
+public static final String INTENT_RETURN_TO_MAIN = "returnToMain";
 public static final String INTENT_SEARCH_FROM_WIDGET = "searchFromWidget";
 public static final String INTENT_FEATURED_ARTICLE_FROM_WIDGET = 
"featuredArticleFromWidget";
 
diff --git a/app/src/main/java/org/wikipedia/MainFragment.java 
b/app/src/main/java/org/wikipedia/MainFragment.java
index 79fe87c..062762c 100644
--- a/app/src/main/java/org/wikipedia/MainFragment.java
+++ b/app/src/main/java/org/wikipedia/MainFragment.java
@@ -183,7 +183,7 @@
 } else if (intent.hasExtra(Constants.INTENT_SEARCH_FROM_WIDGET)) {
 funnel.logSearchWidgetTap();
 openSearchFragment(SearchInvokeSource.WIDGET, null);
-} else if (lastPageViewedWithin(1)) {
+} else if (lastPageViewedWithin(1) && 
!intent.hasExtra(Constants.INTENT_RETURN_TO_MAIN)) {
 startActivity(PageActivity.newIntent(getContext()));
 }
 }
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index ddc3c7c..8ede44e 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -215,7 +215,8 @@
 switch (item.getItemId()) {
 case android.R.id.home:
 if (shouldRecreateMainActivity()) {
-startActivity(getSupportParentActivityIntent());
+startActivity(getSupportParentActivityIntent()
+.putExtra(Constants.INTENT_RETURN_TO_MAIN, true));
 }
 finish();
 return true;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7ade14e3900d774126d47eeeda3be103fa478fa4
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Dbrant 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: Niedzielski 
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...Kartographer[master]: Remove unused uses

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Remove unused uses
..

Remove unused uses

Change-Id: Ib3f093e747a1c0dc220d6440b2296d69453cc9a6
---
M includes/DataModuleLinks.php
1 file changed, 0 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Kartographer 
refs/changes/37/312937/1

diff --git a/includes/DataModuleLinks.php b/includes/DataModuleLinks.php
index a010fd1..e67010c 100644
--- a/includes/DataModuleLinks.php
+++ b/includes/DataModuleLinks.php
@@ -9,14 +9,9 @@
 namespace Kartographer;
 
 use FormatJson;
-use Language;
-use Parser;
-use ParserOptions;
 use ResourceLoader;
 use ResourceLoaderContext;
 use ResourceLoaderModule;
-use stdClass;
-use Title;
 
 class DataModuleLinks extends ResourceLoaderModule {
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3f093e747a1c0dc220d6440b2296d69453cc9a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: MaxSem 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikimediaEvents[master]: Ignore null values when sending to EventLogging

2016-09-26 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Ignore null values when sending to EventLogging
..

Ignore null values when sending to EventLogging

Apparently, optional parameters are supposed to not be sent in if
they have null values, rather than being recognized as optional if
their value is null.

Adding a check to ignore null value parameters when building the
logging parameter list.

Bug: T146674
Change-Id: I5c8b564974490df93bb303652b7e478955b9bcd5
---
M WikimediaEventsHooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index 8ba1267..352accd 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -596,7 +596,7 @@
 
$webParams = $special->getRequest()->getQueryValues();
foreach ( $webParams as $param => $value ) {
-   if ( array_key_exists( $param, $knownFilters ) && 
$value !== '' ) {
+   if ( array_key_exists( $param, $knownFilters ) && 
$value !== '' && $value !== null ) {
$logData[ $param ] = $knownFilters[ $param ] 
=== 'bool' ?
(bool)$value : $value;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c8b564974490df93bb303652b7e478955b9bcd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: POC: UCMini browser should behave correctly as a NORLQ client

2016-09-26 Thread Jdlrobson (Code Review)
Jdlrobson has uploaded a new change for review.

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

Change subject: POC: UCMini browser should behave correctly as a NORLQ client
..

POC: UCMini browser should behave correctly as a NORLQ client

Change-Id: I65b1ea277214b7108ba1dc24ac61efa8a598f9b5
---
M includes/resourceloader/ResourceLoaderClientHtml.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/35/312935/1

diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php 
b/includes/resourceloader/ResourceLoaderClientHtml.php
index 5729218..2496440 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -261,9 +261,11 @@
// Change "client-nojs" class to client-js. This allows easy 
toggling of UI components.
// This happens synchronously on every page view to avoid 
flashes of wrong content.
// See also #getDocumentAttributes() and 
/resources/src/startup.js.
+   // When doing this we should be sure that async loading is 
supported to avoid unexpected rendering issues.
+   // The UCMini browser although claiming support with async 
attribute doesn't seem to work so we also have to browser sniff.
$chunks[] = Html::inlineScript(
-   'document.documentElement.className = 
document.documentElement.className'
-   . '.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" 
);'
+   'if ( "async" in document.createElement("script") && 
navigator.userAgent.indexOf( "U; " ) === 0 ) { 
document.documentElement.className = document.documentElement.className'
+   . '.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" 
); }'
);
 
// Inline RLQ: Set page variables

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: AuthManager phpdoc cleanup

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: AuthManager phpdoc cleanup
..

AuthManager phpdoc cleanup

Change-Id: Ib6fa897e76ae479de68acaeb16708c2bdf15ae5f
---
M includes/auth/ButtonAuthenticationRequest.php
M includes/auth/PasswordDomainAuthenticationRequest.php
M includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
M includes/specialpage/AuthManagerSpecialPage.php
4 files changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/34/312934/1

diff --git a/includes/auth/ButtonAuthenticationRequest.php 
b/includes/auth/ButtonAuthenticationRequest.php
index 055d7ea..d274e18 100644
--- a/includes/auth/ButtonAuthenticationRequest.php
+++ b/includes/auth/ButtonAuthenticationRequest.php
@@ -81,6 +81,8 @@
 
/**
 * @codeCoverageIgnore
+* @param array $data
+* @return AuthenticationRequest|static
 */
public static function __set_state( $data ) {
if ( !isset( $data['label'] ) ) {
diff --git a/includes/auth/PasswordDomainAuthenticationRequest.php 
b/includes/auth/PasswordDomainAuthenticationRequest.php
index ddad54b..3db7e21 100644
--- a/includes/auth/PasswordDomainAuthenticationRequest.php
+++ b/includes/auth/PasswordDomainAuthenticationRequest.php
@@ -70,6 +70,8 @@
 
/**
 * @codeCoverageIgnore
+* @param array $data
+* @return AuthenticationRequest|static
 */
public static function __set_state( $data ) {
$ret = new static( $data['domainList'] );
diff --git a/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php 
b/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
index f11a12c..45ac3aa 100644
--- a/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
+++ b/includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
@@ -58,6 +58,7 @@
 
/**
 * Try to reset the password
+* @param \User $user
 * @param AuthenticationRequest[] $reqs
 * @return AuthenticationResponse
 */
diff --git a/includes/specialpage/AuthManagerSpecialPage.php 
b/includes/specialpage/AuthManagerSpecialPage.php
index 3adf5a6..bdf7638 100644
--- a/includes/specialpage/AuthManagerSpecialPage.php
+++ b/includes/specialpage/AuthManagerSpecialPage.php
@@ -43,7 +43,7 @@
 * Change the form descriptor that determines how a field will look in 
the authentication form.
 * Called from fieldInfoToFormDescriptor().
 * @param AuthenticationRequest[] $requests
-* @param string $fieldInfo Field information array (union of all
+* @param array $fieldInfo Field information array (union of all
 *AuthenticationRequest::getFieldInfo() responses).
 * @param array $formDescriptor HTMLForm descriptor. The special key 
'weight' can be set to
 *change the order of the fields.
@@ -205,6 +205,7 @@
/**
 * Return custom message key.
 * Allows subclasses to customize messages.
+* @param string $defaultKey
 * @return string
 */
protected function messageKey( $defaultKey ) {
@@ -668,6 +669,7 @@
 * Maps an authentication field configuration for a single field (as 
returned by
 * AuthenticationRequest::getFieldInfo()) to a HTMLForm field 
descriptor.
 * @param array $singleFieldInfo
+* @param string $fieldName
 * @return array
 */
protected static function mapSingleFieldInfo( $singleFieldInfo, 
$fieldName ) {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: mw.UploadWizardLicenseInput: Parse license templates as if t...

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

Change subject: mw.UploadWizardLicenseInput: Parse license templates as if they 
were used on a file page
..


mw.UploadWizardLicenseInput: Parse license templates as if they were used on a 
file page

Some of Commons' license templates, for example:
https://commons.wikimedia.org/wiki/Template:Images_by_Ulrich_Kalkschmidt
only appear when used on a page in the 'File' namespace.
Provide a 'title' with the action=parse query to avoid false rejections.
We don't know the real title, so just use a fake one, it shouldn't matter.

Follow-up to 5861fa0f27387bbb29d9db5c7e19996618d0691e.

Bug: T140903
Change-Id: Iad3647ace8ed7acac6a25488de94ddde51e1bd40
---
M resources/mw.UploadWizardLicenseInput.js
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/resources/mw.UploadWizardLicenseInput.js 
b/resources/mw.UploadWizardLicenseInput.js
index 28e82bf..075b093 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -497,6 +497,7 @@
return this.api.get( {
action: 'parse',
prop: 'templates',
+   title: 'File:UploadWizard license 
verification.png',
text: wikitext
} ).then( function ( result ) {
var templates = [],

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iad3647ace8ed7acac6a25488de94ddde51e1bd40
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 
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...CentralNotice[master]: Cleanup: simplify in-memory cache invalidation

2016-09-26 Thread Awight (Code Review)
Awight has uploaded a new change for review.

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

Change subject: Cleanup: simplify in-memory cache invalidation
..

Cleanup: simplify in-memory cache invalidation

Return values were unused, wfSetVar was too fancy for our purposes.

FIXME: We shouldn't be micromanaging this database access.

Change-Id: I9a8b5f0facca50a77ea920b3b0909a89da09c15a
---
M includes/Banner.php
1 file changed, 10 insertions(+), 5 deletions(-)


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

diff --git a/includes/Banner.php b/includes/Banner.php
index 3c37227..e91dc10 100644
--- a/includes/Banner.php
+++ b/includes/Banner.php
@@ -356,7 +356,7 @@
 * Sets the flag which will save basic metadata on next save()
 */
protected function setBasicDataDirty( $dirty = true ) {
-   return (bool)wfSetVar( $this->dirtyFlags['basic'], $dirty, true 
);
+   $this->dirtyFlags['basic'] = $dirty;
}
 
/**
@@ -476,7 +476,7 @@
 * Sets the flag which will force saving of device targeting data on 
next save()
 */
protected function markDeviceTargetDataDirty( $dirty = true ) {
-   return (bool)wfSetVar( $this->dirtyFlags['devices'], $dirty, 
true );
+   $this->dirtyFlags['devices'] = $dirty;
}
 
/**
@@ -582,7 +582,7 @@
 * Sets the flag which will force saving of mixin data upon next save()
 */
protected function markMixinDataDirty( $dirty = true ) {
-   return (bool)wfSetVar( $this->dirtyFlags['mixins'], $dirty, 
true );
+   $this->dirtyFlags['mixins'] = $dirty;
}
 
/**
@@ -673,7 +673,7 @@
}
 
protected function markPriorityLanguageDataDirty( $dirty = true ) {
-   return (bool)wfSetVar( $this->dirtyFlags['prioritylang'], 
$dirty, true );
+   $this->dirtyFlags['prioritylang'] = $dirty;
}
 
protected function savePriorityLanguageData() {
@@ -752,8 +752,13 @@
$this->markBodyContentDirty( false );
}
 
+   /**
+* @param boolean $dirty If true, we're storing a flag that means the
+* in-memory banner content is newer than what's stored in the database.
+* If false, we're clearing that bit.
+*/
protected function markBodyContentDirty( $dirty = true ) {
-   return (bool)wfSetVar( $this->dirtyFlags['content'], $dirty, 
true );
+   $this->dirtyFlags['content'] = $dirty;
}
 
protected function saveBodyContent( $summary = null ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a8b5f0facca50a77ea920b3b0909a89da09c15a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: mw.jqueryMsg: Prevent middle-clicking fake links with custom...

2016-09-26 Thread Code Review
Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: mw.jqueryMsg: Prevent middle-clicking fake links with custom 
handlers
..

mw.jqueryMsg: Prevent middle-clicking fake links with custom handlers

Middle-clicking or Ctrl-clicking them, or in general opening them in
a new tab in any way, is entirely useless (it will just open a copy of
the current page). We should just run the event handler on such clicks.

Firefox does not fire the 'click' event on middle-click, and it
doesn't allow preventing middle clicks on links, so we use 'mousedown'
instead and remove the fake 'href' to make the element a non-link and
allow it. We also have to implement 'keypress' and add tabindex for
accessibility (browsers fire fake 'click' events when keypressing
links, which is why this worked before, but this is no longer a link).

Bug: T146532
Change-Id: I292425e288debd918bff49d3d6c44fe8512a8d1e
---
M resources/src/mediawiki/mediawiki.jqueryMsg.js
1 file changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/99/312899/1

diff --git a/resources/src/mediawiki/mediawiki.jqueryMsg.js 
b/resources/src/mediawiki/mediawiki.jqueryMsg.js
index 44b9117..dd32e58 100644
--- a/resources/src/mediawiki/mediawiki.jqueryMsg.js
+++ b/resources/src/mediawiki/mediawiki.jqueryMsg.js
@@ -1126,11 +1126,20 @@
} else {
$el = $( '' );
if ( typeof arg === 'function' ) {
-   $el.attr( 'href', '#' )
-   .click( function ( e ) {
-   e.preventDefault();
-   } )
-   .click( arg );
+   $el
+   .attr( 'tabindex', '0' )
+   // Use 'mousedown' rather than 
'click' because we want to handle middle-click too,
+   // and browsers don't fire the 
'click' even for it.
+   .mousedown( function ( e ) {
+   arg.call( this, e );
+   e.preventDefault();
+   } )
+   .keypress( function ( e ) {
+   // 13 = Enter; 32 = 
Space
+   if ( e.which === 32 || 
e.which === 13 ) {
+   arg.call( this, 
e );
+   }
+   } );
} else {
$el.attr( 'href', textify( arg ) );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I292425e288debd918bff49d3d6c44fe8512a8d1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Always open pages from Intent in a new foreground tab.

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

Change subject: Always open pages from Intent in a new foreground tab.
..


Always open pages from Intent in a new foreground tab.

Some users, as well as our own dogfooding, have expressed some confusion
around the behavior of the hardware Back button when reading articles.

The confusion seems to stem from the following:
When a user opens a page from within MainActivity (from the feed, History,
etc), it causes PageActivity to open, and load the requested page into the
*current tab* that may have been previously open. This causes some
unexpected behavior:  if the user presses the hardware Back button,
PageActivity will go backwards in the backstack of pages that had already
existed in the current tab. This is contrary to the intuition that the
Back button should simply close the current page and go back to
MainActivity from where we launched it.

This patch attempts to alleviate the confusion by always loading pages in
a new tab (that is, pages that are loaded from an Intent that causes
PageActivity to start). Here are the benefits to this approach:

- This introduces better "navigational consistency", meaning that every
  launch of PageActivity will now be a proper self-contained browsing
  "session".
- The user will still be able to navigate to links and build a backstack
  in the current tab, but the number of Back presses to return to the
  parent Activity will now make intuitive sense, since the newly-opened
  page will not be pushed onto the existing backstack of the current tab.
- Notice that when the app is launched from an external Intent (e.g. from
  a deeplink) we do already open the requested page in a new tab,
  precisely for the purpose of maintaining consistent Back behavior. We
  should simply treat "internal" Intents coming from MainActivity the same
  way we treat external intents.

This patch also limits the total number of possible tabs to 100, since
we're technically leaving open the possibility for the user to create more
tabs than they normally would, if the user always uses the home-as-up
button for backwards navigation instead of the hardware Back button.
Limiting the total number of tabs doesn't seem too unexpected, since users
will still be able to refer to their History and Reading Lists for reading
previous pages.

In addition, this patch removes a bit of dead code.

Change-Id: I861b2822942f28c95ac0c3d3fb6f56ed18a8fd00
---
M app/src/main/java/org/wikipedia/Constants.java
M app/src/main/java/org/wikipedia/MainFragment.java
M app/src/main/java/org/wikipedia/editing/EditPreviewFragment.java
M app/src/main/java/org/wikipedia/interlanguage/LangLinksActivity.java
M app/src/main/java/org/wikipedia/news/NewsFragment.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
8 files changed, 20 insertions(+), 41 deletions(-)

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



diff --git a/app/src/main/java/org/wikipedia/Constants.java 
b/app/src/main/java/org/wikipedia/Constants.java
index c2bbb63..3aa89ca 100644
--- a/app/src/main/java/org/wikipedia/Constants.java
+++ b/app/src/main/java/org/wikipedia/Constants.java
@@ -27,5 +27,7 @@
 
 public static final int PREFERRED_THUMB_SIZE = 320;
 
+public static final int MAX_TABS = 100;
+
 private Constants() { }
 }
diff --git a/app/src/main/java/org/wikipedia/MainFragment.java 
b/app/src/main/java/org/wikipedia/MainFragment.java
index 79fe87c..04b6831 100644
--- a/app/src/main/java/org/wikipedia/MainFragment.java
+++ b/app/src/main/java/org/wikipedia/MainFragment.java
@@ -207,7 +207,7 @@
 }
 
 @Override public void onFeedSelectPage(HistoryEntry entry) {
-startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle(), false));
+startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle()));
 }
 
 @Override public void onFeedAddPageToList(HistoryEntry entry) {
@@ -278,7 +278,7 @@
 }
 
 @Override public void onLoadPage(PageTitle title, HistoryEntry entry) {
-startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle(), false));
+startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle()));
 }
 
 @Override public void onClearHistory() {
@@ -308,7 +308,7 @@
 
 @Override
 public void onSearchSelectPage(@NonNull HistoryEntry entry, boolean 
inNewTab) {
-startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle(), inNewTab));
+startActivity(PageActivity.newIntent(getContext(), entry, 
entry.getTitle()));
 }
 
 @Override
@@ -334,7 +334,7 @@
 
 @Override
 public void onLinkPreviewLoadPage(@NonNull PageTitle title, @NonNull 
HistoryEntry entry, boolean inNewTab) {
-

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add bzr and cvs schemes

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

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

Change subject: Add bzr and cvs schemes
..

Add bzr and cvs schemes

The URL of a source code repository
https://www.wikidata.org/wiki/Property:P1324
can be Bazaar (bzr) or Concurrent Versions System (cvs)

Bug: T146692
Change-Id: I1c813048ade4e6260bfe0789639db2cd6c54fd48
---
M repo/config/Wikibase.default.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/repo/config/Wikibase.default.php b/repo/config/Wikibase.default.php
index 20df301..75e931d 100644
--- a/repo/config/Wikibase.default.php
+++ b/repo/config/Wikibase.default.php
@@ -35,7 +35,7 @@
],
 
// URL schemes allowed for URL values. See UrlSchemeValidators for a 
full list.
-   'urlSchemes' => [ 'ftp', 'http', 'https', 'irc', 'mailto', 'svn', 
'git', 'ssh' ],
+   'urlSchemes' => [ 'ftp', 'http', 'https', 'irc', 'mailto', 'svn', 
'git', 'ssh', 'bzr', 'cvs' ],
 
// Items allowed to be used as badges pointing to their CSS class names
'badgeItems' => [],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c813048ade4e6260bfe0789639db2cd6c54fd48
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
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...SharedHelpPages[master]: Initial import of a "new" extension from ShoutWiki

2016-09-26 Thread Jack Phoenix (Code Review)
Jack Phoenix has submitted this change and it was merged.

Change subject: Initial import of a "new" extension from ShoutWiki
..


Initial import of a "new" extension from ShoutWiki

ShoutWiki bug T126

Change-Id: Id1e4a0b8bab4487b26be627909c2cf0eae8c5e6f
---
A SharedHelpPages.body.php
A SharedHelpPages.hooks.php
A ext.SharedHelpPages.css
A extension.json
A i18n/ast.json
A i18n/bg.json
A i18n/bn.json
A i18n/ca.json
A i18n/de.json
A i18n/en.json
A i18n/es.json
A i18n/fi.json
A i18n/fr.json
A i18n/gl.json
A i18n/hsb.json
A i18n/ie.json
A i18n/it.json
A i18n/ja.json
A i18n/ko.json
A i18n/lb.json
A i18n/mk.json
A i18n/nl.json
A i18n/pt-br.json
A i18n/qqq.json
A i18n/ru.json
A i18n/uk.json
A i18n/zh-hans.json
27 files changed, 777 insertions(+), 0 deletions(-)

Approvals:
  Jack Phoenix: Verified; Looks good to me, approved



diff --git a/SharedHelpPages.body.php b/SharedHelpPages.body.php
new file mode 100644
index 000..a1cee04
--- /dev/null
+++ b/SharedHelpPages.body.php
@@ -0,0 +1,221 @@
+http://{$langCode}.shoutwiki.com/w/api.php;;
+   } else {
+   // Fall back to English
+   $baseURL = 'http://www.shoutwiki.com/w/api.php';
+   }
+   $url = wfAppendQuery( $baseURL, $params );
+
+   $req = MWHttpRequest::factory( $url );
+   $req->execute();
+   $json = $req->getContent();
+   $decoded = FormatJson::decode( $json, true );
+   return $decoded;
+   }
+
+   /**
+* Get the cache key for a certain title
+*
+* @param Title|string $title
+* @return string
+*/
+   public static function getCacheKey( $title ) {
+   global $wgLanguageCode;
+   return wfMemcKey( 'helppages', $wgLanguageCode, md5( $title ), 
'v2' );
+   }
+
+   /**
+* Use action=parse to get rendered HTML of a page
+*
+* @param $title string
+* @param $langCode string
+* @return array
+*/
+   public static function parseWikiText( $title, $langCode ) {
+   $params = array(
+   'action' => 'parse',
+   'page' => $title,
+   'redirects' => true // follow redirects
+   );
+   $data = self::makeAPIRequest( $params, $langCode );
+   $parsed = $data['parse']['text']['*'];
+   $oldid = $data['parse']['revid'];
+
+   // Eliminate section edit links
+   // As legoktm pointed out, this is done in CSS, which works and 
most
+   // likely is a lot faster, but I'll keep this around anyway for 
future
+   // reference.
+   /*
+   $parsed = preg_replace(
+   "/(.*?)<\/span>(.*?)<\/a>\(.*?)<\/span><\/span>/",
+   '',
+   $parsed
+   );
+   */
+
+   // HACK TIME! The parsed wikitext acts as if it was parsed on 
the remote
+   // wiki -- this is good for things like images and whatnot, but 
very
+   // bad for things like the project namespace name and whatnot.
+   // So, we need to get the remote wiki's project ( talk) 
NS names;
+   // either from memcached, or failing that, via an API query.
+   global $wgContLang, $wgLanguageCode, $wgMemc;
+
+   $projectNSCacheKey = wfMemcKey( 'helppages', $wgLanguageCode, 
'projectns' );
+   $projectTalkNSCacheKey = wfMemcKey( 'helppages', 
$wgLanguageCode, 'projecttalkns' );
+
+   $remoteWikiProjectNS = $wgMemc->get( $projectNSCacheKey );
+   $remoteWikiProjectTalkNS = $wgMemc->get( $projectTalkNSCacheKey 
);
+
+   if (
+   $remoteWikiProjectNS === false ||
+   $remoteWikiProjectTalkNS === false
+   )
+   {
+   // Damn, no cache hit, so we need to hit the API 
instead.
+   // Yes, I realize that's a terrible pun.
+   $nsQueryParams = array(
+   'action' => 'query',
+   'meta' => 'siteinfo',
+   'siprop' => 'namespaces|namespacealiases'
+   );
+   $namespaceData = self::makeAPIRequest( $nsQueryParams, 
$langCode );
+
+   // Get the remote wiki's NS_PROJECT & NS_PROJECT_TALK
+   $remoteWikiProjectNS = 
$namespaceData['query']['namespaces'][NS_PROJECT]['*'];
+   $remoteWikiProjectTalkNS = 
$namespaceData['query']['namespaces'][NS_PROJECT_TALK]['*'];
+
+   // Sanitize it. This should have the nice side-effect 
of avoiding (too many)
+   // false positives 

[MediaWiki-commits] [Gerrit] mediawiki...SharedHelpPages[master]: Initial import of a "new" extension from ShoutWiki

2016-09-26 Thread Jack Phoenix (Code Review)
Jack Phoenix has uploaded a new change for review.

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

Change subject: Initial import of a "new" extension from ShoutWiki
..

Initial import of a "new" extension from ShoutWiki

ShoutWiki bug T126

Change-Id: Id1e4a0b8bab4487b26be627909c2cf0eae8c5e6f
---
A SharedHelpPages.body.php
A SharedHelpPages.hooks.php
A ext.SharedHelpPages.css
A extension.json
A i18n/ast.json
A i18n/bg.json
A i18n/bn.json
A i18n/ca.json
A i18n/de.json
A i18n/en.json
A i18n/es.json
A i18n/fi.json
A i18n/fr.json
A i18n/gl.json
A i18n/hsb.json
A i18n/ie.json
A i18n/it.json
A i18n/ja.json
A i18n/ko.json
A i18n/lb.json
A i18n/mk.json
A i18n/nl.json
A i18n/pt-br.json
A i18n/qqq.json
A i18n/ru.json
A i18n/uk.json
A i18n/zh-hans.json
27 files changed, 777 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SharedHelpPages 
refs/changes/71/312871/1

diff --git a/SharedHelpPages.body.php b/SharedHelpPages.body.php
new file mode 100644
index 000..a1cee04
--- /dev/null
+++ b/SharedHelpPages.body.php
@@ -0,0 +1,221 @@
+http://{$langCode}.shoutwiki.com/w/api.php;;
+   } else {
+   // Fall back to English
+   $baseURL = 'http://www.shoutwiki.com/w/api.php';
+   }
+   $url = wfAppendQuery( $baseURL, $params );
+
+   $req = MWHttpRequest::factory( $url );
+   $req->execute();
+   $json = $req->getContent();
+   $decoded = FormatJson::decode( $json, true );
+   return $decoded;
+   }
+
+   /**
+* Get the cache key for a certain title
+*
+* @param Title|string $title
+* @return string
+*/
+   public static function getCacheKey( $title ) {
+   global $wgLanguageCode;
+   return wfMemcKey( 'helppages', $wgLanguageCode, md5( $title ), 
'v2' );
+   }
+
+   /**
+* Use action=parse to get rendered HTML of a page
+*
+* @param $title string
+* @param $langCode string
+* @return array
+*/
+   public static function parseWikiText( $title, $langCode ) {
+   $params = array(
+   'action' => 'parse',
+   'page' => $title,
+   'redirects' => true // follow redirects
+   );
+   $data = self::makeAPIRequest( $params, $langCode );
+   $parsed = $data['parse']['text']['*'];
+   $oldid = $data['parse']['revid'];
+
+   // Eliminate section edit links
+   // As legoktm pointed out, this is done in CSS, which works and 
most
+   // likely is a lot faster, but I'll keep this around anyway for 
future
+   // reference.
+   /*
+   $parsed = preg_replace(
+   "/(.*?)<\/span>(.*?)<\/a>\(.*?)<\/span><\/span>/",
+   '',
+   $parsed
+   );
+   */
+
+   // HACK TIME! The parsed wikitext acts as if it was parsed on 
the remote
+   // wiki -- this is good for things like images and whatnot, but 
very
+   // bad for things like the project namespace name and whatnot.
+   // So, we need to get the remote wiki's project ( talk) 
NS names;
+   // either from memcached, or failing that, via an API query.
+   global $wgContLang, $wgLanguageCode, $wgMemc;
+
+   $projectNSCacheKey = wfMemcKey( 'helppages', $wgLanguageCode, 
'projectns' );
+   $projectTalkNSCacheKey = wfMemcKey( 'helppages', 
$wgLanguageCode, 'projecttalkns' );
+
+   $remoteWikiProjectNS = $wgMemc->get( $projectNSCacheKey );
+   $remoteWikiProjectTalkNS = $wgMemc->get( $projectTalkNSCacheKey 
);
+
+   if (
+   $remoteWikiProjectNS === false ||
+   $remoteWikiProjectTalkNS === false
+   )
+   {
+   // Damn, no cache hit, so we need to hit the API 
instead.
+   // Yes, I realize that's a terrible pun.
+   $nsQueryParams = array(
+   'action' => 'query',
+   'meta' => 'siteinfo',
+   'siprop' => 'namespaces|namespacealiases'
+   );
+   $namespaceData = self::makeAPIRequest( $nsQueryParams, 
$langCode );
+
+   // Get the remote wiki's NS_PROJECT & NS_PROJECT_TALK
+   $remoteWikiProjectNS = 
$namespaceData['query']['namespaces'][NS_PROJECT]['*'];
+   $remoteWikiProjectTalkNS = 
$namespaceData['query']['namespaces'][NS_PROJECT_TALK]['*'];
+
+   // Sanitize it. This should have the nice 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: StringUtil: Replace deprecated Html.fromHtml(String) calls

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

Change subject: StringUtil: Replace deprecated Html.fromHtml(String) calls
..


StringUtil: Replace deprecated Html.fromHtml(String) calls

Html.fromHtml(String) method was deprecated in API level 24. A version check
method is added to StringUtil class to use old method on before API level 24
and new method on API level 24 and higher. Additionally, the method is 
overloaded
to satisfy overloaded version of fromHtml(String) method, which is 
fromHtml(String, ImageGetter, TagHandler).

Bug: T145582
Change-Id: I256ce2b3a35e5d8434b7d392eb1c3b102f2e7af7
---
M app/src/main/java/org/wikipedia/editing/EditSectionActivity.java
M app/src/main/java/org/wikipedia/feed/news/NewsItemCard.java
M app/src/main/java/org/wikipedia/page/IssuesListAdapter.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/page/ReferenceDialog.java
M app/src/main/java/org/wikipedia/page/ToCHandler.java
M app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
M app/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
M app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
M app/src/main/java/org/wikipedia/page/linkpreview/PageExtract.java
M app/src/main/java/org/wikipedia/page/snippet/SnippetImage.java
M app/src/main/java/org/wikipedia/richtext/RichTextUtil.java
M app/src/main/java/org/wikipedia/savedpages/ImageUrlMap.java
M app/src/main/java/org/wikipedia/search/SearchResultsFragment.java
M app/src/main/java/org/wikipedia/settings/AboutActivity.java
M app/src/main/java/org/wikipedia/settings/LicenseActivity.java
M app/src/main/java/org/wikipedia/util/FeedbackUtil.java
M app/src/main/java/org/wikipedia/util/StringUtil.java
M app/src/main/java/org/wikipedia/widgets/WidgetProviderFeaturedPage.java
M app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.java
21 files changed, 138 insertions(+), 101 deletions(-)

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



diff --git a/app/src/main/java/org/wikipedia/editing/EditSectionActivity.java 
b/app/src/main/java/org/wikipedia/editing/EditSectionActivity.java
index f1755ff..90e78dd 100644
--- a/app/src/main/java/org/wikipedia/editing/EditSectionActivity.java
+++ b/app/src/main/java/org/wikipedia/editing/EditSectionActivity.java
@@ -10,7 +10,6 @@
 import android.support.annotation.Nullable;
 import android.support.v7.app.AlertDialog;
 import android.text.Editable;
-import android.text.Html;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.view.Menu;
@@ -24,32 +23,35 @@
 import android.widget.LinearLayout;
 import android.widget.ScrollView;
 import android.widget.TextView;
+
 import com.squareup.otto.Bus;
+
 import org.mediawiki.api.json.Api;
 import org.mediawiki.api.json.ApiException;
 import org.mediawiki.api.json.RequestBuilder;
 import org.wikipedia.Constants;
-import org.wikipedia.activity.ActivityUtil;
-import org.wikipedia.login.LoginResult;
-import org.wikipedia.login.LoginTask;
-import org.wikipedia.page.PageTitle;
 import org.wikipedia.R;
-import org.wikipedia.activity.ThemedActionBarActivity;
 import org.wikipedia.ViewAnimations;
 import org.wikipedia.WikipediaApp;
+import org.wikipedia.activity.ActivityUtil;
+import org.wikipedia.activity.ThemedActionBarActivity;
 import org.wikipedia.analytics.EditFunnel;
 import org.wikipedia.analytics.LoginFunnel;
-import org.wikipedia.editing.summaries.EditSummaryFragment;
 import org.wikipedia.editing.richtext.SyntaxHighlighter;
+import org.wikipedia.editing.summaries.EditSummaryFragment;
 import org.wikipedia.login.LoginActivity;
+import org.wikipedia.login.LoginResult;
+import org.wikipedia.login.LoginTask;
 import org.wikipedia.login.User;
 import org.wikipedia.page.LinkMovementMethodExt;
 import org.wikipedia.page.PageProperties;
+import org.wikipedia.page.PageTitle;
 import org.wikipedia.util.FeedbackUtil;
+import org.wikipedia.util.StringUtil;
 import org.wikipedia.util.log.L;
 
-import static org.wikipedia.util.L10nUtil.setConditionalTextDirection;
 import static org.wikipedia.util.DeviceUtil.hideSoftKeyboard;
+import static org.wikipedia.util.L10nUtil.setConditionalTextDirection;
 import static org.wikipedia.util.UriUtil.handleExternalLink;
 
 public class EditSectionActivity extends ThemedActionBarActivity {
@@ -222,9 +224,9 @@
 private void updateEditLicenseText() {
 TextView editLicenseText = (TextView) 
findViewById(R.id.edit_section_license_text);
 if (app.getUserInfoStorage().isLoggedIn()) {
-
editLicenseText.setText(Html.fromHtml(getString(R.string.edit_save_action_license_logged_in)));
+
editLicenseText.setText(StringUtil.fromHtml(getString(R.string.edit_save_action_license_logged_in)));
 } else {
-

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Deploying PageAssessments to English Wikipedia

2016-09-26 Thread Kaldari (Code Review)
Kaldari has uploaded a new change for review.

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

Change subject: Deploying PageAssessments to English Wikipedia
..

Deploying PageAssessments to English Wikipedia

This is a purely back-end feature and has no user-facing
components other than APIs.

Bug: T146679
Change-Id: Iab6473ca0ec14efabfb9c3b385f0afdcd85a4a35
---
M wmf-config/InitialiseSettings.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 7b8fc72..d8870f1 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -16431,8 +16431,9 @@
 
 'wmgUsePageAssessments' => [
'default' => false,
-   'testwiki' => true, // T137918
+   'enwiki' => true, // T146679
'enwikivoyage' => true, // T142056
+   'testwiki' => true, // T137918
 ],
 
 'wmgUsePageImages' => [

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...GlobalUsage[master]: Use provided transaction ticket in onLinksUpdateComplete()

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

Change subject: Use provided transaction ticket in onLinksUpdateComplete()
..


Use provided transaction ticket in onLinksUpdateComplete()

Change-Id: I878fcb4a263e3e6291c7632a0ccd89d42179001d
---
M GlobalUsageHooks.php
M GlobalUsage_body.php
2 files changed, 12 insertions(+), 7 deletions(-)

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



diff --git a/GlobalUsageHooks.php b/GlobalUsageHooks.php
index 778a0ff..b1363de 100644
--- a/GlobalUsageHooks.php
+++ b/GlobalUsageHooks.php
@@ -12,9 +12,10 @@
 * Hook to LinksUpdateComplete
 * Deletes old links from usage table and insert new ones.
 * @param $linksUpdater LinksUpdate
+* @param int|null $ticket
 * @return bool
 */
-   public static function onLinksUpdateComplete( LinksUpdate $linksUpdater 
) {
+   public static function onLinksUpdateComplete( LinksUpdate 
$linksUpdater, $ticket = null ) {
$title = $linksUpdater->getTitle();
 
// Create a list of locally existing images (DB keys)
@@ -42,9 +43,9 @@
$removed = array_diff( $existing, $missingFiles );
 
// Add new usages and delete removed
-   $gu->insertLinks( $title, $added );
+   $gu->insertLinks( $title, $added, Title::GAID_FOR_UPDATE, 
$ticket );
if ( $removed ) {
-   $gu->deleteLinksFromPage( $articleId, $removed );
+   $gu->deleteLinksFromPage( $articleId, $removed, $ticket 
);
}
 
return true;
diff --git a/GlobalUsage_body.php b/GlobalUsage_body.php
index f9cd85e..49f6229 100644
--- a/GlobalUsage_body.php
+++ b/GlobalUsage_body.php
@@ -27,8 +27,11 @@
 * @param $title Title Title of the page
 * @param $images array Array of db keys of images used
 * @param $pageIdFlags int
+* @param $ticket int|null
 */
-   public function insertLinks( $title, $images, $pageIdFlags = 
Title::GAID_FOR_UPDATE ) {
+   public function insertLinks(
+   Title $title, array $images, $pageIdFlags = 
Title::GAID_FOR_UPDATE, $ticket = null
+   ) {
global $wgUpdateRowsPerQuery;
 
$insert = array();
@@ -44,7 +47,7 @@
}
 
$lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   $ticket = $ticket ?: $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
foreach ( array_chunk( $insert, $wgUpdateRowsPerQuery ) as 
$insertBatch ) {
$this->db->insert( 'globalimagelinks', $insertBatch, 
__METHOD__, array( 'IGNORE' ) );
$lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
@@ -80,8 +83,9 @@
 *
 * @param $id int Page id of the page
 * @param $to mixed File name(s)
+* @param $ticket int|null
 */
-   public function deleteLinksFromPage( $id, array $to = null ) {
+   public function deleteLinksFromPage( $id, array $to = null, $ticket = 
null ) {
global $wgUpdateRowsPerQuery;
 
$where = array(
@@ -90,7 +94,7 @@
);
if ( $to ) {
$lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+   $ticket = $ticket ?: 
$lbFactory->getEmptyTransactionTicket( __METHOD__ );
foreach ( array_chunk( $to, $wgUpdateRowsPerQuery ) as 
$toBatch ) {
$where['gil_to'] = $toBatch;
$this->db->delete( 'globalimagelinks', $where, 
__METHOD__ );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I878fcb4a263e3e6291c7632a0ccd89d42179001d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUsage
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
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]: Minor installer/upgrader cleanups

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

Change subject: Minor installer/upgrader cleanups
..


Minor installer/upgrader cleanups

Change-Id: I6352d16dce242c94203bdf7d020f1c0279fec6e5
---
M includes/installer/DatabaseInstaller.php
M includes/installer/DatabaseUpdater.php
2 files changed, 10 insertions(+), 3 deletions(-)

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



diff --git a/includes/installer/DatabaseInstaller.php 
b/includes/installer/DatabaseInstaller.php
index 4f10367..2b84144 100644
--- a/includes/installer/DatabaseInstaller.php
+++ b/includes/installer/DatabaseInstaller.php
@@ -167,7 +167,7 @@
 *
 * @param string $sourceFileMethod
 * @param string $stepName
-* @param string $archiveTableMustNotExist
+* @param bool $archiveTableMustNotExist
 * @return Status
 */
private function stepApplySourceFile(
@@ -353,10 +353,14 @@
$up = DatabaseUpdater::newForDB( $this->db );
try {
$up->doUpdates();
-   } catch ( Exception $e ) {
+   } catch ( MWException $e ) {
echo "\nAn error occurred:\n";
echo $e->getText();
$ret = false;
+   } catch ( Exception $e ) {
+   echo "\nAn error occurred:\n";
+   echo $e->getMessage();
+   $ret = false;
}
$up->purgeCache();
ob_end_flush();
diff --git a/includes/installer/DatabaseUpdater.php 
b/includes/installer/DatabaseUpdater.php
index 0d0da08..2425005 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -20,6 +20,7 @@
  * @file
  * @ingroup Deployment
  */
+use MediaWiki\MediaWikiServices;
 
 require_once __DIR__ . '/../../maintenance/Maintenance.php';
 
@@ -456,6 +457,8 @@
 * @param bool $passSelf Whether to pass this object we calling 
external functions
 */
private function runUpdates( array $updates, $passSelf ) {
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
$updatesDone = [];
$updatesSkipped = [];
foreach ( $updates as $params ) {
@@ -470,7 +473,7 @@
flush();
if ( $ret !== false ) {
$updatesDone[] = $origParams;
-   wfGetLBFactory()->waitForReplication();
+   $lbFactory->waitForReplication();
} else {
$updatesSkipped[] = [ $func, $params, 
$origParams ];
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6352d16dce242c94203bdf7d020f1c0279fec6e5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
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]: Update wfEscapeShellArg() comments

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

Change subject: Update wfEscapeShellArg() comments
..


Update wfEscapeShellArg() comments

Change-Id: Ib62a51186aee0967ba4420054ee69b83dcae4d59
---
M includes/GlobalFunctions.php
1 file changed, 4 insertions(+), 5 deletions(-)

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



diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 6e8ce8f..5fe4b4e 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2194,12 +2194,11 @@
 }
 
 /**
- * Windows-compatible version of escapeshellarg()
- * Windows doesn't recognise single-quotes in the shell, but the 
escapeshellarg()
- * function puts single quotes in regardless of OS.
+ * Version of escapeshellarg() that works better on Windows.
  *
- * Also fixes the locale problems on Linux in PHP 5.2.6+ (bug backported to
- * earlier distro releases of PHP)
+ * Originally, this fixed the incorrect use of single quotes on Windows
+ * (https://bugs.php.net/bug.php?id=26285) and the locale problems on Linux in
+ * PHP 5.2.6+ (bug backported to earlier distro releases of PHP).
  *
  * @param string ... strings to escape and glue together, or a single array of 
strings parameter
  * @return string

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib62a51186aee0967ba4420054ee69b83dcae4d59
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
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/config[master]: Whitelist Neslihan

2016-09-26 Thread Mholloway (Code Review)
Mholloway has uploaded a new change for review.

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

Change subject: Whitelist Neslihan
..

Whitelist Neslihan

Whitelisting a new contributor who has been submitting useful Android
patches.

Change-Id: I22fb9c39a4a659c50b29db3b609275253c3d86f3
---
M zuul/layout.yaml
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/68/312868/1

diff --git a/zuul/layout.yaml b/zuul/layout.yaml
index 315b9db..1eeb642 100644
--- a/zuul/layout.yaml
+++ b/zuul/layout.yaml
@@ -197,6 +197,7 @@
 | tinajohnson\.1234@gmail\.com
 | trevorparscal@gmail\.com
 | tomasz@twkozlowski\.com
+| tur\.neslihan@gmail\.com
 | tylerromeo@gmail\.com
 | umherirrender_de\.wp@web\.de
 | v\.a\.ghaisas@gmail\.com
@@ -432,6 +433,7 @@
- ^01tonythomas@gmail\.com$
- ^tim@tim-landscheidt\.de$
- ^tinajohnson\.1234@gmail\.com$
+   - ^tur\.neslihan@gmail\.com$ # Nes / Neslihan
- ^tylerromeo@gmail\.com$
- ^umherirrender_de\.wp@web\.de$
- ^v\.a\.ghaisas@gmail\.com$ # polybuildr

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22fb9c39a4a659c50b29db3b609275253c3d86f3
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Mholloway 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Use slice instead of substring per code conventions

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

Change subject: Use slice instead of substring per code conventions
..


Use slice instead of substring per code conventions

Change-Id: I5de8b485d287db097f2ad63a7edf75f86a86822d
---
M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
index b14de0e..187c9d2 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
@@ -100,7 +100,7 @@
  */
 ve.ui.MWAceEditorWidget.prototype.setupEditor = function () {
var basePath = mw.config.get( 'wgExtensionAssetsPath', '' );
-   if ( basePath.substring( 0, 2 ) === '//' ) {
+   if ( basePath.slice( 0, 2 ) === '//' ) {
// ACE uses web workers, which have importScripts, which don't 
like relative links.
basePath = window.location.protocol + basePath;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5de8b485d287db097f2ad63a7edf75f86a86822d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: TheDJ 
Gerrit-Reviewer: Alex Monk 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Follow-up fd8998a4ec9: remove another stray $wmgMFUseCentral...

2016-09-26 Thread Catrope (Code Review)
Catrope has uploaded a new change for review.

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

Change subject: Follow-up fd8998a4ec9: remove another stray 
$wmgMFUseCentralAuthToken reference
..

Follow-up fd8998a4ec9: remove another stray $wmgMFUseCentralAuthToken reference

Was causing warnings in beta labs.

Change-Id: Id81d1cbf004488d25fbadc6ca2c1ded260ffc73a
---
M wmf-config/mobile-labs.php
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/wmf-config/mobile-labs.php b/wmf-config/mobile-labs.php
index ff80d8d..c27c752 100644
--- a/wmf-config/mobile-labs.php
+++ b/wmf-config/mobile-labs.php
@@ -17,7 +17,6 @@
 $wgMobileFrontendLogo = $wgLogo;
 
 $wgMFForceSecureLogin = false;
-$wgMFUseCentralAuthToken = $wmgMFUseCentralAuthToken;
 $wgMFSpecialCaseMainPage = $wmgMFSpecialCaseMainPage;
 
 $wgMFMobileFormatterHeadings = $wmgMFMobileFormatterHeadings;

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

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

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Use "X" icon for home-as-up button in PageActivity.

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

Change subject: Use "X" icon for home-as-up button in PageActivity.
..


Use "X" icon for home-as-up button in PageActivity.

Bug: T145910
Change-Id: I6f40890fba7dde296e354270f12d491d0285
---
M app/src/main/res/layout/activity_page.xml
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/app/src/main/res/layout/activity_page.xml 
b/app/src/main/res/layout/activity_page.xml
index d4db551..9f2721e 100644
--- a/app/src/main/res/layout/activity_page.xml
+++ b/app/src/main/res/layout/activity_page.xml
@@ -1,6 +1,7 @@
 
 http://schemas.android.com/apk/res/android;
+xmlns:app="http://schemas.android.com/apk/res-auto;
 xmlns:tools="http://schemas.android.com/tools;
 android:id="@+id/activity_page_container"
 android:layout_width="match_parent"
@@ -54,7 +55,8 @@
 android:theme="@style/AppTheme.ToolbarTheme"
 android:id="@+id/page_toolbar"
 android:layout_width="match_parent"
-android:layout_height="?attr/actionBarSize">
+android:layout_height="?attr/actionBarSize"
+app:navigationIcon="@drawable/ic_close_white_24dp">
 
 https://gerrit.wikimedia.org/r/312861
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6f40890fba7dde296e354270f12d491d0285
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant 
Gerrit-Reviewer: BearND 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Mholloway 
Gerrit-Reviewer: Niedzielski 
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...CodeEditor[master]: Use slice instead of substring per code conventions

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

Change subject: Use slice instead of substring per code conventions
..


Use slice instead of substring per code conventions

Change-Id: Id9b08270c377f2b31486dbdb9492b77860f436e7
---
M modules/jquery.codeEditor.js
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/modules/jquery.codeEditor.js b/modules/jquery.codeEditor.js
index 7f695a8..5e661ae 100644
--- a/modules/jquery.codeEditor.js
+++ b/modules/jquery.codeEditor.js
@@ -329,7 +329,7 @@
box = context.$textarea;
lang = mw.config.get( 
'wgCodeEditorCurrentLanguage' );
basePath = mw.config.get( 
'wgExtensionAssetsPath', '' );
-   if ( basePath.substring( 0, 2 ) === '//' ) {
+   if ( basePath.slice( 0, 2 ) === '//' ) {
// ACE uses web workers, which have 
importScripts, which don't like relative links.
// This is a problem only when the 
assets are on another server, so this rewrite should suffice
// Protocol relative

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id9b08270c377f2b31486dbdb9492b77860f436e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeEditor
Gerrit-Branch: master
Gerrit-Owner: TheDJ 
Gerrit-Reviewer: Alex Monk 
Gerrit-Reviewer: Krinkle 
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...CodeEditor[master]: Use slice instead of substring per code conventions

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

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

Change subject: Use slice instead of substring per code conventions
..

Use slice instead of substring per code conventions

Change-Id: Id9b08270c377f2b31486dbdb9492b77860f436e7
---
M modules/jquery.codeEditor.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/jquery.codeEditor.js b/modules/jquery.codeEditor.js
index 7f695a8..5e661ae 100644
--- a/modules/jquery.codeEditor.js
+++ b/modules/jquery.codeEditor.js
@@ -329,7 +329,7 @@
box = context.$textarea;
lang = mw.config.get( 
'wgCodeEditorCurrentLanguage' );
basePath = mw.config.get( 
'wgExtensionAssetsPath', '' );
-   if ( basePath.substring( 0, 2 ) === '//' ) {
+   if ( basePath.slice( 0, 2 ) === '//' ) {
// ACE uses web workers, which have 
importScripts, which don't like relative links.
// This is a problem only when the 
assets are on another server, so this rewrite should suffice
// Protocol relative

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9b08270c377f2b31486dbdb9492b77860f436e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeEditor
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]: Bypass login page if no user input is required.

2016-09-26 Thread Cicalese (Code Review)
Cicalese has uploaded a new change for review.

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

Change subject: Bypass login page if no user input is required.
..

Bypass login page if no user input is required.

Bug: T110464
Change-Id: I9588a2b87a423f614fc5d2e771ad1ac7279ebd0b
---
M includes/specialpage/LoginSignupSpecialPage.php
1 file changed, 39 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/312865/1

diff --git a/includes/specialpage/LoginSignupSpecialPage.php 
b/includes/specialpage/LoginSignupSpecialPage.php
index bf83e7b..642da88 100644
--- a/includes/specialpage/LoginSignupSpecialPage.php
+++ b/includes/specialpage/LoginSignupSpecialPage.php
@@ -294,11 +294,18 @@
return;
}
 
-   $status = $this->trySubmit();
+   if ( $this->canBypassForm() ) {
+   $response = $this->performAuthenticationStep( 
$this->authAction,
+   $this->authRequests );
+   $status = Status::newGood( $response );
+   } else {
 
-   if ( !$status || !$status->isGood() ) {
-   $this->mainLoginForm( $this->authRequests, $status ? 
$status->getMessage() : '', 'error' );
-   return;
+   $status = $this->trySubmit();
+
+   if ( !$status || !$status->isGood() ) {
+   $this->mainLoginForm( $this->authRequests, 
$status ? $status->getMessage() : '', 'error' );
+   return;
+   }
}
 
/** @var AuthenticationResponse $response */
@@ -366,6 +373,34 @@
}
}
 
+   private function canBypassForm() {
+   $requiredCount = 0;
+   foreach ( $this->authRequests as $req ) {
+   if ( $req->required === AuthenticationRequest::REQUIRED 
) {
+   if ( $requiredCount > 0 ) {
+   return false;
+   }
+   $requiredCount = $requiredCount + 1;
+   if ( $this->containsInteractiveFields( $req ) ) 
{
+   return false;
+   }
+   }
+   }
+   return true;
+   }
+
+   private function containsInteractiveFields( $req ) {
+   $fieldInfo = $req->getFieldInfo();
+   foreach ( $fieldInfo as $field ) {
+   $type = $field['type'];
+   if ( $type === 'string' || $type === 'password' || 
$type === 'select' ||
+   $type === 'checkbox' || $type === 'multiselect' 
) {
+   return true;
+   }
+   }
+   return false;
+   }
+
/**
 * Show the success page.
 *

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Use slice instead of substring per code conventions

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

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

Change subject: Use slice instead of substring per code conventions
..

Use slice instead of substring per code conventions

Change-Id: I5de8b485d287db097f2ad63a7edf75f86a86822d
---
M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
index b14de0e..187c9d2 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
@@ -100,7 +100,7 @@
  */
 ve.ui.MWAceEditorWidget.prototype.setupEditor = function () {
var basePath = mw.config.get( 'wgExtensionAssetsPath', '' );
-   if ( basePath.substring( 0, 2 ) === '//' ) {
+   if ( basePath.slice( 0, 2 ) === '//' ) {
// ACE uses web workers, which have importScripts, which don't 
like relative links.
basePath = window.location.protocol + basePath;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5de8b485d287db097f2ad63a7edf75f86a86822d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
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] analytics/discovery-stats[production]: Fix syntax error

2016-09-26 Thread MaxSem (Code Review)
MaxSem has submitted this change and it was merged.

Change subject: Fix syntax error
..


Fix syntax error

Bug: T146592
Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
(cherry picked from commit 3511505c81df3c246bf51bf3701c3df6aef4f348)
---
M tracking-category-count.php
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/tracking-category-count.php b/tracking-category-count.php
index a9030e0..b9978ab 100644
--- a/tracking-category-count.php
+++ b/tracking-category-count.php
@@ -16,11 +16,15 @@
 
 function recordToGraphite( $wiki, $metric, $count ) {
 global $config, $debug;
-static $timestamp = time();
+static $timestamp;
 
 if ( !$config->graphiteHost || !$config->graphitePort ) {
 return;
 }
+if ( !$timestamp ) {
+$timestamp = time();
+}
+
 
 $key = str_replace( '%WIKI%', $wiki, $config->categories[$metric] );
 $packet = "$key $count $timestamp";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
Gerrit-PatchSet: 1
Gerrit-Project: analytics/discovery-stats
Gerrit-Branch: production
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: MaxSem 

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


[MediaWiki-commits] [Gerrit] analytics/discovery-stats[production]: Fix syntax error

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Fix syntax error
..

Fix syntax error

Bug: T146592
Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
(cherry picked from commit 3511505c81df3c246bf51bf3701c3df6aef4f348)
---
M tracking-category-count.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/discovery-stats 
refs/changes/63/312863/1

diff --git a/tracking-category-count.php b/tracking-category-count.php
index a9030e0..b9978ab 100644
--- a/tracking-category-count.php
+++ b/tracking-category-count.php
@@ -16,11 +16,15 @@
 
 function recordToGraphite( $wiki, $metric, $count ) {
 global $config, $debug;
-static $timestamp = time();
+static $timestamp;
 
 if ( !$config->graphiteHost || !$config->graphitePort ) {
 return;
 }
+if ( !$timestamp ) {
+$timestamp = time();
+}
+
 
 $key = str_replace( '%WIKI%', $wiki, $config->categories[$metric] );
 $packet = "$key $count $timestamp";

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
Gerrit-PatchSet: 1
Gerrit-Project: analytics/discovery-stats
Gerrit-Branch: production
Gerrit-Owner: MaxSem 

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


[MediaWiki-commits] [Gerrit] mediawiki...TimedMediaHandler[master]: Fix VideoJS resolution plugin on Internet Explorer 9

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

Change subject: Fix VideoJS resolution plugin on Internet Explorer 9
..


Fix VideoJS resolution plugin on Internet Explorer 9

Per 
https://github.com/kmoskwiak/videojs-resolution-switcher/commit/e22c3aa043b7a103396d05af1ff008e3bd00a79e

Change-Id: I1a6f5aaeab420c4583e0013d50daff25a239fc80
---
M resources/videojs-resolution-switcher/videojs-resolution-switcher.js
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git 
a/resources/videojs-resolution-switcher/videojs-resolution-switcher.js 
b/resources/videojs-resolution-switcher/videojs-resolution-switcher.js
index eae1c38..7e23edf 100644
--- a/resources/videojs-resolution-switcher/videojs-resolution-switcher.js
+++ b/resources/videojs-resolution-switcher/videojs-resolution-switcher.js
@@ -42,7 +42,7 @@
   var selection = this.player_.currentResolution();
   this.selected(this.options_.label === selection.label);
 };
-MenuItem.registerComponent('ResolutionMenuItem', ResolutionMenuItem);
+videojs.registerComponent('ResolutionMenuItem', ResolutionMenuItem);
 
 /*
  * Resolution menu button
@@ -96,7 +96,7 @@
 ResolutionMenuButton.prototype.buildCSSClass = function(){
   return MenuButton.prototype.buildCSSClass.call( this ) + ' 
vjs-resolution-button';
 };
-MenuButton.registerComponent('ResolutionMenuButton', ResolutionMenuButton);
+videojs.registerComponent('ResolutionMenuButton', ResolutionMenuButton);
 
 /**
  * Initialize the plugin.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1a6f5aaeab420c4583e0013d50daff25a239fc80
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Paladox 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: JanZerebecki 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Paladox 
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] analytics/discovery-stats[master]: Fix syntax error

2016-09-26 Thread MaxSem (Code Review)
MaxSem has submitted this change and it was merged.

Change subject: Fix syntax error
..


Fix syntax error

Bug: T146592
Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
---
M tracking-category-count.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  MaxSem: Verified
  Yurik: Looks good to me, approved



diff --git a/tracking-category-count.php b/tracking-category-count.php
index a9030e0..b9978ab 100644
--- a/tracking-category-count.php
+++ b/tracking-category-count.php
@@ -16,11 +16,15 @@
 
 function recordToGraphite( $wiki, $metric, $count ) {
 global $config, $debug;
-static $timestamp = time();
+static $timestamp;
 
 if ( !$config->graphiteHost || !$config->graphitePort ) {
 return;
 }
+if ( !$timestamp ) {
+$timestamp = time();
+}
+
 
 $key = str_replace( '%WIKI%', $wiki, $config->categories[$metric] );
 $packet = "$key $count $timestamp";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
Gerrit-PatchSet: 1
Gerrit-Project: analytics/discovery-stats
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: Yurik 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Always throw exception on execute failure

2016-09-26 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review.

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

Change subject: Always throw exception on execute failure
..

Always throw exception on execute failure

Change-Id: I7d9763bc499f3c3fc447f76c32aadf9bc6040e8a
---
M Core/DataStores/DamagedDatabase.php
M Core/DataStores/SmashPigDatabase.php
2 files changed, 7 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/62/312862/1

diff --git a/Core/DataStores/DamagedDatabase.php 
b/Core/DataStores/DamagedDatabase.php
index c5498ba..6b806c0 100644
--- a/Core/DataStores/DamagedDatabase.php
+++ b/Core/DataStores/DamagedDatabase.php
@@ -2,7 +2,6 @@
 namespace SmashPig\Core\DataStores;
 
 use PDO;
-use SmashPig\Core\SmashPigException;
 use SmashPig\Core\UtcDate;
 
 /**
@@ -20,7 +19,6 @@
 * @param int|null $retryDate When provided, re-process message after
 *  this timestamp
 * @return int ID of message in damaged database
-* @throws SmashPigException if insert fails
 */
public function storeMessage(
$message,
@@ -66,10 +64,7 @@
$insert = "INSERT INTO damaged ( $fieldList )
VALUES ( $paramList );";
 
-   if ( $this->prepareAndExecute( $insert, $dbRecord ) ) {
-   return $this->getDatabase()->lastInsertId();
-   }
-   throw new SmashPigException( 'Unable to insert into damaged db' 
);
+   $this->prepareAndExecute( $insert, $dbRecord );
}
 
/**
diff --git a/Core/DataStores/SmashPigDatabase.php 
b/Core/DataStores/SmashPigDatabase.php
index cb92dc1..4c9b3bc 100644
--- a/Core/DataStores/SmashPigDatabase.php
+++ b/Core/DataStores/SmashPigDatabase.php
@@ -3,6 +3,7 @@
 use PDO;
 use PHPQueue\Exception\Exception;
 use SmashPig\Core\Context;
+use SmashPig\Core\SmashPigException;
 
 abstract class SmashPigDatabase {
 
@@ -70,7 +71,7 @@
 *
 * @param string $sql parameterized SQL command
 * @param array $dbRecord associative array of values to bind
-* @return bool true if execution succeeded
+* @throws SmashPigException
 */
protected function prepareAndExecute( $sql, $dbRecord ) {
$prepared = $this->getDatabase()->prepare( $sql );
@@ -82,6 +83,9 @@
PDO::PARAM_STR
);
}
-   return $prepared->execute();
+   if ( !$prepared->execute() ) {
+   $info = print_r( $this->getDatabase()->errorInfo() );
+   throw new SmashPigException( "Failed to execute $sql: 
$info" );
+   }
}
 }

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

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

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: MessageDialog: Improve `-actions` buttons by resetting `bord...

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

Change subject: MessageDialog: Improve `-actions` buttons by resetting 
`border-radius`
..


MessageDialog: Improve `-actions` buttons by resetting `border-radius`

Improving buttons within MessageDialog-actions in MediaWiki theme to
feature no `border-radius` on `:focus`.
Also removing CSS properties that get overwritten by ButtonElement
properties anyways.

Change-Id: Ifc0eadb4e1890f7513a95a716c94e9a6d3555ad3
---
M src/styles/dialogs/MessageDialog.less
M src/themes/mediawiki/windows.less
2 files changed, 19 insertions(+), 17 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  Esanders: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/src/styles/dialogs/MessageDialog.less 
b/src/styles/dialogs/MessageDialog.less
index e50029f..089e5ff 100644
--- a/src/styles/dialogs/MessageDialog.less
+++ b/src/styles/dialogs/MessageDialog.less
@@ -2,6 +2,21 @@
 
 .oo-ui-messageDialog {
&-actions {
+   .oo-ui-actionWidget {
+   position: relative;
+   text-align: center;
+
+   .oo-ui-buttonElement-button {
+   display: block;
+   }
+
+   .oo-ui-labelElement-label {
+   position: relative;
+   top: auto;
+   bottom: auto;
+   }
+   }
+
&-horizontal {
display: table;
table-layout: fixed;
@@ -20,23 +35,6 @@
display: block;
overflow: hidden;
text-overflow: ellipsis;
-   }
-   }
-
-   .oo-ui-actionWidget {
-   position: relative;
-   text-align: center;
-
-   .oo-ui-buttonElement-button {
-   display: block;
-   }
-
-   .oo-ui-labelElement-label {
-   position: relative;
-   top: auto;
-   bottom: auto;
-   display: inline;
-   white-space: nowrap;
}
}
}
diff --git a/src/themes/mediawiki/windows.less 
b/src/themes/mediawiki/windows.less
index b7e7134..71ac46b 100644
--- a/src/themes/mediawiki/windows.less
+++ b/src/themes/mediawiki/windows.less
@@ -67,6 +67,10 @@
min-height: 3.4em;
.oo-ui-inline-spacing( 0 );
 
+   .oo-ui-buttonElement-button {
+   border-radius: 0;
+   }
+
&.oo-ui-labelElement .oo-ui-labelElement-label {
line-height: 3.4;
text-align: center;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc0eadb4e1890f7513a95a716c94e9a6d3555ad3
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: VolkerE 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: VolkerE 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Use "X" icon for home-as-up button in PageActivity.

2016-09-26 Thread Dbrant (Code Review)
Dbrant has uploaded a new change for review.

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

Change subject: Use "X" icon for home-as-up button in PageActivity.
..

Use "X" icon for home-as-up button in PageActivity.

Bug: T145910
Change-Id: I6f40890fba7dde296e354270f12d491d0285
---
M app/src/main/res/layout/activity_page.xml
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/app/src/main/res/layout/activity_page.xml 
b/app/src/main/res/layout/activity_page.xml
index d4db551..9f2721e 100644
--- a/app/src/main/res/layout/activity_page.xml
+++ b/app/src/main/res/layout/activity_page.xml
@@ -1,6 +1,7 @@
 
 http://schemas.android.com/apk/res/android;
+xmlns:app="http://schemas.android.com/apk/res-auto;
 xmlns:tools="http://schemas.android.com/tools;
 android:id="@+id/activity_page_container"
 android:layout_width="match_parent"
@@ -54,7 +55,8 @@
 android:theme="@style/AppTheme.ToolbarTheme"
 android:id="@+id/page_toolbar"
 android:layout_width="match_parent"
-android:layout_height="?attr/actionBarSize">
+android:layout_height="?attr/actionBarSize"
+app:navigationIcon="@drawable/ic_close_white_24dp">
 
 https://gerrit.wikimedia.org/r/312861
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f40890fba7dde296e354270f12d491d0285
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant 

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: FieldsetLayout: Work around positioning problems in Firefox

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

Change subject: FieldsetLayout: Work around positioning problems in Firefox
..


FieldsetLayout: Work around positioning problems in Firefox

Work around positioning problems with `fieldset` and `legend` in
Firefox.

Bug: T146462
Change-Id: I1849280c986b62abb7ca9cb6e1b62582d745716d
---
M php/layouts/FieldsetLayout.php
M src/layouts/FieldsetLayout.js
M src/styles/layouts/FieldsetLayout.less
3 files changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, but someone else must approve
  VolkerE: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/php/layouts/FieldsetLayout.php b/php/layouts/FieldsetLayout.php
index 3b6495d..2a6bb8c 100644
--- a/php/layouts/FieldsetLayout.php
+++ b/php/layouts/FieldsetLayout.php
@@ -32,6 +32,7 @@
$this->initializeGroupElement( $config );
 
// Initialization
+   $this->group->addClasses( [ 'oo-ui-fieldsetLayout-group' ] );
$this
->addClasses( [ 'oo-ui-fieldsetLayout' ] )
->prependContent( $this->label, $this->icon, 
$this->group );
diff --git a/src/layouts/FieldsetLayout.js b/src/layouts/FieldsetLayout.js
index 76200fe..18892d1 100644
--- a/src/layouts/FieldsetLayout.js
+++ b/src/layouts/FieldsetLayout.js
@@ -70,6 +70,7 @@
}
 
// Initialization
+   this.$group.addClass( 'oo-ui-fieldsetLayout-group' );
this.$element
.addClass( 'oo-ui-fieldsetLayout' )
.prepend( this.$label, this.$help, this.$icon, this.$group );
diff --git a/src/styles/layouts/FieldsetLayout.less 
b/src/styles/layouts/FieldsetLayout.less
index 07d366b..35a6b0a 100644
--- a/src/styles/layouts/FieldsetLayout.less
+++ b/src/styles/layouts/FieldsetLayout.less
@@ -23,6 +23,11 @@
max-width: 100%; // Correct the text wrapping in Edge and IE
padding: 0;
white-space: normal; // Correct the text wrapping in Edge and IE
+   float: left; // Prevent positioning problems in Firefox, see 
T146462
+   }
+
+   &-group {
+   clear: both;
}
 
> .oo-ui-fieldsetLayout-help {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1849280c986b62abb7ca9cb6e1b62582d745716d
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: VolkerE 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: MediaWiki theme: Fix `:hover` in ComboBoxInput- & CapsuleMul...

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

Change subject: MediaWiki theme: Fix `:hover` in ComboBoxInput- & 
CapsuleMultiselectWidget
..


MediaWiki theme: Fix `:hover` in ComboBoxInput- & CapsuleMultiselectWidget

Aligning ComboBoxInput- & CapsuleMultiselectWidget `:hover` with
TextInputWidget. They falsely used color of ButtonElement.

Change-Id: Ic062863969285540e54c1d67081743a926f3b99b
---
M src/themes/mediawiki/widgets.less
1 file changed, 2 insertions(+), 6 deletions(-)

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



diff --git a/src/themes/mediawiki/widgets.less 
b/src/themes/mediawiki/widgets.less
index 8d1009f..8ecee89 100644
--- a/src/themes/mediawiki/widgets.less
+++ b/src/themes/mediawiki/widgets.less
@@ -863,7 +863,7 @@
&.oo-ui-widget-enabled:hover {
input,
textarea {
-   border-color: @border-color-default-hover;
+   border-color: @border-color-input-hover;
 
&:focus {
border-color: @border-color-default-focus;
@@ -889,10 +889,6 @@
border: @border-default;
border-radius: @border-radius-default;
.oo-ui-box-sizing( border-box );
-
-   &:hover {
-   border-color: @border-color-input-hover;
-   }
 
> .oo-ui-indicatorElement-indicator,
> .oo-ui-iconElement-icon {
@@ -959,7 +955,7 @@
);
}
&.oo-ui-widget-enabled:hover &-handle {
-   border-color: @border-color-default-hover;
+   border-color: @border-color-input-hover;
}
&.oo-ui-widget-enabled.oo-ui-capsuleMultiselectWidget-open &-handle {
border-color: @border-color-default-focus;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic062863969285540e54c1d67081743a926f3b99b
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: VolkerE 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Prtksxna 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Fix all db accessors sharing a single instance

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

Change subject: Fix all db accessors sharing a single instance
..


Fix all db accessors sharing a single instance

Late static binding fun.

Didn't hurt us with pending and damaged since they had the same
db name, but it messed up fredge access.

Bug: T141477
Change-Id: I39253ce823e6c1447e7ac7b7be8a2cc73b267a6a
---
M Core/DataStores/SmashPigDatabase.php
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/Core/DataStores/SmashPigDatabase.php 
b/Core/DataStores/SmashPigDatabase.php
index d27d5bc..727aa71 100644
--- a/Core/DataStores/SmashPigDatabase.php
+++ b/Core/DataStores/SmashPigDatabase.php
@@ -14,8 +14,8 @@
 
protected function __construct() {
$config = Context::get()->getConfiguration();
-   if ( !self::$db ) {
-   self::$db = $config->object( $this->getConfigKey() );
+   if ( !static::$db ) {
+   static::$db = $config->object( $this->getConfigKey() );
}
}
 
@@ -27,7 +27,7 @@
 * @return PDO
 */
public function getDatabase() {
-   return self::$db;
+   return static::$db;
}
 
public function createTable() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I39253ce823e6c1447e7ac7b7be8a2cc73b267a6a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Cdentinger 
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]: Don't preload entire video files in video.js mode

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

Change subject: Don't preload entire video files in video.js mode
..


Don't preload entire video files in video.js mode

Uses preload="metadata" instead of preload="auto" for native
video/audio playback, or preload="none" for ogv.js playback.

Prevents aggressive preloading of video and audio files that
might not get used. Especially with ogv.js backend this can
fire off a lot of extra requests and threads.

Note that with preload="metadata" there will be fetches for
the file on desktop (but not on mobile, which ignores the
preload hint) but only the very beginning of the file will
be read in.

Change-Id: Ib71fd0397df92e245b9deda41acf57b137eb
---
M resources/ext.tmh.player.js
1 file changed, 12 insertions(+), 2 deletions(-)

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



diff --git a/resources/ext.tmh.player.js b/resources/ext.tmh.player.js
index c90a262..765f8ca 100755
--- a/resources/ext.tmh.player.js
+++ b/resources/ext.tmh.player.js
@@ -53,9 +53,19 @@
// We remove the fullscreen button
playerConfig = $.extend( true, {}, 
playerConfig, audioConfig );
}
+   // Future interactions go faster if we've preloaded a 
little
+   var preload = 'metadata';
+   if ( videoplayer.canPlayType( 'video/webm; 
codecs=vp8,vorbis' ) === '' ) {
+   // ogv.js currently is expensive to start up:
+   // https://github.com/brion/ogv.js/issues/438
+   preload = 'none';
+   }
+   if ( index >= 10 ) {
+   // On pages with many videos, like Category 
pages, don't preload em all
+   preload = 'none';
+   }
$( videoplayer ).attr( {
-   /* Don't preload on pages with many videos, 
like Category pages */
-   preload: ( index < 10 ) ? 'auto' : 'metadata'
+   preload: preload
} ).find( 'source' ).each( function () {
// FIXME would be better if we can configure 
the plugin to make use of our preferred attributes
$source = $( this );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib71fd0397df92e245b9deda41acf57b137eb
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Paladox 
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...CirrusSearch[master]: Switch query parsing from Searcher to CirrusSearch class

2016-09-26 Thread EBernhardson (Code Review)
EBernhardson has uploaded a new change for review.

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

Change subject: Switch query parsing from Searcher to CirrusSearch class
..

Switch query parsing from Searcher to CirrusSearch class

To generate and test the appropriate more like query parsing fixtures we
need to start at CirrusSearch class, where the branching for more like
happens. I wasn't expecting it, but this also caused minor changes in
all the fixtures:

* Queries get appropriately trimmed of \n. Almost all the fixture files
  finish with a \n and we never bothered trimming it. This is probably
  a desired change
* file_text query portion removed from most queries. This also more
  accurately matches how real queries are built. For the most part only
  insource: queries have kept their file_text portion of the query.

There are so many files changed checking what changed is a bit of a
pain, but 90%+ of the changes are the exact same change. This can be
seen by using `git log -1 -p` and setting the console height to the size
of that change, then paging down changes only a few characters and it's
quite obvious the change is consistent (and the exceptions are obvious).

Change-Id: I977b990573fcb3ee6d04f37fca8f6ec41a4a7fba
---
M includes/CirrusSearch.php
M tests/unit/SearcherTest.php
M tests/unit/fixtures/searchText/boost_templates_001.expected
M tests/unit/fixtures/searchText/boost_templates_002.expected
M tests/unit/fixtures/searchText/browsertest_001.expected
M tests/unit/fixtures/searchText/browsertest_002.expected
M tests/unit/fixtures/searchText/browsertest_003.expected
M tests/unit/fixtures/searchText/browsertest_004.expected
M tests/unit/fixtures/searchText/browsertest_005.expected
M tests/unit/fixtures/searchText/browsertest_006.expected
M tests/unit/fixtures/searchText/browsertest_007.expected
M tests/unit/fixtures/searchText/browsertest_008.expected
M tests/unit/fixtures/searchText/browsertest_009.expected
M tests/unit/fixtures/searchText/browsertest_010.expected
M tests/unit/fixtures/searchText/browsertest_011.expected
M tests/unit/fixtures/searchText/browsertest_012.expected
M tests/unit/fixtures/searchText/browsertest_013.expected
M tests/unit/fixtures/searchText/browsertest_014.expected
M tests/unit/fixtures/searchText/browsertest_015.expected
M tests/unit/fixtures/searchText/browsertest_016.expected
M tests/unit/fixtures/searchText/browsertest_017.expected
M tests/unit/fixtures/searchText/browsertest_018.expected
M tests/unit/fixtures/searchText/browsertest_019.expected
M tests/unit/fixtures/searchText/browsertest_020.expected
M tests/unit/fixtures/searchText/browsertest_021.expected
M tests/unit/fixtures/searchText/browsertest_022.expected
M tests/unit/fixtures/searchText/browsertest_023.expected
M tests/unit/fixtures/searchText/browsertest_024.expected
M tests/unit/fixtures/searchText/browsertest_025.expected
M tests/unit/fixtures/searchText/browsertest_026.expected
M tests/unit/fixtures/searchText/browsertest_027.expected
M tests/unit/fixtures/searchText/browsertest_028.expected
M tests/unit/fixtures/searchText/browsertest_029.expected
M tests/unit/fixtures/searchText/browsertest_030.expected
M tests/unit/fixtures/searchText/browsertest_031.expected
M tests/unit/fixtures/searchText/browsertest_032.expected
M tests/unit/fixtures/searchText/browsertest_033.expected
M tests/unit/fixtures/searchText/browsertest_034.expected
M tests/unit/fixtures/searchText/browsertest_035.expected
M tests/unit/fixtures/searchText/browsertest_036.expected
M tests/unit/fixtures/searchText/browsertest_037.expected
M tests/unit/fixtures/searchText/browsertest_038.expected
M tests/unit/fixtures/searchText/browsertest_039.expected
M tests/unit/fixtures/searchText/browsertest_040.expected
M tests/unit/fixtures/searchText/browsertest_041.expected
M tests/unit/fixtures/searchText/browsertest_042.expected
M tests/unit/fixtures/searchText/browsertest_043.expected
M tests/unit/fixtures/searchText/browsertest_044.expected
M tests/unit/fixtures/searchText/browsertest_045.expected
M tests/unit/fixtures/searchText/browsertest_046.expected
M tests/unit/fixtures/searchText/browsertest_047.expected
M tests/unit/fixtures/searchText/browsertest_048.expected
M tests/unit/fixtures/searchText/browsertest_049.expected
M tests/unit/fixtures/searchText/browsertest_050.expected
M tests/unit/fixtures/searchText/browsertest_051.expected
M tests/unit/fixtures/searchText/browsertest_052.expected
M tests/unit/fixtures/searchText/browsertest_053.expected
M tests/unit/fixtures/searchText/browsertest_054.expected
M tests/unit/fixtures/searchText/browsertest_055.expected
M tests/unit/fixtures/searchText/browsertest_056.expected
M tests/unit/fixtures/searchText/browsertest_057.expected
M tests/unit/fixtures/searchText/browsertest_058.expected
M tests/unit/fixtures/searchText/browsertest_059.expected
M tests/unit/fixtures/searchText/browsertest_060.expected
M 

[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Add query parsing tests for morelike

2016-09-26 Thread EBernhardson (Code Review)
EBernhardson has uploaded a new change for review.

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

Change subject: Add query parsing tests for morelike
..

Add query parsing tests for morelike

Change-Id: Iaa76166db48aafd9e009b2e4f3c1eb8a00e58f9a
---
M tests/unit/SearcherTest.php
A tests/unit/fixtures/searchText/morelike_001.expected
A tests/unit/fixtures/searchText/morelike_001.query
A tests/unit/fixtures/searchText/morelike_002.expected
A tests/unit/fixtures/searchText/morelike_002.query
A tests/unit/fixtures/searchText/morelike_003.expected
A tests/unit/fixtures/searchText/morelike_003.query
A tests/unit/fixtures/searchText/morelike_004.expected
A tests/unit/fixtures/searchText/morelike_004.query
9 files changed, 496 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/60/312860/1

diff --git a/tests/unit/SearcherTest.php b/tests/unit/SearcherTest.php
index 49d2673..274146a 100644
--- a/tests/unit/SearcherTest.php
+++ b/tests/unit/SearcherTest.php
@@ -64,6 +64,11 @@
] + $GLOBALS['wgHooks']
] );
 
+   // Set a couple pre-defined pages for anything (morelike) that 
needs valid pages
+   $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+   $linkCache->addGoodLinkObj( 12345, Title::newFromText( 'Some 
page' ) );
+   $linkCache->addGoodLinkObj( 23456, Title::newFromText( 'Other 
page' ) );
+
\RequestContext::getMain()->setRequest( new \FauxRequest( [
'cirrusDumpQuery' => 1,
] ) );
diff --git a/tests/unit/fixtures/searchText/morelike_001.expected 
b/tests/unit/fixtures/searchText/morelike_001.expected
new file mode 100644
index 000..0064d44
--- /dev/null
+++ b/tests/unit/fixtures/searchText/morelike_001.expected
@@ -0,0 +1,241 @@
+{
+"description": "more_like search for 'Some page'",
+"path": "wiki\/page\/_search",
+"params": {
+"search_type": "dfs_query_then_fetch",
+"timeout": "20s"
+},
+"query": {
+"_source": [
+"id",
+"title",
+"namespace",
+"redirect.*",
+"timestamp",
+"text_bytes"
+],
+"fields": "text.word_count",
+"query": {
+"bool": {
+"must": [
+{
+"more_like_this": {
+"min_doc_freq": 2,
+"max_doc_freq": null,
+"max_query_terms": 25,
+"min_term_freq": 2,
+"min_word_len": 0,
+"max_word_len": 0,
+"minimum_should_match": "30%",
+"fields": [
+"text"
+],
+"like": [
+{
+"_id": "12345"
+}
+]
+}
+}
+],
+"filter": [
+{
+"terms": {
+"namespace": [
+0,
+1,
+2,
+3
+]
+}
+}
+]
+}
+},
+"highlight": {
+"pre_tags": [
+""
+],
+"post_tags": [
+"<\/span>"
+],
+"fields": {
+"title": {
+"type": "experimental",
+"fragmenter": "none",
+"number_of_fragments": 1,
+"matched_fields": [
+"title",
+"title.plain"
+]
+},
+"redirect.title": {
+"type": "experimental",
+"fragmenter": "none",
+"order": "score",
+"number_of_fragments": 1,
+"options": {
+"skip_if_last_matched": true
+},
+"matched_fields": [
+"redirect.title",
+"redirect.title.plain"
+]
+},
+"category": {
+"type": "experimental",
+"fragmenter": "none",
+"order": "score",
+"number_of_fragments": 1,
+"options": {
+"skip_if_last_matched": true
+},
+

[MediaWiki-commits] [Gerrit] analytics/discovery-stats[master]: Fix syntax error

2016-09-26 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review.

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

Change subject: Fix syntax error
..

Fix syntax error

Bug: T146592
Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
---
M tracking-category-count.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/discovery-stats 
refs/changes/58/312858/1

diff --git a/tracking-category-count.php b/tracking-category-count.php
index a9030e0..b9978ab 100644
--- a/tracking-category-count.php
+++ b/tracking-category-count.php
@@ -16,11 +16,15 @@
 
 function recordToGraphite( $wiki, $metric, $count ) {
 global $config, $debug;
-static $timestamp = time();
+static $timestamp;
 
 if ( !$config->graphiteHost || !$config->graphitePort ) {
 return;
 }
+if ( !$timestamp ) {
+$timestamp = time();
+}
+
 
 $key = str_replace( '%WIKI%', $wiki, $config->categories[$metric] );
 $packet = "$key $count $timestamp";

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c6a0b33e361f99b664f36aa82264363c3133ac7
Gerrit-PatchSet: 1
Gerrit-Project: analytics/discovery-stats
Gerrit-Branch: master
Gerrit-Owner: MaxSem 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rather than...

2016-09-26 Thread Code Review
Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rather than 
JSONP
..

ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rather than JSONP

Requires MediaWiki core change
Ic93d733cb9e1b1d7301f8975c68ab7ded778845a.

On wikis with CentralAuth installed, also requires
I24c2819ec2adcab468f961c5c46b31c331324567 and
I372e7bdff35400287b3d961da979d6f094d13bd9.

Bug: T143279
Change-Id: Id60bb3cde7e2032846da9606aefb00ea805f2ecd
---
M modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
1 file changed, 8 insertions(+), 22 deletions(-)


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

diff --git a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js 
b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
index 8d24a32..7f37105 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
@@ -27,25 +27,13 @@
this.isLocal = config.local !== undefined;
 
if ( this.isLocal ) {
-   this.setAjaxSettings( {
-   url: mw.util.wikiScript( 'api' ),
-   // If the url is local use json
-   dataType: 'json'
-   } );
+   this.setAPIurl( mw.util.wikiScript( 'api' ) );
} else {
-   this.setAjaxSettings( {
-   // If 'apiurl' is set, use that. Otherwise, build the 
url
-   // from scriptDirUrl and /api.php suffix
-   url: this.getAPIurl() || ( this.scriptDirUrl + 
'/api.php' ),
-   // If the url is not the same origin use jsonp
-   dataType: 'jsonp',
-   // JSON-P requests are not cached by default and get a 
&_=random trail.
-   // While setting cache=true will still bypass cache in 
most case due to the
-   // callback parameter, at least drop the &_=random 
trail which triggers
-   // an API warning (invalid parameter).
-   cache: true
-   } );
+   // If 'apiurl' is set, use that. Otherwise, build the url
+   // from scriptDirUrl and /api.php suffix
+   this.setAPIurl( this.getAPIurl() || ( this.scriptDirUrl + 
'/api.php' ) );
}
+
this.siteInfoPromise = null;
this.thumbSizes = [];
this.imageSizes = [];
@@ -180,17 +168,15 @@
  *  the fetched data.
  */
 ve.dm.MWMediaResourceProvider.prototype.fetchAPIresults = function ( howMany ) 
{
-   var xhr,
-   ajaxOptions = {},
+   var xhr, api,
provider = this;
 
if ( !this.isValid() ) {
return $.Deferred().reject().promise( { abort: $.noop } );
}
 
-   ajaxOptions = this.getAjaxSettings();
-
-   xhr = new mw.Api().get( $.extend( {}, this.getStaticParams(), 
this.getUserParams(), this.getContinueData( howMany ) ), ajaxOptions );
+   api = this.isLocal ? new mw.Api() : new mw.ForeignApi( 
this.getAPIurl(), { anonymous: true } );
+   xhr = api.get( $.extend( {}, this.getStaticParams(), 
this.getUserParams(), this.getContinueData( howMany ) ) );
return xhr
.then( function ( data ) {
var page, newObj, raw,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id60bb3cde7e2032846da9606aefb00ea805f2ecd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Revert "ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rat...

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

Change subject: Revert "ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rather 
than JSONP"
..


Revert "ve.dm.MWMediaResourceProvider: Use mw.ForeignApi rather than JSONP"

The change was merged without the necessary dependencies.
This reverts commit 2b1c3914eca7fc5b11e517babefa858ecf9eecff.

Bug: T143279
Bug: T146661
Change-Id: I5ce945f6167c9db5d5f03c824dee3d89cd0931a8
---
M modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
1 file changed, 22 insertions(+), 8 deletions(-)

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



diff --git a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js 
b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
index 7f37105..8d24a32 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWMediaResourceProvider.js
@@ -27,13 +27,25 @@
this.isLocal = config.local !== undefined;
 
if ( this.isLocal ) {
-   this.setAPIurl( mw.util.wikiScript( 'api' ) );
+   this.setAjaxSettings( {
+   url: mw.util.wikiScript( 'api' ),
+   // If the url is local use json
+   dataType: 'json'
+   } );
} else {
-   // If 'apiurl' is set, use that. Otherwise, build the url
-   // from scriptDirUrl and /api.php suffix
-   this.setAPIurl( this.getAPIurl() || ( this.scriptDirUrl + 
'/api.php' ) );
+   this.setAjaxSettings( {
+   // If 'apiurl' is set, use that. Otherwise, build the 
url
+   // from scriptDirUrl and /api.php suffix
+   url: this.getAPIurl() || ( this.scriptDirUrl + 
'/api.php' ),
+   // If the url is not the same origin use jsonp
+   dataType: 'jsonp',
+   // JSON-P requests are not cached by default and get a 
&_=random trail.
+   // While setting cache=true will still bypass cache in 
most case due to the
+   // callback parameter, at least drop the &_=random 
trail which triggers
+   // an API warning (invalid parameter).
+   cache: true
+   } );
}
-
this.siteInfoPromise = null;
this.thumbSizes = [];
this.imageSizes = [];
@@ -168,15 +180,17 @@
  *  the fetched data.
  */
 ve.dm.MWMediaResourceProvider.prototype.fetchAPIresults = function ( howMany ) 
{
-   var xhr, api,
+   var xhr,
+   ajaxOptions = {},
provider = this;
 
if ( !this.isValid() ) {
return $.Deferred().reject().promise( { abort: $.noop } );
}
 
-   api = this.isLocal ? new mw.Api() : new mw.ForeignApi( 
this.getAPIurl(), { anonymous: true } );
-   xhr = api.get( $.extend( {}, this.getStaticParams(), 
this.getUserParams(), this.getContinueData( howMany ) ) );
+   ajaxOptions = this.getAjaxSettings();
+
+   xhr = new mw.Api().get( $.extend( {}, this.getStaticParams(), 
this.getUserParams(), this.getContinueData( howMany ) ), ajaxOptions );
return xhr
.then( function ( data ) {
var page, newObj, raw,

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

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

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


  1   2   >