[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make DeferredUpdates call setTransactionTicket() on all Data...

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

Change subject: Make DeferredUpdates call setTransactionTicket() on all 
DataUpdate tasks
..


Make DeferredUpdates call setTransactionTicket() on all DataUpdate tasks

This assues that things like LinksUpdate/LinksDeletionUpdate will
have a proper ticket for commitAndWaitForReplication()

Change-Id: I8234510efb706394c39c4027ddf54ace76983aa9
---
M includes/deferred/DeferredUpdates.php
1 file changed, 9 insertions(+), 1 deletion(-)

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



diff --git a/includes/deferred/DeferredUpdates.php 
b/includes/deferred/DeferredUpdates.php
index 6921b66..d24ebde 100644
--- a/includes/deferred/DeferredUpdates.php
+++ b/includes/deferred/DeferredUpdates.php
@@ -160,6 +160,8 @@
$lbFactory = $services->getDBLoadBalancerFactory();
$method = RequestContext::getMain()->getRequest()->getMethod();
 
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+
/** @var ErrorPageError $reportableError */
$reportableError = null;
/** @var DeferrableUpdate[] $updates Snapshot of queue */
@@ -182,7 +184,13 @@
// Order will be DataUpdate followed by generic 
DeferrableUpdate tasks
$updatesByType = [ 'data' => [], 'generic' => [] ];
foreach ( $updates as $du ) {
-   $updatesByType[$du instanceof DataUpdate ? 
'data' : 'generic'][] = $du;
+   if ( $du instanceof DataUpdate ) {
+   $du->setTransactionTicket( $ticket );
+   $updatesByType['data'][] = $du;
+   } else {
+   $updatesByType['generic'][] = $du;
+   }
+
$name = ( $du instanceof DeferrableCallback )
? get_class( $du ) . '-' . 
$du->getOrigin()
: get_class( $du );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8234510efb706394c39c4027ddf54ace76983aa9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
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]: Parser: Allow disabling magic link functionality

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

Change subject: Parser: Allow disabling magic link functionality
..


Parser: Allow disabling magic link functionality

The magic link functionality is "old backwards-compatibility baggage"
that we probably want to get rid of eventually. The first step to doing
so would be making it configurable and allowing it to be turned off on
wikis that don't use it.

This adds each of the 3 magic link types as individual parser options,
which can be controlled by the $wgEnableMagicLinks setting.

Additionally, wfEscapeWikiText() was updated to only escape enabled
magic link types.

Bug: T47942
Change-Id: If63965f31d17da4b864510146e0018da1cae188c
---
M includes/DefaultSettings.php
M includes/GlobalFunctions.php
M includes/parser/Parser.php
M includes/parser/ParserOptions.php
M tests/parser/ParserTestRunner.php
M tests/parser/parserTests.txt
6 files changed, 108 insertions(+), 4 deletions(-)

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



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index ff7430b..3ab8829 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4353,6 +4353,18 @@
  */
 $wgTranscludeCacheExpiry = 3600;
 
+/**
+ * Enable the magic links feature of automatically turning ISBN xxx,
+ * PMID xxx, RFC xxx into links
+ *
+ * @since 1.28
+ */
+$wgEnableMagicLinks = [
+   'ISBN' => true,
+   'PMID' => true,
+   'RFC' => true
+];
+
 /** @} */ # end of parser settings }
 
 ///**
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index f93c64e..0e59653 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -1665,6 +1665,7 @@
  * @return string
  */
 function wfEscapeWikiText( $text ) {
+   global $wgEnableMagicLinks;
static $repl = null, $repl2 = null;
if ( $repl === null ) {
$repl = [
@@ -1682,8 +1683,9 @@
'__' => '_', '://' => '//',
];
 
+   $magicLinks = array_keys( array_filter( $wgEnableMagicLinks ) );
// We have to catch everything "\s" matches in PCRE
-   foreach ( [ 'ISBN', 'RFC', 'PMID' ] as $magic ) {
+   foreach ( $magicLinks as $magic ) {
$repl["$magic "] = "$magic";
$repl["$magic\t"] = "$magic";
$repl["$magic\r"] = "$magic";
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index d83ea34..7c18798 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1439,11 +1439,17 @@
} elseif ( isset( $m[5] ) && $m[5] !== '' ) {
# RFC or PMID
if ( substr( $m[0], 0, 3 ) === 'RFC' ) {
+   if ( !$this->mOptions->getMagicRFCLinks() ) {
+   return $m[0];
+   }
$keyword = 'RFC';
$urlmsg = 'rfcurl';
$cssClass = 'mw-magiclink-rfc';
$id = $m[5];
} elseif ( substr( $m[0], 0, 4 ) === 'PMID' ) {
+   if ( !$this->mOptions->getMagicPMIDLinks() ) {
+   return $m[0];
+   }
$keyword = 'PMID';
$urlmsg = 'pubmedurl';
$cssClass = 'mw-magiclink-pmid';
@@ -1454,7 +1460,9 @@
}
$url = wfMessage( $urlmsg, $id 
)->inContentLanguage()->text();
return Linker::makeExternalLink( $url, "{$keyword} 
{$id}", true, $cssClass, [], $this->mTitle );
-   } elseif ( isset( $m[6] ) && $m[6] !== '' ) {
+   } elseif ( isset( $m[6] ) && $m[6] !== ''
+   && $this->mOptions->getMagicISBNLinks()
+   ) {
# ISBN
$isbn = $m[6];
$space = self::SPACE_NOT_NL; #  non-newline space
diff --git a/includes/parser/ParserOptions.php 
b/includes/parser/ParserOptions.php
index 891c4dd..fd826a2 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -216,6 +216,21 @@
private $mExtraKey = '';
 
/**
+* Are magic ISBN links enabled?
+*/
+   private $mMagicISBNLinks = true;
+
+   /**
+* Are magic PMID links enabled?
+*/
+   private $mMagicPMIDLinks = true;
+
+   /**
+* Are magic RFC links enabled?
+*/
+   private $mMagicRFCLinks = true;
+
+   /**
 * Function to be called when an option is 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: SkinTemplate: Improve remote content handling in content nav...

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

Change subject: SkinTemplate: Improve remote content handling in content 
navigation URLs
..


SkinTemplate: Improve remote content handling in content navigation URLs

Use Title::isKnown() to determine whether to display the "view" view link
instead of checking $isForeignFile, since that includes all remote
content. This allows us to remove the GlobalUserPage hook that made the
tab look as if it existed.

Change-Id: Ibee7b64511fba8c2934da3c7a3bdd52090dcb58c
---
M includes/skins/SkinTemplate.php
1 file changed, 7 insertions(+), 6 deletions(-)

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



diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index f185789..2351ab8 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -909,11 +909,8 @@
$content_navigation['namespaces'][$talkId]['context'] = 
'talk';
 
if ( $userCanRead ) {
-   $isForeignFile = $title->inNamespace( NS_FILE ) 
&& $this->canUseWikiPage() &&
-   $this->getWikiPage() instanceof 
WikiFilePage && !$this->getWikiPage()->isLocal();
-
-   // Adds view view link
-   if ( $title->exists() || $isForeignFile ) {
+   // Adds "view" view link
+   if ( $title->isKnown() ) {
$content_navigation['views']['view'] = 
$this->tabAction(
$isTalk ? $talkPage : 
$subjectPage,
[ "$skname-view-view", 'view' ],
@@ -923,7 +920,11 @@

$content_navigation['views']['view']['redundant'] = true;
}
 
+   $isForeignFile = $title->inNamespace( NS_FILE ) 
&& $this->canUseWikiPage() &&
+   $this->getWikiPage() instanceof 
WikiFilePage && !$this->getWikiPage()->isLocal();
+
// If it is a non-local file, show a link to 
the file in its own repository
+   // @todo abstract this for remote content that 
isn't a file
if ( $isForeignFile ) {
$file = $this->getWikiPage()->getFile();

$content_navigation['views']['view-foreign'] = [
@@ -981,7 +982,7 @@
'href' => 
$title->getLocalURL( 'action=edit=new' )
];
}
-   // Checks if the page has some kind of viewable 
content
+   // Checks if the page has some kind of viewable 
source content
} elseif ( $title->hasSourceText() ) {
// Adds view source view link

$content_navigation['views']['viewsource'] = [

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibee7b64511fba8c2934da3c7a3bdd52090dcb58c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Jack Phoenix 
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]: Add WikiPage::isLocal()

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

Change subject: Add WikiPage::isLocal()
..


Add WikiPage::isLocal()

WikiFilePage has a isLocal() function which indicates whether the file
is local or not. To better support other remote content, add this method
to the base WikiPage class. It only returns true currently, since all
content represented by WikiPage is local.

Change-Id: Ia39c405af4d131d919a57512e72a112bd65cc461
---
M includes/page/WikiPage.php
1 file changed, 11 insertions(+), 0 deletions(-)

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



diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 938f292..f25dff0 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -3706,4 +3706,15 @@
Hooks::run( 'WikiPageDeletionUpdates', [ $this, $content, 
&$updates ] );
return $updates;
}
+
+   /**
+* Whether this content displayed on this page
+* comes from the local database
+*
+* @since 1.28
+* @return bool
+*/
+   public function isLocal() {
+   return true;
+   }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia39c405af4d131d919a57512e72a112bd65cc461
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
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...Scribunto[master]: Handle magic links being disabled

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

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

Change subject: Handle magic links being disabled
..

Handle magic links being disabled

Follows up 78debba3aa in MediaWiki core.

Bug: T47942
Change-Id: I0c5f8ccd40fb658f9665640c9ecbb6192b4b745a
---
M engines/LuaCommon/TextLibrary.php
M engines/LuaCommon/lualib/mw.text.lua
2 files changed, 34 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/09/310209/1

diff --git a/engines/LuaCommon/TextLibrary.php 
b/engines/LuaCommon/TextLibrary.php
index e3df79b..164f21e 100644
--- a/engines/LuaCommon/TextLibrary.php
+++ b/engines/LuaCommon/TextLibrary.php
@@ -26,6 +26,22 @@
'nowiki_protocols' => array(),
);
 
+   $parserOpts = $this->getParserOptions();
+   // Magic links were made configurable in MW 1.28
+   if ( is_callable( [ $parserOpts, 'getMagicISBNLinks' ] ) ) {
+   $opts += [
+   'magicISBN' => $parserOpts->getMagicISBNLinks(),
+   'magicPMID' => $parserOpts->getMagicPMIDLinks(),
+   'magicRFC' => $parserOpts->getMagicRFCLinks(),
+   ];
+   } else {
+   $opts += [
+   'magicISBN' => true,
+   'magicPMID' => true,
+   'magicRFC' => true,
+   ];
+   }
+
foreach ( $wgUrlProtocols as $prot ) {
if ( substr( $prot, -1 ) === ':' ) {
// To convert the protocol into a 
case-insensitive Lua pattern,
diff --git a/engines/LuaCommon/lualib/mw.text.lua 
b/engines/LuaCommon/lualib/mw.text.lua
index 0439966..583ea86 100644
--- a/engines/LuaCommon/lualib/mw.text.lua
+++ b/engines/LuaCommon/lualib/mw.text.lua
@@ -119,9 +119,15 @@
['\n'] = '',
['\f'] = '',
 } ) do
-   nowikiReplMagic['ISBN' .. sp] = 'ISBN' .. esc
-   nowikiReplMagic['RFC' .. sp] = 'RFC' .. esc
-   nowikiReplMagic['PMID' .. sp] = 'PMID' .. esc
+   if options.magicISBN then
+   nowikiReplMagic['ISBN' .. sp] = 'ISBN' .. esc
+   end
+   if options.magicRFC then
+   nowikiReplMagic['RFC' .. sp] = 'RFC' .. esc
+   end
+   if options.magicPMID then
+   nowikiReplMagic['PMID' .. sp] = 'PMID' .. esc
+   end
 end
 
 function mwtext.nowiki( s )
@@ -133,9 +139,15 @@
s = string.sub( s, 2 )
s = string.gsub( s, '__', '_' )
s = string.gsub( s, '://', '//' )
-   s = string.gsub( s, 'ISBN%s', nowikiReplMagic )
-   s = string.gsub( s, 'RFC%s', nowikiReplMagic )
-   s = string.gsub( s, 'PMID%s', nowikiReplMagic )
+   if options.magicISBN then
+   s = string.gsub( s, 'ISBN%s', nowikiReplMagic )
+   end
+   if options.magicRFC then
+   s = string.gsub( s, 'RFC%s', nowikiReplMagic )
+   end
+   if options.magicPMID then
+   s = string.gsub( s, 'PMID%s', nowikiReplMagic )
+   end
for k, v in pairs( options.nowiki_protocols ) do
s = string.gsub( s, k, v )
end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c5f8ccd40fb658f9665640c9ecbb6192b4b745a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
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]: LocalIdLookup: Use DBAccessObjectUtils

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

Change subject: LocalIdLookup: Use DBAccessObjectUtils
..


LocalIdLookup: Use DBAccessObjectUtils

This simplies some code that was re-implementing
DBAccessObjectUtils::getDBOptions().

Change-Id: Ib446f43149abdf23f07f209ccd9698923f0a2c22
---
M includes/user/LocalIdLookup.php
1 file changed, 4 insertions(+), 8 deletions(-)

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



diff --git a/includes/user/LocalIdLookup.php b/includes/user/LocalIdLookup.php
index 0d8b1a8..0a34554 100644
--- a/includes/user/LocalIdLookup.php
+++ b/includes/user/LocalIdLookup.php
@@ -60,10 +60,8 @@
}
 
$audience = $this->checkAudience( $audience );
-   $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : 
DB_REPLICA );
-   $options = ( ( $flags & self::READ_LOCKING ) == 
self::READ_LOCKING )
-   ? [ 'LOCK IN SHARE MODE' ]
-   : [];
+   list( $index, $options ) = DBAccessObjectUtils::getDBOptions( 
$flags );
+   $db = wfGetDB( $index );
 
$tables = [ 'user' ];
$fields = [ 'user_id', 'user_name' ];
@@ -93,10 +91,8 @@
}
 
$audience = $this->checkAudience( $audience );
-   $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : 
DB_REPLICA );
-   $options = ( ( $flags & self::READ_LOCKING ) == 
self::READ_LOCKING )
-   ? [ 'LOCK IN SHARE MODE' ]
-   : [];
+   list( $index, $options ) = DBAccessObjectUtils::getDBOptions( 
$flags );
+   $db = wfGetDB( $index );
 
$tables = [ 'user' ];
$fields = [ 'user_id', 'user_name' ];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib446f43149abdf23f07f209ccd9698923f0a2c22
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
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...python-thumbor-wikimedia[master]: Upgrade to 0.1.18

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

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

Change subject: Upgrade to 0.1.18
..

Upgrade to 0.1.18

Change-Id: If02f2d9dec5cd07debf3afa1ab435fef3bf62473
---
M debian/40-wikimedia.conf
M debian/changelog
M debian/control
3 files changed, 14 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/debs/python-thumbor-wikimedia 
refs/changes/00/31/1

diff --git a/debian/40-wikimedia.conf b/debian/40-wikimedia.conf
index ccb1417..484315b 100644
--- a/debian/40-wikimedia.conf
+++ b/debian/40-wikimedia.conf
@@ -44,3 +44,5 @@
 PROXY_LOADER_LOADERS = [
 'wikimedia_thumbor.loader.video'
 ]
+
+SLOW_PROCESSING_LIMIT = 30
diff --git a/debian/changelog b/debian/changelog
index 95d8cbb..46a10dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+python-thumbor-wikimedia (0.1.18-1) jessie-wikimedia; urgency=low
+
+  * New upstream release
+  * debian/control
+- remove dependency on python-bs4
+  * debian/40-wikimedia.conf
+- add SLOW_PROCESSING_LIMIT config value
+
+ -- Gilles Dubuc   Mon, 12 Sep 2016 13:57:35 +
+
 python-thumbor-wikimedia (0.1.17-1) jessie-wikimedia; urgency=low
 
   * New upstream release
@@ -17,7 +27,7 @@
   * New upstream release
   * debian/control
 - remove dependency on cgroup-tools
-  * 40-wikimedia.conf
+  * debian/40-wikimedia.conf
 - remove cgroup config, because package doesn't actually create the cgroups
 - set new flag needed for timeout to be used
 
diff --git a/debian/control b/debian/control
index b538a72..e62441d 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,6 @@
librsvg2-bin,
libvips-tools,
python-all,
-   python-bs4,
python-cairosvg,
python-djvu,
python-gi,
@@ -32,7 +31,7 @@
 
 Package: python-thumbor-wikimedia
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, djvulibre-bin, ffmpeg, 
ghostscript, gifsicle, libimage-exiftool-perl, librsvg2-bin, libvips-tools, 
python-bs4, python-cairosvg, python-djvu, python-gi, python-libthumbor (>= 
1.3.2), python-lxml, python-swiftclient (>= 2.5.0), 
python-thumbor-community-core, python-wand, thumbor (>= 6.0.1), xcftools
+Depends: ${misc:Depends}, ${python:Depends}, djvulibre-bin, ffmpeg, 
ghostscript, gifsicle, libimage-exiftool-perl, librsvg2-bin, libvips-tools, 
python-cairosvg, python-djvu, python-gi, python-libthumbor (>= 1.3.2), 
python-lxml, python-swiftclient (>= 2.5.0), python-thumbor-community-core, 
python-wand, thumbor (>= 6.0.1), xcftools
 Suggests: cgroup-tools
 Provides: ${python:Provides}
 Description: Thumbor wikimedia extensions

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If02f2d9dec5cd07debf3afa1ab435fef3bf62473
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/python-thumbor-wikimedia
Gerrit-Branch: master
Gerrit-Owner: Gilles 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: CentralIdLookup: Fix documentation of self::$instances

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

Change subject: CentralIdLookup: Fix documentation of self::$instances
..


CentralIdLookup: Fix documentation of self::$instances

Change-Id: I9fd86c174832e130647e74f4fdeb9fdc7c90702e
---
M includes/user/CentralIdLookup.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/includes/user/CentralIdLookup.php 
b/includes/user/CentralIdLookup.php
index f67a8d8..2ced6e2 100644
--- a/includes/user/CentralIdLookup.php
+++ b/includes/user/CentralIdLookup.php
@@ -31,7 +31,7 @@
const AUDIENCE_PUBLIC = 1;
const AUDIENCE_RAW = 2;
 
-   /** @var CentralIdLookup[][] */
+   /** @var CentralIdLookup[] */
private static $instances = [];
 
/** @var string */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9fd86c174832e130647e74f4fdeb9fdc7c90702e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
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]: session: Fix phpdoc in Token::toStringAtTimestamp()

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

Change subject: session: Fix phpdoc in Token::toStringAtTimestamp()
..


session: Fix phpdoc in Token::toStringAtTimestamp()

Change-Id: I35664eb9e89ffb945eb35bf3af58e1efdea0a8ff
---
M includes/session/Token.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/includes/session/Token.php b/includes/session/Token.php
index 9b4a73c..523e0cc 100644
--- a/includes/session/Token.php
+++ b/includes/session/Token.php
@@ -73,7 +73,7 @@
 
/**
 * Get the string representation of the token at a timestamp
-* @param int timestamp
+* @param int $timestamp
 * @return string
 */
protected function toStringAtTimestamp( $timestamp ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I35664eb9e89ffb945eb35bf3af58e1efdea0a8ff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Anomie 
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]: re-enable "Show globe icon next to all links"

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

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

Change subject: re-enable "Show globe icon next to all  links"
..

re-enable "Show globe icon next to all  links"

Per objections by Ed Sanders and Volker. Once the design
review is done, we should recommit.

This reverts commit be68e2c15a217318c17a06799b6bcdd2f1cf6f83.

Bug: T145176
Change-Id: I67e3607872dd97f45987a59b91f70da9d93d3fa3
---
A styles/images/COPYING
A styles/images/icon-map-link.png
A styles/images/icon-map-link.svg
M styles/kartographer.less
4 files changed, 41 insertions(+), 0 deletions(-)


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

diff --git a/styles/images/COPYING b/styles/images/COPYING
new file mode 100644
index 000..7833ea6
--- /dev/null
+++ b/styles/images/COPYING
@@ -0,0 +1,3 @@
+== icon-map-link.svg ==
+Free to use and licensed under MIT from Ionicons 
https://github.com/driftyco/ionicons/blob/master/src/ios-world-outline.svg
+The ios-world-outline.png is generated for the SVG file for legacy browser 
support.
\ No newline at end of file
diff --git a/styles/images/icon-map-link.png b/styles/images/icon-map-link.png
new file mode 100644
index 000..7e3944a
--- /dev/null
+++ b/styles/images/icon-map-link.png
Binary files differ
diff --git a/styles/images/icon-map-link.svg b/styles/images/icon-map-link.svg
new file mode 100644
index 000..16b5496
--- /dev/null
+++ b/styles/images/icon-map-link.svg
@@ -0,0 +1,22 @@
+
+
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;>
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px"
+width="512px" height="512px" viewBox="0 0 512 512" 
style="enable-background:new 0 0 512 512;" xml:space="preserve">
+
+
diff --git a/styles/kartographer.less b/styles/kartographer.less
index 45f05a8..d6ae54c 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -1,3 +1,5 @@
+@import 'mediawiki.mixins';
+
 .mw-kartographer-mapDialog-map {
position: absolute;
top: 0;
@@ -15,6 +17,19 @@
 a.mw-kartographer-link {
display: inline;
cursor: pointer;
+
+   background-position: center right;
+   background-repeat: no-repeat;
+   .background-image-svg('images/icon-map-link.svg', 
'images/icon-map-link.png');
+   padding-right: 17px;
+   margin-right: 2px;
+   background-size: 16px 16px;
+
+   &.no-icon:not(.mw-kartographer-autostyled) {
+   background: none;
+   padding-right: 0;
+   margin-right: 0;
+   }
 }
 
 a.mw-kartographer-autostyled {
@@ -32,6 +47,7 @@
line-height: 1;
text-align: center;
 }
+
 a.mw-kartographer-autostyled:visited {
color: #fff;
 }

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Revert "Show globe icon next to all links"

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

Change subject: Revert "Show globe icon next to all  links"
..


Revert "Show globe icon next to all  links"

This reverts commit 01e36af383a581b03286d3d919d2a66a99034bc8
and commit 0c49b864590d5f812b0258a20c216d8dcfd5cd91.

Per objections by Ed Sanders and Volker. Once the design
review is done, we should recommit.

Bug: T145176
Change-Id: Id5b071f91f89b592ae7ab327058fe9d1520e7fc8
---
D styles/images/COPYING
D styles/images/icon-map-link.png
D styles/images/icon-map-link.svg
M styles/kartographer.less
4 files changed, 0 insertions(+), 41 deletions(-)

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



diff --git a/styles/images/COPYING b/styles/images/COPYING
deleted file mode 100644
index 7833ea6..000
--- a/styles/images/COPYING
+++ /dev/null
@@ -1,3 +0,0 @@
-== icon-map-link.svg ==
-Free to use and licensed under MIT from Ionicons 
https://github.com/driftyco/ionicons/blob/master/src/ios-world-outline.svg
-The ios-world-outline.png is generated for the SVG file for legacy browser 
support.
\ No newline at end of file
diff --git a/styles/images/icon-map-link.png b/styles/images/icon-map-link.png
deleted file mode 100644
index 7e3944a..000
--- a/styles/images/icon-map-link.png
+++ /dev/null
Binary files differ
diff --git a/styles/images/icon-map-link.svg b/styles/images/icon-map-link.svg
deleted file mode 100644
index 16b5496..000
--- a/styles/images/icon-map-link.svg
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;>
-http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px"
-width="512px" height="512px" viewBox="0 0 512 512" 
style="enable-background:new 0 0 512 512;" xml:space="preserve">
-
-
diff --git a/styles/kartographer.less b/styles/kartographer.less
index d6ae54c..45f05a8 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -1,5 +1,3 @@
-@import 'mediawiki.mixins';
-
 .mw-kartographer-mapDialog-map {
position: absolute;
top: 0;
@@ -17,19 +15,6 @@
 a.mw-kartographer-link {
display: inline;
cursor: pointer;
-
-   background-position: center right;
-   background-repeat: no-repeat;
-   .background-image-svg('images/icon-map-link.svg', 
'images/icon-map-link.png');
-   padding-right: 17px;
-   margin-right: 2px;
-   background-size: 16px 16px;
-
-   &.no-icon:not(.mw-kartographer-autostyled) {
-   background: none;
-   padding-right: 0;
-   margin-right: 0;
-   }
 }
 
 a.mw-kartographer-autostyled {
@@ -47,7 +32,6 @@
line-height: 1;
text-align: center;
 }
-
 a.mw-kartographer-autostyled:visited {
color: #fff;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5b071f91f89b592ae7ab327058fe9d1520e7fc8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Yurik 
Gerrit-Reviewer: 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/core[master]: WikiPage: Use Title::isKnown() in hasViewableContent()

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

Change subject: WikiPage: Use Title::isKnown() in hasViewableContent()
..


WikiPage: Use Title::isKnown() in hasViewableContent()

The current implementation of hasViewableContent() is basically the same
as Title::isKnown(), except that it switched the order of
isAlwaysKnown() and exists(). (Also it used WikiPage::exists() instead
of Title::exists(), but they're functionality equivalent).

This will make refactoring Title::isAlwaysKnown() easier in the future
as there is one less caller.

Change-Id: I698f08fb0f3e6c3bc702ec7d523d7eda063e18ca
---
M includes/page/WikiPage.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 938f292..fcc77a0 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -460,7 +460,7 @@
 * @return bool
 */
public function hasViewableContent() {
-   return $this->exists() || $this->mTitle->isAlwaysKnown();
+   return $this->mTitle->isKnown();
}
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I698f08fb0f3e6c3bc702ec7d523d7eda063e18ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
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...WikimediaMaintenance[master]: Make sure only WMF/Chapter interwikis are internal

2016-09-12 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

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

Change subject: Make sure only WMF/Chapter interwikis are internal
..

Make sure only WMF/Chapter interwikis are internal

This prevents certain non-Wikimedia sites, like semantic
mediawiki from having the internal (forward) flag. This
prevents automatic redirection to those domains. This helps
maintain user privacy and prevent phishing attacks, in case
one of those domains went evil. It also makes which domains
get the internal bit be consistent.

Patch based on TTO's patch from T142071 with mild modification
of anchors used.

For now, this still leaves chapters as being internal, as its
more controversial if they should be. Further discussion on
that can happen on the bug.

Bug: T142071
Change-Id: Ib23690c302e8033610fef9a0ef45345fe8a5803e
---
M dumpInterwiki.php
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/dumpInterwiki.php b/dumpInterwiki.php
index d0b41a4..d8a7c8c 100644
--- a/dumpInterwiki.php
+++ b/dumpInterwiki.php
@@ -297,7 +297,9 @@
$prefix = str_replace( ' ', '_', $prefix );
 
$url = $matches[2];
-   if ( preg_match( 
'/(wikipedia|wiktionary|wikisource|wikiquote|wikibooks|wikimedia|wikinews|wikiversity|wikivoyage|wikimediafoundation|mediawiki|wikidata)\.org/',
 $url ) ) {
+   if ( preg_match( 
'/(?:\/\/|\.)(wikipedia|wiktionary|wikisource|wikiquote|wikibooks|wikimedia|' .
+   
'wikinews|wikiversity|wikivoyage|wikimediafoundation|mediawiki|wikidata)\.org/',
 $url )
+   ) {
$local = 1;
} else {
$local = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib23690c302e8033610fef9a0ef45345fe8a5803e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use late static binding in Article::newFromID()

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

Change subject: Use late static binding in Article::newFromID()
..


Use late static binding in Article::newFromID()

Address the FIXME and remove subclass implementations by using late
static binding.

Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275
---
M includes/page/Article.php
M includes/page/CategoryPage.php
M includes/page/ImagePage.php
3 files changed, 1 insertion(+), 27 deletions(-)

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



diff --git a/includes/page/Article.php b/includes/page/Article.php
index 449c9ff..ea920f1 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -99,9 +99,7 @@
 */
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
+   return $t == null ? null : new static( $t );
}
 
/**
diff --git a/includes/page/CategoryPage.php b/includes/page/CategoryPage.php
index d493002..865471c 100644
--- a/includes/page/CategoryPage.php
+++ b/includes/page/CategoryPage.php
@@ -43,18 +43,6 @@
return new WikiCategoryPage( $title );
}
 
-   /**
-* Constructor from a page id
-* @param int $id Article ID to load
-* @return CategoryPage|null
-*/
-   public static function newFromID( $id ) {
-   $t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
-   }
-
function view() {
$request = $this->getContext()->getRequest();
$diff = $request->getVal( 'diff' );
diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php
index be5535a..af77868 100644
--- a/includes/page/ImagePage.php
+++ b/includes/page/ImagePage.php
@@ -53,18 +53,6 @@
}
 
/**
-* Constructor from a page id
-* @param int $id Article ID to load
-* @return ImagePage|null
-*/
-   public static function newFromID( $id ) {
-   $t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
-   }
-
-   /**
 * @param File $file
 * @return void
 */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
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]: MapCacheLRU: Support null values in getWithSetCallback()

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

Change subject: MapCacheLRU: Support null values in getWithSetCallback()
..


MapCacheLRU: Support null values in getWithSetCallback()

The rest of this class supports having a key with a null value by using
array_key_exists() instead of isset(). So Use $this->has() in
getWithSetCallback() so a null value is still identified as set.

Change-Id: Ida74a6f7e284e98f9a7d76d97312ebe2ee343f10
---
M includes/libs/MapCacheLRU.php
1 file changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/includes/libs/MapCacheLRU.php b/includes/libs/MapCacheLRU.php
index 90c9a75..2f5a454 100644
--- a/includes/libs/MapCacheLRU.php
+++ b/includes/libs/MapCacheLRU.php
@@ -115,8 +115,9 @@
 * @return mixed The cached value if found or the result of $callback 
otherwise
 */
public function getWithSetCallback( $key, callable $callback ) {
-   $value = $this->get( $key );
-   if ( $value === null ) {
+   if ( $this->has( $key ) ) {
+   $value = $this->get( $key );
+   } else {
$value = call_user_func( $callback );
if ( $value !== false ) {
$this->set( $key, $value );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ida74a6f7e284e98f9a7d76d97312ebe2ee343f10
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
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...Kartographer[master]: Revert "Show globe icon next to all links"

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

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

Change subject: Revert "Show globe icon next to all  links"
..

Revert "Show globe icon next to all  links"

This reverts commit 01e36af383a581b03286d3d919d2a66a99034bc8
and commit 0c49b864590d5f812b0258a20c216d8dcfd5cd91.

Per objections by Ed Sanders and Volker. Once the design
review is done, we should recommit.

Bug: T145176
Change-Id: Id5b071f91f89b592ae7ab327058fe9d1520e7fc8
---
D styles/images/COPYING
D styles/images/icon-map-link.png
D styles/images/icon-map-link.svg
M styles/kartographer.less
4 files changed, 0 insertions(+), 41 deletions(-)


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

diff --git a/styles/images/COPYING b/styles/images/COPYING
deleted file mode 100644
index 7833ea6..000
--- a/styles/images/COPYING
+++ /dev/null
@@ -1,3 +0,0 @@
-== icon-map-link.svg ==
-Free to use and licensed under MIT from Ionicons 
https://github.com/driftyco/ionicons/blob/master/src/ios-world-outline.svg
-The ios-world-outline.png is generated for the SVG file for legacy browser 
support.
\ No newline at end of file
diff --git a/styles/images/icon-map-link.png b/styles/images/icon-map-link.png
deleted file mode 100644
index 7e3944a..000
--- a/styles/images/icon-map-link.png
+++ /dev/null
Binary files differ
diff --git a/styles/images/icon-map-link.svg b/styles/images/icon-map-link.svg
deleted file mode 100644
index 16b5496..000
--- a/styles/images/icon-map-link.svg
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;>
-http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px"
-width="512px" height="512px" viewBox="0 0 512 512" 
style="enable-background:new 0 0 512 512;" xml:space="preserve">
-
-
diff --git a/styles/kartographer.less b/styles/kartographer.less
index d6ae54c..45f05a8 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -1,5 +1,3 @@
-@import 'mediawiki.mixins';
-
 .mw-kartographer-mapDialog-map {
position: absolute;
top: 0;
@@ -17,19 +15,6 @@
 a.mw-kartographer-link {
display: inline;
cursor: pointer;
-
-   background-position: center right;
-   background-repeat: no-repeat;
-   .background-image-svg('images/icon-map-link.svg', 
'images/icon-map-link.png');
-   padding-right: 17px;
-   margin-right: 2px;
-   background-size: 16px 16px;
-
-   &.no-icon:not(.mw-kartographer-autostyled) {
-   background: none;
-   padding-right: 0;
-   margin-right: 0;
-   }
 }
 
 a.mw-kartographer-autostyled {
@@ -47,7 +32,6 @@
line-height: 1;
text-align: center;
 }
-
 a.mw-kartographer-autostyled:visited {
color: #fff;
 }

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make DeferredUpdates call setTransactionTicket() on all Data...

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

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

Change subject: Make DeferredUpdates call setTransactionTicket() on all 
DataUpdate tasks
..

Make DeferredUpdates call setTransactionTicket() on all DataUpdate tasks

This assues that things like LinksUpdate/LinksDeletionUpdate will
have a proper ticket for commitAndWaitForReplication()

Change-Id: I8234510efb706394c39c4027ddf54ace76983aa9
---
M includes/deferred/DeferredUpdates.php
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/310205/1

diff --git a/includes/deferred/DeferredUpdates.php 
b/includes/deferred/DeferredUpdates.php
index 6921b66..d24ebde 100644
--- a/includes/deferred/DeferredUpdates.php
+++ b/includes/deferred/DeferredUpdates.php
@@ -160,6 +160,8 @@
$lbFactory = $services->getDBLoadBalancerFactory();
$method = RequestContext::getMain()->getRequest()->getMethod();
 
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+
/** @var ErrorPageError $reportableError */
$reportableError = null;
/** @var DeferrableUpdate[] $updates Snapshot of queue */
@@ -182,7 +184,13 @@
// Order will be DataUpdate followed by generic 
DeferrableUpdate tasks
$updatesByType = [ 'data' => [], 'generic' => [] ];
foreach ( $updates as $du ) {
-   $updatesByType[$du instanceof DataUpdate ? 
'data' : 'generic'][] = $du;
+   if ( $du instanceof DataUpdate ) {
+   $du->setTransactionTicket( $ticket );
+   $updatesByType['data'][] = $du;
+   } else {
+   $updatesByType['generic'][] = $du;
+   }
+
$name = ( $du instanceof DeferrableCallback )
? get_class( $du ) . '-' . 
$du->getOrigin()
: get_class( $du );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: LocalIdLookup: Use DBAccessObjectUtils

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

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

Change subject: LocalIdLookup: Use DBAccessObjectUtils
..

LocalIdLookup: Use DBAccessObjectUtils

This simplies some code that was re-implementing
DBAccessObjectUtils::getDBOptions().

Change-Id: Ib446f43149abdf23f07f209ccd9698923f0a2c22
---
M includes/user/LocalIdLookup.php
1 file changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/310202/1

diff --git a/includes/user/LocalIdLookup.php b/includes/user/LocalIdLookup.php
index 0d8b1a8..0a34554 100644
--- a/includes/user/LocalIdLookup.php
+++ b/includes/user/LocalIdLookup.php
@@ -60,10 +60,8 @@
}
 
$audience = $this->checkAudience( $audience );
-   $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : 
DB_REPLICA );
-   $options = ( ( $flags & self::READ_LOCKING ) == 
self::READ_LOCKING )
-   ? [ 'LOCK IN SHARE MODE' ]
-   : [];
+   list( $index, $options ) = DBAccessObjectUtils::getDBOptions( 
$flags );
+   $db = wfGetDB( $index );
 
$tables = [ 'user' ];
$fields = [ 'user_id', 'user_name' ];
@@ -93,10 +91,8 @@
}
 
$audience = $this->checkAudience( $audience );
-   $db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : 
DB_REPLICA );
-   $options = ( ( $flags & self::READ_LOCKING ) == 
self::READ_LOCKING )
-   ? [ 'LOCK IN SHARE MODE' ]
-   : [];
+   list( $index, $options ) = DBAccessObjectUtils::getDBOptions( 
$flags );
+   $db = wfGetDB( $index );
 
$tables = [ 'user' ];
$fields = [ 'user_id', 'user_name' ];

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: SkinTemplate: Improve remote content handling in content nav...

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

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

Change subject: SkinTemplate: Improve remote content handling in content 
navigation URLs
..

SkinTemplate: Improve remote content handling in content navigation URLs

Use Title::isKnown() to determine whether to display the view view link
instead of checking $isForeignFile, since that includes all remote
content. This allows us to remove the GlobalUserPage hook that made the
tab look as if it existed.

Change-Id: Ibee7b64511fba8c2934da3c7a3bdd52090dcb58c
---
M includes/skins/SkinTemplate.php
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/04/310204/1

diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index f185789..aaef2da 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -909,11 +909,8 @@
$content_navigation['namespaces'][$talkId]['context'] = 
'talk';
 
if ( $userCanRead ) {
-   $isForeignFile = $title->inNamespace( NS_FILE ) 
&& $this->canUseWikiPage() &&
-   $this->getWikiPage() instanceof 
WikiFilePage && !$this->getWikiPage()->isLocal();
-
// Adds view view link
-   if ( $title->exists() || $isForeignFile ) {
+   if ( $title->isKnown() ) {
$content_navigation['views']['view'] = 
$this->tabAction(
$isTalk ? $talkPage : 
$subjectPage,
[ "$skname-view-view", 'view' ],
@@ -923,7 +920,11 @@

$content_navigation['views']['view']['redundant'] = true;
}
 
+   $isForeignFile = $title->inNamespace( NS_FILE ) 
&& $this->canUseWikiPage() &&
+   $this->getWikiPage() instanceof 
WikiFilePage && !$this->getWikiPage()->isLocal();
+
// If it is a non-local file, show a link to 
the file in its own repository
+   // @todo abstract this for remote content that 
isn't a file
if ( $isForeignFile ) {
$file = $this->getWikiPage()->getFile();

$content_navigation['views']['view-foreign'] = [
@@ -981,7 +982,7 @@
'href' => 
$title->getLocalURL( 'action=edit=new' )
];
}
-   // Checks if the page has some kind of viewable 
content
+   // Checks if the page has some kind of viewable 
source content
} elseif ( $title->hasSourceText() ) {
// Adds view source view link

$content_navigation['views']['viewsource'] = [

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add WikiPage::isLocal()

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

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

Change subject: Add WikiPage::isLocal()
..

Add WikiPage::isLocal()

WikiFilePage has a isLocal() function which indicates whether the file
is local or not. To better support other remote content, add this method
to th base WikiPage class. It only returns true currently, since all
content represented by WikiPage is local.

Change-Id: Ia39c405af4d131d919a57512e72a112bd65cc461
---
M includes/page/WikiPage.php
1 file changed, 11 insertions(+), 0 deletions(-)


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

diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 938f292..f25dff0 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -3706,4 +3706,15 @@
Hooks::run( 'WikiPageDeletionUpdates', [ $this, $content, 
&$updates ] );
return $updates;
}
+
+   /**
+* Whether this content displayed on this page
+* comes from the local database
+*
+* @since 1.28
+* @return bool
+*/
+   public function isLocal() {
+   return true;
+   }
 }

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: session: Fix phpdoc in Token::toStringAtTimestamp()

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

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

Change subject: session: Fix phpdoc in Token::toStringAtTimestamp()
..

session: Fix phpdoc in Token::toStringAtTimestamp()

Change-Id: I35664eb9e89ffb945eb35bf3af58e1efdea0a8ff
---
M includes/session/Token.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/00/310200/1

diff --git a/includes/session/Token.php b/includes/session/Token.php
index 9b4a73c..523e0cc 100644
--- a/includes/session/Token.php
+++ b/includes/session/Token.php
@@ -73,7 +73,7 @@
 
/**
 * Get the string representation of the token at a timestamp
-* @param int timestamp
+* @param int $timestamp
 * @return string
 */
protected function toStringAtTimestamp( $timestamp ) {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WikiPage: Use Title::isKnown() in hasViewableContent()

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

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

Change subject: WikiPage: Use Title::isKnown() in hasViewableContent()
..

WikiPage: Use Title::isKnown() in hasViewableContent()

The current implementation of hasViewableContent() is basically the same
as Title::isKnown(), except that it switched the order of
isAlwaysKnown() and exists(). (Also it used WikiPage::exists() instead
of Title::exists(), but they're functionality equivalent).

This will make refactoring Title::isAlwaysKnown() easier in the future
as there is one less caller.

Change-Id: I698f08fb0f3e6c3bc702ec7d523d7eda063e18ca
---
M includes/page/WikiPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 938f292..fcc77a0 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -460,7 +460,7 @@
 * @return bool
 */
public function hasViewableContent() {
-   return $this->exists() || $this->mTitle->isAlwaysKnown();
+   return $this->mTitle->isKnown();
}
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: CentralIdLookup: Fix documentation of self::$instances

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

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

Change subject: CentralIdLookup: Fix documentation of self::$instances
..

CentralIdLookup: Fix documentation of self::$instances

Change-Id: I9fd86c174832e130647e74f4fdeb9fdc7c90702e
---
M includes/user/CentralIdLookup.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/310201/1

diff --git a/includes/user/CentralIdLookup.php 
b/includes/user/CentralIdLookup.php
index f67a8d8..2ced6e2 100644
--- a/includes/user/CentralIdLookup.php
+++ b/includes/user/CentralIdLookup.php
@@ -31,7 +31,7 @@
const AUDIENCE_PUBLIC = 1;
const AUDIENCE_RAW = 2;
 
-   /** @var CentralIdLookup[][] */
+   /** @var CentralIdLookup[] */
private static $instances = [];
 
/** @var string */

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: MapCacheLRU: Support null values in getWithSetCallback()

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

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

Change subject: MapCacheLRU: Support null values in getWithSetCallback()
..

MapCacheLRU: Support null values in getWithSetCallback()

The rest of this class supports having a key with a null value by using
array_key_exists() instead of isset(). So Use $this->has() in
getWithSetCallback() so a null value is still identified as set.

Change-Id: Ida74a6f7e284e98f9a7d76d97312ebe2ee343f10
---
M includes/libs/MapCacheLRU.php
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/310197/1

diff --git a/includes/libs/MapCacheLRU.php b/includes/libs/MapCacheLRU.php
index 90c9a75..2f5a454 100644
--- a/includes/libs/MapCacheLRU.php
+++ b/includes/libs/MapCacheLRU.php
@@ -115,8 +115,9 @@
 * @return mixed The cached value if found or the result of $callback 
otherwise
 */
public function getWithSetCallback( $key, callable $callback ) {
-   $value = $this->get( $key );
-   if ( $value === null ) {
+   if ( $this->has( $key ) ) {
+   $value = $this->get( $key );
+   } else {
$value = call_user_func( $callback );
if ( $value !== false ) {
$this->set( $key, $value );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use late static binding in Article::newFromID()

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

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

Change subject: Use late static binding in Article::newFromID()
..

Use late static binding in Article::newFromID()

Address the FIXME and remove subclass implementations by using late
static binding.

Change-Id: I4f1793c87dfe08f768a283128d14ee2226a9e275
---
M includes/page/Article.php
M includes/page/CategoryPage.php
M includes/page/ImagePage.php
3 files changed, 1 insertion(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/98/310198/1

diff --git a/includes/page/Article.php b/includes/page/Article.php
index 449c9ff..ea920f1 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -99,9 +99,7 @@
 */
public static function newFromID( $id ) {
$t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
+   return $t == null ? null : new static( $t );
}
 
/**
diff --git a/includes/page/CategoryPage.php b/includes/page/CategoryPage.php
index d493002..865471c 100644
--- a/includes/page/CategoryPage.php
+++ b/includes/page/CategoryPage.php
@@ -43,18 +43,6 @@
return new WikiCategoryPage( $title );
}
 
-   /**
-* Constructor from a page id
-* @param int $id Article ID to load
-* @return CategoryPage|null
-*/
-   public static function newFromID( $id ) {
-   $t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
-   }
-
function view() {
$request = $this->getContext()->getRequest();
$diff = $request->getVal( 'diff' );
diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php
index be5535a..af77868 100644
--- a/includes/page/ImagePage.php
+++ b/includes/page/ImagePage.php
@@ -53,18 +53,6 @@
}
 
/**
-* Constructor from a page id
-* @param int $id Article ID to load
-* @return ImagePage|null
-*/
-   public static function newFromID( $id ) {
-   $t = Title::newFromID( $id );
-   # @todo FIXME: Doesn't inherit right
-   return $t == null ? null : new self( $t );
-   # return $t == null ? null : new static( $t ); // PHP 5.3
-   }
-
-   /**
 * @param File $file
 * @return void
 */

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: install_server: use separate /srv for bastions

2016-09-12 Thread Filippo Giunchedi (Code Review)
Filippo Giunchedi has uploaded a new change for review.

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

Change subject: install_server: use separate /srv for bastions
..

install_server: use separate /srv for bastions

Bastions all come with two disks in software raid, unify all partman recipes on
separate /srv.

Change-Id: I94d4a57962eb321bfc883261d4507020d057bd7a
---
M modules/install_server/files/autoinstall/netboot.cfg
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/95/309995/1

diff --git a/modules/install_server/files/autoinstall/netboot.cfg 
b/modules/install_server/files/autoinstall/netboot.cfg
index 0ccfc63..c30802a 100755
--- a/modules/install_server/files/autoinstall/netboot.cfg
+++ b/modules/install_server/files/autoinstall/netboot.cfg
@@ -55,7 +55,8 @@
 aqs100[123]) echo partman/raid1-30G.cfg ;; \
 aqs100[456]) echo partman/aqs-cassandra-8ssd-2srv.cfg ;; \
 arsenic|heze|neodymium|oxygen|palladium|promethium|strontium|terbium) 
echo partman/lvm.cfg ;; \
-bast[124]001|copper|neon|ruthenium|subra|suhail|titanium|ocg1003) echo 
partman/raid1-lvm.cfg ;; \
+copper|neon|ruthenium|subra|suhail|titanium|ocg1003) echo 
partman/raid1-lvm.cfg ;; \
+bast[1234]*) echo partman/raid1-lvm-ext4-srv.cfg ;; \
 californium|dbproxy10[0-1][0-9]|install2001|iridium) echo 
partman/raid1.cfg ;; \
 boron) echo partman/lvm.cfg ;; \
 helium|potassium|tmh1002|hydrogen|chromium) echo 
partman/raid1-1partition.cfg ;; \
@@ -69,7 +70,7 @@
 
db[0-8][0-9]|db10[0-8][0-9]|db109[0-4]|db20[0-2][0-9]|db2030|db203[3-9]|db20[4-7][0-9]|dbstore[1-2]00[1-9]|es[1-2]01[1-9])
 echo partman/db.cfg ;; \
 d-i-test) echo partman/cassandrahosts-12hdd.cfg ;; \
 druid100[123]) echo partman/druid-4ssd-raid10.cfg ;; \
-eeden|bast3001|maerlant|multatuli|nescio) echo 
partman/raid1-1partition.cfg ;; \
+eeden|maerlant|multatuli|nescio) echo partman/raid1-1partition.cfg ;; \
 elastic101[7-9]|elastic102[0-9]|elastic103[0-1]) echo 
partman/elasticsearch-raid0.cfg ;; \
 elastic103[2-9]|elastic104[0-9]|elastic20[0-2][0-9]|elastic203[0-1]) 
echo partman/elasticsearch-raid1.cfg ;; \
 relforge100[12]) echo partman/raid10-gpt-srv-lvm-ext4.cfg ;; \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94d4a57962eb321bfc883261d4507020d057bd7a
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Reorganize RefreshLinksJob code slightly and avoid deprecate...

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

Change subject: Reorganize RefreshLinksJob code slightly and avoid deprecated 
functions
..


Reorganize RefreshLinksJob code slightly and avoid deprecated functions

Change-Id: I6ff4bec61b37bfbffc1e96eac61d692dd7feb31a
---
M includes/jobqueue/jobs/RefreshLinksJob.php
1 file changed, 10 insertions(+), 6 deletions(-)

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



diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php 
b/includes/jobqueue/jobs/RefreshLinksJob.php
index a337da4..5f33ae0 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -88,7 +88,8 @@
// enqueued will be reflected in backlink page parses 
when the leaf jobs run.
if ( !isset( $params['range'] ) ) {
try {
-   wfGetLBFactory()->waitForReplication( [
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lbFactory->waitForReplication( [
'wiki'=> wfWikiID(),
'timeout' => 
self::LAG_WAIT_TIMEOUT
] );
@@ -128,13 +129,18 @@
 * @return bool
 */
protected function runForTitle( Title $title ) {
-   $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
+   $services = MediaWikiServices::getInstance();
+   $stats = $services->getStatsdDataFactory();
+   $lbFactory = $services->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
 
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
 
// Serialize links updates by page ID so they see each others' 
changes
-   $scopedLock = LinksUpdate::acquirePageLock( wfGetDB( DB_MASTER 
), $page->getId(), 'job' );
+   $dbw = $lbFactory->getMainLB()->getConnection( DB_MASTER );
+   /** @noinspection PhpUnusedLocalVariableInspection */
+   $scopedLock = LinksUpdate::acquirePageLock( $dbw, 
$page->getId(), 'job' );
// Get the latest ID *after* acquirePageLock() flushed the 
transaction.
// This is used to detect edits/moves after loadPageData() but 
before the scope lock.
// The works around the chicken/egg problem of determining the 
scope lock key.
@@ -241,10 +247,7 @@
$parserOutput
);
 
-   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
foreach ( $updates as $key => $update ) {
-   $update->setTransactionTicket( $ticket );
// FIXME: This code probably shouldn't be here?
// Needed by things like Echo notifications which need
// to know which user caused the links update
@@ -264,6 +267,7 @@
}
 
foreach ( $updates as $update ) {
+   $update->setTransactionTicket( $ticket );
$update->doUpdate();
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ff4bec61b37bfbffc1e96eac61d692dd7feb31a
Gerrit-PatchSet: 1
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...VisualEditor[master]: Avoid DBPerformance log warnings due to isBlockedFrom()

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

Change subject: Avoid DBPerformance log warnings due to isBlockedFrom()
..


Avoid DBPerformance log warnings due to isBlockedFrom()

Change-Id: I276656ab854d2566b81774360d2bf155fa609ae8
---
M ApiVisualEditor.php
1 file changed, 5 insertions(+), 2 deletions(-)

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



diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 9b07384..f59cdfa 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -487,7 +487,8 @@
$notices[] = "\n" .
$this->msg( 
'userpage-userdoesnotexist', wfEscapeWikiText( $targetUsername ) ) .
"\n";
-   } elseif ( $targetUser->isBlocked() ) { 
// Show log extract if the user is currently blocked
+   } elseif ( $targetUser->isBlocked() ) {
+   // Show log extract if the user 
is currently blocked
$notices[] = $this->msg(

'blocked-notice-logextract',
$targetUser->getName() 
// Support GENDER in notice
@@ -496,7 +497,9 @@
}
 
// Blocked user notice
-   if ( $user->isBlockedFrom( $title ) && 
$user->getBlock()->prevents( 'edit' ) !== false ) {
+   if ( $user->isBlockedFrom( $title, true )
+   && $user->getBlock()->prevents( 'edit' 
) !== false
+   ) {
$notices[] = call_user_func_array(
[ $this, 'msg' ],

$user->getBlock()->getPermissionsError( $this->getContext() )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I276656ab854d2566b81774360d2bf155fa609ae8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Catrope 
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]: Tweak $wgTrxProfilerLimits to lower noise a bit

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

Change subject: Tweak $wgTrxProfilerLimits to lower noise a bit
..


Tweak $wgTrxProfilerLimits to lower noise a bit

Change-Id: I22ae7a5c2ba5f39007019e47ea0dff17a4cc971a
---
M includes/DefaultSettings.php
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index c7fda14..ff7430b 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5972,7 +5972,7 @@
'POST' => [
'readQueryTime' => 5,
'writeQueryTime' => 1,
-   'maxAffected' => 500
+   'maxAffected' => 1000
],
'POST-nonwrite' => [
'masterConns' => 0,
@@ -5983,7 +5983,7 @@
'PostSend' => [
'readQueryTime' => 5,
'writeQueryTime' => 1,
-   'maxAffected' => 500
+   'maxAffected' => 1000
],
// Background job runner
'JobRunner' => [

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I22ae7a5c2ba5f39007019e47ea0dff17a4cc971a
Gerrit-PatchSet: 1
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]: Make safeWaitForMasterPos() use mWaitTimeout instead of hard...

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

Change subject: Make safeWaitForMasterPos() use mWaitTimeout instead of 
hard-coded value
..


Make safeWaitForMasterPos() use mWaitTimeout instead of hard-coded value

Change-Id: Idd5db66f5e7cea9fc3f3a4f47bd38e08e42559f6
---
M includes/db/loadbalancer/LoadBalancer.php
1 file changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/includes/db/loadbalancer/LoadBalancer.php 
b/includes/db/loadbalancer/LoadBalancer.php
index 42044a7..96ae2e7 100644
--- a/includes/db/loadbalancer/LoadBalancer.php
+++ b/includes/db/loadbalancer/LoadBalancer.php
@@ -1662,11 +1662,11 @@
 *
 * @param IDatabase $conn Replica DB
 * @param DBMasterPos|bool $pos Master position; default: current 
position
-* @param integer $timeout Timeout in seconds
+* @param integer|null $timeout Timeout in seconds [optional]
 * @return bool Success
 * @since 1.27
 */
-   public function safeWaitForMasterPos( IDatabase $conn, $pos = false, 
$timeout = 10 ) {
+   public function safeWaitForMasterPos( IDatabase $conn, $pos = false, 
$timeout = null ) {
if ( $this->getServerCount() == 1 || !$conn->getLBInfo( 
'replica' ) ) {
return true; // server is not a replica DB
}
@@ -1676,6 +1676,7 @@
return false; // something is misconfigured
}
 
+   $timeout = $timeout ?: $this->mWaitTimeout;
$result = $conn->masterPosWait( $pos, $timeout );
if ( $result == -1 || is_null( $result ) ) {
$msg = __METHOD__ . ": Timed out waiting on 
{$conn->getServer()} pos {$pos}";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd5db66f5e7cea9fc3f3a4f47bd38e08e42559f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Parent5446 
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]: Avoid using deprecated methods in JobQueueDB

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

Change subject: Avoid using deprecated methods in JobQueueDB
..


Avoid using deprecated methods in JobQueueDB

Change-Id: Ib35b8792e3e4902b52c3e708d8c6e756f35986bd
---
M includes/jobqueue/JobQueueDB.php
1 file changed, 6 insertions(+), 3 deletions(-)

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



diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php
index f6b4d53..50727a2 100644
--- a/includes/jobqueue/JobQueueDB.php
+++ b/includes/jobqueue/JobQueueDB.php
@@ -20,6 +20,7 @@
  * @file
  * @author Aaron Schulz
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * Class to handle job queues stored in the DB
@@ -526,7 +527,8 @@
 * @return void
 */
protected function doWaitForBackups() {
-   wfWaitForSlaves( false, $this->wiki, $this->cluster ?: false );
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lbFactory->waitForReplication( [ 'wiki' => $this->wiki, 
'cluster' => $this->cluster ] );
}
 
/**
@@ -755,9 +757,10 @@
 * @return DBConnRef
 */
protected function getDB( $index ) {
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$lb = ( $this->cluster !== false )
-   ? wfGetLBFactory()->getExternalLB( $this->cluster, 
$this->wiki )
-   : wfGetLB( $this->wiki );
+   ? $lbFactory->getExternalLB( $this->cluster, 
$this->wiki )
+   : $lbFactory->getMainLB( $this->wiki );
 
return $lb->getConnectionRef( $index, [], $this->wiki );
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib35b8792e3e4902b52c3e708d8c6e756f35986bd
Gerrit-PatchSet: 1
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...WikimediaMaintenance[master]: Add babel database table

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

Change subject: Add babel database table
..


Add babel database table

Change-Id: I39f34d1ad3233fb1fff4ac8d10430c76dbedbf9f
---
M addWiki.php
M createExtensionTables.php
2 files changed, 5 insertions(+), 0 deletions(-)

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



diff --git a/addWiki.php b/addWiki.php
index 2eeb215..43c5e08 100644
--- a/addWiki.php
+++ b/addWiki.php
@@ -88,6 +88,7 @@
array( $this, 'noExecuteCommands' )
);
$dbw->sourceFile( 
"$IP/extensions/AntiSpoof/sql/patch-antispoof.mysql.sql" );
+   $dbw->sourceFile( "$IP/extensions/Babel/babel.sql" );
$dbw->sourceFile( "$IP/extensions/CheckUser/cu_changes.sql" );
$dbw->sourceFile( "$IP/extensions/CheckUser/cu_log.sql" );
$dbw->sourceFile( 
"$IP/extensions/GlobalBlocking/globalblocking.sql" );
diff --git a/createExtensionTables.php b/createExtensionTables.php
index 6bba929..278081b 100644
--- a/createExtensionTables.php
+++ b/createExtensionTables.php
@@ -40,6 +40,10 @@
$path = '';
 
switch ( strtolower( $extension ) ) {
+   case 'babel':
+   $files = [ 'babel.sql' ];
+   $path = "$IP/extensions/Babel";
+   break;
case 'echo':
if ( $wgEchoCluster !== false ) {
$this->error( "Cannot create Echo 
tables on $wgEchoCluster using this script.", 1 );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I39f34d1ad3233fb1fff4ac8d10430c76dbedbf9f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Alex Monk 
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]: Remove pointless getTransactionProfiler() method

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

Change subject: Remove pointless getTransactionProfiler() method
..


Remove pointless getTransactionProfiler() method

Change-Id: Ib019e8317568105b95138cfdc0962b06a55154b9
---
M includes/db/Database.php
1 file changed, 4 insertions(+), 11 deletions(-)

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



diff --git a/includes/db/Database.php b/includes/db/Database.php
index 0a1774d..c41e7c7 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -332,13 +332,6 @@
}
 
/**
-* @return TransactionProfiler
-*/
-   protected function getTransactionProfiler() {
-   return $this->trxProfiler;
-   }
-
-   /**
 * @param TransactionProfiler $profiler
 * @since 1.27
 */
@@ -914,7 +907,7 @@
# Keep track of whether the transaction has write queries 
pending
if ( $this->mTrxLevel && !$this->mTrxDoneWrites && $isWrite ) {
$this->mTrxDoneWrites = true;
-   $this->getTransactionProfiler()->transactionWritingIn(
+   $this->trxProfiler->transactionWritingIn(
$this->mServer, $this->mDBname, 
$this->mTrxShortId );
}
 
@@ -1008,7 +1001,7 @@
$this->mRTTEstimate = $queryRuntime;
}
 
-   $this->getTransactionProfiler()->recordQueryCompletion(
+   $this->trxProfiler->recordQueryCompletion(
$queryProf, $startTime, $isWrite, $this->affectedRows()
);
MWDebug::query( $sql, $fname, $isMaster, $queryRuntime );
@@ -3014,7 +3007,7 @@
$this->doCommit( $fname );
if ( $this->mTrxDoneWrites ) {
$this->mDoneWrites = microtime( true );
-   $this->getTransactionProfiler()->transactionWritingOut(
+   $this->trxProfiler->transactionWritingOut(
$this->mServer, $this->mDBname, 
$this->mTrxShortId, $writeTime );
}
 
@@ -3058,7 +3051,7 @@
$this->doRollback( $fname );
$this->mTrxAtomicLevels = [];
if ( $this->mTrxDoneWrites ) {
-   $this->getTransactionProfiler()->transactionWritingOut(
+   $this->trxProfiler->transactionWritingOut(
$this->mServer, $this->mDBname, 
$this->mTrxShortId );
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib019e8317568105b95138cfdc0962b06a55154b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Parent5446 
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 DeferredUpdates::execute() protected

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

Change subject: Make DeferredUpdates::execute() protected
..


Make DeferredUpdates::execute() protected

Update the only caller, which is a deprecated wrapper method.
Locking down this internal method makes it secure against
misuse with regards to recursion checks.

Change-Id: I3ed52dbe4c0ad52c7b5de92e81bfdc98a1737bcf
---
M includes/deferred/DataUpdate.php
M includes/deferred/DeferredUpdates.php
2 files changed, 7 insertions(+), 4 deletions(-)

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



diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php
index 8d26460..d2d8bd7 100644
--- a/includes/deferred/DataUpdate.php
+++ b/includes/deferred/DataUpdate.php
@@ -45,11 +45,12 @@
 * Convenience method, calls doUpdate() on every DataUpdate in the 
array.
 *
 * @param DataUpdate[] $updates A list of DataUpdate instances
-* @param string $mode Use "enqueue" to use the job queue when possible 
[Default: run]
 * @throws Exception
 * @deprecated Since 1.28 Use DeferredUpdates::execute()
 */
-   public static function runUpdates( array $updates, $mode = 'run' ) {
-   DeferredUpdates::execute( $updates, $mode, DeferredUpdates::ALL 
);
+   public static function runUpdates( array $updates ) {
+   foreach ( $updates as $update ) {
+   $update->doUpdate();
+   }
}
 }
diff --git a/includes/deferred/DeferredUpdates.php 
b/includes/deferred/DeferredUpdates.php
index 2b2b2b7..6921b66 100644
--- a/includes/deferred/DeferredUpdates.php
+++ b/includes/deferred/DeferredUpdates.php
@@ -146,13 +146,15 @@
}
 
/**
+* Immediately run/queue a list of updates
+*
 * @param DeferrableUpdate[] &$queue List of DeferrableUpdate objects
 * @param string $mode Use "enqueue" to use the job queue when possible
 * @param integer $stage Class constant (PRESEND, POSTSEND) (since 1.28)
 * @throws ErrorPageError Happens on top-level calls
 * @throws Exception Happens on second-level calls
 */
-   public static function execute( array &$queue, $mode, $stage ) {
+   protected static function execute( array &$queue, $mode, $stage ) {
$services = MediaWikiServices::getInstance();
$stats = $services->getStatsdDataFactory();
$lbFactory = $services->getDBLoadBalancerFactory();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ed52dbe4c0ad52c7b5de92e81bfdc98a1737bcf
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Addshore 
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...FileAnnotations[master]: Handle API request errors and improve caching

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

Change subject: Handle API request errors and improve caching
..


Handle API request errors and improve caching

* Use adaptive TTLs so cache entries that change more often have
  lower TTLs than those that change less often.
* Use "minAsOf" together with getChronologyProtectorTouched() to
  opportunistically purge the cache. This triggers when a user makes
  changes to one of the shared wiki DBs and then hits this API.
* Increase the TTL to 1 hour, given the above.

Depends-On: Ia1168cf0d46cfdee046838ce4c5a6294e4d81760
Change-Id: Id71bef631888ba3b12b9db59bd62bc2fe3647ea8
---
M ApiFileAnnotations.php
1 file changed, 135 insertions(+), 35 deletions(-)

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



diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index d50a063..73dafbd 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -23,13 +23,11 @@
  * @copyright 2015 Mark Holmquist
  * @license GNU General Public License version 2.0
  */
+use MediaWiki\MediaWikiServices;
 
 class ApiFileAnnotations extends ApiQueryBase {
-   // 5 minutes - long enough to avoid crashing the servers with a lot
-   // of repeated requests for the same data, but not long enough so it's
-   // hard to update information quickly. Cache not invalidated by changes
-   // to Wikidata, Wikipedia, or Commons.
-   const CACHE_TTL = 300;
+   const MIN_CACHE_TTL = WANObjectCache::TTL_MINUTE;
+   const MAX_CACHE_TTL = WANObjectCache::TTL_DAY;
 
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'fa' );
@@ -86,12 +84,16 @@
protected function renderCommonsAnnotation( $commonsMatches ) {
$categoryName = $commonsMatches[1];
 
+   $safeAsOf = $this->getSafeCacheAsOfForUser( 'commonswiki' );
+
$cache = ObjectCache::getMainWANInstance();
+   $cacheKey = $cache->makeKey( 'fileannotations', 
'commonscategory', $categoryName );
 
return $cache->getWithSetCallback(
-   $cache->makeKey( 'fileannotations', 'commonscategory', 
$categoryName ),
-   self::CACHE_TTL,
-   function ( $oldValue, &$ttl, array &$setOpts ) use ( 
$categoryName ) {
+   $cacheKey,
+   self::MAX_CACHE_TTL,
+   function ( $oldValue, &$ttl, array &$setOpts, $oldAsOf )
+   use ( $cache, $categoryName, $cacheKey, $safeAsOf ) {
$client = new MultiHttpClient( [] );
 
$response = $client->run( [
@@ -111,9 +113,14 @@
],
] );
 
-   $imagesApiData = json_decode( 
$response['body'], true );
+   if ( $response['code'] == 200 ) {
+   $imagesApiData = json_decode( 
$response['body'], true );
+   $pages = 
$imagesApiData['query']['pages'];
+   } else {
+   $pages = [];
 
-   $pages = $imagesApiData['query']['pages'];
+   $ttl = $cache::TTL_UNCACHEABLE;
+   }
 
$imagesHtml = '';
 
@@ -136,25 +143,38 @@
? '' . 'See 
more images' . ''
: '';
 
-   return
+   $html =
'' .
$imagesHtml .
$seeMoreHtml .
'';
-   }
+
+   $setOpts['staleTTL'] = self::MAX_CACHE_TTL;
+   if ( self::maybePurge( $safeAsOf, $oldValue, 
$html, $cache, $cacheKey ) ) {
+   $ttl = $cache::TTL_UNCACHEABLE; // 
don't bother; tombstoned by delete()
+   } else {
+   $ttl = self::elasticCacheTTL( 
$oldValue, $html, $oldAsOf, $ttl );
+   }
+
+   return $html;
+   },
+   [ 'minAsOf' => $safeAsOf ]
);
}
 
protected function renderWikipediaAnnotation( $wpMatches ) {
$articleName = $wpMatches[2];
$language = $wpMatches[1];
+   $safeAsOf = $this->getSafeCacheAsOfForUser( 'enwiki' );
 
$cache = ObjectCache::getMainWANInstance();
+   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Reorganize RefreshLinksJob code slightly and avoid deprecate...

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

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

Change subject: Reorganize RefreshLinksJob code slightly and avoid deprecated 
functions
..

Reorganize RefreshLinksJob code slightly and avoid deprecated functions

Change-Id: I6ff4bec61b37bfbffc1e96eac61d692dd7feb31a
---
M includes/jobqueue/jobs/RefreshLinksJob.php
1 file changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/310196/1

diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php 
b/includes/jobqueue/jobs/RefreshLinksJob.php
index a337da4..5f33ae0 100644
--- a/includes/jobqueue/jobs/RefreshLinksJob.php
+++ b/includes/jobqueue/jobs/RefreshLinksJob.php
@@ -88,7 +88,8 @@
// enqueued will be reflected in backlink page parses 
when the leaf jobs run.
if ( !isset( $params['range'] ) ) {
try {
-   wfGetLBFactory()->waitForReplication( [
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lbFactory->waitForReplication( [
'wiki'=> wfWikiID(),
'timeout' => 
self::LAG_WAIT_TIMEOUT
] );
@@ -128,13 +129,18 @@
 * @return bool
 */
protected function runForTitle( Title $title ) {
-   $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
+   $services = MediaWikiServices::getInstance();
+   $stats = $services->getStatsdDataFactory();
+   $lbFactory = $services->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
 
$page = WikiPage::factory( $title );
$page->loadPageData( WikiPage::READ_LATEST );
 
// Serialize links updates by page ID so they see each others' 
changes
-   $scopedLock = LinksUpdate::acquirePageLock( wfGetDB( DB_MASTER 
), $page->getId(), 'job' );
+   $dbw = $lbFactory->getMainLB()->getConnection( DB_MASTER );
+   /** @noinspection PhpUnusedLocalVariableInspection */
+   $scopedLock = LinksUpdate::acquirePageLock( $dbw, 
$page->getId(), 'job' );
// Get the latest ID *after* acquirePageLock() flushed the 
transaction.
// This is used to detect edits/moves after loadPageData() but 
before the scope lock.
// The works around the chicken/egg problem of determining the 
scope lock key.
@@ -241,10 +247,7 @@
$parserOutput
);
 
-   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
foreach ( $updates as $key => $update ) {
-   $update->setTransactionTicket( $ticket );
// FIXME: This code probably shouldn't be here?
// Needed by things like Echo notifications which need
// to know which user caused the links update
@@ -264,6 +267,7 @@
}
 
foreach ( $updates as $update ) {
+   $update->setTransactionTicket( $ticket );
$update->doUpdate();
}
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Show current zoom in edit preview & VE mode

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

Change subject: Show current zoom in edit preview & VE mode
..


Show current zoom in edit preview & VE mode

Bug: T129875
Change-Id: Ib91a454fbcfc3696375259566ed7b12a020e92aa
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/preview/preview.js
M modules/ve-maps/ve.ui.MWMaps.css
M modules/ve-maps/ve.ui.MWMapsDialog.js
6 files changed, 85 insertions(+), 10 deletions(-)

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



diff --git a/extension.json b/extension.json
index 7fd352c..c90e009 100644
--- a/extension.json
+++ b/extension.json
@@ -230,6 +230,11 @@
"scripts": [
"modules/preview/preview.js"
],
+   "messages": [
+   "visualeditor-mwmapsdialog-position-lat",
+   "visualeditor-mwmapsdialog-position-lon",
+   "visualeditor-mwmapsdialog-position-zoom"
+   ],
"targets": [
"mobile",
"desktop"
@@ -269,6 +274,10 @@
"messages": [
"visualeditor-mwmapsdialog-align",
"visualeditor-mwmapsdialog-geojson",
+   "visualeditor-mwmapsdialog-position-button",
+   "visualeditor-mwmapsdialog-position-lat",
+   "visualeditor-mwmapsdialog-position-lon",
+   "visualeditor-mwmapsdialog-position-zoom",
"visualeditor-mwmapsdialog-reset-map",
"visualeditor-mwmapsdialog-size",
"visualeditor-mwmapsdialog-title"
diff --git a/i18n/en.json b/i18n/en.json
index 7740904..6d05cf2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -75,6 +75,10 @@
"kartographer-fullscreen-text": "Show in full screen",
"visualeditor-mwmapsdialog-align": "Alignment",
"visualeditor-mwmapsdialog-geojson": "GeoJSON",
+   "visualeditor-mwmapsdialog-position-button": "Current position",
+   "visualeditor-mwmapsdialog-position-lat": "Latitude",
+   "visualeditor-mwmapsdialog-position-lon": "Longitude",
+   "visualeditor-mwmapsdialog-position-zoom": "Zoom",
"visualeditor-mwmapsdialog-reset-map": "Reset map position",
"visualeditor-mwmapsdialog-size": "Size",
"visualeditor-mwmapsdialog-title": "Map"
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 7a006fc..94eb549 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -78,6 +78,10 @@
"kartographer-fullscreen-text": "Tooltip for a button that puts the map 
into full screen",
"visualeditor-mwmapsdialog-align": "Label for setting the map's 
alignment\n{{Identical|Alignment}}",
"visualeditor-mwmapsdialog-geojson": "{{optional}}\nLabel for map 
GeoJSON data",
+   "visualeditor-mwmapsdialog-position-button": "Label for current 
position button",
+   "visualeditor-mwmapsdialog-position-lat": "Label for latitude within 
current position popup",
+   "visualeditor-mwmapsdialog-position-lon": "Label for longitude within 
current position popup",
+   "visualeditor-mwmapsdialog-position-zoom": "Label for zoom within 
current position popup",
"visualeditor-mwmapsdialog-reset-map": "Label for resetting the map's 
position",
"visualeditor-mwmapsdialog-size": "Label for map 
size\n{{Identical|Size}}",
"visualeditor-mwmapsdialog-title": "Title of the map 
dialog\n{{Identical|Map}}"
diff --git a/modules/preview/preview.js b/modules/preview/preview.js
index ffa5418..a1eea57 100644
--- a/modules/preview/preview.js
+++ b/modules/preview/preview.js
@@ -19,15 +19,23 @@
var popup = L.popup();
 
function onMapMenu( e ) {
-   var coords = map.getScaleLatLng(
+   var content = '',
+   zoom = map.getZoom(),
+   coords = map.getScaleLatLng(
e.latlng.lat,
e.latlng.lng
);
 
+   content += '';
+   content += '' + mw.msg( 
'visualeditor-mwmapsdialog-position-lat' ) + '' + coords[ 0 ] + 
'';
+   content += '' + mw.msg( 
'visualeditor-mwmapsdialog-position-lon' ) + '' + coords[ 1 ] + 
'';
+   content += '' + mw.msg( 
'visualeditor-mwmapsdialog-position-zoom' ) + '' + zoom + '';
+   content += '';
+
popup

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Simplify LBFactory ticket code in CategoryMembershipChangeJob

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

Change subject: Simplify LBFactory ticket code in CategoryMembershipChangeJob
..


Simplify LBFactory ticket code in CategoryMembershipChangeJob

Change-Id: I5800bbf6fa718604ffa12d8cde1aa3675fced6fd
---
M includes/jobqueue/jobs/CategoryMembershipChangeJob.php
1 file changed, 12 insertions(+), 8 deletions(-)

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



diff --git a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php 
b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
index 1828dd7..cd37263 100644
--- a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
+++ b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
@@ -33,6 +33,9 @@
  * @since 1.27
  */
 class CategoryMembershipChangeJob extends Job {
+   /** @var integer|null */
+   private $ticket;
+
const ENQUEUE_FUDGE_SEC = 60;
 
public function __construct( Title $title, array $params ) {
@@ -43,14 +46,18 @@
}
 
public function run() {
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lb = $lbFactory->getMainLB();
+   $dbw = $lb->getConnection( DB_MASTER );
+
+   $this->ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+
$page = WikiPage::newFromID( $this->params['pageId'], 
WikiPage::READ_LATEST );
if ( !$page ) {
$this->setLastError( "Could not find page 
#{$this->params['pageId']}" );
return false; // deleted?
}
 
-   $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
-   $dbw = $lb->getConnection( DB_MASTER );
// Use a named lock so that jobs for this page see each others' 
changes
$lockKey = "CategoryMembershipUpdates:{$page->getId()}";
$scopedLock = $dbw->getScopedLockAndFlush( $lockKey, 
__METHOD__, 10 );
@@ -59,7 +66,7 @@
return false;
}
 
-   $dbr = wfGetDB( DB_REPLICA, [ 'recentchanges' ] );
+   $dbr = $lb->getConnection( DB_REPLICA, [ 'recentchanges' ] );
// Wait till the replica DB is caught up so that jobs for this 
page see each others' changes
if ( !$lb->safeWaitForMasterPos( $dbr ) ) {
$this->setLastError( "Timed out while waiting for 
replica DB to catch up" );
@@ -120,7 +127,6 @@
);
 
// Apply all category updates in revision timestamp order
-   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
foreach ( $res as $row ) {
$this->notifyUpdatesForRevision( $lbFactory, $page, 
Revision::newFromRow( $row ) );
}
@@ -162,8 +168,6 @@
return; // nothing to do
}
 
-   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
-
$catMembChange = new CategoryMembershipChange( $title, $newRev 
);
$catMembChange->checkTemplateLinks();
 
@@ -174,7 +178,7 @@
$categoryTitle = Title::makeTitle( NS_CATEGORY, 
$categoryName );
$catMembChange->triggerCategoryAddedNotification( 
$categoryTitle );
if ( $insertCount++ && ( $insertCount % $batchSize ) == 
0 ) {
-   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $this->ticket );
}
}
 
@@ -182,7 +186,7 @@
$categoryTitle = Title::makeTitle( NS_CATEGORY, 
$categoryName );
$catMembChange->triggerCategoryRemovedNotification( 
$categoryTitle );
if ( $insertCount++ && ( $insertCount++ % $batchSize ) 
== 0 ) {
-   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $this->ticket );
}
}
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5800bbf6fa718604ffa12d8cde1aa3675fced6fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: BryanDavis 
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...UploadWizard[master]: Further improve handling of silly canvas #drawImage exceptions

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

Change subject: Further improve handling of silly canvas #drawImage exceptions
..


Further improve handling of silly canvas #drawImage exceptions

* Do not re-throw in uw.EventFlowLogger#maybeLogFirefoxCanvasException.
  I've looked a bit more at the exceptions we have logged, and
  without exception (heheh) they're useless and just mean that
  thumbnailing failed for a reason clearly beyond our control.
* Report failure in mw.UploadWizardUpload#getTransformedCanvasElement
  by returning null.
* In mw.UploadWizardUpload#getScaledImageElement, fall back
  to #getBrowserScaledImageElement if #getTransformedCanvasElement
  fails.
* Add some comments quoting some of the stupid exceptions
  that we've seen in the logs, to justify the try...catch.

Follow-up to 5f5fdae13b30a39fd9b198e97d29df45a70e9ad2,
c6b74d5e68470c102e07237d127d54bdb9302ab7.

Bug: T136831
Bug: T145341
Change-Id: Ie60421358d2178c0d8189018720021d1b3d58dbb
---
M resources/mw.UploadWizardUpload.js
M resources/uw.EventFlowLogger.js
2 files changed, 21 insertions(+), 7 deletions(-)

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



diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index 5859345..61d0d94 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -937,7 +937,7 @@
 *
 * @param {HTMLImageElement} image
 * @param {Object} constraints Width & height constraints
-* @return {HTMLCanvasElement}
+* @return {HTMLCanvasElement|null}
 */
mw.UploadWizardUpload.prototype.getTransformedCanvasElement = function 
( image, constraints ) {
var angle, scaleConstraints, scaling, width, height,
@@ -1001,9 +1001,18 @@
ctx.clearRect( 0, 0, width, height );
ctx.rotate( rotation / 180 * Math.PI );
try {
+   // Calling #drawImage likes to throw all kinds of 
ridiculous exceptions in various browsers,
+   // including but not limited to:
+   // * (Firefox) NS_ERROR_NOT_AVAILABLE:
+   // * (Internet Explorer / Edge) Not enough storage is 
available to complete this operation.
+   // * (Internet Explorer / Edge) Unspecified error.
+   // * (Internet Explorer / Edge) The GPU device instance 
has been suspended. Use GetDeviceRemovedReason to determine the appropriate 
action.
+   // * (Safari) IndexSizeError: Index or size was 
negative, or greater than the allowed value.
+   // There is nothing we can do about this. It's okay 
though, there just won't be a thumbnail.
ctx.drawImage( image, x, y, width, height );
} catch ( err ) {
uw.eventFlowLogger.maybeLogFirefoxCanvasException( err, 
image );
+   return null;
}
 
return $canvas;
@@ -1038,7 +1047,7 @@
 * @return {HTMLCanvasElement|HTMLImageElement}
 */
mw.UploadWizardUpload.prototype.getScaledImageElement = function ( 
image, width, height ) {
-   var constraints;
+   var constraints, transform;
if ( width === undefined || width === null || width <= 0 ) {
width = mw.UploadWizard.config.thumbnailWidth;
}
@@ -1047,9 +1056,14 @@
height: ( height === undefined ? null : parseInt( 
height, 10 ) )
};
 
-   return mw.canvas.isAvailable() ?
-   this.getTransformedCanvasElement( image, constraints ) :
-   this.getBrowserScaledImageElement( image, constraints );
+   if ( mw.canvas.isAvailable() ) {
+   transform = this.getTransformedCanvasElement( image, 
constraints );
+   if ( transform ) {
+   return transform;
+   }
+   }
+   // No canvas support or canvas drawing failed mysteriously, 
fall back
+   return this.getBrowserScaledImageElement( image, constraints );
};
 
/**
@@ -1152,6 +1166,7 @@
canvas.height = 
Math.round( canvas.width * video.videoHeight / video.videoWidth );
context = 
canvas.getContext( '2d' );
try {
+   // More 
ridiculous exceptions, see the comment in #getTransformedCanvasElement

context.drawImage( video, 0, 0, canvas.width, canvas.height );

[MediaWiki-commits] [Gerrit] mediawiki...PageAssessments[master]: Move getEmptyTransactionTicket() above insertProject()

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

Change subject: Move getEmptyTransactionTicket() above insertProject()
..


Move getEmptyTransactionTicket() above insertProject()

Otherwise we might not get the ticket due to pending writes

Change-Id: I6e659eb8f61fc9bac59b2bf18d1eda388f9622e2
---
M PageAssessmentsBody.php
1 file changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/PageAssessmentsBody.php b/PageAssessmentsBody.php
index 32ff7b9..e9dee64 100644
--- a/PageAssessmentsBody.php
+++ b/PageAssessmentsBody.php
@@ -37,6 +37,9 @@
public static function doUpdates( $titleObj, $assessmentData ) {
global $wgUpdateRowsPerQuery;
 
+   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
+
$pageId = $titleObj->getArticleID();
$revisionId = $titleObj->getLatestRevID();
// Compile a list of projects to find out which ones to be 
deleted afterwards
@@ -54,8 +57,6 @@
$toDelete = array_diff( $projectsInDb, $projects );
$toUpdate = array_intersect( $projects, $projectsInDb );
 
-   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
$i = 0;
 
// Add and update records to the database

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6e659eb8f61fc9bac59b2bf18d1eda388f9622e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageAssessments
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Kaldari 
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...PageAssessments[master]: Move getEmptyTransactionTicket() above insertProject()

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

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

Change subject: Move getEmptyTransactionTicket() above insertProject()
..

Move getEmptyTransactionTicket() above insertProject()

Otherwise we might not get the ticket due to pending writes

Change-Id: I6e659eb8f61fc9bac59b2bf18d1eda388f9622e2
---
M PageAssessmentsBody.php
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageAssessments 
refs/changes/95/310195/1

diff --git a/PageAssessmentsBody.php b/PageAssessmentsBody.php
index 32ff7b9..e9dee64 100644
--- a/PageAssessmentsBody.php
+++ b/PageAssessmentsBody.php
@@ -37,6 +37,9 @@
public static function doUpdates( $titleObj, $assessmentData ) {
global $wgUpdateRowsPerQuery;
 
+   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
+
$pageId = $titleObj->getArticleID();
$revisionId = $titleObj->getLatestRevID();
// Compile a list of projects to find out which ones to be 
deleted afterwards
@@ -54,8 +57,6 @@
$toDelete = array_diff( $projectsInDb, $projects );
$toUpdate = array_intersect( $projects, $projectsInDb );
 
-   $factory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-   $ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
$i = 0;
 
// Add and update records to the database

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e659eb8f61fc9bac59b2bf18d1eda388f9622e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageAssessments
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/core[master]: Simplify LBFactory ticket code in CategoryMembershipChangeJob

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

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

Change subject: Simplify LBFactory ticket code in CategoryMembershipChangeJob
..

Simplify LBFactory ticket code in CategoryMembershipChangeJob

Change-Id: I5800bbf6fa718604ffa12d8cde1aa3675fced6fd
---
M includes/jobqueue/jobs/CategoryMembershipChangeJob.php
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/310194/1

diff --git a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php 
b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
index 1828dd7..cd37263 100644
--- a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
+++ b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php
@@ -33,6 +33,9 @@
  * @since 1.27
  */
 class CategoryMembershipChangeJob extends Job {
+   /** @var integer|null */
+   private $ticket;
+
const ENQUEUE_FUDGE_SEC = 60;
 
public function __construct( Title $title, array $params ) {
@@ -43,14 +46,18 @@
}
 
public function run() {
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lb = $lbFactory->getMainLB();
+   $dbw = $lb->getConnection( DB_MASTER );
+
+   $this->ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+
$page = WikiPage::newFromID( $this->params['pageId'], 
WikiPage::READ_LATEST );
if ( !$page ) {
$this->setLastError( "Could not find page 
#{$this->params['pageId']}" );
return false; // deleted?
}
 
-   $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
-   $dbw = $lb->getConnection( DB_MASTER );
// Use a named lock so that jobs for this page see each others' 
changes
$lockKey = "CategoryMembershipUpdates:{$page->getId()}";
$scopedLock = $dbw->getScopedLockAndFlush( $lockKey, 
__METHOD__, 10 );
@@ -59,7 +66,7 @@
return false;
}
 
-   $dbr = wfGetDB( DB_REPLICA, [ 'recentchanges' ] );
+   $dbr = $lb->getConnection( DB_REPLICA, [ 'recentchanges' ] );
// Wait till the replica DB is caught up so that jobs for this 
page see each others' changes
if ( !$lb->safeWaitForMasterPos( $dbr ) ) {
$this->setLastError( "Timed out while waiting for 
replica DB to catch up" );
@@ -120,7 +127,6 @@
);
 
// Apply all category updates in revision timestamp order
-   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
foreach ( $res as $row ) {
$this->notifyUpdatesForRevision( $lbFactory, $page, 
Revision::newFromRow( $row ) );
}
@@ -162,8 +168,6 @@
return; // nothing to do
}
 
-   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
-
$catMembChange = new CategoryMembershipChange( $title, $newRev 
);
$catMembChange->checkTemplateLinks();
 
@@ -174,7 +178,7 @@
$categoryTitle = Title::makeTitle( NS_CATEGORY, 
$categoryName );
$catMembChange->triggerCategoryAddedNotification( 
$categoryTitle );
if ( $insertCount++ && ( $insertCount % $batchSize ) == 
0 ) {
-   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $this->ticket );
}
}
 
@@ -182,7 +186,7 @@
$categoryTitle = Title::makeTitle( NS_CATEGORY, 
$categoryName );
$catMembChange->triggerCategoryRemovedNotification( 
$categoryTitle );
if ( $insertCount++ && ( $insertCount++ % $batchSize ) 
== 0 ) {
-   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $this->ticket );
}
}
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove pointless double exception logging from JobRunner

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

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

Change subject: Remove pointless double exception logging from JobRunner
..

Remove pointless double exception logging from JobRunner

Change-Id: I12a2e6db326af25a3a276a477fbff505feac87b6
---
M includes/jobqueue/JobRunner.php
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/93/310193/1

diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index 022abd9..721fe45 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -279,8 +279,6 @@
} catch ( Exception $e ) {
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
$status = false;
-   $error = get_class( $e ) . ': ' . $e->getMessage();
-   MWExceptionHandler::logException( $e );
}
// Always attempt to call teardown() even if Job throws 
exception.
try {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: MW 1.27 fix for Special:ViewData

2016-09-12 Thread Yaron Koren (Code Review)
Yaron Koren has submitted this change and it was merged.

Change subject: MW 1.27 fix for Special:ViewData
..


MW 1.27 fix for Special:ViewData

Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
---
M specials/CargoViewData.php
1 file changed, 12 insertions(+), 5 deletions(-)

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



diff --git a/specials/CargoViewData.php b/specials/CargoViewData.php
index c940e1c..095e1a2 100644
--- a/specials/CargoViewData.php
+++ b/specials/CargoViewData.php
@@ -161,15 +161,22 @@
// "order by" is handled elsewhere, in getOrderFields().
//
// Field aliases need to have quotes placed around them
-   // before actually running the query.
-   $realAliasedFieldNames = array();
-   foreach ( $this->sqlQuery->mAliasedFieldNames as $alias => 
$fieldName ) {
-   $realAliasedFieldNames['"' . $alias . '"'] = $fieldName;
+   // before running the query - though, starting in
+   // MW 1.27 (specifically, with
+   // https://gerrit.wikimedia.org/r/#/c/286489/),
+   // the quotes get added automatically.
+   if ( version_compare( $GLOBALS['wgVersion'], '1.27', '<' ) ) {
+   $aliasedFieldNames = array();
+   foreach ( $this->sqlQuery->mAliasedFieldNames as $alias 
=> $fieldName ) {
+   $aliasedFieldNames['"' . $alias . '"'] = 
$fieldName;
+   }
+   } else {
+   $aliasedFieldNames = 
$this->sqlQuery->mAliasedFieldNames;
}
 
$queryInfo = array(
'tables' => $this->sqlQuery->mTableNames,
-   'fields' => $realAliasedFieldNames,
+   'fields' => $aliasedFieldNames,
'options' => $selectOptions
);
if ( $this->sqlQuery->mWhereStr != '' ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: Yaron Koren 
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 Bugzilla references to Phabricator references

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

Change subject: Update Bugzilla references to Phabricator references
..


Update Bugzilla references to Phabricator references

Change-Id: I28dbaf05d29062c485042d432fec5d11e9c6d193
---
M includes/GlobalFunctions.php
1 file changed, 6 insertions(+), 6 deletions(-)

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



diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index bc78be5..f93c64e 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -358,7 +358,7 @@
  *
  * ;:@$!*(),/~
  *
- * However, IIS7 redirects fail when the url contains a colon (Bug 22709),
+ * However, IIS7 redirects fail when the url contains a colon (see T24709),
  * so no fancy : for IIS7.
  *
  * %2F in the page titles seems to fatally break for some reason.
@@ -617,7 +617,7 @@
  * This is the basic structure used (brackets contain keys for $urlParts):
  * [scheme][delimiter][user]:[pass]@[host]:[port][path]?[query]#[fragment]
  *
- * @todo Need to integrate this into wfExpandUrl (bug 32168)
+ * @todo Need to integrate this into wfExpandUrl (see T34168)
  *
  * @since 1.19
  * @param array $urlParts URL parts, as output from wfParseUrl
@@ -670,7 +670,7 @@
  * '/a/./b/../c/' becomes '/a/c/'.  For details on the algorithm, please see
  * RFC3986 section 5.2.4.
  *
- * @todo Need to integrate this into wfExpandUrl (bug 32168)
+ * @todo Need to integrate this into wfExpandUrl (see T34168)
  *
  * @param string $urlPath URL path, potentially containing dot-segments
  * @return string URL path with all dot-segments removed
@@ -850,11 +850,11 @@
return false;
}
 
-   /* Provide an empty host for eg. file:/// urls (see bug 28627) */
+   /* Provide an empty host for eg. file:/// urls (see T30627) */
if ( !isset( $bits['host'] ) ) {
$bits['host'] = '';
 
-   // bug 45069
+   // See T47069
if ( isset( $bits['path'] ) ) {
/* parse_url loses the third / for file:///c:/ urls 
(but not on variants) */
if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
@@ -2306,7 +2306,7 @@
// Refs:
//  * 
http://web.archive.org/web/20020708081031/http://mailman.lyra.org/pipermail/scite-interest/2002-March/000436.html
//  * 
http://technet.microsoft.com/en-us/library/cc723564.aspx
-   //  * Bug #13518
+   //  * T15518
//  * CR r63214
// Double the backslashes before any double quotes. 
Escape the double quotes.
// @codingStandardsIgnoreEnd

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I28dbaf05d29062c485042d432fec5d11e9c6d193
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Dereckson 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add Index to contact.preferred_language

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

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

Change subject: Add Index to contact.preferred_language
..

Add Index to contact.preferred_language

CRM-19350

Bug: T96410
Change-Id: If686ad6e20c2906221bc0b8c989ee2d913ad11e2
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/92/310192/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 1d84e5b..5ab003f 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -2188,3 +2188,29 @@
   civicrm_initialize();
   CRM_Core_DAO::executeQuery("DELETE FROM civicrm_email WHERE email = 
'nob...@wikimedia.org'");
 }
+
+/**
+ * T128221 add index to civicrm_contribution.total_amount.
+ *
+ * Bug: T96410
+ */
+function wmf_civicrm_update_7250() {
+  civicrm_initialize();
+  CRM_Core_BAO_SchemaHandler::createIndexes(array('civicrm_contact' => 
array('preferred_language')));
+}
+
+/**
+ * Clean up legacy junk data from preferred_language field.
+ *
+ * This nulls out '_' junk data string (19690 rows)
+ * and changes '_US' to 'en_US' (which is implied) (25387 rows).
+ *
+ * CRM-19350
+ *
+ * Bug: T96410
+ */
+function wmf_civicrm_update_7255() {
+  civicrm_initialize();
+  CRM_Core_DAO::executeQuery("UPDATE civicrm_contact SET preferred_language = 
NULL WHERE preferred_language = '_'");
+  CRM_Core_DAO::executeQuery("UPDATE civicrm_contact SET preferred_language = 
'en_US' WHERE preferred_language = '_US'");
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If686ad6e20c2906221bc0b8c989ee2d913ad11e2
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] mediawiki...VisualEditor[master]: Simplify and fix category popup widget checks

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

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

Change subject: Simplify and fix category popup widget checks
..

Simplify and fix category popup widget checks

Bug: T86357
Change-Id: I9a85267f6da0077e2167a92f25a8dc41074e6548
---
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
3 files changed, 4 insertions(+), 44 deletions(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
index 1407bef..866ffcb 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryItemWidget.js
@@ -38,11 +38,6 @@
this.isHidden = config.hidden;
this.isMissing = config.missing;
 
-   // Events
-   this.$button.on( {
-   mousedown: this.onMouseDown.bind( this )
-   } );
-
// Initialization
this.setLabel( config.redirectTo || this.value );
if ( config.redirectTo ) {
@@ -66,10 +61,6 @@
 /* Events */
 
 /**
- * @event savePopupState
- */
-
-/**
  * @event togglePopupMenu
  * @param {ve.ui.MWCategoryItemWidget} item Item to load into popup
  */
@@ -77,25 +68,11 @@
 /* Methods */
 
 /**
- * Handle mouse down events.
- *
- * @method
- * @param {jQuery.Event} e Mouse down event
- * @fires savePopupState on mousedown.
- */
-ve.ui.MWCategoryItemWidget.prototype.onMouseDown = function () {
-   this.emit( 'savePopupState' );
-
-   // Parent method
-   return ve.ui.MWCategoryItemWidget.super.prototype.onMouseDown.apply( 
this, arguments );
-};
-
-/**
  * Handle mouse click events.
  *
  * @method
  * @param {jQuery.Event} e Mouse click event
- * @fires togglePopupMenu on mousedown.
+ * @fires togglePopupMenu on click.
  */
 ve.ui.MWCategoryItemWidget.prototype.onClick = function () {
this.emit( 'togglePopupMenu', this );
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
index 1293ec5..2cde3ce 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
@@ -164,6 +164,7 @@
 ve.ui.MWCategoryPopupWidget.prototype.closePopup = function () {
this.toggle( false );
this.popupOpen = false;
+   this.category = null;
 };
 
 /**
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
index c6671d5..05cb30c 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
@@ -37,8 +37,6 @@
this.categoryRedirects = {};
// Title cache - will contain entries even if title is already 
normalized
this.normalizedTitles = {};
-   this.popupState = false;
-   this.savedPopupState = false;
this.popup = new ve.ui.MWCategoryPopupWidget();
this.input = new ve.ui.MWCategoryInputWidget( this, { $overlay: 
config.$overlay } );
this.forceCapitalization = mw.config.get( 'wgCaseSensitiveNamespaces' 
).indexOf( categoryNamespace ) === -1;
@@ -48,8 +46,7 @@
this.input.connect( this, { choose: 'onInputChoose' } );
this.popup.connect( this, {
removeCategory: 'onRemoveCategory',
-   updateSortkey: 'onUpdateSortkey',
-   hide: 'onPopupHide'
+   updateSortkey: 'onUpdateSortkey'
} );
this.connect( this, {
drag: 'onDrag'
@@ -210,27 +207,13 @@
 };
 
 /**
- * Sets popup state when popup is hidden
- */
-ve.ui.MWCategoryWidget.prototype.onPopupHide = function () {
-   this.popupState = false;
-};
-
-/**
- * Saves current popup state
- */
-ve.ui.MWCategoryWidget.prototype.onSavePopupState = function () {
-   this.savedPopupState = this.popupState;
-};
-
-/**
  * Toggles popup menu per category item
  *
  * @param {Object} item
  */
 ve.ui.MWCategoryWidget.prototype.onTogglePopupMenu = function ( item ) {
// Close open popup.
-   if ( this.savedPopupState === false || item.value !== 
this.popup.category ) {
+   if ( item.value !== this.popup.category ) {
this.popup.openPopup( item );
} else {
// Handle toggle
@@ -367,7 +350,6 @@
 
categoryItem = new ve.ui.MWCategoryItemWidget( config );
categoryItem.connect( widget, {
-   savePopupState: 'onSavePopupState',
togglePopupMenu: 'onTogglePopupMenu'
} );
 

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


[MediaWiki-commits] [Gerrit] labs...grrrit[master]: Update some packages

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

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

Change subject: Update some packages
..

Update some packages

Update irc to 0.5

Update irc-colors to 1.3.0

Update ssh2 to 0.5.1

Update underscore to 1.8.3

Update winston to 2.1.1

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


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/grrrit 
refs/changes/33/310033/2

diff --git a/package.json b/package.json
index c1dc983..6960a24 100644
--- a/package.json
+++ b/package.json
@@ -4,13 +4,13 @@
   "description": "Gerrit IRC bot",
   "main": "src/relay.js",
   "dependencies": {
-"irc": "~0.3.6",
-"irc-colors": "~1.0.3",
+"irc": "~0.5",
+"irc-colors": "~1.3.0",
 "js-yaml": "^3.4.2",
-"ssh2": "~0.4.4",
+"ssh2": "~0.5.1",
 "swig": "~0.14.0",
-"underscore": "~1.5.1",
-"winston": "~0.7.2"
+"underscore": "~1.8.3",
+"winston": "~2.1.1"
   },
   "devDependencies": {
 "grunt": "^0.4.5",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc312a9ff83d1ef0c330778e3be1847a3580ab2f
Gerrit-PatchSet: 2
Gerrit-Project: labs/tools/grrrit
Gerrit-Branch: master
Gerrit-Owner: Paladox 
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]: Avoid using deprecated methods in JobQueueDB

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

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

Change subject: Avoid using deprecated methods in JobQueueDB
..

Avoid using deprecated methods in JobQueueDB

Change-Id: Ib35b8792e3e4902b52c3e708d8c6e756f35986bd
---
M includes/jobqueue/JobQueueDB.php
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/90/310190/1

diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php
index f6b4d53..50727a2 100644
--- a/includes/jobqueue/JobQueueDB.php
+++ b/includes/jobqueue/JobQueueDB.php
@@ -20,6 +20,7 @@
  * @file
  * @author Aaron Schulz
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * Class to handle job queues stored in the DB
@@ -526,7 +527,8 @@
 * @return void
 */
protected function doWaitForBackups() {
-   wfWaitForSlaves( false, $this->wiki, $this->cluster ?: false );
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $lbFactory->waitForReplication( [ 'wiki' => $this->wiki, 
'cluster' => $this->cluster ] );
}
 
/**
@@ -755,9 +757,10 @@
 * @return DBConnRef
 */
protected function getDB( $index ) {
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$lb = ( $this->cluster !== false )
-   ? wfGetLBFactory()->getExternalLB( $this->cluster, 
$this->wiki )
-   : wfGetLB( $this->wiki );
+   ? $lbFactory->getExternalLB( $this->cluster, 
$this->wiki )
+   : $lbFactory->getMainLB( $this->wiki );
 
return $lb->getConnectionRef( $index, [], $this->wiki );
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove pointless getTransactionProfiler() method

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

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

Change subject: Remove pointless getTransactionProfiler() method
..

Remove pointless getTransactionProfiler() method

Change-Id: Ib019e8317568105b95138cfdc0962b06a55154b9
---
M includes/db/Database.php
1 file changed, 4 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/310189/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 0a1774d..c41e7c7 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -332,13 +332,6 @@
}
 
/**
-* @return TransactionProfiler
-*/
-   protected function getTransactionProfiler() {
-   return $this->trxProfiler;
-   }
-
-   /**
 * @param TransactionProfiler $profiler
 * @since 1.27
 */
@@ -914,7 +907,7 @@
# Keep track of whether the transaction has write queries 
pending
if ( $this->mTrxLevel && !$this->mTrxDoneWrites && $isWrite ) {
$this->mTrxDoneWrites = true;
-   $this->getTransactionProfiler()->transactionWritingIn(
+   $this->trxProfiler->transactionWritingIn(
$this->mServer, $this->mDBname, 
$this->mTrxShortId );
}
 
@@ -1008,7 +1001,7 @@
$this->mRTTEstimate = $queryRuntime;
}
 
-   $this->getTransactionProfiler()->recordQueryCompletion(
+   $this->trxProfiler->recordQueryCompletion(
$queryProf, $startTime, $isWrite, $this->affectedRows()
);
MWDebug::query( $sql, $fname, $isMaster, $queryRuntime );
@@ -3014,7 +3007,7 @@
$this->doCommit( $fname );
if ( $this->mTrxDoneWrites ) {
$this->mDoneWrites = microtime( true );
-   $this->getTransactionProfiler()->transactionWritingOut(
+   $this->trxProfiler->transactionWritingOut(
$this->mServer, $this->mDBname, 
$this->mTrxShortId, $writeTime );
}
 
@@ -3058,7 +3051,7 @@
$this->doRollback( $fname );
$this->mTrxAtomicLevels = [];
if ( $this->mTrxDoneWrites ) {
-   $this->getTransactionProfiler()->transactionWritingOut(
+   $this->trxProfiler->transactionWritingOut(
$this->mServer, $this->mDBname, 
$this->mTrxShortId );
}
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...CentralNotice[master]: [Cleanup] Fix annoying punctuation and unnecessary strict eq...

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

Change subject: [Cleanup] Fix annoying punctuation and unnecessary strict 
equality
..


[Cleanup] Fix annoying punctuation and unnecessary strict equality

Change-Id: I61b4df1d785e5b104f9cab8b7417aaaecaa9fda3
---
M CentralNotice.hooks.php
1 file changed, 10 insertions(+), 10 deletions(-)

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



diff --git a/CentralNotice.hooks.php b/CentralNotice.hooks.php
index e29db47..73eb9de 100644
--- a/CentralNotice.hooks.php
+++ b/CentralNotice.hooks.php
@@ -36,7 +36,7 @@
$wgAvailableRights, $wgGroupPermissions, 
$wgCentralDBname, $wgDBname;
 
// Default for a standalone wiki is that the CN tables are in 
the main database.
-   if ( $wgCentralDBname === false ) {
+   if ( !$wgCentralDBname ) {
$wgCentralDBname = $wgDBname;
}
 
@@ -53,20 +53,20 @@
// If this is the wiki that hosts the management interface, 
load further components
if ( $wgNoticeInfrastructure ) {
if ( $wgNoticeUseTranslateExtension ) {
-   $wgHooks[ 'TranslatePostInitGroups' ][ ] = 
'BannerMessageGroup::registerGroupHook';
-   $wgHooks[ 
'TranslateEventMessageGroupStateChange' ][] = 
'BannerMessageGroup::updateBannerGroupStateHook';
+   $wgHooks['TranslatePostInitGroups'][] = 
'BannerMessageGroup::registerGroupHook';
+   
$wgHooks['TranslateEventMessageGroupStateChange'][] = 
'BannerMessageGroup::updateBannerGroupStateHook';
}
 
-   $wgSpecialPages[ 'CentralNotice' ] = 'CentralNotice';
-   $wgSpecialPages[ 'NoticeTemplate' ] = 
'SpecialNoticeTemplate';
-   $wgSpecialPages[ 'GlobalAllocation' ] = 
'SpecialGlobalAllocation';
-   $wgSpecialPages[ 'BannerAllocation' ] = 
'SpecialBannerAllocation';
-   $wgSpecialPages[ 'CentralNoticeLogs' ] = 
'SpecialCentralNoticeLogs';
-   $wgSpecialPages[ 'CentralNoticeBanners'] = 
'SpecialCentralNoticeBanners';
+   $wgSpecialPages['CentralNotice'] = 'CentralNotice';
+   $wgSpecialPages['NoticeTemplate'] = 
'SpecialNoticeTemplate';
+   $wgSpecialPages['GlobalAllocation'] = 
'SpecialGlobalAllocation';
+   $wgSpecialPages['BannerAllocation'] = 
'SpecialBannerAllocation';
+   $wgSpecialPages['CentralNoticeLogs'] = 
'SpecialCentralNoticeLogs';
+   $wgSpecialPages['CentralNoticeBanners'] = 
'SpecialCentralNoticeBanners';
 
// Register user rights for editing
$wgAvailableRights[] = 'centralnotice-admin';
-   $wgGroupPermissions[ 'sysop' ][ 'centralnotice-admin' ] 
= true; // Only sysops can make change
+   $wgGroupPermissions['sysop']['centralnotice-admin'] = 
true; // Only sysops can make change
}
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I61b4df1d785e5b104f9cab8b7417aaaecaa9fda3
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: AndyRussG 
Gerrit-Reviewer: Cdentinger 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Ssmith 
Gerrit-Reviewer: XenoRyet 

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


[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Show globe icon next to all links

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

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

Change subject: Show globe icon next to all  links
..

Show globe icon next to all  links

* Uses MIT licensed globe icon from Ionicons icon pack,
  may be replaced once we have WMF icon.
* Provides a CSS class .no-icon to hide it.

Bug: T145176
Change-Id: Iddb86055eb71b258829ca3f14fa8292335f41acd
---
A styles/images/COPYING
A styles/images/ios-world-outline.png
A styles/images/ios-world-outline.svg
M styles/kartographer.less
4 files changed, 40 insertions(+), 0 deletions(-)


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

diff --git a/styles/images/COPYING b/styles/images/COPYING
new file mode 100644
index 000..10d27d5
--- /dev/null
+++ b/styles/images/COPYING
@@ -0,0 +1,3 @@
+== ios-world-outline.svg ==
+Free to use and licensed under MIT from Ionicons 
https://github.com/driftyco/ionicons/blob/master/src/ios-world-outline.svg
+The ios-world-outline.png is generated for the SVG file for legacy browser 
support.
\ No newline at end of file
diff --git a/styles/images/ios-world-outline.png 
b/styles/images/ios-world-outline.png
new file mode 100644
index 000..077e810
--- /dev/null
+++ b/styles/images/ios-world-outline.png
Binary files differ
diff --git a/styles/images/ios-world-outline.svg 
b/styles/images/ios-world-outline.svg
new file mode 100644
index 000..2679e98
--- /dev/null
+++ b/styles/images/ios-world-outline.svg
@@ -0,0 +1,22 @@
+
+
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;>
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px"
+width="512px" height="512px" viewBox="0 0 512 512" 
style="enable-background:new 0 0 512 512;" xml:space="preserve">
+
+
diff --git a/styles/kartographer.less b/styles/kartographer.less
index 853499e..e288d9d 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -1,3 +1,5 @@
+@import 'mediawiki.mixins';
+
 .mw-kartographer-mapDialog-map {
position: absolute;
top: 0;
@@ -15,6 +17,19 @@
 a.mw-kartographer-link {
display: inline;
cursor: pointer;
+
+   background-position: center right;
+   background-repeat: no-repeat;
+   .background-image-svg('images/ios-world-outline.svg', 
'images/ios-world-outline.png');
+   padding-right: 17px;
+   margin-right: 2px;
+   background-size: 16px 16px;
+
+   &.no-icon {
+   background: none;
+   padding-right: 0;
+   margin-right: 0;
+   }
 }
 
 a.mw-kartographer-autostyled {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...GlobalUserPage[master]: Implement magic word based opt-out

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

Change subject: Implement magic word based opt-out
..


Implement magic word based opt-out

The current method of opting out via  tags is a bit hacky and
has a few problems:
* It requires transcluding the page itself
* Determining opt-out requires a full page parse
* Not re-usable for generic shadow namespaces

Instead, this adds a __NOGLOBAL__ magic word, which if present on the
central user page, will prevent it from being displayed on remote wikis.
Additionally, this is checked when determining whether a link should be
red or blue.

The old way of opt-out still works, but will be removed in the future
after a deprecation period and time for migration to the new magic word.

Bug: T90849
Change-Id: I29a45bb40b16516f15dfff9a445080949b7fb221
---
M GlobalUserPage.body.php
M GlobalUserPage.hooks.php
A GlobalUserPage.i18n.magic.php
M extension.json
4 files changed, 38 insertions(+), 6 deletions(-)

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

Objections:
  Jforrester: There's a problem with this change, please improve



diff --git a/GlobalUserPage.body.php b/GlobalUserPage.body.php
index bd60d45..aed7664 100644
--- a/GlobalUserPage.body.php
+++ b/GlobalUserPage.body.php
@@ -160,15 +160,28 @@
global $wgGlobalUserPageDBname;
$lb = wfGetLB( $wgGlobalUserPageDBname );
$dbr = $lb->getConnection( DB_SLAVE, array(), 
$wgGlobalUserPageDBname );
-   $touched = $dbr->selectField(
-   'page',
-   'page_touched',
+   $row = $dbr->selectRow(
+   [ 'page', 'page_props' ],
+   [ 'page_touched', 'pp_propname' ],
array(
'page_namespace' => NS_USER,
-   'page_title' => $user->getUserPage()->getDBkey()
+   'page_title' => 
$user->getUserPage()->getDBkey(),
),
-   __METHOD__
+   __METHOD__,
+   [],
+   [ 'page_props' =>
+   [ 'LEFT JOIN', [ 'page_id=pp_page', 
'pp_propname' => 'noglobal' ] ]
+   ]
);
+   if ( $row ) {
+   if ( $row->pp_propname == 'noglobal' ) {
+   $touched = false;
+   } else {
+   $touched = $row->page_touched;
+   }
+   } else {
+   $touched = false;
+   }
$lb->reuseConnection( $dbr );
 
self::$touchedCache->set( $user->getName(), $touched );
diff --git a/GlobalUserPage.hooks.php b/GlobalUserPage.hooks.php
index b3317bf..1054c06 100644
--- a/GlobalUserPage.hooks.php
+++ b/GlobalUserPage.hooks.php
@@ -156,4 +156,11 @@
 
return true;
}
+
+   /**
+* @param array $ids
+*/
+   public static function onGetDoubleUnderscoreIDs( array &$ids ) {
+   $ids[] = 'noglobal';
+   }
 }
diff --git a/GlobalUserPage.i18n.magic.php b/GlobalUserPage.i18n.magic.php
new file mode 100644
index 000..869cbf3
--- /dev/null
+++ b/GlobalUserPage.i18n.magic.php
@@ -0,0 +1,8 @@
+ array( 1, '__NOGLOBAL__' ),
+);
+
diff --git a/extension.json b/extension.json
index ee6e10f..69d4549 100644
--- a/extension.json
+++ b/extension.json
@@ -17,6 +17,9 @@
"i18n"
]
},
+   "ExtensionMessagesFiles": {
+   "GlobalUserPageMagic": "GlobalUserPage.i18n.magic.php"
+   },
"Hooks": {
"GetPreferences": [
"GlobalUserPageHooks::onGetPreferences"
@@ -41,7 +44,8 @@
],
"TitleGetEditNotices": [
"GlobalUserPageHooks::onTitleGetEditNotices"
-   ]
+   ],
+   "GetDoubleUnderscoreIDs": 
"GlobalUserPageHooks::onGetDoubleUnderscoreIDs"
},
"config": {
"GlobalUserPageCacheExpiry": 604800,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I29a45bb40b16516f15dfff9a445080949b7fb221
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GlobalUserPage
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: C. Scott Ananian 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: MZMcBride 
Gerrit-Reviewer: Siebrand 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: Tim Starling 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: puppet tab: Rely less on fqdns and instance objects

2016-09-12 Thread Andrew Bogott (Code Review)
Andrew Bogott has submitted this change and it was merged.

Change subject: puppet tab:  Rely less on fqdns and instance objects
..


puppet tab:  Rely less on fqdns and instance objects

This is a step towards being able to re-use the same
tab code in a different tab group.

Change-Id: If68a1e3d80a96e34c107f2a04384fe128bd51fcd
---
M modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
M modules/openstack/files/liberty/horizon/puppettab/puppet_roles.py
M modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
M modules/openstack/files/liberty/horizon/puppettab/tab.py
M modules/openstack/files/liberty/horizon/puppettab/urls.py
M modules/openstack/files/liberty/horizon/puppettab/views.py
6 files changed, 50 insertions(+), 60 deletions(-)

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



diff --git a/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py 
b/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
index 8aa6bbc..5384e27 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
@@ -28,8 +28,8 @@
 #
 # This class manages all communication with the home-made puppet REST backend
 class puppet_config():
-def __init__(self, fqdn, tenant_id):
-self.fqdn = fqdn
+def __init__(self, prefix, tenant_id):
+self.prefix = prefix
 self.tenant_id = tenant_id
 self.apiurl = getattr(settings,
   "PUPPET_CONFIG_BACKEND",
@@ -40,7 +40,7 @@
 def refresh(self):
 classesurl = "%s/%s/prefix/%s/roles" % (self.apiurl,
 self.tenant_id,
-self.fqdn)
+self.prefix)
 req = requests.get(classesurl, verify=False)
 if req.status_code == 404:
 self.roles = []
@@ -50,7 +50,7 @@
 
 hieraurl = "%s/%s/prefix/%s/hiera" % (self.apiurl,
   self.tenant_id,
-  self.fqdn)
+  self.prefix)
 req = requests.get(hieraurl, verify=False)
 if req.status_code == 404:
 self.hiera_raw = ""
@@ -135,7 +135,7 @@
 list_dump = yaml.safe_dump(role_list, default_flow_style=False)
 roleurl = "%s/%s/prefix/%s/roles" % (self.apiurl,
  self.tenant_id,
- self.fqdn)
+ self.prefix)
 requests.post(roleurl,
   verify=False,
   data=list_dump,
@@ -146,7 +146,7 @@
 hiera_dump = yaml.safe_dump(hiera_yaml, default_flow_style=False)
 hieraurl = "%s/%s/prefix/%s/hiera" % (self.apiurl,
   self.tenant_id,
-  self.fqdn)
+  self.prefix)
 requests.post(hieraurl,
   verify=False,
   data=hiera_dump,
diff --git a/modules/openstack/files/liberty/horizon/puppettab/puppet_roles.py 
b/modules/openstack/files/liberty/horizon/puppettab/puppet_roles.py
index 34571b9..5a64a3e 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/puppet_roles.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/puppet_roles.py
@@ -43,13 +43,9 @@
 self.filter_tags = []
 self.instance = None
 
-def update_instance_data(self, instance):
-self.instance_id = instance.id
-self.tenant_id = instance.tenant_id
-tld = getattr(settings,
-  "INSTANCE_TLD",
-  "eqiad.wmflabs")
-self.fqdn = "%s.%s.%s" % (instance.name, instance.tenant_id, tld)
+def update_prefix_data(self, prefix, tenant_id):
+self.prefix = prefix
+self.tenant_id = tenant_id
 return self
 
 def mark_applied(self, paramdict):
diff --git a/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py 
b/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
index d2e2a51..ab6310b 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
@@ -69,7 +69,7 @@
 def get_link_url(self, datum):
 url = "horizon:project:puppet:removepuppetrole"
 kwargs = {
-'fqdn': datum.fqdn,
+'prefix': datum.prefix,
 'tenantid': datum.tenant_id,
 'roleid': datum.name,
 }
@@ -89,7 +89,7 @@
 def get_link_url(self, datum):
 url = "horizon:project:puppet:applypuppetrole"
 kwargs = {
-'fqdn': 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Puppet tab: A tiny bit of error handling

2016-09-12 Thread Andrew Bogott (Code Review)
Andrew Bogott has submitted this change and it was merged.

Change subject: Puppet tab:  A tiny bit of error handling
..


Puppet tab:  A tiny bit of error handling

Throw an error if the backend rejects our POST

Change-Id: I92cffc1bdaf7bb39991e3a4f987d4bc2c293323d
---
M modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
1 file changed, 10 insertions(+), 8 deletions(-)

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



diff --git a/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py 
b/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
index 5384e27..bc209db 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/puppet_config.py
@@ -136,10 +136,11 @@
 roleurl = "%s/%s/prefix/%s/roles" % (self.apiurl,
  self.tenant_id,
  self.prefix)
-requests.post(roleurl,
-  verify=False,
-  data=list_dump,
-  headers={'Content-Type': 'application/x-yaml'})
+req = requests.post(roleurl,
+verify=False,
+data=list_dump,
+headers={'Content-Type': 'application/x-yaml'})
+req.raise_for_status()
 self.refresh()
 
 def set_hiera(self, hiera_yaml):
@@ -147,8 +148,9 @@
 hieraurl = "%s/%s/prefix/%s/hiera" % (self.apiurl,
   self.tenant_id,
   self.prefix)
-requests.post(hieraurl,
-  verify=False,
-  data=hiera_dump,
-  headers={'Content-Type': 'application/x-yaml'})
+req = requests.post(hieraurl,
+verify=False,
+data=hiera_dump,
+headers={'Content-Type': 'application/x-yaml'})
+req.raise_for_status()
 self.refresh()

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I92cffc1bdaf7bb39991e3a4f987d4bc2c293323d
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott 
Gerrit-Reviewer: Andrew Bogott 
Gerrit-Reviewer: Volans 
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/puppet[production]: Add deployment-mediawiki04 to the deployment-prep scap dsh

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

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

Change subject: Add deployment-mediawiki04 to the deployment-prep scap dsh
..

Add deployment-mediawiki04 to the deployment-prep scap dsh

Bug: T144006
Change-Id: I464f1be3c4cecb7b06afed4d55841f710b219782
---
M hieradata/labs/deployment-prep/common.yaml
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/34/310034/1

diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index 3d489d1..a38327e 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -172,6 +172,7 @@
 - deployment-mediawiki01.deployment-prep.eqiad.wmflabs
 - deployment-mediawiki02.deployment-prep.eqiad.wmflabs
 - deployment-mediawiki03.deployment-prep.eqiad.wmflabs
+- deployment-mediawiki04.deployment-prep.eqiad.wmflabs
 - deployment-tmh01.deployment-prep.eqiad.wmflabs
 - deployment-tin.deployment-prep.eqiad.wmflabs
 - mira.deployment-prep.eqiad.wmflabs

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

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

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


[MediaWiki-commits] [Gerrit] operations...python-thumbor-wikimedia[master]: Upgrade upstream code to 0.1.18

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

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

Change subject: Upgrade upstream code to 0.1.18
..

Upgrade upstream code to 0.1.18

Change-Id: I3615f9360f95988f45b3bbb383d6aabcab6add5d
---
M setup.py
M wikimedia_thumbor/engine/proxy/proxy.py
M wikimedia_thumbor/engine/svg/svg.py
M wikimedia_thumbor/handler/images/images.py
4 files changed, 14 insertions(+), 33 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/debs/python-thumbor-wikimedia 
refs/changes/98/309998/1

diff --git a/setup.py b/setup.py
index bb8b2db..f7fb2af 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@
 
 setup(
 name='wikimedia_thumbor',
-version='0.1.17',
+version='0.1.18',
 url='https://phabricator.wikimedia.org/diffusion/THMBREXT/',
 license='MIT',
 author='Gilles Dubuc, Wikimedia Foundation',
@@ -21,7 +21,6 @@
 zip_safe=False,
 platforms='any',
 install_requires=[
-'bs4',
 'cairosvg',
 'gi',
 'libthumbor>=1.3.2',
diff --git a/wikimedia_thumbor/engine/proxy/proxy.py 
b/wikimedia_thumbor/engine/proxy/proxy.py
index 58800a5..f18b334 100644
--- a/wikimedia_thumbor/engine/proxy/proxy.py
+++ b/wikimedia_thumbor/engine/proxy/proxy.py
@@ -84,6 +84,10 @@
 duration
 )
 
+if (hasattr(self.lcl['context'].config, 'SLOW_PROCESSING_LIMIT')
+and duration > self.lcl['context'].config.SLOW_PROCESSING_LIMIT):
+logger.error('[Proxy] Request took a long time: %r' % duration)
+
 self.lcl['context'].request_handler.set_header(
 header,
 duration
diff --git a/wikimedia_thumbor/engine/svg/svg.py 
b/wikimedia_thumbor/engine/svg/svg.py
index 4e2e493..572ece2 100644
--- a/wikimedia_thumbor/engine/svg/svg.py
+++ b/wikimedia_thumbor/engine/svg/svg.py
@@ -15,26 +15,12 @@
 import locale
 import StringIO
 
-from bs4 import BeautifulSoup
-
 from thumbor.utils import logger
 
 from wikimedia_thumbor.engine import BaseWikimediaEngine
 
-BaseWikimediaEngine.add_format(
-'image/svg+xml',
-'.svg',
-lambda buffer: Engine.is_svg(buffer)
-)
-
 
 class Engine(BaseWikimediaEngine):
-@classmethod
-def is_svg(cls, buffer):
-soup = BeautifulSoup(buffer, 'xml')
-
-return soup.svg is not None
-
 def create_image(self, buffer):
 self.original_buffer = buffer
 
diff --git a/wikimedia_thumbor/handler/images/images.py 
b/wikimedia_thumbor/handler/images/images.py
index 2aa1ac5..0a62fd1 100644
--- a/wikimedia_thumbor/handler/images/images.py
+++ b/wikimedia_thumbor/handler/images/images.py
@@ -72,16 +72,6 @@
 
 return path
 
-@tornado.web.asynchronous
-def get(self, **kw):
-translated_kw = self.translate(kw)
-return super(ImagesHandler, self).get(**translated_kw)
-
-@tornado.web.asynchronous
-def head(self, **kw):  # pragma: no cover
-translated_kw = self.translate(kw)
-return super(ImagesHandler, self).head(**translated_kw)
-
 def translate(self, kw):
 logger.debug('[ImagesHandlers] translate: %r' % kw)
 
@@ -199,25 +189,27 @@
 
 return translated
 
-@gen.coroutine  # NOQA
+@gen.coroutine
 def check_image(self, kw):
+translated_kw = self.translate(kw)
+
 if self.context.config.MAX_ID_LENGTH > 0:
 # Check if an image with an uuid exists in storage
-truncated_image = kw['image'][:self.context.config.MAX_ID_LENGTH]
+truncated_image = 
translated_kw['image'][:self.context.config.MAX_ID_LENGTH]
 maybe_future = self.context.modules.storage.exists(truncated_image)
 exists = yield gen.maybe_future(maybe_future)
 if exists:  # pragma: no cover
-kw['image'] = kw['image'][:self.context.config.MAX_ID_LENGTH]
+translated_kw['image'] = 
translated_kw['image'][:self.context.config.MAX_ID_LENGTH]
 
-kw['image'] = quote(kw['image'].encode('utf-8'))
-if not self.validate(kw['image']):  # pragma: no cover
+translated_kw['image'] = quote(translated_kw['image'].encode('utf-8'))
+if not self.validate(translated_kw['image']):  # pragma: no cover
 self._error(
 400,
 'No original image was specified in the given URL'
 )
 return
 
-kw['request'] = self.request
-self.context.request = RequestParameters(**kw)
+translated_kw['request'] = self.request
+self.context.request = RequestParameters(**translated_kw)
 
 self.execute_image_operations()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3615f9360f95988f45b3bbb383d6aabcab6add5d
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/python-thumbor-wikimedia
Gerrit-Branch: 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: puppettable: Eliminate most uses of instance_id

2016-09-12 Thread Andrew Bogott (Code Review)
Andrew Bogott has submitted this change and it was merged.

Change subject: puppettable:  Eliminate most uses of instance_id
..


puppettable:  Eliminate most uses of instance_id

We were passing this all over just so we would have
the right URL to return to from our modals.  Returning
to the referrer works ok and lets us simplify
and generalize the code quite a bit.

Change-Id: If7493dbe0617cea612446f6b3c037fc14f02eecf
---
M modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
M modules/openstack/files/liberty/horizon/puppettab/tab.py
M modules/openstack/files/liberty/horizon/puppettab/urls.py
M modules/openstack/files/liberty/horizon/puppettab/views.py
4 files changed, 12 insertions(+), 24 deletions(-)

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



diff --git a/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py 
b/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
index ad5f99c..d2e2a51 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/puppet_tables.py
@@ -71,7 +71,6 @@
 kwargs = {
 'fqdn': datum.fqdn,
 'tenantid': datum.tenant_id,
-'instanceid': datum.instance_id,
 'roleid': datum.name,
 }
 return urlresolvers.reverse(url, kwargs=kwargs)
@@ -92,7 +91,6 @@
 kwargs = {
 'fqdn': datum.fqdn,
 'tenantid': datum.tenant_id,
-'instanceid': datum.instance_id,
 'roleid': datum.name,
 }
 return urlresolvers.reverse(url, kwargs=kwargs)
diff --git a/modules/openstack/files/liberty/horizon/puppettab/tab.py 
b/modules/openstack/files/liberty/horizon/puppettab/tab.py
index 2cab719..8278d13 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/tab.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/tab.py
@@ -64,7 +64,6 @@
 kwargs = {
 'fqdn': fqdn,
 'tenantid': instance.tenant_id,
-'instanceid': instance.id,
 }
 context['edithieraurl'] = urlresolvers.reverse(url, kwargs=kwargs)
 
diff --git a/modules/openstack/files/liberty/horizon/puppettab/urls.py 
b/modules/openstack/files/liberty/horizon/puppettab/urls.py
index 936a5a7..d1e5b8f 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/urls.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/urls.py
@@ -21,12 +21,12 @@
 '',
 url(r'^$', panel.IndexView.as_view(), name='index'),
 url(r'^(?P[^/]+)/(?P[^/]+)/'
-'(?P[^/]+)/(?P[^/]+)/applypuppetrole$',
+'(?P[^/]+)/applypuppetrole$',
 views.ApplyRoleView.as_view(), name='applypuppetrole'),
 url(r'^(?P[^/]+)/(?P[^/]+)/'
-'(?P[^/]+)/(?P[^/]+)/removepuppetrole$',
+'(?P[^/]+)/removepuppetrole$',
 views.RemoveRoleView.as_view(), name='removepuppetrole'),
 url(r'^(?P[^/]+)/(?P[^/]+)/'
-'(?P[^/]+)/edithiera$',
+'edithiera$',
 views.EditHieraView.as_view(), name='edithiera'),
 )
diff --git a/modules/openstack/files/liberty/horizon/puppettab/views.py 
b/modules/openstack/files/liberty/horizon/puppettab/views.py
index b1d0f1e..47b1e79 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/views.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/views.py
@@ -16,6 +16,7 @@
 import logging
 
 from django.core import urlresolvers
+from django.core.validators import URLValidator
 from django.utils.safestring import mark_safe
 from django.utils.translation import ugettext_lazy as _
 
@@ -62,15 +63,16 @@
 urlkwargs = {
 'fqdn': self.fqdn,
 'tenantid': self.tenant_id,
-'instanceid': self.instance_id,
 }
 context['submit_url'] = urlresolvers.reverse(self.submit_url,
  kwargs=urlkwargs)
 return context
 
 def get_success_url(self):
-success_url = "horizon:project:instances:detail"
-return urlresolvers.reverse(success_url, args=[self.instance_id])
+validate = URLValidator()
+refer = self.request.META.get('HTTP_REFERER', '/')
+validate(refer)
+return refer
 
 def get_fqdn(self):
 return self.kwargs['fqdn']
@@ -78,14 +80,10 @@
 def get_tenant_id(self):
 return self.kwargs['tenantid']
 
-def get_instance_id(self):
-return self.kwargs['instanceid']
-
 def get_initial(self):
 initial = {}
 self.fqdn = self.get_fqdn()
 self.tenant_id = self.get_tenant_id()
-self.instance_id = self.get_instance_id()
 self.hieradata = puppet_config(self.fqdn, self.tenant_id)
 initial['hieradata'] = self.hieradata.hiera
 initial['fqdn'] = self.fqdn
@@ -105,7 +103,6 @@
 urlkwargs = {
 'fqdn': self.fqdn,
 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Tweak $wgTrxProfilerLimits to lower noise a bit

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

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

Change subject: Tweak $wgTrxProfilerLimits to lower noise a bit
..

Tweak $wgTrxProfilerLimits to lower noise a bit

Change-Id: I22ae7a5c2ba5f39007019e47ea0dff17a4cc971a
---
M includes/DefaultSettings.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/310188/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index c7fda14..ff7430b 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5972,7 +5972,7 @@
'POST' => [
'readQueryTime' => 5,
'writeQueryTime' => 1,
-   'maxAffected' => 500
+   'maxAffected' => 1000
],
'POST-nonwrite' => [
'masterConns' => 0,
@@ -5983,7 +5983,7 @@
'PostSend' => [
'readQueryTime' => 5,
'writeQueryTime' => 1,
-   'maxAffected' => 500
+   'maxAffected' => 1000
],
// Background job runner
'JobRunner' => [

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: upload frontends: hfp limit change 8MB -> 1MB

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

Change subject: upload frontends: hfp limit change 8MB -> 1MB
..


upload frontends: hfp limit change 8MB -> 1MB

Change-Id: I1b928db061056e4b683d2246982097918153aa01
---
M templates/varnish/upload-frontend.inc.vcl.erb
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 6b8820e..4dcc6de 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -73,8 +73,8 @@
set beresp.do_stream = true;
}
 
-   // hit-for-pass objects >= 8MB size
-   if (std.integer(beresp.http.Content-Length, 8388608) >= 8388608 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   // hit-for-pass objects >= 1MB size
+   if (std.integer(beresp.http.Content-Length, 1048576) >= 1048576 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.http.X-CDIS = "pass";
<%- if @varnish_version4 -%>
set beresp.uncacheable = true;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b928db061056e4b683d2246982097918153aa01
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Ema 
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/puppet[production]: upload frontends: hfp limit change 8MB -> 1MB

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

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

Change subject: upload frontends: hfp limit change 8MB -> 1MB
..

upload frontends: hfp limit change 8MB -> 1MB

Change-Id: I1b928db061056e4b683d2246982097918153aa01
---
M templates/varnish/upload-frontend.inc.vcl.erb
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/87/310187/1

diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 6b8820e..4dcc6de 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -73,8 +73,8 @@
set beresp.do_stream = true;
}
 
-   // hit-for-pass objects >= 8MB size
-   if (std.integer(beresp.http.Content-Length, 8388608) >= 8388608 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   // hit-for-pass objects >= 1MB size
+   if (std.integer(beresp.http.Content-Length, 1048576) >= 1048576 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.http.X-CDIS = "pass";
<%- if @varnish_version4 -%>
set beresp.uncacheable = true;

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.18]: Add missing dependency to 'mediawiki.Upload.BookletLayout' m...

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

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

Change subject: Add missing dependency to 'mediawiki.Upload.BookletLayout' 
module
..

Add missing dependency to 'mediawiki.Upload.BookletLayout' module

Bug: T145315
Change-Id: Idadbf3adf4a145530774abc5fc8cf5fe4920330d
(cherry picked from commit 93c2381b09085e29667f1a8183494b0b188d1f7e)
---
M resources/Resources.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/32/310032/1

diff --git a/resources/Resources.php b/resources/Resources.php
index 7055f36..63c3490 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1282,6 +1282,7 @@
],
'dependencies' => [
'oojs-ui-core',
+   'oojs-ui-widgets',
'oojs-ui-windows',
'oojs-ui.styles.icons-content',
'oojs-ui.styles.icons-editing-advanced',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idadbf3adf4a145530774abc5fc8cf5fe4920330d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.18
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/core[master]: Sync up with Parsoid parserTests.

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

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

Change subject: Sync up with Parsoid parserTests.
..

Sync up with Parsoid parserTests.

This now aligns with Parsoid commit 94316242479f272b51db431a0f8fb6d77bd8f639

Change-Id: I411e3b733f4f1e5da5fa2500354575af77e09c88
---
M tests/parser/parserTests.txt
1 file changed, 88 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/309994/1

diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index c1c421b..e1a54fb 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -3055,6 +3055,28 @@
 | c
 !!end
 
+!! test
+2g. Indented table markup mixed with indented pre content (proposed in bug 
6200)
+!! wikitext
+ 
+ 
+ 
+ Text that should be rendered preformatted
+ 
+ 
+ 
+!! html
+ 
+ 
+ 
+Text that should be rendered preformatted
+
+ 
+ 
+ 
+
+!! end
+
 !!test
 3a. Indent-Pre and block tags (single-line html)
 !! wikitext
@@ -6392,26 +6414,55 @@
 ho">ha
 !! end
 
+## We don't support roundtripping of these attributes in Parsoid.
+## Selective serialization takes care of preventing dirty diffs.
+## But, on edits, we dirty-diff the invalid attribute text.
 !! test
-Indented table markup mixed with indented pre content (proposed in bug 6200)
+Invalid text in table attributes should be discarded
+!! options
+parsoid=wt2html
 !! wikitext
- 
- 
- 
- Text that should be rendered preformatted
- 
- 
- 
-!! html
- 
- 
- 
-Text that should be rendered preformatted
-
- 
- 
- 
+{| boo style='border:1px solid black'
+|  boo style='color:blue'  | 1
+|boo style='color:blue'| 2
+|}
+!! html/php
+
+
+ 1
+
+ 2
+
 
+!! html/parsoid
+
+
+ 1
+ 2
+
+
+!! end
+
+!! test
+Invalid text in table attributes should be preserved by selective serializer
+!! options
+parsoid={
+  "modes": ["selser"],
+  "changes": [
+["td:first-child", "text", "abc"],
+["td + td", "text", "xyz"]
+  ]
+}
+!! wikitext
+{| boo style='border:1px solid black'
+|  boo style='color:blue'  | 1
+|boo style='color:blue'| 2
+|}
+!! wikitext/edited
+{| boo style='border:1px solid black'
+|  boo style='color:blue'  |abc
+|boo style='color:blue'|xyz
+|}
 !! end
 
 !! test
@@ -7998,6 +8049,20 @@
 [[/123]]
 !! html/parsoid
 /123
+!! end
+
+!! test
+Ensure that transclusion titles are not url-decoded
+!! options
+subpage title=[[Test]]
+parsoid=wt2html
+!! wikitext
+{{Bar%C3%A9}} {{/Bar%C3%A9}}
+!! html/php
+{{Bar%C3%A9}} {{/Bar%C3%A9}}
+
+!! html/parsoid
+{{Bar%C3%A9}} {{/Bar%C3%A9}}
 !! end
 
 !! test
@@ -19388,9 +19453,11 @@
 parsoid=wt2html
 !! wikitext
 {{../../../../More than parent}}
-!! html
+!! html/php
 {{../../../../More than parent}}
 
+!! html/parsoid
+{{../../../../More than parent}}
 !! end
 
 !! test
@@ -27241,7 +27308,9 @@
 unclosed internal link XSS (T137264)
 !! wikitext
 [[#%3Cscript%3Ealert(1)%3C/script%3E|
-!! html
+!! html/php
 [[#scriptalert(1)/script|
 
+!! html/parsoid
+[[#%3Cscript%3Ealert(1)%3C/script%3E|
 !! end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I411e3b733f4f1e5da5fa2500354575af77e09c88
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry 

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


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Lower $wgMaxUserDBWriteDuration to 3

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

Change subject: Lower $wgMaxUserDBWriteDuration to 3
..


Lower $wgMaxUserDBWriteDuration to 3

Still no errors in the last 24 hours

Change-Id: If455f3dc6e4f8db8aa5cddb5a11ce5823326f4f9
---
M wmf-config/CommonSettings.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 482147b..d2c47dc 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -222,7 +222,7 @@
 }
 
 # Disallow web request DB transactions slower than this
-$wgMaxUserDBWriteDuration = 4;
+$wgMaxUserDBWriteDuration = 3;
 # Activate read-only mode for bots when lag is getting high.
 # This should be lower than 'max lag' in the LBFactory conf.
 $wgAPIMaxLagThreshold = 5;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If455f3dc6e4f8db8aa5cddb5a11ce5823326f4f9
Gerrit-PatchSet: 2
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
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]: Lower $wgMaxUserDBWriteDuration to 3

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

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

Change subject: Lower $wgMaxUserDBWriteDuration to 3
..

Lower $wgMaxUserDBWriteDuration to 3

Still no errors in the last 24 hours

Change-Id: If455f3dc6e4f8db8aa5cddb5a11ce5823326f4f9
---
M wmf-config/CommonSettings.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 482147b..d2c47dc 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -222,7 +222,7 @@
 }
 
 # Disallow web request DB transactions slower than this
-$wgMaxUserDBWriteDuration = 4;
+$wgMaxUserDBWriteDuration = 3;
 # Activate read-only mode for bots when lag is getting high.
 # This should be lower than 'max lag' in the LBFactory conf.
 $wgAPIMaxLagThreshold = 5;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If455f3dc6e4f8db8aa5cddb5a11ce5823326f4f9
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: upload frontends: hfp limit change 50MB -> 8MB

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

Change subject: upload frontends: hfp limit change 50MB -> 8MB
..


upload frontends: hfp limit change 50MB -> 8MB

Change-Id: Icb362254ed37704b16f48a0b107d7e2748a4dd36
---
M templates/varnish/upload-frontend.inc.vcl.erb
1 file changed, 11 insertions(+), 10 deletions(-)

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



diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 7f51046..6b8820e 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -71,16 +71,17 @@
 <% stream_threshold = @cache_route == 'direct' ? 33554432 : 1048576 -%>
if (std.integer(beresp.http.Content-Length, 33554432) >= <%= 
stream_threshold %> || beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.do_stream = true;
-   if (std.integer(beresp.http.Content-Length, 50331648) >= 
50331648 || beresp.http.Content-Length ~ "^[0-9]{9}") {
-   // don't attempt to cache these in the frontend
-   set beresp.http.X-CDIS = "pass";
-   <%- if @varnish_version4 -%>
-   set beresp.uncacheable = true;
-   return (deliver);
-   <%- else -%>
-   return (hit_for_pass);
-   <%- end -%>
-   }
+   }
+
+   // hit-for-pass objects >= 8MB size
+   if (std.integer(beresp.http.Content-Length, 8388608) >= 8388608 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   set beresp.http.X-CDIS = "pass";
+   <%- if @varnish_version4 -%>
+   set beresp.uncacheable = true;
+   return (deliver);
+   <%- else -%>
+   return (hit_for_pass);
+   <%- end -%>
}
 
call upload_common_backend_response;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb362254ed37704b16f48a0b107d7e2748a4dd36
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
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/puppet[production]: upload frontends: hfp limit change 50MB -> 8MB

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

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

Change subject: upload frontends: hfp limit change 50MB -> 8MB
..

upload frontends: hfp limit change 50MB -> 8MB

Change-Id: Icb362254ed37704b16f48a0b107d7e2748a4dd36
---
M templates/varnish/upload-frontend.inc.vcl.erb
1 file changed, 11 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/85/310185/1

diff --git a/templates/varnish/upload-frontend.inc.vcl.erb 
b/templates/varnish/upload-frontend.inc.vcl.erb
index 7f51046..6b8820e 100644
--- a/templates/varnish/upload-frontend.inc.vcl.erb
+++ b/templates/varnish/upload-frontend.inc.vcl.erb
@@ -71,16 +71,17 @@
 <% stream_threshold = @cache_route == 'direct' ? 33554432 : 1048576 -%>
if (std.integer(beresp.http.Content-Length, 33554432) >= <%= 
stream_threshold %> || beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.do_stream = true;
-   if (std.integer(beresp.http.Content-Length, 50331648) >= 
50331648 || beresp.http.Content-Length ~ "^[0-9]{9}") {
-   // don't attempt to cache these in the frontend
-   set beresp.http.X-CDIS = "pass";
-   <%- if @varnish_version4 -%>
-   set beresp.uncacheable = true;
-   return (deliver);
-   <%- else -%>
-   return (hit_for_pass);
-   <%- end -%>
-   }
+   }
+
+   // hit-for-pass objects >= 8MB size
+   if (std.integer(beresp.http.Content-Length, 8388608) >= 8388608 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   set beresp.http.X-CDIS = "pass";
+   <%- if @varnish_version4 -%>
+   set beresp.uncacheable = true;
+   return (deliver);
+   <%- else -%>
+   return (hit_for_pass);
+   <%- end -%>
}
 
call upload_common_backend_response;

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: Add mediawiki04 to the list of labs appservers in deployment...

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

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

Change subject: Add mediawiki04 to the list of labs appservers in 
deployment-prep
..

Add mediawiki04 to the list of labs appservers in deployment-prep

Bug: T144006
Change-Id: I9640a8ea84b4872c0ea7a9c0c415b3d21167c777
---
M hieradata/labs.yaml
M hieradata/labs/deployment-prep/common.yaml
M modules/torrus/tests/cdn.pp
3 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/99/30/1

diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index 1f38e7d..04985fd 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -53,18 +53,21 @@
   eqiad:
 - '10.68.17.170' # deployment-mediawiki01
 - '10.68.16.127' # deployment-mediawiki02
+- '10.68.19.128' # deployment-mediawiki04
   api:
 route: eqiad
 backends:
   eqiad:
 - '10.68.17.170' # deployment-mediawiki01
 - '10.68.16.127' # deployment-mediawiki02
+- '10.68.19.128' # deployment-mediawiki04
   rendering:
 route: eqiad
 backends:
   eqiad:
 - '10.68.17.170' # deployment-mediawiki01
 - '10.68.16.127' # deployment-mediawiki02
+- '10.68.19.128' # deployment-mediawiki04
   security_audit:
 route: eqiad
 backends:
diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index 3d489d1..a38327e 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -172,6 +172,7 @@
 - deployment-mediawiki01.deployment-prep.eqiad.wmflabs
 - deployment-mediawiki02.deployment-prep.eqiad.wmflabs
 - deployment-mediawiki03.deployment-prep.eqiad.wmflabs
+- deployment-mediawiki04.deployment-prep.eqiad.wmflabs
 - deployment-tmh01.deployment-prep.eqiad.wmflabs
 - deployment-tin.deployment-prep.eqiad.wmflabs
 - mira.deployment-prep.eqiad.wmflabs
diff --git a/modules/torrus/tests/cdn.pp b/modules/torrus/tests/cdn.pp
index e052c23..14da580 100644
--- a/modules/torrus/tests/cdn.pp
+++ b/modules/torrus/tests/cdn.pp
@@ -76,18 +76,21 @@
 'eqiad' => [
 '10.68.17.96',  # deployment-mediawiki01
 '10.68.17.208', # deployment-mediawiki02
+'10.68.19.128', # deployment-mediawiki04
 ],
 },
 'api' => {
 'eqiad' => [
 '10.68.17.96',  # deployment-mediawiki01
 '10.68.17.208', # deployment-mediawiki02
+'10.68.19.128', # deployment-mediawiki04
 ],
 },
 'rendering' => {
 'eqiad' => [
 '10.68.17.96',  # deployment-mediawiki01
 '10.68.17.208', # deployment-mediawiki02
+'10.68.19.128', # deployment-mediawiki04
 ],
 },
 'appservers_debug' => {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make LBFactory::waitForReplication() mask wait latency with ...

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

Change subject: Make LBFactory::waitForReplication() mask wait latency with 
callbacks
..


Make LBFactory::waitForReplication() mask wait latency with callbacks

This simply moves the call order down a bit.

Change-Id: I78559f769133d5addb590a65af7d535604de8407
---
M includes/db/loadbalancer/LBFactory.php
1 file changed, 6 insertions(+), 4 deletions(-)

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



diff --git a/includes/db/loadbalancer/LBFactory.php 
b/includes/db/loadbalancer/LBFactory.php
index cd8dff3..4758cc7 100644
--- a/includes/db/loadbalancer/LBFactory.php
+++ b/includes/db/loadbalancer/LBFactory.php
@@ -430,10 +430,6 @@
'ifWritesSince' => null
];
 
-   foreach ( $this->replicationWaitCallbacks as $callback ) {
-   $callback();
-   }
-
// Figure out which clusters need to be checked
/** @var LoadBalancer[] $lbs */
$lbs = [];
@@ -467,6 +463,12 @@
$masterPositions[$i] = $lb->getMasterPos();
}
 
+   // Run any listener callbacks *after* getting the DB positions. 
The more
+   // time spent in the callbacks, the less time is spent in 
waitForAll().
+   foreach ( $this->replicationWaitCallbacks as $callback ) {
+   $callback();
+   }
+
$failed = [];
foreach ( $lbs as $i => $lb ) {
if ( $masterPositions[$i] ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I78559f769133d5addb590a65af7d535604de8407
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Parent5446 
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]: Avoid creating DB replication lag in clearAllNotifications()

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

Change subject: Avoid creating DB replication lag in clearAllNotifications()
..


Avoid creating DB replication lag in clearAllNotifications()

Change-Id: Ifad51cf2aaa9867513615d48753436cf686d7f1c
---
M includes/user/User.php
1 file changed, 56 insertions(+), 18 deletions(-)

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



diff --git a/includes/user/User.php b/includes/user/User.php
index 7109a4a..2af0324 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -3613,31 +3613,69 @@
 * @note If the user doesn't have 'editmywatchlist', this will do 
nothing.
 */
public function clearAllNotifications() {
-   if ( wfReadOnly() ) {
-   return;
-   }
-
-   // Do nothing if not allowed to edit the watchlist
-   if ( !$this->isAllowed( 'editmywatchlist' ) ) {
-   return;
-   }
-
global $wgUseEnotif, $wgShowUpdatedMarker;
+   // Do nothing if not allowed to edit the watchlist
+   if ( wfReadOnly() || !$this->isAllowed( 'editmywatchlist' ) ) {
+   return;
+   }
+
if ( !$wgUseEnotif && !$wgShowUpdatedMarker ) {
$this->setNewtalk( false );
return;
}
+
$id = $this->getId();
-   if ( $id != 0 ) {
-   $dbw = wfGetDB( DB_MASTER );
-   $dbw->update( 'watchlist',
-   [ /* SET */ 'wl_notificationtimestamp' => null 
],
-   [ /* WHERE */ 'wl_user' => $id, 
'wl_notificationtimestamp IS NOT NULL' ],
-   __METHOD__
-   );
-   // We also need to clear here the "you have new 
message" notification for the own user_talk page;
-   // it's cleared one page view later in 
WikiPage::doViewUpdates().
+   if ( !$id ) {
+   return;
}
+
+   $dbw = wfGetDB( DB_MASTER );
+   $asOfTimes = array_unique( $dbw->selectFieldValues(
+   'watchlist',
+   'wl_notificationtimestamp',
+   [ 'wl_user' => $id, 'wl_notificationtimestamp IS NOT 
NULL' ],
+   __METHOD__,
+   [ 'ORDER BY' => 'wl_notificationtimestamp DESC', 
'LIMIT' => 500 ]
+   ) );
+   if ( !$asOfTimes ) {
+   return;
+   }
+   // Immediately update the most recent touched rows, which 
hopefully covers what
+   // the user sees on the watchlist page before pressing "mark 
all pages visited"
+   $dbw->update(
+   'watchlist',
+   [ 'wl_notificationtimestamp' => null ],
+   [ 'wl_user' => $id, 'wl_notificationtimestamp' => 
$asOfTimes ],
+   __METHOD__
+   );
+   // ...and finish the older ones in a post-send update with lag 
checks...
+   DeferredUpdates::addUpdate( new AutoCommitUpdate(
+   $dbw,
+   __METHOD__,
+   function () use ( $dbw, $id ) {
+   global $wgUpdateRowsPerQuery;
+
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = 
$lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   $asOfTimes = array_unique( 
$dbw->selectFieldValues(
+   'watchlist',
+   'wl_notificationtimestamp',
+   [ 'wl_user' => $id, 
'wl_notificationtimestamp IS NOT NULL' ],
+   __METHOD__
+   ) );
+   foreach ( array_chunk( $asOfTimes, 
$wgUpdateRowsPerQuery ) as $asOfTimeBatch ) {
+   $dbw->update(
+   'watchlist',
+   [ 'wl_notificationtimestamp' => 
null ],
+   [ 'wl_user' => $id, 
'wl_notificationtimestamp' => $asOfTimeBatch ],
+   __METHOD__
+   );
+   
$lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
+   }
+   }
+   ) );
+   // We also need to clear here the "you have new message" 
notification for the own
+

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: refreshLinks: Add --namespace option

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

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

Change subject: refreshLinks: Add --namespace option
..

refreshLinks: Add --namespace option

This allows limiting refreshing data to pages in a single namespace.

Change-Id: I309058df98b638beb32adb1d663455a0c4aa1cec
---
M maintenance/refreshLinks.php
1 file changed, 24 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/84/310184/1

diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index 24c8c11..6c009a1 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -29,6 +29,12 @@
  * @ingroup Maintenance
  */
 class RefreshLinks extends Maintenance {
+
+   /**
+* @var int|bool
+*/
+   protected $namespace = false;
+
public function __construct() {
parent::__construct();
$this->addDescription( 'Refresh link tables' );
@@ -39,6 +45,7 @@
$this->addOption( 'e', 'Last page id to refresh', false, true );
$this->addOption( 'dfn-chunk-size', 'Maximum number of existent 
IDs to check per ' .
'query, default 10', false, true );
+   $this->addOption( 'namespace', 'Only fix pages in this 
namespace', false );
$this->addArg( 'start', 'Page_id to start from, default 1', 
false );
$this->setBatchSize( 100 );
}
@@ -51,6 +58,12 @@
$start = (int)$this->getArg( 0 ) ?: null;
$end = (int)$this->getOption( 'e' ) ?: null;
$dfnChunkSize = (int)$this->getOption( 'dfn-chunk-size', 10 
);
+   $ns = $this->getOption( 'namespace' );
+   if ( $ns === null ) {
+   $this->namespace = false;
+   } else {
+   $this->namespace = (int)$ns;
+   }
if ( !$this->hasOption( 'dfn-only' ) ) {
$new = $this->getOption( 'new-only', false );
$redir = $this->getOption( 'redirects-only', false );
@@ -60,6 +73,12 @@
} else {
$this->deleteLinksFromNonexistent( $start, $end, 
$this->mBatchSize, $dfnChunkSize );
}
+   }
+
+   private function namespaceCond() {
+   return $this->namespace !== false
+   ? [ 'page_namespace' => $this->namespace ]
+   : [];
}
 
/**
@@ -92,7 +111,7 @@
"page_is_redirect=1",
"rd_from IS NULL",
self::intervalCond( $dbr, 'page_id', $start, 
$end ),
-   ];
+   ] + $this->namespaceCond();
 
$res = $dbr->select(
[ 'page', 'redirect' ],
@@ -121,7 +140,7 @@
[
'page_is_new' => 1,
self::intervalCond( $dbr, 'page_id', 
$start, $end ),
-   ],
+   ] + $this->namespaceCond(),
__METHOD__
);
$num = $res->numRows();
@@ -141,7 +160,7 @@
}
} else {
if ( !$end ) {
-   $maxPage = $dbr->selectField( 'page', 
'max(page_id)', false );
+   $maxPage = $dbr->selectField( 'page', 
'max(page_id)', $this->namespaceCond() );
$maxRD = $dbr->selectField( 'redirect', 
'max(rd_from)', false );
$end = max( $maxPage, $maxRD );
}
@@ -265,7 +284,8 @@
$nextStart = $dbr->selectField(
'page',
'page_id',
-   self::intervalCond( $dbr, 'page_id', $start, 
$end ),
+   [ self::intervalCond( $dbr, 'page_id', $start, 
$end ) ]
+   + $this->namespaceCond(),
__METHOD__,
[ 'ORDER BY' => 'page_id', 'OFFSET' => 
$chunkSize ]
);

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Delete 'sourcefiles' directory

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

Change subject: Delete 'sourcefiles' directory
..


Delete 'sourcefiles' directory

These do not resemble anything in our interface and are probably hopelessly 
outdated.

Change-Id: I0158aa43d35e35b067faa7727c88a7731651fa5a
---
D sourcefiles/active-arrow.svg
D sourcefiles/arrow.svg
D sourcefiles/inactive-divider.svg
3 files changed, 0 insertions(+), 238 deletions(-)

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



diff --git a/sourcefiles/active-arrow.svg b/sourcefiles/active-arrow.svg
deleted file mode 100644
index 8dd89ba..000
--- a/sourcefiles/active-arrow.svg
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-http://purl.org/dc/elements/1.1/;
-   xmlns:cc="http://creativecommons.org/ns#;
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
-   xmlns:svg="http://www.w3.org/2000/svg;
-   xmlns="http://www.w3.org/2000/svg;
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   version="1.1"
-   inkscape:version="0.47pre4 r22446"
-   sodipodi:docname="active-arrow.svg">
-  
-
-  
-  
-
-  
-  
-
-  
-image/svg+xml
-http://purl.org/dc/dcmitype/StillImage; />
-
-  
-
-  
-  
-
-  
-
diff --git a/sourcefiles/arrow.svg b/sourcefiles/arrow.svg
deleted file mode 100644
index 81edc75..000
--- a/sourcefiles/arrow.svg
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-http://purl.org/dc/elements/1.1/;
-   xmlns:cc="http://creativecommons.org/ns#;
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
-   xmlns:svg="http://www.w3.org/2000/svg;
-   xmlns="http://www.w3.org/2000/svg;
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
-   width="1052.3622"
-   height="744.09448"
-   id="svg2"
-   version="1.1"
-   inkscape:version="0.47pre4 r22446"
-   sodipodi:docname="active-arrow.svg">
-  
-
-
-  
-  
-
-  
-  
-
-  
-image/svg+xml
-http://purl.org/dc/dcmitype/StillImage; />
-
-  
-
-  
-  
-
-
-  
-
diff --git a/sourcefiles/inactive-divider.svg b/sourcefiles/inactive-divider.svg
deleted file mode 100644
index 0fb9621..000
--- a/sourcefiles/inactive-divider.svg
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-http://purl.org/dc/elements/1.1/;
-   xmlns:cc="http://creativecommons.org/ns#;
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
-   xmlns:svg="http://www.w3.org/2000/svg;
-   xmlns="http://www.w3.org/2000/svg;
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape;
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   version="1.1"
-   inkscape:version="0.47pre4 r22446"
-   sodipodi:docname="active-arrow.svg">
-  
-
-  
-  
-
-  
-  
-
-  
-image/svg+xml
-http://purl.org/dc/dcmitype/StillImage; />
-
-  
-
-  
-  
-
-  
-

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0158aa43d35e35b067faa7727c88a7731651fa5a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...GlobalUsage[wmf/1.28.0-wmf.18]: Avoid making DB replication lag in onLinksUpdateComplete()

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

Change subject: Avoid making DB replication lag in onLinksUpdateComplete()
..


Avoid making DB replication lag in onLinksUpdateComplete()

Also removed old legacy code branch.

Change-Id: Ib69dd3958b74d09ec137448af132712c6aa61083
(cherry picked from commit 128869299f78071d56a05e80648a68b2dfc778d9)
---
M GlobalUsageHooks.php
M GlobalUsage_body.php
2 files changed, 33 insertions(+), 24 deletions(-)

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



diff --git a/GlobalUsageHooks.php b/GlobalUsageHooks.php
index b766ade..778a0ff 100644
--- a/GlobalUsageHooks.php
+++ b/GlobalUsageHooks.php
@@ -14,7 +14,7 @@
 * @param $linksUpdater LinksUpdate
 * @return bool
 */
-   public static function onLinksUpdateComplete( $linksUpdater ) {
+   public static function onLinksUpdateComplete( LinksUpdate $linksUpdater 
) {
$title = $linksUpdater->getTitle();
 
// Create a list of locally existing images (DB keys)
@@ -22,24 +22,11 @@
 
$localFiles = array();
$repo = RepoGroup::singleton()->getLocalRepo();
-   if ( defined( 'FileRepo::NAME_AND_TIME_ONLY' ) ) { // MW 1.23
-   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
-   foreach ( $imagesInfo as $dbKey => $info ) {
-   $localFiles[] = $dbKey;
-   if ( $dbKey !== $info['title'] ) { // redirect
-   $localFiles[] = $info['title'];
-   }
-   }
-   } else {
-   // Unrolling findFiles() here because pages with 
thousands of images trigger an OOM
-   foreach ( $images as $dbKey ) {
-   $file = $repo->findFile( $dbKey );
-   if ( $file ) {
-   $localFiles[] = $dbKey;
-   if ( $file->getTitle()->getDBkey() !== 
$dbKey ) { // redirect
-   $localFiles[] = 
$file->getTitle()->getDBkey();
-   }
-   }
+   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
+   foreach ( $imagesInfo as $dbKey => $info ) {
+   $localFiles[] = $dbKey;
+   if ( $dbKey !== $info['title'] ) { // redirect
+   $localFiles[] = $info['title'];
}
}
$localFiles = array_values( array_unique( $localFiles ) );
@@ -106,6 +93,7 @@
 */
public static function onArticleDeleteComplete( $article, $user, 
$reason, $id ) {
$gu = self::getGlobalUsage();
+   // @FIXME: avoid making DB replication lag
$gu->deleteLinksFromPage( $id );
 
return true;
diff --git a/GlobalUsage_body.php b/GlobalUsage_body.php
index ca3fe1c..f9cd85e 100644
--- a/GlobalUsage_body.php
+++ b/GlobalUsage_body.php
@@ -1,6 +1,8 @@
  $name
);
}
-   $this->db->insert( 'globalimagelinks', $insert, __METHOD__, 
array( 'IGNORE' ) );
+
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   foreach ( array_chunk( $insert, $wgUpdateRowsPerQuery ) as 
$insertBatch ) {
+   $this->db->insert( 'globalimagelinks', $insertBatch, 
__METHOD__, array( 'IGNORE' ) );
+   $lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
+   }
}
 
/**
@@ -58,8 +68,10 @@
);
 
$images = array();
-   foreach ( $res as $row )
+   foreach ( $res as $row ) {
$images[] = $row->gil_to;
+   }
+
return $images;
}
 
@@ -69,15 +81,24 @@
 * @param $id int Page id of the page
 * @param $to mixed File name(s)
 */
-   public function deleteLinksFromPage( $id, $to = null ) {
+   public function deleteLinksFromPage( $id, array $to = null ) {
+   global $wgUpdateRowsPerQuery;
+
$where = array(
'gil_wiki' => $this->interwiki,
'gil_page' => $id
);
if ( $to ) {
-   $where['gil_to'] = $to;
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+   

[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Show globe icon next to all links

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

Change subject: Show globe icon next to all  links
..


Show globe icon next to all  links

* Uses MIT licensed globe icon from Ionicons icon pack,
  may be replaced once we have WMF icon.
* Provides a CSS class .no-icon to hide it.

Bug: T145176
Change-Id: Iddb86055eb71b258829ca3f14fa8292335f41acd
---
A styles/images/COPYING
A styles/images/ios-world-outline.png
A styles/images/ios-world-outline.svg
M styles/kartographer.less
4 files changed, 41 insertions(+), 0 deletions(-)

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



diff --git a/styles/images/COPYING b/styles/images/COPYING
new file mode 100644
index 000..10d27d5
--- /dev/null
+++ b/styles/images/COPYING
@@ -0,0 +1,3 @@
+== ios-world-outline.svg ==
+Free to use and licensed under MIT from Ionicons 
https://github.com/driftyco/ionicons/blob/master/src/ios-world-outline.svg
+The ios-world-outline.png is generated for the SVG file for legacy browser 
support.
\ No newline at end of file
diff --git a/styles/images/ios-world-outline.png 
b/styles/images/ios-world-outline.png
new file mode 100644
index 000..7e3944a
--- /dev/null
+++ b/styles/images/ios-world-outline.png
Binary files differ
diff --git a/styles/images/ios-world-outline.svg 
b/styles/images/ios-world-outline.svg
new file mode 100644
index 000..16b5496
--- /dev/null
+++ b/styles/images/ios-world-outline.svg
@@ -0,0 +1,22 @@
+
+
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;>
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px"
+width="512px" height="512px" viewBox="0 0 512 512" 
style="enable-background:new 0 0 512 512;" xml:space="preserve">
+
+
diff --git a/styles/kartographer.less b/styles/kartographer.less
index 853499e..1e387b0 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -1,3 +1,5 @@
+@import 'mediawiki.mixins';
+
 .mw-kartographer-mapDialog-map {
position: absolute;
top: 0;
@@ -15,6 +17,19 @@
 a.mw-kartographer-link {
display: inline;
cursor: pointer;
+
+   background-position: center right;
+   background-repeat: no-repeat;
+   .background-image-svg('images/ios-world-outline.svg', 
'images/ios-world-outline.png');
+   padding-right: 17px;
+   margin-right: 2px;
+   background-size: 16px 16px;
+
+   &.no-icon:not(.mw-kartographer-autostyled) {
+   background: none;
+   padding-right: 0;
+   margin-right: 0;
+   }
 }
 
 a.mw-kartographer-autostyled {
@@ -32,6 +47,7 @@
line-height: 1;
text-align: center;
 }
+
 a.mw-kartographer-autostyled:visited {
color: #fff;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iddb86055eb71b258829ca3f14fa8292335f41acd
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: JGirault 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: Kaldari 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: VolkerE 
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...GlobalUsage[wmf/1.28.0-wmf.18]: Avoid making DB replication lag in onLinksUpdateComplete()

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

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

Change subject: Avoid making DB replication lag in onLinksUpdateComplete()
..

Avoid making DB replication lag in onLinksUpdateComplete()

Also removed old legacy code branch.

Change-Id: Ib69dd3958b74d09ec137448af132712c6aa61083
(cherry picked from commit 128869299f78071d56a05e80648a68b2dfc778d9)
---
M GlobalUsageHooks.php
M GlobalUsage_body.php
2 files changed, 33 insertions(+), 24 deletions(-)


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

diff --git a/GlobalUsageHooks.php b/GlobalUsageHooks.php
index b766ade..778a0ff 100644
--- a/GlobalUsageHooks.php
+++ b/GlobalUsageHooks.php
@@ -14,7 +14,7 @@
 * @param $linksUpdater LinksUpdate
 * @return bool
 */
-   public static function onLinksUpdateComplete( $linksUpdater ) {
+   public static function onLinksUpdateComplete( LinksUpdate $linksUpdater 
) {
$title = $linksUpdater->getTitle();
 
// Create a list of locally existing images (DB keys)
@@ -22,24 +22,11 @@
 
$localFiles = array();
$repo = RepoGroup::singleton()->getLocalRepo();
-   if ( defined( 'FileRepo::NAME_AND_TIME_ONLY' ) ) { // MW 1.23
-   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
-   foreach ( $imagesInfo as $dbKey => $info ) {
-   $localFiles[] = $dbKey;
-   if ( $dbKey !== $info['title'] ) { // redirect
-   $localFiles[] = $info['title'];
-   }
-   }
-   } else {
-   // Unrolling findFiles() here because pages with 
thousands of images trigger an OOM
-   foreach ( $images as $dbKey ) {
-   $file = $repo->findFile( $dbKey );
-   if ( $file ) {
-   $localFiles[] = $dbKey;
-   if ( $file->getTitle()->getDBkey() !== 
$dbKey ) { // redirect
-   $localFiles[] = 
$file->getTitle()->getDBkey();
-   }
-   }
+   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
+   foreach ( $imagesInfo as $dbKey => $info ) {
+   $localFiles[] = $dbKey;
+   if ( $dbKey !== $info['title'] ) { // redirect
+   $localFiles[] = $info['title'];
}
}
$localFiles = array_values( array_unique( $localFiles ) );
@@ -106,6 +93,7 @@
 */
public static function onArticleDeleteComplete( $article, $user, 
$reason, $id ) {
$gu = self::getGlobalUsage();
+   // @FIXME: avoid making DB replication lag
$gu->deleteLinksFromPage( $id );
 
return true;
diff --git a/GlobalUsage_body.php b/GlobalUsage_body.php
index ca3fe1c..f9cd85e 100644
--- a/GlobalUsage_body.php
+++ b/GlobalUsage_body.php
@@ -1,6 +1,8 @@
  $name
);
}
-   $this->db->insert( 'globalimagelinks', $insert, __METHOD__, 
array( 'IGNORE' ) );
+
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   foreach ( array_chunk( $insert, $wgUpdateRowsPerQuery ) as 
$insertBatch ) {
+   $this->db->insert( 'globalimagelinks', $insertBatch, 
__METHOD__, array( 'IGNORE' ) );
+   $lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
+   }
}
 
/**
@@ -58,8 +68,10 @@
);
 
$images = array();
-   foreach ( $res as $row )
+   foreach ( $res as $row ) {
$images[] = $row->gil_to;
+   }
+
return $images;
}
 
@@ -69,15 +81,24 @@
 * @param $id int Page id of the page
 * @param $to mixed File name(s)
 */
-   public function deleteLinksFromPage( $id, $to = null ) {
+   public function deleteLinksFromPage( $id, array $to = null ) {
+   global $wgUpdateRowsPerQuery;
+
$where = array(
'gil_wiki' => $this->interwiki,
'gil_page' => $id
);
if ( $to ) {
-   $where['gil_to'] = $to;
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = 

[MediaWiki-commits] [Gerrit] mediawiki...GlobalUsage[master]: Avoid making DB replication lag in onLinksUpdateComplete()

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

Change subject: Avoid making DB replication lag in onLinksUpdateComplete()
..


Avoid making DB replication lag in onLinksUpdateComplete()

Also removed old legacy code branch.

Change-Id: Ib69dd3958b74d09ec137448af132712c6aa61083
---
M GlobalUsageHooks.php
M GlobalUsage_body.php
2 files changed, 33 insertions(+), 24 deletions(-)

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



diff --git a/GlobalUsageHooks.php b/GlobalUsageHooks.php
index b766ade..778a0ff 100644
--- a/GlobalUsageHooks.php
+++ b/GlobalUsageHooks.php
@@ -14,7 +14,7 @@
 * @param $linksUpdater LinksUpdate
 * @return bool
 */
-   public static function onLinksUpdateComplete( $linksUpdater ) {
+   public static function onLinksUpdateComplete( LinksUpdate $linksUpdater 
) {
$title = $linksUpdater->getTitle();
 
// Create a list of locally existing images (DB keys)
@@ -22,24 +22,11 @@
 
$localFiles = array();
$repo = RepoGroup::singleton()->getLocalRepo();
-   if ( defined( 'FileRepo::NAME_AND_TIME_ONLY' ) ) { // MW 1.23
-   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
-   foreach ( $imagesInfo as $dbKey => $info ) {
-   $localFiles[] = $dbKey;
-   if ( $dbKey !== $info['title'] ) { // redirect
-   $localFiles[] = $info['title'];
-   }
-   }
-   } else {
-   // Unrolling findFiles() here because pages with 
thousands of images trigger an OOM
-   foreach ( $images as $dbKey ) {
-   $file = $repo->findFile( $dbKey );
-   if ( $file ) {
-   $localFiles[] = $dbKey;
-   if ( $file->getTitle()->getDBkey() !== 
$dbKey ) { // redirect
-   $localFiles[] = 
$file->getTitle()->getDBkey();
-   }
-   }
+   $imagesInfo = $repo->findFiles( $images, 
FileRepo::NAME_AND_TIME_ONLY );
+   foreach ( $imagesInfo as $dbKey => $info ) {
+   $localFiles[] = $dbKey;
+   if ( $dbKey !== $info['title'] ) { // redirect
+   $localFiles[] = $info['title'];
}
}
$localFiles = array_values( array_unique( $localFiles ) );
@@ -106,6 +93,7 @@
 */
public static function onArticleDeleteComplete( $article, $user, 
$reason, $id ) {
$gu = self::getGlobalUsage();
+   // @FIXME: avoid making DB replication lag
$gu->deleteLinksFromPage( $id );
 
return true;
diff --git a/GlobalUsage_body.php b/GlobalUsage_body.php
index ca3fe1c..f9cd85e 100644
--- a/GlobalUsage_body.php
+++ b/GlobalUsage_body.php
@@ -1,6 +1,8 @@
  $name
);
}
-   $this->db->insert( 'globalimagelinks', $insert, __METHOD__, 
array( 'IGNORE' ) );
+
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   foreach ( array_chunk( $insert, $wgUpdateRowsPerQuery ) as 
$insertBatch ) {
+   $this->db->insert( 'globalimagelinks', $insertBatch, 
__METHOD__, array( 'IGNORE' ) );
+   $lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
+   }
}
 
/**
@@ -58,8 +68,10 @@
);
 
$images = array();
-   foreach ( $res as $row )
+   foreach ( $res as $row ) {
$images[] = $row->gil_to;
+   }
+
return $images;
}
 
@@ -69,15 +81,24 @@
 * @param $id int Page id of the page
 * @param $to mixed File name(s)
 */
-   public function deleteLinksFromPage( $id, $to = null ) {
+   public function deleteLinksFromPage( $id, array $to = null ) {
+   global $wgUpdateRowsPerQuery;
+
$where = array(
'gil_wiki' => $this->interwiki,
'gil_page' => $id
);
if ( $to ) {
-   $where['gil_to'] = $to;
+   $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+   foreach ( array_chunk( $to, $wgUpdateRowsPerQuery ) as 
$toBatch ) {
+

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Let native extensions add stylesheets

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

Change subject: Let native extensions add stylesheets
..


Let native extensions add stylesheets

Change-Id: Ib418544236ddf2d9a075934d72712734d90b4537
---
M lib/config/MWParserEnvironment.js
M lib/config/WikiConfig.js
M lib/ext/Cite/index.js
M lib/mw/ApiRequest.js
M lib/wt2html/DOMPostProcessor.js
5 files changed, 47 insertions(+), 32 deletions(-)

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



diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index 229db34..3901f45 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -738,6 +738,24 @@
}
 };
 
+/**
+ * @method
+ */
+MWParserEnvironment.prototype.setPageProperty = function(src, property) {
+   console.assert(this.page);
+   if (Array.isArray(src) && src.length > 0) {
+   // This info comes back from the MW API when extension tags are 
parsed.
+   // Since a page can have multiple extension tags, we can hit 
this code
+   // multiple times and run into an already initialized set.
+   if (!this.page[property]) {
+   this.page[property] = new Set();
+   }
+   src.forEach(function(s) {
+   this.page[property].add(s);
+   }, this);
+   }
+};
+
 
 if (typeof module === "object") {
module.exports.MWParserEnvironment = MWParserEnvironment;
diff --git a/lib/config/WikiConfig.js b/lib/config/WikiConfig.js
index 24fccce..06cb9d0 100644
--- a/lib/config/WikiConfig.js
+++ b/lib/config/WikiConfig.js
@@ -496,7 +496,8 @@
}
 
// Register native extension handlers second to overwrite the above.
-   this.nativeExtPostProcessors = [];
+   this.extensionPostProcessors = [];
+   this.extensionStyles = new Set();
mwApiConf.extensions.forEach(function(Ext) {
var ext = new Ext();
var tags = ext.config.hasOwnProperty('tags') ? ext.config.tags 
: [];
@@ -504,11 +505,16 @@
this.extensionTags.set(tag.name.toLowerCase(), tag);
}, this);
if (ext.config.hasOwnProperty('domPostProcessor')) {
-   this.nativeExtPostProcessors.push({
+   this.extensionPostProcessors.push({
tag:   tags.map(function(t) { return t.name; 
}).join('+'),
domPP: ext.config.domPostProcessor,
});
}
+   if (ext.config.hasOwnProperty('styles')) {
+   ext.config.styles.forEach(function(s) {
+   this.extensionStyles.add(s);
+   }, this);
+   }
}, this);
 
// Function hooks on this wiki, indexed by their normalized form
diff --git a/lib/ext/Cite/index.js b/lib/ext/Cite/index.js
index e6804c8..5ede05c 100644
--- a/lib/ext/Cite/index.js
+++ b/lib/ext/Cite/index.js
@@ -704,6 +704,7 @@
serialHandler: this.references.serialHandler,
},
],
+   styles: ['ext.cite.style'],
};
 };
 
diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js
index 886f856..3915e31 100644
--- a/lib/mw/ApiRequest.js
+++ b/lib/mw/ApiRequest.js
@@ -112,20 +112,6 @@
};
 };
 
-var setPageProperty = function(env, src, property) {
-   if (src && env.page) {
-   // This info comes back from the MW API when extension tags are 
parsed.
-   // Since a page can have multiple extension tags, we can hit 
this code
-   // multiple times and run into an already initialized set.
-   if (!env.page[property]) {
-   env.page[property] = new Set();
-   }
-   for (var i in src) {
-   env.page[property].add(src[i]);
-   }
-   }
-};
-
 var manglePreprocessorResponse = function(env, response) {
var src = '';
if (response.wikitext !== undefined) {
@@ -158,9 +144,9 @@
});
}
// The same for ResourceLoader modules
-   setPageProperty(env, response.modules, "extensionModules");
-   setPageProperty(env, response.modulescripts, "extensionModuleScripts");
-   setPageProperty(env, response.modulestyles, "extensionModuleStyles");
+   env.setPageProperty(response.modules, "extensionModules");
+   env.setPageProperty(response.modulescripts, "extensionModuleScripts");
+   env.setPageProperty(response.modulestyles, "extensionModuleStyles");
 
return src;
 };
@@ -183,9 +169,9 @@
parsedHtml = parsedHtml.replace(/(^)|(<\/p>$)/g, '');
 
// Add the modules to the page data
-   setPageProperty(env, response.modules, 

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Provide the new wikitext editor as a beta feature

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

Change subject: Provide the new wikitext editor as a beta feature
..


Provide the new wikitext editor as a beta feature

Still needs to be de-feature-flagged later.

Bug: T142644
Change-Id: I8e2588909ff95085b5a4d58f4394d9bc805f5598
---
M VisualEditor.hooks.php
A betafeatures-icon-WikitextEditor-ltr.svg
A betafeatures-icon-WikitextEditor-rtl.svg
M extension.json
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
M modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
8 files changed, 527 insertions(+), 4 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  Paladox: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index ae5c34a..1a79b58 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -607,6 +607,24 @@
'skins' => $veConfig->get( 
'VisualEditorSupportedSkins' ),
]
];
+
+   $preferences['visualeditor-newwikitext'] = [
+   'version' => '1.0',
+   'label-message' => 
'visualeditor-preference-newwikitexteditor-label',
+   'desc-message' => 
'visualeditor-preference-newwikitexteditor-description',
+   'screenshot' => [
+   'ltr' => 
"$iconpath/betafeatures-icon-WikitextEditor-ltr.svg",
+   'rtl' => 
"$iconpath/betafeatures-icon-WikitextEditor-rtl.svg",
+   ],
+   'info-message' => 
'visualeditor-preference-newwikitexteditor-info-link',
+   'discussion-message' => 
'visualeditor-preference-newwikitexteditor-discussion-link',
+   'requirements' => [
+   'javascript' => true,
+   'blacklist' => $veConfig->get( 
'VisualEditorBrowserBlacklist' ),
+   'skins' => $veConfig->get( 
'VisualEditorSupportedSkins' ),
+   ]
+   ];
+
}
 
/**
diff --git a/betafeatures-icon-WikitextEditor-ltr.svg 
b/betafeatures-icon-WikitextEditor-ltr.svg
new file mode 100644
index 000..67b49cc
--- /dev/null
+++ b/betafeatures-icon-WikitextEditor-ltr.svg
@@ -0,0 +1,239 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   version="1.1"
+   width="264"
+   height="162"
+   viewBox="0 0 264 162"
+   id="svg2">
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+  
+
+  
+
+
+  
+
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+
+  
+  
+
+  
+  
+
+  
+  
+  
+  
+
+  
+
+
+
+  
+  
+
+  
+
+  
+  
+
+  
+  
+
+  
+
+
+  
+
+
+  
+
+  
+  
+
+  
+  
+  
+
+  
+
diff --git a/betafeatures-icon-WikitextEditor-rtl.svg 
b/betafeatures-icon-WikitextEditor-rtl.svg
new file mode 100644
index 000..b098957
--- /dev/null
+++ b/betafeatures-icon-WikitextEditor-rtl.svg
@@ -0,0 +1,256 @@
+
+
+
+http://purl.org/dc/elements/1.1/;
+   xmlns:cc="http://creativecommons.org/ns#;
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg="http://www.w3.org/2000/svg;
+   xmlns="http://www.w3.org/2000/svg;
+   version="1.1"
+   width="264"
+   height="162"
+   viewBox="0 0 264 162"
+   id="svg2">
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage; />
+
+  
+
+  
+  
+  
+  
+
+  
+
+
+  
+
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+
+  
+  
+
+  
+  
+
+  
+  
+  
+
+  
+
+
+
+  
+  
+
+  
+
+  
+  
+
+  
+  
+
+  
+
+
+  
+
+
+  
+
+  
+  
+
+  
+  
+  
+
+  
+
diff --git a/extension.json b/extension.json
index 92d2c0f..881f3ec 100644
--- a/extension.json
+++ b/extension.json
@@ -1870,6 +1870,7 @@
"DefaultUserOptions": {
"visualeditor-enable": 0,
"visualeditor-betatempdisable": 0,
+   "visualeditor-newwikitext": 0,

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: core-js shims Object.entries

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

Change subject: core-js shims Object.entries
..


core-js shims Object.entries

Change-Id: Ib16aeb76b26ac0de0439a8388489a42ec9736178
---
M lib/utils/jsutils.js
1 file changed, 1 insertion(+), 4 deletions(-)

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



diff --git a/lib/utils/jsutils.js b/lib/utils/jsutils.js
index ba9d913..d7b336f 100644
--- a/lib/utils/jsutils.js
+++ b/lib/utils/jsutils.js
@@ -20,11 +20,8 @@
 
lastItem: lastItem,
 
-   // in ES7 it should be `new Map(Object.entries(obj))`
mapObject: function(obj) {
-   return new Map(Object.keys(obj).map(function(k) {
-   return [k, obj[k]];
-   }));
+   return new Map(Object.entries(obj));
},
 
// ES6 maps/sets are still writable even when frozen, because they

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Band-aid for jsapi

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

Change subject: Band-aid for jsapi
..


Band-aid for jsapi

 * This revision sucks the following text into the data-mw parts,
   
https://en.wikipedia.org/w/index.php?title=Template%3AFoo=revision=739118866=679114704

Change-Id: I6ceaad04a6531711658fcfcd13425f8cabb62392
---
M tests/mocha/jsapi.js
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/tests/mocha/jsapi.js b/tests/mocha/jsapi.js
index 65dc63b..96e3130 100644
--- a/tests/mocha/jsapi.js
+++ b/tests/mocha/jsapi.js
@@ -49,13 +49,13 @@
templates.length.should.equal(1);
return templates[0].toWikitext();
}).then(function(wt) {
-   wt.should.equal('{{foo|bar|baz|eggs=spam}}');
+   wt.should.equal('{{foo|bar|baz|eggs=spam}} See it?');
template = templates[0];
template.name.should.equal('foo');
template.name = 'notfoo';
return template.toWikitext();
}).then(function(wt) {
-   wt.should.equal('{{notfoo|bar|baz|eggs=spam}}');
+   wt.should.equal('{{notfoo|bar|baz|eggs=spam}} See it?');
template.params.length.should.equal(3);
template.params[0].name.should.equal('1');
template.params[1].name.should.equal('2');

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: EditPage: Don't throw exceptions for invalid content models

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

Change subject: EditPage: Don't throw exceptions for invalid content models
..


EditPage: Don't throw exceptions for invalid content models

If a user tries to use an unrecognized content model using the "model"
request parameter, show a nice, localized error instead of an exception.

Bug: T145367
Change-Id: I50e7d332727c9afc22c1658d32c981db4305185b
---
M includes/EditPage.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 15 insertions(+), 3 deletions(-)

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



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 7e4e411..ed3e212 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1008,9 +1008,17 @@
// May be overridden by revision.
$this->contentFormat = $request->getText( 'format', 
$this->contentFormat );
 
-   if ( !ContentHandler::getForModelID( $this->contentModel )
-   ->isSupportedFormat( $this->contentFormat )
-   ) {
+   try {
+   $handler = ContentHandler::getForModelID( 
$this->contentModel );
+   } catch ( MWUnknownContentModelException $e ) {
+   throw new ErrorPageError(
+   'editpage-invalidcontentmodel-title',
+   'editpage-invalidcontentmodel-text',
+   [ $this->contentModel ]
+   );
+   }
+
+   if ( !$handler->isSupportedFormat( $this->contentFormat ) ) {
throw new ErrorPageError(
'editpage-notsupportedcontentformat-title',
'editpage-notsupportedcontentformat-text',
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index cc7466b..ad2b6b6 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -777,6 +777,8 @@
"invalid-content-data": "Invalid content data",
"content-not-allowed-here": "\"$1\" content is not allowed on page 
[[$2]]",
"editwarning-warning": "Leaving this page may cause you to lose any 
changes you have made.\nIf you are logged in, you can disable this warning in 
the \"{{int:prefs-editing}}\" section of your preferences.",
+   "editpage-invalidcontentmodel-title": "Content model not supported",
+   "editpage-invalidcontentmodel-text": "The content model \"$1\" is not a 
supported.",
"editpage-notsupportedcontentformat-title": "Content format not 
supported",
"editpage-notsupportedcontentformat-text": "The content format $1 is 
not supported by the content model $2.",
"content-model-wikitext": "wikitext",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 924d25f..023af97 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -961,6 +961,8 @@
"invalid-content-data": "Error message indicating that the page's 
content can not be saved because it is invalid. This may occurr for content 
types with internal consistency constraints.",
"content-not-allowed-here": "Error message indicating that the desired 
content model is not supported in given localtion.\n* $1 - the human readable 
name of the content model: {{msg-mw|Content-model-wikitext}}, 
{{msg-mw|Content-model-javascript}}, {{msg-mw|Content-model-css}} or 
{{msg-mw|Content-model-text}}\n* $2 - the title of the page in question",
"editwarning-warning": "Uses {{msg-mw|Prefs-editing}}",
+   "editpage-invalidcontentmodel-title": "Title of error page shown when 
using an unrecognized content model on EditPage",
+   "editpage-invalidcontentmodel-text": "Error message shown when using an 
unrecognized content model on EditPage. $1 is the user's invalid input",
"editpage-notsupportedcontentformat-title": "Title of error page shown 
when using an incompatible format on EditPage.\n\nUsed as title for the 
following error message:\n* 
{{msg-mw|Editpage-notsupportedcontentformat-text}}.",
"editpage-notsupportedcontentformat-text": "Error message shown when 
using an incompatible format on EditPage.\n\nThe title for this error is 
{{msg-mw|Editpage-notsupportedcontentformat-title}}.\n\nParameters:\n* $1 - the 
format id\n* $2 - the content model name",
"content-model-wikitext": "Name for the wikitext content model, used 
when decribing what type of content a page contains.\n\nThis message is 
substituted 
in:\n*{{msg-mw|Bad-target-model}}\n*{{msg-mw|Content-not-allowed-here}}",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I50e7d332727c9afc22c1658d32c981db4305185b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Revert "Revert "cache_upload: switch to file storage backend...

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

Change subject: Revert "Revert "cache_upload: switch to file storage backend on 
Varnish 4""
..


Revert "Revert "cache_upload: switch to file storage backend on Varnish 4""

This reverts commit d327a88b88fc911b3a3fcc5d84de60e101822148.

Change-Id: I5f140420b9f82ad6ce9762fe1e563e4cb4a34550
---
M modules/role/manifests/cache/upload.pp
1 file changed, 10 insertions(+), 6 deletions(-)

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



diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 841803c..2b3c389 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -81,20 +81,24 @@
 })
 
 if ($::role::cache::2layer::varnish_version4) {
-# The persistent storage backend has been renamed into
-# deprecated_persistent in varnish 4:
+# The persistent storage backend is deprecated and buggy in Varnish 4.
+# Use "file" instead. See T142810, T142848 and
 # https://www.varnish-cache.org/docs/trunk/phk/persistent.html
-$persistent_name = 'deprecated_persistent'
+$storage_backend = 'file'
+$storage_mma_1 = ''
+$storage_mma_2 = ''
 }
 else {
-$persistent_name = 'persistent'
+$storage_backend = 'persistent'
+$storage_mma_1 = ",${::role::cache::2layer::mma[0]}"
+$storage_mma_2 = ",${::role::cache::2layer::mma[1]}"
 }
 
 $storage_size_bigobj = floor($::role::cache::2layer::storage_size / 6)
 $storage_size_up = $::role::cache::2layer::storage_size - 
$storage_size_bigobj
 $upload_storage_args = join([
-"-s 
main1=${persistent_name},/srv/${::role::cache::2layer::storage_parts[0]}/varnish.main1,${storage_size_up}G,${::role::cache::2layer::mma[0]}",
-"-s 
main2=${persistent_name},/srv/${::role::cache::2layer::storage_parts[1]}/varnish.main2,${storage_size_up}G,${::role::cache::2layer::mma[1]}",
+"-s 
main1=${storage_backend},/srv/${::role::cache::2layer::storage_parts[0]}/varnish.main1,${storage_size_up}G${storage_mma_1}",
+"-s 
main2=${storage_backend},/srv/${::role::cache::2layer::storage_parts[1]}/varnish.main2,${storage_size_up}G${storage_mma_2}",
 "-s 
bigobj1=file,/srv/${::role::cache::2layer::storage_parts[0]}/varnish.bigobj1,${storage_size_bigobj}G",
 "-s 
bigobj2=file,/srv/${::role::cache::2layer::storage_parts[1]}/varnish.bigobj2,${storage_size_bigobj}G",
 ], ' ')

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5f140420b9f82ad6ce9762fe1e563e4cb4a34550
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: Revert "Revert "cache_upload: switch to file storage backend...

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

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

Change subject: Revert "Revert "cache_upload: switch to file storage backend on 
Varnish 4""
..

Revert "Revert "cache_upload: switch to file storage backend on Varnish 4""

This reverts commit d327a88b88fc911b3a3fcc5d84de60e101822148.

Change-Id: I5f140420b9f82ad6ce9762fe1e563e4cb4a34550
---
M modules/role/manifests/cache/upload.pp
1 file changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/82/310182/1

diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 841803c..2b3c389 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -81,20 +81,24 @@
 })
 
 if ($::role::cache::2layer::varnish_version4) {
-# The persistent storage backend has been renamed into
-# deprecated_persistent in varnish 4:
+# The persistent storage backend is deprecated and buggy in Varnish 4.
+# Use "file" instead. See T142810, T142848 and
 # https://www.varnish-cache.org/docs/trunk/phk/persistent.html
-$persistent_name = 'deprecated_persistent'
+$storage_backend = 'file'
+$storage_mma_1 = ''
+$storage_mma_2 = ''
 }
 else {
-$persistent_name = 'persistent'
+$storage_backend = 'persistent'
+$storage_mma_1 = ",${::role::cache::2layer::mma[0]}"
+$storage_mma_2 = ",${::role::cache::2layer::mma[1]}"
 }
 
 $storage_size_bigobj = floor($::role::cache::2layer::storage_size / 6)
 $storage_size_up = $::role::cache::2layer::storage_size - 
$storage_size_bigobj
 $upload_storage_args = join([
-"-s 
main1=${persistent_name},/srv/${::role::cache::2layer::storage_parts[0]}/varnish.main1,${storage_size_up}G,${::role::cache::2layer::mma[0]}",
-"-s 
main2=${persistent_name},/srv/${::role::cache::2layer::storage_parts[1]}/varnish.main2,${storage_size_up}G,${::role::cache::2layer::mma[1]}",
+"-s 
main1=${storage_backend},/srv/${::role::cache::2layer::storage_parts[0]}/varnish.main1,${storage_size_up}G${storage_mma_1}",
+"-s 
main2=${storage_backend},/srv/${::role::cache::2layer::storage_parts[1]}/varnish.main2,${storage_size_up}G${storage_mma_2}",
 "-s 
bigobj1=file,/srv/${::role::cache::2layer::storage_parts[0]}/varnish.bigobj1,${storage_size_bigobj}G",
 "-s 
bigobj2=file,/srv/${::role::cache::2layer::storage_parts[1]}/varnish.bigobj2,${storage_size_bigobj}G",
 ], ' ')

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow all users to view Special:UserRights

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

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

Change subject: Allow all users to view Special:UserRights
..

Allow all users to view Special:UserRights

Allow Special:UserRights to always be used in read-only mode, rather than
completely locking out users who cannot make modifications with it.

Bug: T27319
Change-Id: I5e586c09f4e92108d57bd2167a033e58425b7d5d
---
M includes/specials/SpecialUserrights.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 58 insertions(+), 119 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/81/310181/1

diff --git a/includes/specials/SpecialUserrights.php 
b/includes/specials/SpecialUserrights.php
index 8a06abf..cc82177 100644
--- a/includes/specials/SpecialUserrights.php
+++ b/includes/specials/SpecialUserrights.php
@@ -48,32 +48,6 @@
return true;
}
 
-   public function isRestricted() {
-   return true;
-   }
-
-   public function userCanExecute( User $user ) {
-   return $this->userCanChangeRights( $user, false );
-   }
-
-   /**
-* @param User $user
-* @param bool $checkIfSelf
-* @return bool
-*/
-   public function userCanChangeRights( $user, $checkIfSelf = true ) {
-   $available = $this->changeableGroups();
-   if ( $user->getId() == 0 ) {
-   return false;
-   }
-
-   return !empty( $available['add'] )
-   || !empty( $available['remove'] )
-   || ( ( $this->isself || !$checkIfSelf ) &&
-   ( !empty( $available['add-self'] )
-   || !empty( $available['remove-self'] ) 
) );
-   }
-
/**
 * Manage forms to be shown according to posted data.
 * Depending on the submit button used, call a form or a save function.
@@ -82,21 +56,9 @@
 * @throws UserBlockedError|PermissionsError
 */
public function execute( $par ) {
-   // If the visitor doesn't have permissions to assign or remove
-   // any groups, it's a bit silly to give them the user search 
prompt.
-
$user = $this->getUser();
$request = $this->getRequest();
$out = $this->getOutput();
-
-   /*
-* If the user is blocked and they only have "partial" access
-* (e.g. they don't have the userrights permission), then don't
-* allow them to use Special:UserRights.
-*/
-   if ( $user->isBlocked() && !$user->isAllowed( 'userrights' ) ) {
-   throw new UserBlockedError( $user->getBlock() );
-   }
 
if ( $par !== null ) {
$this->mTarget = $par;
@@ -108,24 +70,7 @@
$this->mTarget = trim( $this->mTarget );
}
 
-   $available = $this->changeableGroups();
-
-   if ( $this->mTarget === null ) {
-   /*
-* If the user specified no target, and they can only
-* edit their own groups, automatically set them as the
-* target.
-*/
-   if ( !count( $available['add'] ) && !count( 
$available['remove'] ) ) {
-   $this->mTarget = $user->getName();
-   }
-   }
-
-   if ( $this->mTarget !== null && User::getCanonicalName( 
$this->mTarget ) === $user->getName() ) {
-   $this->isself = true;
-   }
-
-   $fetchedStatus = $this->fetchUser( $this->mTarget );
+   $fetchedStatus = $this->fetchUser( $this->mTarget, true );
if ( $fetchedStatus->isOK() ) {
$this->mFetchedUser = $fetchedStatus->value;
if ( $this->mFetchedUser instanceof User ) {
@@ -133,23 +78,6 @@
// User logs, UserRights, etc.
$this->getSkin()->setRelevantUser( 
$this->mFetchedUser );
}
-   }
-
-   if ( !$this->userCanChangeRights( $user, true ) ) {
-   if ( $this->isself && $request->getCheck( 'success' ) ) 
{
-   // bug 48609: if the user just removed its own 
rights, this would
-   // leads it in a "permissions error" page. In 
that case, show a
-   // message that it can't anymore use this page 
instead of an error
-   $this->setHeaders();
-   $out->wrapWikiMsg( "\n$1\n", 'userrights-removed-self' );
- 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow putting the app ID in the password for bot passwords

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

Change subject: Allow putting the app ID in the password for bot passwords
..


Allow putting the app ID in the password for bot passwords

Bot passwords allow backwards-compatible login (with grants, for API
usage only) with "@" for username plus a
random-generated password.
This doesn't work well with some bot frameworks (including Pywikibot,
the most popular one) which assume that the text that goes into the
username field of the login API is the username that they will be
logged in with afterwards (and so the @-postfix causes all kinds of
errors).

Since the goal of bot passwords is compatibility with old unmaintained
API clients, this patch adds an alternative format which does not
cause problems with old bots: use the username normally, and use
"@" as password. Since this is
technically a valid normal password, there is some ambiguity, but
bot passwords have a distintive format so it's easy to check and it is
extremely unlikely that someone would use the exact same format for
their normal password; and if the bot password login fails we can
simply retry it as a normal password, just in case.

Bug: T142304
Change-Id: Ib59a6fbe0e65d80d5e7d19ff37cec5e011c00539
---
M includes/api/ApiLogin.php
M includes/specials/SpecialBotPasswords.php
M includes/user/BotPassword.php
M languages/i18n/en.json
M languages/i18n/qqq.json
M tests/phpunit/includes/user/BotPasswordTest.php
6 files changed, 76 insertions(+), 10 deletions(-)

Approvals:
  Anomie: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  Brian Wolff: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php
index 28937f7..5f6e34a 100644
--- a/includes/api/ApiLogin.php
+++ b/includes/api/ApiLogin.php
@@ -102,17 +102,18 @@
}
 
// Try bot passwords
-   if ( $authRes === false && $this->getConfig()->get( 
'EnableBotPasswords' ) &&
-   strpos( $params['name'], BotPassword::getSeparator() ) 
!== false
+   if (
+   $authRes === false && $this->getConfig()->get( 
'EnableBotPasswords' ) &&
+   ( $botLoginData = BotPassword::canonicalizeLoginData( 
$params['name'], $params['password'] ) )
) {
$status = BotPassword::login(
-   $params['name'], $params['password'], 
$this->getRequest()
+   $botLoginData[0], $botLoginData[1], 
$this->getRequest()
);
if ( $status->isOK() ) {
$session = $status->getValue();
$authRes = 'Success';
$loginType = 'BotPassword';
-   } else {
+   } elseif ( !$botLoginData[2] ) {
$authRes = 'Failed';
$message = $status->getMessage();
LoggerFactory::getInstance( 'authentication' 
)->info(
diff --git a/includes/specials/SpecialBotPasswords.php 
b/includes/specials/SpecialBotPasswords.php
index 7e330aa..f2ea3e4 100644
--- a/includes/specials/SpecialBotPasswords.php
+++ b/includes/specials/SpecialBotPasswords.php
@@ -290,9 +290,7 @@
] );
 
if ( $this->operation === 'insert' || !empty( 
$data['resetPassword'] ) ) {
-   $this->password = 
PasswordFactory::generateRandomPasswordString(
-   max( 32, $this->getConfig()->get( 
'MinimalPasswordLength' ) )
-   );
+   $this->password = BotPassword::generatePassword( 
$this->getConfig() );
$passwordFactory = new PasswordFactory();
$passwordFactory->init( 
RequestContext::getMain()->getConfig() );
$password = $passwordFactory->newFromPlaintext( 
$this->password );
@@ -335,7 +333,9 @@
$out->addWikiMsg(
'botpasswords-newpassword',
htmlspecialchars( $username . $sep . $this->par 
),
-   htmlspecialchars( $this->password )
+   htmlspecialchars( $this->password ),
+   htmlspecialchars( $username ),
+   htmlspecialchars( $this->par . $sep . 
$this->password )
);
$this->password = null;
}
diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php
index 49a7163..df1cb77 100644
--- a/includes/user/BotPassword.php
+++ b/includes/user/BotPassword.php
@@ -389,6 +389,44 @@
}
 
/**
+* Returns a (raw, unhashed) 

[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[wmf/1.28.0-wmf.18]: uw.EventFlowLogger: Fix 'NS_ERROR_NOT_AVAILABLE' debug logging

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

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

Change subject: uw.EventFlowLogger: Fix 'NS_ERROR_NOT_AVAILABLE' debug logging
..

uw.EventFlowLogger: Fix 'NS_ERROR_NOT_AVAILABLE' debug logging

Apparently the 'line' and 'column' fields are required and omitting
them causes the whole event to be silently dropped (well, the fact is
logged in some other event log that no one ever looks at).

Bug: T136831
Change-Id: I40cc3129b54cc35bee6128ebaa366c11a06ed928
(cherry picked from commit 5577860caf72c4ddb65b1de72cc91098f224f1a2)
---
M resources/uw.EventFlowLogger.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/resources/uw.EventFlowLogger.js b/resources/uw.EventFlowLogger.js
index 636a792..590b597 100644
--- a/resources/uw.EventFlowLogger.js
+++ b/resources/uw.EventFlowLogger.js
@@ -271,6 +271,8 @@
this.log( 'UploadWizardExceptionFlowEvent', {
message: ( err.message || '' ),
url: 'debug://NS_ERROR_NOT_AVAILABLE',
+   line: 0,
+   column: 0,
stack: JSON.stringify( {
type: img.tagName,
url: String( img.src ).slice( 0, 100 ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40cc3129b54cc35bee6128ebaa366c11a06ed928
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: wmf/1.28.0-wmf.18
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...MediaWikiChat[master]: Make JSHint happy by defining the "undefined" variables and ...

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

Change subject: Make JSHint happy by defining the "undefined" variables and 
getting rid of a few unnecessary "callback"s
..


Make JSHint happy by defining the "undefined" variables and getting rid of a 
few unnecessary "callback"s

Change-Id: Ibe510348642c46d90b26141d649deec3353c612a
---
M MediaWikiChat.js
1 file changed, 7 insertions(+), 7 deletions(-)

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



diff --git a/MediaWikiChat.js b/MediaWikiChat.js
index 9cfe59f..3ee281b 100644
--- a/MediaWikiChat.js
+++ b/MediaWikiChat.js
@@ -352,15 +352,15 @@
 
getColourFromUsername: function( name ) {
name = name + 'abc'; // at least 4 digits
-   one = Math.min( Math.max( Math.round( ( name.charCodeAt( 1 ) - 
48 ) * 3 ), 0 ), 255 ).toString( 16 ); // the 30 and 1.3 are scaling
+   var one = Math.min( Math.max( Math.round( ( name.charCodeAt( 1 
) - 48 ) * 3 ), 0 ), 255 ).toString( 16 ); // the 30 and 1.3 are scaling
if ( one.length < 2 ) {
one = "0" + one;
}
-   two = Math.min( Math.max( Math.round( ( name.charCodeAt( 3 ) - 
48 ) * 3 ), 0 ), 255 ).toString( 16 );
+   var two = Math.min( Math.max( Math.round( ( name.charCodeAt( 3 
) - 48 ) * 3 ), 0 ), 255 ).toString( 16 );
if ( two.length < 2 ) {
two = "0" + two;
}
-   three = Math.min( Math.max( Math.round( ( name.charCodeAt( 
name.length - 1 ) - 48 ) * 3 ), 0 ), 255 ).toString( 16 );
+   var three = Math.min( Math.max( Math.round( ( name.charCodeAt( 
name.length - 1 ) - 48 ) * 3 ), 0 ), 255 ).toString( 16 );
if ( three.length < 2 ) {
three = "0" + three;
}
@@ -541,7 +541,7 @@
var user = MediaWikiChat.userData[userId];
var userE = MediaWikiChat.safe( user.name );
 
-   $( '#mwchat-users #' + userE ).animate( { height:0, opacity:0 
}, callback=function(){ $( this ).remove(); } );
+   $( '#mwchat-users #' + userE ).animate( { height:0, opacity:0 
}, function() { $( this ).remove(); } );
 
MediaWikiChat.addSystemMessage( mw.message( 'chat-left', 
user.name, user.gender ).text(), MediaWikiChat.now() );
MediaWikiChat.scrollToBottom();
@@ -706,11 +706,11 @@
 
loadingBackground: function() {
$( '#mwchat-loading-3' ).animate( { opacity: 1 } );
-   $( '#mwchat-loading-2' ).animate( { opacity: 0 }, 
callback=function() {
+   $( '#mwchat-loading-2' ).animate( { opacity: 0 }, function() {
$( '#mwchat-loading-3' ).animate( { opacity: 0 } );
-   $( '#mwchat-loading-1' ).animate( { opacity: 1 }, 
callback=function() {
+   $( '#mwchat-loading-1' ).animate( { opacity: 1 }, 
function() {
$( '#mwchat-loading-2' ).animate( { opacity: 1 
} );
-   $( '#mwchat-loading-1' ).animate( { opacity: 0 
}, callback=MediaWikiChat.loadingBackground );
+   $( '#mwchat-loading-1' ).animate( { opacity: 0 
}, MediaWikiChat.loadingBackground );
});
});
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe510348642c46d90b26141d649deec3353c612a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MediaWikiChat
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix 
Gerrit-Reviewer: Jack Phoenix 
Gerrit-Reviewer: UltrasonicNXT 
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...discernatron[master]: Fix user creation

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

Change subject: Fix user creation
..


Fix user creation

The patch to add a persistent toggle for the scoring interface switch
had a bug that prevented new users from being created. With this update
that should now work appropriately.

Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
---
M app.php
M src/RelevanceScoring/Repository/UsersRepository.php
2 files changed, 4 insertions(+), 3 deletions(-)

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



diff --git a/app.php b/app.php
index 54718b5..ca4af5a 100644
--- a/app.php
+++ b/app.php
@@ -132,6 +132,7 @@
 return $app->redirect($app->path('oauth_authorize'));
 }
 $user->extra['last_authorized'] = time();
+$user->extra['scoringInterface'] = 'classic';
 $app['search.repository.users']->updateUser($user);
 $session->set('user', $user);
 }
diff --git a/src/RelevanceScoring/Repository/UsersRepository.php 
b/src/RelevanceScoring/Repository/UsersRepository.php
index f2db9c8..bd84195 100644
--- a/src/RelevanceScoring/Repository/UsersRepository.php
+++ b/src/RelevanceScoring/Repository/UsersRepository.php
@@ -22,8 +22,8 @@
 {
 $properties = [
 'name' => $user->name,
-'edit_count' => $user->extra['editCount'],
-'scoring_interface' => $user->extra['scoringInterface'],
+'edit_count' => isset($user->extra['editCount']) ? 
$user->extra['editCount'] : 0,
+'scoring_interface' => isset($user->extra['scoringInterface']) ? 
$user->extra['scoringInterface'] : 'classic',
 ];
 
 if ($this->userExists($user)) {
@@ -75,7 +75,7 @@
 $user->name = $row['name'];
 $user->extra = [
 'editCount' => $row['edit_count'],
-'scoringInterface' => $row['scoringInterface'],
+'scoringInterface' => $row['scoring_interface'],
 ];
 
 return new Some($user);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 
Gerrit-Reviewer: EBernhardson 

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


[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Fix user creation

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

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

Change subject: Fix user creation
..

Fix user creation

The patch to add a persistent toggle for the scoring interface switch
had a bug that prevented new users from being created. With this update
that should now work appropriately.

Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
---
M app.php
M src/RelevanceScoring/Repository/UsersRepository.php
2 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/discernatron 
refs/changes/79/310179/1

diff --git a/app.php b/app.php
index 54718b5..ca4af5a 100644
--- a/app.php
+++ b/app.php
@@ -132,6 +132,7 @@
 return $app->redirect($app->path('oauth_authorize'));
 }
 $user->extra['last_authorized'] = time();
+$user->extra['scoringInterface'] = 'classic';
 $app['search.repository.users']->updateUser($user);
 $session->set('user', $user);
 }
diff --git a/src/RelevanceScoring/Repository/UsersRepository.php 
b/src/RelevanceScoring/Repository/UsersRepository.php
index f2db9c8..bd84195 100644
--- a/src/RelevanceScoring/Repository/UsersRepository.php
+++ b/src/RelevanceScoring/Repository/UsersRepository.php
@@ -22,8 +22,8 @@
 {
 $properties = [
 'name' => $user->name,
-'edit_count' => $user->extra['editCount'],
-'scoring_interface' => $user->extra['scoringInterface'],
+'edit_count' => isset($user->extra['editCount']) ? 
$user->extra['editCount'] : 0,
+'scoring_interface' => isset($user->extra['scoringInterface']) ? 
$user->extra['scoringInterface'] : 'classic',
 ];
 
 if ($this->userExists($user)) {
@@ -75,7 +75,7 @@
 $user->name = $row['name'];
 $user->extra = [
 'editCount' => $row['edit_count'],
-'scoringInterface' => $row['scoringInterface'],
+'scoringInterface' => $row['scoring_interface'],
 ];
 
 return new Some($user);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8019df0942f83c7fe21e546dc1a94e5647142fb7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 

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


[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Hide deck when empty

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

Change subject: Hide deck when empty
..


Hide deck when empty

This adds a css class that gets added/removed to the main deck of cards
when it is empty. I'm not sure what to do about the cards in the
"discard" pile though, it's not particularly obvious that there are
multiple cards there ... i dunno.

Change-Id: I2a205df330780365f9e513e09791816acaaec2ea
---
M public/css/deck.css
M public/js/discernadeck.js
2 files changed, 19 insertions(+), 2 deletions(-)

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



diff --git a/public/css/deck.css b/public/css/deck.css
index 3e4fc15..e10940b 100644
--- a/public/css/deck.css
+++ b/public/css/deck.css
@@ -107,6 +107,10 @@
 cursor: pointer;
 }
 
+.card-deck.empty {
+background-image: none;
+}
+
 .card.active {
 z-index:  !important;
 box-shadow: 0 4px 5px 0px rgba(0,0,0,0.15);
diff --git a/public/js/discernadeck.js b/public/js/discernadeck.js
index f374665..232ee43 100644
--- a/public/js/discernadeck.js
+++ b/public/js/discernadeck.js
@@ -37,7 +37,7 @@
card.setCardXY( stackXY.x, stackXY.y + stack.gap - (( 
reverseIndex - 1) * stack.DROP_GAP ));
}
},
-   onTap: function tapOnDropArea( stack ) {
+   onTap: function ( stack ) {
return function( ev ) {
if ( stack.deck.currentCard ) {
stack.deck.currentCard.moveCardToStack( false, 
stack );
@@ -136,14 +136,23 @@
if ( droppedArea ) {
card.moveCardToStack( card.stack, 
droppedArea.stack );
} else {
+
// jump back to deck
if ( card.stack ) {
card.stack.removeCard();
card.stack = false;
}
+   if ( deck.currentCard ) {
+   deck.moveCardToBottom();
+   }
+   deck.currentCard = card;
+   deck.cardsInDeck.unshift(card.cardData);
card.setCardXY( 0, 0 );
TweenLite.to( card.domEl, 0.8,{ x:"0", y:"0", 
ease:Elastic.easeOut } );
-   this.formEl.value = "";
+   card.formEl.value = "";
+   if (deck.cardsInDeck.length > 1) {
+   deck.domEl.classList.remove( 'empty' );
+   }
}
}
},
@@ -218,6 +227,10 @@
var card = deck.createCard(deck, 0);
deck.currentCard = card;
}
+   if ( deck.cardsInDeck.length <= 1 ) {
+   deck.domEl.classList.add( 'empty' );
+   }
+
}
},
removeFromDeck: function( card ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2a205df330780365f9e513e09791816acaaec2ea
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/discovery/discernatron
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 
Gerrit-Reviewer: EBernhardson 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Support masking the WRITE_SYNC latency from ChronologyProtector

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

Change subject: Support masking the WRITE_SYNC latency from ChronologyProtector
..


Support masking the WRITE_SYNC latency from ChronologyProtector

* Use OutputPage::output() as the method to mask latency, since it
  takes a good while to run. By the time it runs, cache replication
  should have caught up, so the reap call will likely not block.
* For redirects emitted after changes in POST, instead of masking
  with OutputPage, add a parameter to the redirect and block on
  the positions appearing. This uses the redirection RTT to mask
  the replication latency.

Change-Id: Ib23690c302e8033610fef9a0ef451dafe8a5803e
---
M RELEASE-NOTES-1.28
M includes/MediaWiki.php
M includes/OutputPage.php
M includes/db/ChronologyProtector.php
M includes/db/loadbalancer/LBFactory.php
M includes/libs/objectcache/IExpiringStore.php
M includes/libs/objectcache/MemcachedBagOStuff.php
M includes/libs/objectcache/RESTBagOStuff.php
M includes/objectcache/RedisBagOStuff.php
M includes/objectcache/SqlBagOStuff.php
M maintenance/doMaintenance.php
11 files changed, 275 insertions(+), 55 deletions(-)

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



diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28
index 979da5c..1f4b8dc 100644
--- a/RELEASE-NOTES-1.28
+++ b/RELEASE-NOTES-1.28
@@ -54,6 +54,11 @@
 * mw.Api has a new option, useUS, to use U+001F (Unit Separator) when
   appropriate for sending multi-valued parameters. This defaults to true when
   the mw.Api instance seems to be for the local wiki.
+* After a client performs an action which alters a database that has replica 
databases,
+  MediaWiki will wait for the replica databases to synchronize with the master 
database
+  while it renders the HTML output. However, if the output is a redirect, it 
will instead
+  alter the redirect URL to include a ?cpPosTime parameter that triggers the 
database
+  synchronization when the URL is followed by the client.
 
 === External library changes in 1.28 ===
 
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index bca7a21..7f20de1 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -535,10 +535,11 @@
 
/**
 * @see MediaWiki::preOutputCommit()
+* @param callable $postCommitWork [default: null]
 * @since 1.26
 */
-   public function doPreOutputCommit() {
-   self::preOutputCommit( $this->context );
+   public function doPreOutputCommit( callable $postCommitWork = null ) {
+   self::preOutputCommit( $this->context, $postCommitWork );
}
 
/**
@@ -546,33 +547,61 @@
 * the user can receive a response (in case commit fails)
 *
 * @param IContextSource $context
+* @param callable $postCommitWork [default: null]
 * @since 1.27
 */
-   public static function preOutputCommit( IContextSource $context ) {
+   public static function preOutputCommit(
+   IContextSource $context, callable $postCommitWork = null
+   ) {
// Either all DBs should commit or none
ignore_user_abort( true );
 
$config = $context->getConfig();
-
+   $request = $context->getRequest();
+   $output = $context->getOutput();
$lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
// Commit all changes
$lbFactory->commitMasterChanges(
__METHOD__,
// Abort if any transaction was too big
[ 'maxWriteDuration' => $config->get( 
'MaxUserDBWriteDuration' ) ]
);
+   wfDebug( __METHOD__ . ': primary transaction round committed' );
 
+   // Run updates that need to block the user or affect output 
(this is the last chance)
DeferredUpdates::doUpdates( 'enqueue', DeferredUpdates::PRESEND 
);
wfDebug( __METHOD__ . ': pre-send deferred updates completed' );
 
-   // Record ChronologyProtector positions
-   $lbFactory->shutdown();
-   wfDebug( __METHOD__ . ': all transactions committed' );
+   // Decide when clients block on ChronologyProtector DB position 
writes
+   if (
+   $request->wasPosted() &&
+   $output->getRedirect() &&
+   $lbFactory->hasOrMadeRecentMasterChanges( INF ) &&
+   self::isWikiClusterURL( $output->getRedirect(), 
$context )
+   ) {
+   // OutputPage::output() will be fast; $postCommitWork 
will not be useful for
+   // masking the latency of syncing DB positions accross 
all datacenters synchronously.
+   // Instead, make use of the RTT time of 

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Band-aid for jsapi

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

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

Change subject: Band-aid for jsapi
..

Band-aid for jsapi

 * This revision sucks the following text into the data-mw parts,
   
https://en.wikipedia.org/w/index.php?title=Template%3AFoo=revision=739118866=679114704

Change-Id: I6ceaad04a6531711658fcfcd13425f8cabb62392
---
M tests/mocha/jsapi.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/tests/mocha/jsapi.js b/tests/mocha/jsapi.js
index 65dc63b..96e3130 100644
--- a/tests/mocha/jsapi.js
+++ b/tests/mocha/jsapi.js
@@ -49,13 +49,13 @@
templates.length.should.equal(1);
return templates[0].toWikitext();
}).then(function(wt) {
-   wt.should.equal('{{foo|bar|baz|eggs=spam}}');
+   wt.should.equal('{{foo|bar|baz|eggs=spam}} See it?');
template = templates[0];
template.name.should.equal('foo');
template.name = 'notfoo';
return template.toWikitext();
}).then(function(wt) {
-   wt.should.equal('{{notfoo|bar|baz|eggs=spam}}');
+   wt.should.equal('{{notfoo|bar|baz|eggs=spam}} See it?');
template.params.length.should.equal(3);
template.params[0].name.should.equal('1');
template.params[1].name.should.equal('2');

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: swift conns limit -> 10K

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

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

Change subject: cache_upload: swift conns limit -> 10K
..

cache_upload: swift conns limit -> 10K

Change-Id: Ie28d26dc458dcf3f3b81908281298d50d0726942
---
M modules/role/manifests/cache/upload.pp
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/77/310177/1

diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 6c5e45a..841803c 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -42,7 +42,7 @@
 'port'  => 80,
 'connect_timeout'   => '5s',
 'first_byte_timeout'=> '35s',
-'max_connections'   => 1000,
+'max_connections'   => 1,
 }
 },
 'swift_thumbs'   => {
@@ -53,7 +53,7 @@
 'port'  => 80,
 'connect_timeout'   => '5s',
 'first_byte_timeout'=> '35s',
-'max_connections'   => 1000,
+'max_connections'   => 1,
 }
 },
 }

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: swift conns limit -> 10K

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

Change subject: cache_upload: swift conns limit -> 10K
..


cache_upload: swift conns limit -> 10K

Change-Id: Ie28d26dc458dcf3f3b81908281298d50d0726942
---
M modules/role/manifests/cache/upload.pp
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index 6c5e45a..841803c 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -42,7 +42,7 @@
 'port'  => 80,
 'connect_timeout'   => '5s',
 'first_byte_timeout'=> '35s',
-'max_connections'   => 1000,
+'max_connections'   => 1,
 }
 },
 'swift_thumbs'   => {
@@ -53,7 +53,7 @@
 'port'  => 80,
 'connect_timeout'   => '5s',
 'first_byte_timeout'=> '35s',
-'max_connections'   => 1000,
+'max_connections'   => 1,
 }
 },
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie28d26dc458dcf3f3b81908281298d50d0726942
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Ema 

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


[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: MW 1.27 fix for Special:ViewData

2016-09-12 Thread Yaron Koren (Code Review)
Yaron Koren has uploaded a new change for review.

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

Change subject: MW 1.27 fix for Special:ViewData
..

MW 1.27 fix for Special:ViewData

Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
---
M specials/CargoViewData.php
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/86/309986/2

diff --git a/specials/CargoViewData.php b/specials/CargoViewData.php
index c940e1c..095e1a2 100644
--- a/specials/CargoViewData.php
+++ b/specials/CargoViewData.php
@@ -161,15 +161,22 @@
// "order by" is handled elsewhere, in getOrderFields().
//
// Field aliases need to have quotes placed around them
-   // before actually running the query.
-   $realAliasedFieldNames = array();
-   foreach ( $this->sqlQuery->mAliasedFieldNames as $alias => 
$fieldName ) {
-   $realAliasedFieldNames['"' . $alias . '"'] = $fieldName;
+   // before running the query - though, starting in
+   // MW 1.27 (specifically, with
+   // https://gerrit.wikimedia.org/r/#/c/286489/),
+   // the quotes get added automatically.
+   if ( version_compare( $GLOBALS['wgVersion'], '1.27', '<' ) ) {
+   $aliasedFieldNames = array();
+   foreach ( $this->sqlQuery->mAliasedFieldNames as $alias 
=> $fieldName ) {
+   $aliasedFieldNames['"' . $alias . '"'] = 
$fieldName;
+   }
+   } else {
+   $aliasedFieldNames = 
$this->sqlQuery->mAliasedFieldNames;
}
 
$queryInfo = array(
'tables' => $this->sqlQuery->mTableNames,
-   'fields' => $realAliasedFieldNames,
+   'fields' => $aliasedFieldNames,
'options' => $selectOptions
);
if ( $this->sqlQuery->mWhereStr != '' ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
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[wmf/1.28.0-wmf.18]: Make PurgeJobUtils avoid creating DB replication lag

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

Change subject: Make PurgeJobUtils avoid creating DB replication lag
..


Make PurgeJobUtils avoid creating DB replication lag

Large affected rows counts were being reported in DBPerformance logs.

Change-Id: Ia5504aa4fbd27473771c65688f0b9e78e3a5caae
(cherry picked from commit d077eb9daad6290032660b9f154c51f00b492472)
---
M includes/jobqueue/utils/PurgeJobUtils.php
1 file changed, 20 insertions(+), 14 deletions(-)

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



diff --git a/includes/jobqueue/utils/PurgeJobUtils.php 
b/includes/jobqueue/utils/PurgeJobUtils.php
index 329bc23..5eafcb3 100644
--- a/includes/jobqueue/utils/PurgeJobUtils.php
+++ b/includes/jobqueue/utils/PurgeJobUtils.php
@@ -20,6 +20,8 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
+
 class PurgeJobUtils {
/**
 * Invalidate the cache of a list of pages from a single namespace.
@@ -34,7 +36,9 @@
return;
}
 
-   $dbw->onTransactionPreCommitOrIdle( function() use ( $dbw, 
$namespace, $dbkeys ) {
+   $dbw->onTransactionIdle( function() use ( $dbw, $namespace, 
$dbkeys ) {
+   $services = MediaWikiServices::getInstance();
+   $lbFactory = $services->getDBLoadBalancerFactory();
// Determine which pages need to be updated.
// This is necessary to prevent the job queue from 
smashing the DB with
// large numbers of concurrent invalidations of the 
same page.
@@ -50,22 +54,24 @@
__METHOD__
);
 
-   if ( $ids === [] ) {
+   if ( !$ids ) {
return;
}
 
-   // Do the update.
-   // We still need the page_touched condition, in case 
the row has changed since
-   // the non-locking select above.
-   $dbw->update(
-   'page',
-   [ 'page_touched' => $now ],
-   [
-   'page_id' => $ids,
-   'page_touched < ' . $dbw->addQuotes( 
$now )
-   ],
-   __METHOD__
-   );
+   $batchSize = $services->getMainConfig()->get( 
'UpdateRowsPerQuery' );
+   $ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+   foreach ( array_chunk( $ids, $batchSize ) as $idBatch ) 
{
+   $dbw->update(
+   'page',
+   [ 'page_touched' => $now ],
+   [
+   'page_id' => $idBatch,
+   'page_touched < ' . 
$dbw->addQuotes( $now ) // handle races
+   ],
+   __METHOD__
+   );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   }
} );
}
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5504aa4fbd27473771c65688f0b9e78e3a5caae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.18
Gerrit-Owner: Aaron Schulz 
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...GeoData[wmf/1.28.0-wmf.18]: Make doLinksUpdate() avoid creating DB replication lag

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

Change subject: Make doLinksUpdate() avoid creating DB replication lag
..


Make doLinksUpdate() avoid creating DB replication lag

Large affected rows counts were being reported in DBPerformance logs.

Change-Id: Iad0af3d8edb789e240861f213c03b88cd8dba48a
(cherry picked from commit 886a379c7ade38360be1e9bb2bdc34198b958db8)
---
M extension.json
M includes/Hooks.php
2 files changed, 33 insertions(+), 23 deletions(-)

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



diff --git a/extension.json b/extension.json
index a9c9b3d..f9f82a4 100644
--- a/extension.json
+++ b/extension.json
@@ -39,7 +39,7 @@
"LoadExtensionSchemaUpdates": 
"GeoData\\Hooks::onLoadExtensionSchemaUpdates",
"ParserFirstCallInit": "GeoData\\Hooks::onParserFirstCallInit",
"ArticleDeleteComplete": 
"GeoData\\Hooks::onArticleDeleteComplete",
-   "LinksUpdate": "GeoData\\Hooks::onLinksUpdate",
+   "LinksUpdateComplete": "GeoData\\Hooks::onLinksUpdateComplete",
"FileUpload": "GeoData\\Hooks::onFileUpload",
"OutputPageParserOutput": 
"GeoData\\Hooks::onOutputPageParserOutput",
"SearchIndexFields": "GeoData\\Hooks::onSearchIndexFields",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 8ce3092..df271e4 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -8,6 +8,7 @@
 use DatabaseUpdater;
 use LinksUpdate;
 use LocalFile;
+use MediaWiki\MediaWikiServices;
 use MWException;
 use OutputPage;
 use Parser;
@@ -99,12 +100,12 @@
}
 
/**
-* LinksUpdate hook handler
-* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
+* LinksUpdateComplete hook handler
+* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdateComplete
 *
 * @param LinksUpdate $linksUpdate
 */
-   public static function onLinksUpdate( &$linksUpdate ) {
+   public static function onLinksUpdateComplete( LinksUpdate $linksUpdate 
) {
$out = $linksUpdate->getParserOutput();
$data = [];
$coordFromMetadata = self::getCoordinatesIfFile( 
$linksUpdate->getTitle() );
@@ -150,27 +151,24 @@
return null;
}
 
-   private static function doLinksUpdate( $coords, $pageId ) {
-   global $wgGeoDataBackend;
+   /**
+* @param Coord[] $coords
+* @param int $pageId
+* @throws \DBUnexpectedError
+*/
+   private static function doLinksUpdate( array $coords, $pageId ) {
+   $services = MediaWikiServices::getInstance();
 
-   $dbw = wfGetDB( DB_MASTER );
-
-   if ( $wgGeoDataBackend == 'db' && !count( $coords ) ) {
-   $dbw->delete( 'geo_tags', [ 'gt_page_id' => $pageId ], 
__METHOD__ );
-   return;
-   }
-
-   $prevCoords = GeoData::getAllCoordinates( $pageId, [], 
DB_MASTER );
$add = [];
$delete = [];
$primary = ( isset( $coords[0] ) && $coords[0]->primary ) ? 
$coords[0] : null;
-   foreach ( $prevCoords as $old ) {
+   foreach ( GeoData::getAllCoordinates( $pageId, [], DB_MASTER ) 
as $old ) {
$delete[$old->id] = $old;
}
-   /** @var Coord $new */
foreach ( $coords as $new ) {
if ( !$new->primary && $new->equalsTo( $primary ) ) {
-   continue; // Don't save secondary coordinates 
pointing to the same place as the primary one
+   // Don't save secondary coordinates pointing to 
the same place as the primary one
+   continue;
}
$match = false;
foreach ( $delete as $id => $old ) {
@@ -185,12 +183,20 @@
}
}
 
-   if ( count( $delete ) ) {
-   $deleteIds = array_keys( $delete );
-   $dbw->delete( 'geo_tags', [ 'gt_id' => $deleteIds ], 
__METHOD__ );
+   $dbw = wfGetDB( DB_MASTER );
+   $lbFactory = $services->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   $batchSize = $services->getMainConfig()->get( 
'UpdateRowsPerQuery' );
+
+   $deleteIds = array_keys( $delete );
+   foreach ( array_chunk( $deleteIds, $batchSize ) as 
$deleteIdBatch ) {
+   $dbw->delete( 'geo_tags', [ 'gt_id' => $deleteIdBatch 
], __METHOD__ );
+   $lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
}
-   if ( count( $add ) ) {
-  

[MediaWiki-commits] [Gerrit] mediawiki...Kartographer[master]: Show snapshot map image as background for non-js clients

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

Change subject: Show snapshot map image as background for non-js clients
..


Show snapshot map image as background for non-js clients

Bug: T145014
Change-Id: Ic449d91b3d94a4a33f08457cd7fcee4e34289500
---
M includes/Tag/MapFrame.php
M styles/kartographer.less
M tests/parserTests.txt
3 files changed, 46 insertions(+), 20 deletions(-)

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



diff --git a/includes/Tag/MapFrame.php b/includes/Tag/MapFrame.php
index 6ac6f7c..739a376 100644
--- a/includes/Tag/MapFrame.php
+++ b/includes/Tag/MapFrame.php
@@ -29,7 +29,7 @@
 * @return string
 */
protected function render() {
-   global $wgKartographerFrameMode;
+   global $wgKartographerFrameMode, $wgKartographerMapServer;
 
$alignClasses = [
'left' => 'floatleft',
@@ -94,12 +94,17 @@
if ( preg_match( '/^\d+%$/', $width ) ) {
if ( $width === '100%' ) {
$fullWidth = true;
+   $staticWidth = 800;
} else {
$width = '300px'; // @todo: 
deprecate old syntax completely
+   $staticWidth = 300;
}
} else if ( $width === 'full' ) {
$width = '100%';
$fullWidth = true;
+   $staticWidth = 800;
+   } else {
+   $staticWidth = $this->width;
}
 
$height = "{$this->height}px";
@@ -112,11 +117,20 @@
'data-height' => $this->height,
];
if ( $this->zoom !== null ) {
+   $staticZoom = $this->zoom;
$attrs['data-zoom'] = $this->zoom;
+   } else {
+   $staticZoom = 2;
}
+
if ( $this->lat !== null && $this->lon !== null 
) {
$attrs['data-lat'] = $this->lat;
$attrs['data-lon'] = $this->lon;
+   $staticLat = $this->lat;
+   $staticLon = $this->lon;
+   } else {
+   $staticLat = 30;
+   $staticLon = 0;
}
if ( $this->showGroups ) {
$attrs['data-overlays'] = 
FormatJson::encode( $this->showGroups, false,
@@ -135,14 +149,16 @@
$containerClass .= ' mw-kartographer-full';
}
 
+   $attrs['style'] = "background-image: 
url({$wgKartographerMapServer}/img/{$this->mapStyle},{$staticZoom},{$staticLat},{$staticLon},{$staticWidth}x{$this->height}.png);";
+
if ( !$framed ) {
-   $attrs['style'] = "width: {$width}; height: {$height};";
+   $attrs['style'] .= " width: {$width}; height: 
{$height};";
$attrs['class'] .= " {$containerClass} 
{$alignClasses[$this->align]}";
 
return Html::rawElement( 'div', $attrs );
}
 
-   $attrs['style'] = "height: {$height};";
+   $attrs['style'] .= " height: {$height};";
$containerClass .= " thumb {$thumbAlignClasses[$this->align]}";
 
$captionFrame = Html::rawElement( 'div', [ 'class' => 
'thumbcaption' ],
diff --git a/styles/kartographer.less b/styles/kartographer.less
index 853499e..45f05a8 100644
--- a/styles/kartographer.less
+++ b/styles/kartographer.less
@@ -57,6 +57,16 @@
}
 }
 
+.mw-kartographer-map {
+   background-position: center;
+   background-repeat: no-repeat;
+}
+.client-js .mw-kartographer-map {
+   /* stylelint-disable declaration-no-important */
+   background: none !important;
+   /* stylelint-enable declaration-no-important */
+}
+
 .mw-kartographer-container:not(.mw-kartographer-full) {
max-width: 100%;
 
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 0448d48..6c01b3f 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -125,18 +125,18 @@
 
 
 !! result
-
-
-
-
-
-
-
-
-
-
-
-

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.18]: Make PurgeJobUtils avoid creating DB replication lag

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

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

Change subject: Make PurgeJobUtils avoid creating DB replication lag
..

Make PurgeJobUtils avoid creating DB replication lag

Large affected rows counts were being reported in DBPerformance logs.

Change-Id: Ia5504aa4fbd27473771c65688f0b9e78e3a5caae
(cherry picked from commit d077eb9daad6290032660b9f154c51f00b492472)
---
M includes/jobqueue/utils/PurgeJobUtils.php
1 file changed, 20 insertions(+), 14 deletions(-)


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

diff --git a/includes/jobqueue/utils/PurgeJobUtils.php 
b/includes/jobqueue/utils/PurgeJobUtils.php
index 329bc23..5eafcb3 100644
--- a/includes/jobqueue/utils/PurgeJobUtils.php
+++ b/includes/jobqueue/utils/PurgeJobUtils.php
@@ -20,6 +20,8 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
+
 class PurgeJobUtils {
/**
 * Invalidate the cache of a list of pages from a single namespace.
@@ -34,7 +36,9 @@
return;
}
 
-   $dbw->onTransactionPreCommitOrIdle( function() use ( $dbw, 
$namespace, $dbkeys ) {
+   $dbw->onTransactionIdle( function() use ( $dbw, $namespace, 
$dbkeys ) {
+   $services = MediaWikiServices::getInstance();
+   $lbFactory = $services->getDBLoadBalancerFactory();
// Determine which pages need to be updated.
// This is necessary to prevent the job queue from 
smashing the DB with
// large numbers of concurrent invalidations of the 
same page.
@@ -50,22 +54,24 @@
__METHOD__
);
 
-   if ( $ids === [] ) {
+   if ( !$ids ) {
return;
}
 
-   // Do the update.
-   // We still need the page_touched condition, in case 
the row has changed since
-   // the non-locking select above.
-   $dbw->update(
-   'page',
-   [ 'page_touched' => $now ],
-   [
-   'page_id' => $ids,
-   'page_touched < ' . $dbw->addQuotes( 
$now )
-   ],
-   __METHOD__
-   );
+   $batchSize = $services->getMainConfig()->get( 
'UpdateRowsPerQuery' );
+   $ticket = $lbFactory->getEmptyTransactionTicket( 
__METHOD__ );
+   foreach ( array_chunk( $ids, $batchSize ) as $idBatch ) 
{
+   $dbw->update(
+   'page',
+   [ 'page_touched' => $now ],
+   [
+   'page_id' => $idBatch,
+   'page_touched < ' . 
$dbw->addQuotes( $now ) // handle races
+   ],
+   __METHOD__
+   );
+   $lbFactory->commitAndWaitForReplication( 
__METHOD__, $ticket );
+   }
} );
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5504aa4fbd27473771c65688f0b9e78e3a5caae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.18
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...GeoData[wmf/1.28.0-wmf.18]: Make doLinksUpdate() avoid creating DB replication lag

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

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

Change subject: Make doLinksUpdate() avoid creating DB replication lag
..

Make doLinksUpdate() avoid creating DB replication lag

Large affected rows counts were being reported in DBPerformance logs.

Change-Id: Iad0af3d8edb789e240861f213c03b88cd8dba48a
(cherry picked from commit 886a379c7ade38360be1e9bb2bdc34198b958db8)
---
M extension.json
M includes/Hooks.php
2 files changed, 33 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData 
refs/changes/76/310176/1

diff --git a/extension.json b/extension.json
index a9c9b3d..f9f82a4 100644
--- a/extension.json
+++ b/extension.json
@@ -39,7 +39,7 @@
"LoadExtensionSchemaUpdates": 
"GeoData\\Hooks::onLoadExtensionSchemaUpdates",
"ParserFirstCallInit": "GeoData\\Hooks::onParserFirstCallInit",
"ArticleDeleteComplete": 
"GeoData\\Hooks::onArticleDeleteComplete",
-   "LinksUpdate": "GeoData\\Hooks::onLinksUpdate",
+   "LinksUpdateComplete": "GeoData\\Hooks::onLinksUpdateComplete",
"FileUpload": "GeoData\\Hooks::onFileUpload",
"OutputPageParserOutput": 
"GeoData\\Hooks::onOutputPageParserOutput",
"SearchIndexFields": "GeoData\\Hooks::onSearchIndexFields",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 8ce3092..df271e4 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -8,6 +8,7 @@
 use DatabaseUpdater;
 use LinksUpdate;
 use LocalFile;
+use MediaWiki\MediaWikiServices;
 use MWException;
 use OutputPage;
 use Parser;
@@ -99,12 +100,12 @@
}
 
/**
-* LinksUpdate hook handler
-* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
+* LinksUpdateComplete hook handler
+* @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdateComplete
 *
 * @param LinksUpdate $linksUpdate
 */
-   public static function onLinksUpdate( &$linksUpdate ) {
+   public static function onLinksUpdateComplete( LinksUpdate $linksUpdate 
) {
$out = $linksUpdate->getParserOutput();
$data = [];
$coordFromMetadata = self::getCoordinatesIfFile( 
$linksUpdate->getTitle() );
@@ -150,27 +151,24 @@
return null;
}
 
-   private static function doLinksUpdate( $coords, $pageId ) {
-   global $wgGeoDataBackend;
+   /**
+* @param Coord[] $coords
+* @param int $pageId
+* @throws \DBUnexpectedError
+*/
+   private static function doLinksUpdate( array $coords, $pageId ) {
+   $services = MediaWikiServices::getInstance();
 
-   $dbw = wfGetDB( DB_MASTER );
-
-   if ( $wgGeoDataBackend == 'db' && !count( $coords ) ) {
-   $dbw->delete( 'geo_tags', [ 'gt_page_id' => $pageId ], 
__METHOD__ );
-   return;
-   }
-
-   $prevCoords = GeoData::getAllCoordinates( $pageId, [], 
DB_MASTER );
$add = [];
$delete = [];
$primary = ( isset( $coords[0] ) && $coords[0]->primary ) ? 
$coords[0] : null;
-   foreach ( $prevCoords as $old ) {
+   foreach ( GeoData::getAllCoordinates( $pageId, [], DB_MASTER ) 
as $old ) {
$delete[$old->id] = $old;
}
-   /** @var Coord $new */
foreach ( $coords as $new ) {
if ( !$new->primary && $new->equalsTo( $primary ) ) {
-   continue; // Don't save secondary coordinates 
pointing to the same place as the primary one
+   // Don't save secondary coordinates pointing to 
the same place as the primary one
+   continue;
}
$match = false;
foreach ( $delete as $id => $old ) {
@@ -185,12 +183,20 @@
}
}
 
-   if ( count( $delete ) ) {
-   $deleteIds = array_keys( $delete );
-   $dbw->delete( 'geo_tags', [ 'gt_id' => $deleteIds ], 
__METHOD__ );
+   $dbw = wfGetDB( DB_MASTER );
+   $lbFactory = $services->getDBLoadBalancerFactory();
+   $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
+   $batchSize = $services->getMainConfig()->get( 
'UpdateRowsPerQuery' );
+
+   $deleteIds = array_keys( $delete );
+   foreach ( array_chunk( $deleteIds, $batchSize ) as 
$deleteIdBatch ) {
+   $dbw->delete( 'geo_tags', [ 'gt_id' => $deleteIdBatch 
], __METHOD__ );
+   $lbFactory->commitAndWaitForReplication( __METHOD__, 
$ticket );
  

  1   2   3   4   5   >