[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use cpPosTime cookie for same-domain redirects on DB change

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

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

Change subject: Use cpPosTime cookie for same-domain redirects on DB change
..

Use cpPosTime cookie for same-domain redirects on DB change

This follows-up a3dacac90f to show the URL parameter in less cases.

Change-Id: Ibe015352962fb3ee14d5aa322f0e748ef4cba5c1
---
M RELEASE-NOTES-1.28
M includes/MediaWiki.php
M includes/db/ChronologyProtector.php
M includes/db/loadbalancer/LBFactory.php
4 files changed, 29 insertions(+), 18 deletions(-)


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

diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28
index 116dc2a..dfa482a 100644
--- a/RELEASE-NOTES-1.28
+++ b/RELEASE-NOTES-1.28
@@ -56,9 +56,10 @@
   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.
+  while it renders the HTML output. However, if the output is a redirect to 
another wiki
+  on the wiki farm with a different domain, MediaWiki will instead alter the 
redirect
+  URL to include a ?cpPosTime parameter that triggers the database 
synchronization when
+  the URL is followed by the client. The same-domain case uses a new cpPosTime 
cookie.
 
 === External library changes in 1.28 ===
 
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 0bd183f..ddbb52c 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -574,22 +574,32 @@
wfDebug( __METHOD__ . ': pre-send deferred updates completed' );
 
// Decide when clients block on ChronologyProtector DB position 
writes
-   if (
+   $urlDomainDistance = (
$request->wasPosted() &&
$output->getRedirect() &&
-   $lbFactory->hasOrMadeRecentMasterChanges( INF ) &&
-   self::isWikiClusterURL( $output->getRedirect(), 
$context )
-   ) {
+   $lbFactory->hasOrMadeRecentMasterChanges( INF )
+   ) ? self::getUrlDomainDistance( $output->getRedirect(), 
$context ) : false;
+
+   if ( $urlDomainDistance === 'local' || $urlDomainDistance === 
'remote' ) {
// 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 the client 
follow redirects.
$flags = $lbFactory::SHUTDOWN_CHRONPROT_ASYNC;
+   $cpPosTime = microtime( true );
// Client's next request should see 1+ positions with 
this DBMasterPos::asOf() time
-   $safeUrl = $lbFactory->appendPreShutdownTimeAsQuery(
-   $output->getRedirect(),
-   microtime( true )
-   );
-   $output->redirect( $safeUrl );
+   if ( $urlDomainDistance === 'local' ) {
+   // Client will stay on this domain, so set an 
unobtrusive cookie
+   $expires = time() + 
ChronologyProtector::POSITION_TTL;
+   $options = [ 'prefix' => '' ];
+   $request->response()->setCookie( 'cpPosTime', 
$cpPosTime, $expires, $options );
+   } else {
+   // Cookies may not work across wiki domains, so 
use a URL parameter
+   $safeUrl = 
$lbFactory->appendPreShutdownTimeAsQuery(
+   $output->getRedirect(),
+   $cpPosTime
+   );
+   $output->redirect( $safeUrl );
+   }
} else {
// OutputPage::output() is fairly slow; run it in 
$postCommitWork to mask
// the latency of syncing DB positions accross all 
datacenters synchronously
@@ -629,9 +639,9 @@
/**
 * @param string $url
 * @param IContextSource $context
-* @return bool Whether $url is to something on this wiki farm
+* @return string|bool Either "local" or "remote" if in the farm, 
"external" otherwise
 */
-   private function isWikiClusterURL( $url, IContextSource $context ) {
+   private function getUrlDomainDistance( $url, 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move wfEscapeWikiText() to Parser::escapeWikitext()

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

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

Change subject: Move wfEscapeWikiText() to Parser::escapeWikitext()
..

Move wfEscapeWikiText() to Parser::escapeWikitext()

wfEscapeWikiText() used $wgEnableMagicLinks, but that could result in an
inconsistency when something modifies the magic link related
ParserOptions.

In general, most uses of wfEscapeWikiText() are in parser functions or
when message parsing, so the Parser is a logical place for it.

A future patch will make it easy to use Parser::escapeWikitext() in
message parameters.

Change-Id: I0fd4d5c135541971b1384a20328f1302b03d715f
---
M includes/GlobalFunctions.php
M includes/parser/CoreParserFunctions.php
M includes/parser/Parser.php
3 files changed, 89 insertions(+), 68 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/310487/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 0e59653..ee5ebd0 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -1656,6 +1656,8 @@
 }
 
 /**
+ * @deprecated since 1.28, use Parser::escapeWikitext() directly
+ *
  * Escapes the given text so that it may be output using addWikiText()
  * without any linking, formatting, etc. making its way through. This
  * is achieved by substituting certain characters with HTML entities.
@@ -1665,47 +1667,8 @@
  * @return string
  */
 function wfEscapeWikiText( $text ) {
-   global $wgEnableMagicLinks;
-   static $repl = null, $repl2 = null;
-   if ( $repl === null ) {
-   $repl = [
-   '"' => '', '&' => '', "'" => '', '<' => 
'',
-   '=' => '', '>' => '', '[' => '', ']' => 
'',
-   '{' => '', '|' => '', '}' => '', ';' 
=> '',
-   "\n#" => "\n", "\r#" => "\r",
-   "\n*" => "\n", "\r*" => "\r",
-   "\n:" => "\n", "\r:" => "\r",
-   "\n " => "\n", "\r " => "\r",
-   "\n\n" => "\n", "\r\n" => "\n",
-   "\n\r" => "\n", "\r\r" => "\r",
-   "\n\t" => "\n", "\r\t" => "\r", // "\n\t\n" is 
treated like "\n\n"
-   "\n" => "\n---", "\r" => "\r---",
-   '__' => '_', '://' => '//',
-   ];
-
-   $magicLinks = array_keys( array_filter( $wgEnableMagicLinks ) );
-   // We have to catch everything "\s" matches in PCRE
-   foreach ( $magicLinks as $magic ) {
-   $repl["$magic "] = "$magic";
-   $repl["$magic\t"] = "$magic";
-   $repl["$magic\r"] = "$magic";
-   $repl["$magic\n"] = "$magic";
-   $repl["$magic\f"] = "$magic";
-   }
-
-   // And handle protocols that don't use "://"
-   global $wgUrlProtocols;
-   $repl2 = [];
-   foreach ( $wgUrlProtocols as $prot ) {
-   if ( substr( $prot, -1 ) === ':' ) {
-   $repl2[] = preg_quote( substr( $prot, 0, -1 ), 
'/' );
-   }
-   }
-   $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : 
'/^(?!)/';
-   }
-   $text = substr( strtr( "\n$text", $repl ), 1 );
-   $text = preg_replace( $repl2, '$1', $text );
-   return $text;
+   global $wgParser;
+   return $wgParser->escapeWikitext( $text );
 }
 
 /**
diff --git a/includes/parser/CoreParserFunctions.php 
b/includes/parser/CoreParserFunctions.php
index 01cce02..b3dc17c 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -594,98 +594,98 @@
if ( is_null( $t ) ) {
return '';
}
-   return wfEscapeWikiText( $t->getText() );
+   return $parser->escapeWikitext( $t->getText() );
}
-   public static function pagenamee( $parser, $title = null ) {
+   public static function pagenamee( Parser $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) ) {
return '';
}
-   return wfEscapeWikiText( $t->getPartialURL() );
+   return $parser->escapeWikitext( $t->getPartialURL() );
}
-   public static function fullpagename( $parser, $title = null ) {
+   public static function fullpagename( Parser $parser, $title = null ) {
$t = Title::newFromText( $title );
if ( is_null( $t ) || !$t->canTalk() ) {
return '';
}
-   return wfEscapeWikiText( $t->getPrefixedText() );
+   return $parser->escapeWikitext( $t->getPrefixedText() );
}
-   public static 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add Message::escapewikitextParam()

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

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

Change subject: Add Message::escapewikitextParam()
..

Add Message::escapewikitextParam()

This parameter helper calls Parser::escapeWikitext() on the parameter
before it is parsed.

Change-Id: Id6218a01808f0a06b0aa9ca1d1b7f2ad05399221
---
M includes/Message.php
M tests/phpunit/includes/MessageTest.php
2 files changed, 73 insertions(+), 0 deletions(-)


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

diff --git a/includes/Message.php b/includes/Message.php
index c2c954a..6233879 100644
--- a/includes/Message.php
+++ b/includes/Message.php
@@ -668,6 +668,28 @@
}
 
/**
+* Add parameters that should not be parsed as wikitext, but still
+* be escaped by the parser
+*
+* @since 1.28
+*
+* @param string|string[] $param,... wikitext parameters, or a single 
argument that is
+* an array of wikitext parameters.
+*
+* @return Message $this
+*/
+   public function escapeWikitextParams( /*...*/ ) {
+   $params = func_get_args();
+   if ( isset( $params[0] ) && is_array( $params[0] ) ) {
+   $params = $params[0];
+   }
+   foreach ( $params as $param ) {
+   $this->parameters[] = self::escapewikitextParam( $param 
);
+   }
+   return $this;
+   }
+
+   /**
 * Set the language and the title from a context object
 *
 * @since 1.19
@@ -1058,6 +1080,17 @@
}
 
/**
+* @since 1.28
+*
+* @param $wikitext
+*
+* @return string[] Array with a single "escapewikitext" key
+*/
+   public static function escapewikitextParam( $wikitext ) {
+   return [ 'escapewikitext' => $wikitext ];
+   }
+
+   /**
 * Substitutes any parameters into the message text.
 *
 * @since 1.17
@@ -1108,6 +1141,8 @@
return [ 'before', 
$this->getLanguage()->formatBitrate( $param['bitrate'] ) ];
} elseif ( isset( $param['plaintext'] ) ) {
return [ 'after', $this->formatPlaintext( 
$param['plaintext'] ) ];
+   } elseif ( isset( $param['escapewikitext'] ) ) {
+   return [ 'before', $this->escapeWikitext( 
$param['escapewikitext'] ) ];
} else {
$warning = 'Invalid parameter for message "' . 
$this->getKey() . '": ' .
htmlspecialchars( serialize( $param ) );
@@ -1218,6 +1253,14 @@
 
}
}
+
+   /**
+* @param $wikitext
+* @return string
+*/
+   protected function escapeWikitext( $wikitext ) {
+   return MessageCache::singleton()->getParser()->escapeWikitext( 
$wikitext );
+   }
 }
 
 /**
diff --git a/tests/phpunit/includes/MessageTest.php 
b/tests/phpunit/includes/MessageTest.php
index 4c689ab..ea6169b 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -475,6 +475,36 @@
);
}
 
+   public static function provideEscapeWikitextParams() {
+   return [
+   [
+   'Test foobar',
+   'Test $1',
+   [ Message::escapewikitextParam( '[[foobar]]' ) 
],
+   ],
+   [
+   'Test foobar',
+   'Test $1',
+   [ Message::escapewikitextParam( '{{foobar}}' ) 
],
+   ],
+   [
+   'Test https//www.example.org/',
+   'Test $1',
+   [ Message::escapewikitextParam( 
'https://www.example.org/' ) ],
+   ],
+   ];
+   }
+
+   /**
+* @covers Message::escapeWikitext
+* @dataProvider provideEscapeWikitextParams
+*/
+   public function testEscapeWikitextParams( $expect, $msg, $params ) {
+   $msg = new RawMessage( $msg );
+   $actual = $msg->inLanguage( 'en' )->params( $params )->parse();
+   $this->assertEquals( $expect, $actual );
+   }
+
public static function provideParser() {
return [
[

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6218a01808f0a06b0aa9ca1d1b7f2ad05399221
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [WIP] Add MWExceptionExposer class

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

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

Change subject: [WIP] Add MWExceptionExposer class
..

[WIP] Add MWExceptionExposer class

* This handles the work of showing exceptions so that
  MWException does not have too.
* Simplify the DBError classes to regular Exception
  classes. Lots of pointless prettification has been
  removed, but DBConnectionError still gets the usual
  special treatment of a fallback page and Google form.
* Remove hacky file cache fallback code that probably
  did not work.
* Make MWExceptionHandler::report() wrap
  MWExceptionExposer::output().
* Make MWException::runHooks() wrap
  MWExceptionExposer::runHooks().

Change-Id: I5dfdc84e94ddac65417226cf7c84513ebb9f9faa
---
M autoload.php
M includes/db/DatabaseError.php
M includes/db/IDatabase.php
M includes/db/loadbalancer/ILoadBalancer.php
M includes/exception/MWException.php
A includes/exception/MWExceptionExposer.php
M includes/exception/MWExceptionHandler.php
7 files changed, 445 insertions(+), 484 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/310486/1

diff --git a/autoload.php b/autoload.php
index 6654f5b..f8c653b 100644
--- a/autoload.php
+++ b/autoload.php
@@ -766,6 +766,7 @@
'MWDebug' => __DIR__ . '/includes/debug/MWDebug.php',
'MWDocGen' => __DIR__ . '/maintenance/mwdocgen.php',
'MWException' => __DIR__ . '/includes/exception/MWException.php',
+   'MWExceptionExposer' => __DIR__ . 
'/includes/exception/MWExceptionExposer.php',
'MWExceptionHandler' => __DIR__ . 
'/includes/exception/MWExceptionHandler.php',
'MWGrants' => __DIR__ . '/includes/utils/MWGrants.php',
'MWHttpRequest' => __DIR__ . '/includes/HttpFunctions.php',
diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php
index cfae74f..2242c5a 100644
--- a/includes/db/DatabaseError.php
+++ b/includes/db/DatabaseError.php
@@ -25,16 +25,16 @@
  * Database error base class
  * @ingroup Database
  */
-class DBError extends MWException {
-   /** @var DatabaseBase */
+class DBError extends Exception {
+   /** @var IDatabase */
public $db;
 
/**
 * Construct a database error
-* @param DatabaseBase $db Object which threw the error
+* @param IDatabase $db Object which threw the error
 * @param string $error A simple error message to be used for debugging
 */
-   function __construct( DatabaseBase $db = null, $error ) {
+   function __construct( IDatabase $db = null, $error ) {
$this->db = $db;
parent::__construct( $error );
}
@@ -48,274 +48,23 @@
  * @since 1.23
  */
 class DBExpectedError extends DBError {
-   /**
-* @return string
-*/
-   function getText() {
-   global $wgShowDBErrorBacktrace;
-
-   $s = $this->getTextContent() . "\n";
-
-   if ( $wgShowDBErrorBacktrace ) {
-   $s .= "Backtrace:\n" . $this->getTraceAsString() . "\n";
-   }
-
-   return $s;
-   }
-
-   /**
-* @return string
-*/
-   function getHTML() {
-   global $wgShowDBErrorBacktrace;
-
-   $s = $this->getHTMLContent();
-
-   if ( $wgShowDBErrorBacktrace ) {
-   $s .= 'Backtrace:' . htmlspecialchars( 
$this->getTraceAsString() ) . '';
-   }
-
-   return $s;
-   }
-
-   function getPageTitle() {
-   return $this->msg( 'databaseerror', 'Database error' );
-   }
-
-   /**
-* @return string
-*/
-   protected function getTextContent() {
-   return $this->getMessage();
-   }
-
-   /**
-* @return string
-*/
-   protected function getHTMLContent() {
-   return '' . nl2br( htmlspecialchars( $this->getTextContent() 
) ) . '';
-   }
 }
 
 /**
  * @ingroup Database
  */
 class DBConnectionError extends DBExpectedError {
-   /** @var string Error text */
-   public $error;
-
/**
-* @param DatabaseBase $db Object throwing the error
+* @param IDatabase $db Object throwing the error
 * @param string $error Error text
 */
-   function __construct( DatabaseBase $db = null, $error = 'unknown error' 
) {
-   $msg = 'DB connection error';
-
+   function __construct( IDatabase $db = null, $error = 'unknown error' ) {
+   $msg = 'Cannot access the database';
if ( trim( $error ) != '' ) {
$msg .= ": $error";
-   } elseif ( $db ) {
-   $error = $this->db->getServer();
}
 
parent::__construct( $db, $msg );
-   $this->error = $error;
-   }
-
-   /**
-* @return bool
-

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: OutputPage: Don't set 'user' module state if filtered out

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

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

Change subject: OutputPage: Don't set 'user' module state if filtered out
..

OutputPage: Don't set 'user' module state if filtered out

On pages where the 'user' module is filtered out (e.g.
on Special:Preferences) it would export state 'loading' (or state
'ready') eventhough the actual call to makeResourceLoader() later
in getBottomScripts() would be a no-op due to filtering.

This would cause either an indefinite state of "loading" or a
state "ready" that wasn't true.

Test plan:
* Logged-in with non-empty user page common.js.
* View Special:Preferences.
* Verify in  source code, or via mw.loader.getState('user')
  that it has state "registered" (the default initial state) and
  not state "loading" or "ready".

Change-Id: I9b360d7e12703bddb80793aef47296fd63032c3d
---
M includes/OutputPage.php
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/85/310485/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index d9230b0..4c4fb1c 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2726,12 +2726,17 @@
);
$this->rlExemptStyleModules = $exemptGroups;
 
-   // Manually handled by getBottomScripts()
-   $userModule = $rl->getModule( 'user' );
-   $userState = $userModule->isKnownEmpty( $context ) && 
!$this->isUserJsPreview()
-   ? 'ready'
-   : 'loading';
-   $this->rlUserModuleState = $exemptStates['user'] = 
$userState;
+   $isUserModuleFiltered = !$this->filterModules( [ 'user' 
] );
+   // If this page filters out 'user', 
makeResourceLoaderLink will drop it.
+   // Avoid indefinite "loading" state or untrue "ready" 
state (T145368).
+   if ( !$isUserModuleFiltered ) {
+   // Manually handled by getBottomScripts()
+   $userModule = $rl->getModule( 'user' );
+   $userState = $userModule->isKnownEmpty( 
$context ) && !$this->isUserJsPreview()
+   ? 'ready'
+   : 'loading';
+   $this->rlUserModuleState = 
$exemptStates['user'] = $userState;
+   }
 
$rlClient = new ResourceLoaderClientHtml( $context, 
$this->getTarget() );
$rlClient->setConfig( $this->getJSVars() );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Lockdown[master]: Consolidate hook handler code

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

Change subject: Consolidate hook handler code
..


Consolidate hook handler code

* add type hints
* removed SearchEngineReplacePrefixesComplete handler
* re-use lockdownNamespace()

Change-Id: I052713789665e6384b5cc1ba225450680cd1398c
---
M Lockdown.php
1 file changed, 48 insertions(+), 87 deletions(-)

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



diff --git a/Lockdown.php b/Lockdown.php
index 27ba77c..3632364 100644
--- a/Lockdown.php
+++ b/Lockdown.php
@@ -53,9 +53,20 @@
 $wgHooks['MediaWikiPerformAction'][] = 'lockdownMediawikiPerformAction';
 $wgHooks['SearchableNamespaces'][] = 'lockdownSearchableNamespaces';
 $wgHooks['SearchGetNearMatchComplete'][] = 
'lockdownSearchGetNearMatchComplete';
-$wgHooks['SearchEngineReplacePrefixesComplete'][] = 
'lockdownSearchEngineReplacePrefixesComplete';
 
-function lockdownUserPermissionsErrors( $title, $user, $action, &$result ) {
+/**
+ * @param Title $title
+ * @param User $user
+ * @param string $action
+ * @param MessageSpecifier|array|string|bool|null $result
+ * @return bool
+ */
+function lockdownUserPermissionsErrors(
+   Title $title,
+   User $user,
+   $action,
+   &$result = null
+) {
global $wgNamespacePermissionLockdown, $wgSpecialPageLockdown, 
$wgWhitelistRead, $wgLang;
 
$result = null;
@@ -65,7 +76,7 @@
return true;
}
 
-   if ( $action == 'read' && $wgWhitelistRead ) {
+   if ( $action == 'read' && is_array( $wgWhitelistRead ) ) {
// don't impose read restrictions on whitelisted pages
if ( in_array( $title->getPrefixedText(), $wgWhitelistRead ) ) {
return true;
@@ -128,10 +139,17 @@
}
 }
 
-function lockdownMediawikiPerformAction ( $output, $article, $title, $user, 
$request, $wiki ) {
+function lockdownMediawikiPerformAction (
+   OutputPage $output,
+   Article $article,
+   Title $title,
+   User $user,
+   WebRequest $request,
+   MediaWiki $wiki
+) {
global $wgActionLockdown, $wgLang;
 
-   $action = $wiki->getAction( $request );
+   $action = $wiki->getAction();
 
if ( !isset( $wgActionLockdown[$action] ) ) {
return true;
@@ -155,107 +173,50 @@
 
$err = array( 'badaccess-groups', $wgLang->commaList( 
$groupLinks ), count( $groups ) );
throw new PermissionsError( $request->getVal('action'), array( 
$err ) );
-
-   return false;
}
 }
 
-function lockdownSearchableNamespaces( &$searchableNs ) {
-   global $wgNamespacePermissionLockdown;
-
+function lockdownSearchableNamespaces( array &$searchableNs ) {
$user = RequestContext::getMain()->getUser();
-
-   if ( !$user ) {
-   return true;
-   }
-
-   //don't continue if $user's name and id are both null (bug 28842)
-   if ( $user->getId() === null && $user->getName() === null ) {
-   return true;
-   }
-
$ugroups = $user->getEffectiveGroups();
 
foreach ( $searchableNs as $ns => $name ) {
-   $groups = @$wgNamespacePermissionLockdown[$ns]['read'];
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown['*']['read'];
-   }
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown[$ns]['*'];
-   }
-
-   if ( $groups === null ) {
-   continue;
-   }
-
-   if ( !$groups || !array_intersect( $ugroups, $groups ) ) {
+   if ( !lockdownNamespace( $ns, $ugroups ) ) {
unset( $searchableNs[$ns] );
}
}
return true;
 }
 
-function lockdownTitle(&$title) {
-   if ( is_object($title) ) {
-   global $wgUser, $wgNamespacePermissionLockdown;
-   $ugroups = $wgUser->getEffectiveGroups();
+function lockdownNamespace( $ns, array $ugroups ) {
+   global $wgNamespacePermissionLockdown;
 
-   $groups = 
@$wgNamespacePermissionLockdown[$title->getNamespace()]['read'];
-   if ( $groups === null ) {
-   $groups = @$wgNamespacePermissionLockdown['*']['read'];
-   }
-   if ( $groups === null ) {
-   $groups = 
@$wgNamespacePermissionLockdown[$title->getNamespace()]['*'];
-   }
-
-   if ( $groups === null ) {
-   return false;
-   }
-
-   if ( !$groups || !array_intersect($ugroups, $groups) ) {
-   $title = null;
-   return false;
-   }
+   $groups = @$wgNamespacePermissionLockdown[$ns]['read'];
+   if ( $groups === null ) {
+   $groups = 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: horizon: change wikitech help URLs to use https

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

Change subject: horizon: change wikitech help URLs to use https
..


horizon: change wikitech help URLs to use https

Change-Id: I6118cfa2f407b576ed9572da4d41c53446c641d4
---
M modules/openstack/templates/kilo/horizon/local_settings.py.erb
M modules/openstack/templates/liberty/horizon/local_settings.py.erb
M modules/openstack/templates/mitaka/horizon/local_settings.py.erb
3 files changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/modules/openstack/templates/kilo/horizon/local_settings.py.erb 
b/modules/openstack/templates/kilo/horizon/local_settings.py.erb
index 00ca1b2..55fc36a 100644
--- a/modules/openstack/templates/kilo/horizon/local_settings.py.erb
+++ b/modules/openstack/templates/kilo/horizon/local_settings.py.erb
@@ -65,7 +65,7 @@
 'fade_duration': 1500,
 'types': ['alert-success', 'alert-info']
 },
-'help_url': "http://wikitech.wikimedia.org/wiki/horizon;,
+'help_url': "https://wikitech.wikimedia.org/wiki/Horizon;,
 'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},
diff --git a/modules/openstack/templates/liberty/horizon/local_settings.py.erb 
b/modules/openstack/templates/liberty/horizon/local_settings.py.erb
index addc70e..4549b71 100644
--- a/modules/openstack/templates/liberty/horizon/local_settings.py.erb
+++ b/modules/openstack/templates/liberty/horizon/local_settings.py.erb
@@ -73,7 +73,7 @@
 'fade_duration': 1500,
 'types': ['alert-success', 'alert-info']
 },
-'help_url': "http://wikitech.wikimedia.org/wiki/horizon;,
+'help_url': "https://wikitech.wikimedia.org/wiki/Horizon;,
 'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},
diff --git a/modules/openstack/templates/mitaka/horizon/local_settings.py.erb 
b/modules/openstack/templates/mitaka/horizon/local_settings.py.erb
index addc70e..4549b71 100644
--- a/modules/openstack/templates/mitaka/horizon/local_settings.py.erb
+++ b/modules/openstack/templates/mitaka/horizon/local_settings.py.erb
@@ -73,7 +73,7 @@
 'fade_duration': 1500,
 'types': ['alert-success', 'alert-info']
 },
-'help_url': "http://wikitech.wikimedia.org/wiki/horizon;,
+'help_url': "https://wikitech.wikimedia.org/wiki/Horizon;,
 'exceptions': {'recoverable': exceptions.RECOVERABLE,
'not_found': exceptions.NOT_FOUND,
'unauthorized': exceptions.UNAUTHORIZED},

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6118cfa2f407b576ed9572da4d41c53446c641d4
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alex Monk 
Gerrit-Reviewer: Muehlenhoff 
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] mediawiki...NewUserMessage[master]: Use MessagePoster for non-wikitext pages

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

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

Change subject: Use MessagePoster for non-wikitext pages
..

Use MessagePoster for non-wikitext pages

Due to (sometimes) using the SUPPRESS_RC feature, we keep the path
for standard wikitext pages the same.

Bug: T131957
Change-Id: I90b686ccaa8fc41ea16e9796cbba6d8c59fa48c5
Depends-On: I654c50482d70051323b312a5cb213f9db72e999e
---
M NewUserMessage.class.php
M i18n/en.json
M i18n/qqq.json
A tests/phpunit/NewUserMessageTest.php
4 files changed, 389 insertions(+), 22 deletions(-)


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

diff --git a/NewUserMessage.class.php b/NewUserMessage.class.php
index 596004a..7cd5edb 100644
--- a/NewUserMessage.class.php
+++ b/NewUserMessage.class.php
@@ -1,6 +1,7 @@
 getRealName();
$name = $user->getName();
 
-   // Add (any) content to [[MediaWiki:Newusermessage-substitute]] 
to substitute the
-   // welcome template.
-   $substDisabled = self::getMsg( 'newusermessage-substitute' 
)->isDisabled();
-
-   if ( $substDisabled ) {
-   $str = '{{' . "$str|realName=$realName|name=$name}}";
-   } else {
+   if ( $shouldSubst ) {
$str = '{{subst:' . 
"$str|realName=$realName|name=$name}}";
+   } else {
+   $str = '{{' . "$str|realName=$realName|name=$name}}";
}
 
-   if ( $preparse ) {
+   if ( $shouldPreparse ) {
global $wgParser;
 
$str = $wgParser->preSaveTransform( $str, $talk, 
$editor, new ParserOptions );
@@ -166,7 +179,8 @@
/**
 * Add the message if the users talk page does not already exist
 * @param $user User object
-* @return bool
+* @return bool True if the page already existed, or a message was 
successfully
+*   left, false otherwise.
 */
protected static function createNewUserMessage( $user ) {
$talk = $user->getTalkPage();
@@ -187,13 +201,19 @@
}
 
if ( $subject ) {
-   $subject = self::substString( $subject, $user, 
$editor, $talk, "preparse" );
+   // Always subst the subject, since some 
MessagePoster
+   // implementations require it.
+   $subject = self::substString( $subject, $user, 
$editor, $talk, /*subst*/ true, /*preparse*/ true );
}
if ( $text ) {
-   $text = self::substString( $text, $user, 
$editor, $talk );
+   // Add (any) content to 
[[MediaWiki:Newusermessage-substitute]] to substitute the
+   // welcome template.
+   $isSubstDisabled = self::getMsg( 
'newusermessage-substitute' )->isDisabled();
+
+   $text = self::substString( $text, $user, 
$editor, $talk, /*subst*/ !$isSubstDisabled );
}
 
-   self::leaveUserMessage( $user, $wikiPage, $subject, 
$text,
+   return self::leaveUserMessage( $user, $wikiPage, 
$subject, $text,
$signature, $editSummary, $editor, $flags );
}
return true;
@@ -243,17 +263,131 @@
 *"{{MediaWiki:usermessage-editor}}"
 * @param $flags int default edit flags
 *
-* @return boolean true if it was successful
+* @return boolean true if it was successful, false otherwise (an error 
will be
+*   logged)
 */
public static function leaveUserMessage( $user, $wikiPage, $subject, 
$text, $signature,
$summary, $editor, $flags ) {
-   $text = self::formatUserMessage( $subject, $text, $signature );
+
+   $contentModel = $wikiPage->getContentModel();
+
+   if ( $contentModel !== CONTENT_MODEL_WIKITEXT ) {
+   return self::leaveUserMessageWithMessagePoster( 
$wikiPage, $editor, $subject, $text, $signature );
+   } else {
+   // We don't use MessagePoster for wikitext because it 
does not (and probably can not since we use ApiEditPage)
+   // support EDIT_SUPPRESS_RC, which is an option.
+   //
+   // We would also have to add an optional flag to 
suppress the signature (to avoid double-signatures due
+   // to NewUserMessage's special signature-handling).
+   return self::leaveUserMessageWithWikitext( $wikiPage, 
$editor, $subject, $text, 

[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Initiate Hovercards A/B test on ruwiki and itwiki

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

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

Change subject: Initiate Hovercards A/B test on ruwiki and itwiki
..

Initiate Hovercards A/B test on ruwiki and itwiki

ON rate of 10% and 20%, respectively.
EL sampling rate of 1% and 2%, respectively.

Bug: T136746
Change-Id: I37bd630393e0ff347f7592263514627cbac4d876
---
M wmf-config/InitialiseSettings.php
1 file changed, 32 insertions(+), 0 deletions(-)


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

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index b5b781a..57eb45b 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -12732,9 +12732,12 @@
 ],
 
 // T134778
+// T136746
 'wmgUsePopups' => [
'default' => false,
'huwiki' => true,
+   'ruwiki' => true,
+   'itwiki' => true,
 ],
 
 'wmgPopupsBetaFeature' => [
@@ -12743,12 +12746,16 @@
 ],
 
 // T134778
+// T136746
 'wmgPopupsExperiment' => [
'default' => false,
'huwiki' => true,
+   'ruwiki' => true,
+   'itwiki' => true,
 ],
 
 // T134778
+// T136746
 'wmgPopupsExperimentConfig' => [
'default' => false,
'huwiki' => [
@@ -12760,6 +12767,31 @@
'A' => 0.5,
],
],
+   'ruwiki' => [
+   'name' => 'T136746',
+   'enabled' => true,
+   'buckets' => [
+   // T136746
+   'control' => 0.9,
+   'A' => 0.1,
+   ],
+   ],
+   'itwiki' => [
+   'name' => 'T136746',
+   'enabled' => true,
+   'buckets' => [
+   // T136746
+   'control' => 0.8,
+   'A' => 0.2,
+   ],
+   ],
+],
+
+// T136746
+'wgPopupsSchemaPopupsSamplingRate' => [
+   'default' => 0,
+   'ruwiki' => 0.01,
+   'itwiki' => 0.02
 ],
 
 'wmgULSCompactLanguageLinksBetaFeature' => [

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...CentralAuth[master]: Add a script to easily fix stuck global renames

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

Change subject: Add a script to easily fix stuck global renames
..


Add a script to easily fix stuck global renames

Change-Id: I94bc20a5f878b35916f9d9b9f7784086c6fd8f58
---
A maintenance/fixStuckGlobalRename.php
1 file changed, 99 insertions(+), 0 deletions(-)

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



diff --git a/maintenance/fixStuckGlobalRename.php 
b/maintenance/fixStuckGlobalRename.php
new file mode 100644
index 000..89ad9f4
--- /dev/null
+++ b/maintenance/fixStuckGlobalRename.php
@@ -0,0 +1,99 @@
+addArg( 'oldname', 'Old name' );
+   $this->addArg( 'newname', 'New name' );
+   $this->addOption( 'logwiki', 'Wiki where the log entry exists', 
true, true );
+   $this->addDescription( 'Unstuck global rename on a single wiki' 
);
+   }
+
+   public function execute() {
+   $oldName = User::getCanonicalName( $this->getArg( 0 ) );
+   $newName = User::getCanonicalName( $this->getArg( 1 ) );
+   if ( $oldName === false || $newName === false ) {
+   $this->error( 'Invalid name', 1 );
+   }
+
+   $logTitle = Title::newFromText( 'Special:CentralAuth' 
)->getSubpage( $newName );
+   $ca = new CentralAuthUser( $newName );
+   if ( !$ca->renameInProgressOn( wfWikiID() ) ) {
+   $this->error( "{$ca->getName()} does not have a rename 
in progress on this wiki.", 1 );
+   }
+
+   $dbr = wfGetDB( DB_SLAVE, [], $this->getOption( 'logwiki' ) );
+   $queryData = DatabaseLogEntry::getSelectQueryData();
+   $row = $dbr->selectRow(
+   $queryData['tables'],
+   $queryData['fields'],
+   array_merge( $queryData['conds'], [
+   'log_type' => 'gblrename',
+   'log_action' => 'rename',
+   'log_namespace' => NS_SPECIAL,
+   'log_title' => $logTitle->getDBkey(),
+   ] ),
+   __METHOD__,
+   array_merge( $queryData['options'], [ 'ORDER BY' => 
'log_timestamp DESC' ] ),
+   $queryData['join_conds']
+   );
+
+   // try to guess the options if the log record does not contain 
them
+   $movepages = true;
+   $suppressredirects = false;
+   if ( $row ) {
+   $logEntry = DatabaseLogEntry::newFromRow( $row );
+   $renamer = $logEntry->getPerformer()->getName();
+   $comment = $logEntry->getComment();
+   $logParams = $logEntry->getParameters();
+   if ( isset( $logParams['movepages'] ) ) {
+   $movepages = $logParams['movepages'];
+   }
+   if ( isset( $logParams['suppressredirects'] ) ) {
+   $suppressredirects = 
$logParams['suppressredirects'];
+   }
+   $this->output( "Using $renamer as the renamer.\n" );
+   } else {
+   $this->output( "Could not find log entry, falling back 
to system account\n" );
+   $renamer = 'Global rename script';
+   $comment = '';
+   }
+   $params = [
+   'from' => $oldName,
+   'to' => $newName,
+   'renamer' => $renamer,
+   'movepages' => $movepages,
+   'suppressredirects' => $suppressredirects,
+   'reason' => $comment,
+   // no way to recover localuser attachment details, 
faking it
+   'reattach' => [ wfWikiID() => [
+   'attachedMethod' => 'admin',
+   'attachedTimestamp' => wfTimestamp( TS_MW ),
+   ] ],
+   ];
+   foreach ( $params as $key => $value ) {
+   if ( $key === 'reattach' ) {
+   continue;
+   }
+   $this->output( "$key: $value\n" );
+   }
+   $title = Title::newFromText( 'Global rename job' );
+   $job = new LocalRenameUserJob( $title, $params );
+   $this->output( "\nStarting to run job...\n" );
+   $job->run();
+   $this->output( "Done!\n" );
+   }
+}
+
+$maintClass = 'FixStuckGlobalRename';
+require_once RUN_MAINTENANCE_IF_MAIN;

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add ILoadBalancer interface

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

Change subject: Add ILoadBalancer interface
..


Add ILoadBalancer interface

Remove redundant LoadBalancer docs (those without @since).

Change-Id: I981177b6854cfdbea4a51b6db7e365dac0da258a
---
M autoload.php
A includes/db/loadbalancer/ILoadBalancer.php
M includes/db/loadbalancer/LoadBalancer.php
3 files changed, 487 insertions(+), 204 deletions(-)

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



diff --git a/autoload.php b/autoload.php
index 309a7d0..6654f5b 100644
--- a/autoload.php
+++ b/autoload.php
@@ -580,6 +580,7 @@
'IEUrlExtension' => __DIR__ . '/includes/libs/IEUrlExtension.php',
'IExpiringStore' => __DIR__ . 
'/includes/libs/objectcache/IExpiringStore.php',
'IJobSpecification' => __DIR__ . 
'/includes/jobqueue/JobSpecification.php',
+   'ILoadBalancer' => __DIR__ . 
'/includes/db/loadbalancer/ILoadBalancer.php',
'IP' => __DIR__ . '/includes/utils/IP.php',
'IPSet' => __DIR__ . '/includes/compat/IPSetCompat.php',
'IPTC' => __DIR__ . '/includes/media/IPTC.php',
diff --git a/includes/db/loadbalancer/ILoadBalancer.php 
b/includes/db/loadbalancer/ILoadBalancer.php
new file mode 100644
index 000..9313ccd
--- /dev/null
+++ b/includes/db/loadbalancer/ILoadBalancer.php
@@ -0,0 +1,473 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Database
+ * @author Aaron Schulz
+ */
+
+/**
+ * Interface for database load balancing object that manages IDatabase handles
+ *
+ * @todo: loosen up DB classes from MWException
+ * @since 1.28
+ * @ingroup Database
+ */
+interface ILoadBalancer {
+   /**
+* @param array $params Array with keys:
+*  - servers : Required. Array of server info structures.
+*  - loadMonitor : Name of a class used to fetch server lag and load.
+*  - readOnlyReason : Reason the master DB is read-only if so 
[optional]
+*  - waitTimeout : Maximum time to wait for replicas for consistency 
[optional]
+*  - srvCache : BagOStuff object [optional]
+*  - wanCache : WANObjectCache object [optional]
+* @throws MWException
+*/
+   public function __construct( array $params );
+
+   /**
+* Get the index of the reader connection, which may be a replica DB
+* This takes into account load ratios and lag times. It should
+* always return a consistent index during a given invocation
+*
+* Side effect: opens connections to databases
+* @param string|bool $group Query group, or false for the generic 
reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
+* @throws MWException
+* @return bool|int|string
+*/
+   public function getReaderIndex( $group = false, $wiki = false );
+
+   /**
+* Set the master wait position
+* If a DB_REPLICA connection has been opened already, waits
+* Otherwise sets a variable telling it to wait if such a connection is 
opened
+* @param DBMasterPos $pos
+*/
+   public function waitFor( $pos );
+
+   /**
+* Set the master wait position and wait for a "generic" replica DB to 
catch up to it
+*
+* This can be used a faster proxy for waitForAll()
+*
+* @param DBMasterPos $pos
+* @param int $timeout Max seconds to wait; default is mWaitTimeout
+* @return bool Success (able to connect and no timeouts reached)
+*/
+   public function waitForOne( $pos, $timeout = null );
+
+   /**
+* Set the master wait position and wait for ALL replica DBs to catch 
up to it
+* @param DBMasterPos $pos
+* @param int $timeout Max seconds to wait; default is mWaitTimeout
+* @return bool Success (able to connect and no timeouts reached)
+*/
+   public function waitForAll( $pos, $timeout = null );
+
+   /**
+* Get any open connection to a given server index, local or foreign
+* Returns false if there is no connection open
+*
+* @param int $i Server index
+* @return IDatabase|bool False on failure
+*/
+   public function getAnyOpenConnection( $i );
+
+   /**
+* Get a connection by index
+* This is the main entry point for this class.
+*
+* @param int $i Server index
+* @param array|string|bool $groups Query group(s), or false for the 
generic reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
+*
+* @throws MWException
+* @return IDatabase
+*/
+   public function getConnection( $i, $groups = [], $wiki = false );
+
+   /**
+* Mark a foreign connection as being available for reuse under a 
different
+* DB name or prefix. This mechanism is reference-counted, 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace some MWExceptions with natives ones in /db

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

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

Change subject: Replace some MWExceptions with natives ones in /db
..

Replace some MWExceptions with natives ones in /db

Change-Id: I94532d09216926d401e94c61acd60fdc6241a2a0
---
M includes/db/CloneDatabase.php
M includes/db/Database.php
M includes/db/DatabaseMssql.php
M includes/db/DatabaseOracle.php
M includes/db/DatabaseSqlite.php
M includes/db/loadbalancer/LBFactoryMulti.php
M includes/db/loadbalancer/LBFactorySimple.php
M includes/db/loadbalancer/LoadBalancer.php
8 files changed, 24 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/310482/1

diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index cab9438..97d59d8 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -76,7 +76,7 @@
if ( $wgSharedDB && in_array( $tbl, $wgSharedTables, 
true ) ) {
// Shared tables don't work properly when 
cloning due to
// how prefixes are handled (bug 65654)
-   throw new MWException( "Cannot clone shared 
table $tbl." );
+   throw new RuntimeException( "Cannot clone 
shared table $tbl." );
}
# Clean up from previous aborted run.  So that table 
escaping
# works correctly across DB engines, we need to change 
the pre-
@@ -93,7 +93,7 @@
) {
if ( $oldTableName === $newTableName ) {
// Last ditch check to avoid data loss
-   throw new MWException( "Not dropping 
new table, as '$newTableName'"
+   throw new LogicException( "Not dropping 
new table, as '$newTableName'"
. " is name of both the old and 
the new table." );
}
$this->db->dropTable( $tbl, __METHOD__ );
diff --git a/includes/db/Database.php b/includes/db/Database.php
index b044e23..109dbfe 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -340,8 +340,8 @@
if ( in_array( $p['driver'], $possibleDrivers ) 
) {
$driver = $p['driver'];
} else {
-   throw new MWException( __METHOD__ .
-   " cannot construct Database 
with type '$dbType' and driver '{$p['driver']}'" );
+   throw new InvalidArgumentException( 
__METHOD__ .
+   " type '$dbType' does not 
support driver '{$p['driver']}'" );
}
} else {
foreach ( $possibleDrivers as $posDriver ) {
@@ -740,7 +740,7 @@
 * not restored on unserialize.
 */
public function __sleep() {
-   throw new MWException( 'Database serialization may cause 
problems, since ' .
+   throw new RuntimeException( 'Database serialization may cause 
problems, since ' .
'the connection is not restored on wakeup.' );
}
 
@@ -807,7 +807,7 @@
$closed = $this->closeConnection();
$this->mConn = false;
} elseif ( $this->mTrxIdleCallbacks || $this->mTrxEndCallbacks 
) { // sanity
-   throw new MWException( "Transaction callbacks still 
pending." );
+   throw new RuntimeException( "Transaction callbacks 
still pending." );
} else {
$closed = true;
}
@@ -1736,7 +1736,7 @@
unset( $value[$nullKey] );
}
if ( count( $value ) == 0 && !$includeNull ) {
-   throw new MWException( __METHOD__ . ": 
empty input for field $field" );
+   throw new InvalidArgumentException( 
__METHOD__ . ": empty input for field $field" );
} elseif ( count( $value ) == 0 ) {
// only check if $field is null
$list .= "$field IS NULL";
@@ -3132,12 +3132,12 @@
public function duplicateTableStructure( $oldName, $newName, $temporary 
= false,
$fname = __METHOD__
) {
-   throw new MWException(
+   throw new RuntimeException(
'DatabaseBase::duplicateTableStructure is not 

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Gerit: Rewrite outdated comment about Gerrit-Phabricator lin...

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

Change subject: Gerit: Rewrite outdated comment about Gerrit-Phabricator linking
..


Gerit: Rewrite outdated comment about Gerrit-Phabricator linking

Bug: T75997
Bug: T76459
Change-Id: I2f06f93b6f7b42815c3594fd6902b078ea5a020e
---
M modules/gerrit/templates/gerrit.config.erb
1 file changed, 1 insertion(+), 4 deletions(-)

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



diff --git a/modules/gerrit/templates/gerrit.config.erb 
b/modules/gerrit/templates/gerrit.config.erb
index 6d3b202..cd70900 100644
--- a/modules/gerrit/templates/gerrit.config.erb
+++ b/modules/gerrit/templates/gerrit.config.erb
@@ -119,10 +119,7 @@
 match = ([^ ]+) (https://integration\\.wikimedia\\.org/ci/[a-zA-Z0-9/_.-]+\; 
target=\"_blank\">)[^<]+ : ([a-zA-Z_]+)([^<]*)
 html = $2$1 $3$4
 [commentlink "its-phabricator"]
-# Due to limitations of our old gerrit (and hence the old plugins)
-# that we use, $1 needs to hold the bug number. By the way the
-# pattern gets used, neither non-capturing groups nor
-# look-aheads/look-backs work reliably.
+# $1 must hold the bug number because of the notification bots that are 
using this.
 match =  "\\bT(\\d+)(#\\d+)?\\b(?![#\"]|)"
 link = https://phabricator.wikimedia.org/T$1$2
 [mimetype "application/javascript"]

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2f06f93b6f7b42815c3594fd6902b078ea5a020e
Gerrit-PatchSet: 14
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: Alex Monk 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: JanZerebecki 
Gerrit-Reviewer: MZMcBride 
Gerrit-Reviewer: Paladox 
Gerrit-Reviewer: PleaseStand 
Gerrit-Reviewer: QChris 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
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[REL1_27]: Make JobQueueGroup::push() update the queuesHaveJobs() cache

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

Change subject: Make JobQueueGroup::push() update the queuesHaveJobs() cache
..


Make JobQueueGroup::push() update the queuesHaveJobs() cache

This makes it so jobs can run sooner with $wgJobRunRate

Bug: T145206
Change-Id: Ia7673f51312f90a696fa056bd3daf7f3f440782b
(cherry picked from commit 6f9a246d25b29d406e68e366e707822f14be8a2d)
---
M includes/jobqueue/JobQueueGroup.php
1 file changed, 15 insertions(+), 1 deletion(-)

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



diff --git a/includes/jobqueue/JobQueueGroup.php 
b/includes/jobqueue/JobQueueGroup.php
index 2dd0615..3b7c2b8 100644
--- a/includes/jobqueue/JobQueueGroup.php
+++ b/includes/jobqueue/JobQueueGroup.php
@@ -142,6 +142,20 @@
$this->cache->clear( 'queues-ready' );
}
}
+
+   $cache = ObjectCache::getLocalClusterInstance();
+   $cache->set(
+   $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', self::TYPE_ANY ),
+   'true',
+   15
+   );
+   if ( array_intersect( array_keys( $jobsByType ), 
$this->getDefaultQueueTypes() ) ) {
+   $cache->set(
+   $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', self::TYPE_DEFAULT ),
+   'true',
+   15
+   );
+   }
}
 
/**
@@ -298,8 +312,8 @@
 * @since 1.23
 */
public function queuesHaveJobs( $type = self::TYPE_ANY ) {
-   $key = wfMemcKey( 'jobqueue', 'queueshavejobs', $type );
$cache = ObjectCache::getLocalClusterInstance();
+   $key = $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', $type );
 
$value = $cache->get( $key );
if ( $value === false ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7673f51312f90a696fa056bd3daf7f3f440782b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_27
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] operations/puppet[production]: Fix broken refs/meta/config diffusion links in access section

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

Change subject: Fix broken refs/meta/config diffusion links in access section
..


Fix broken refs/meta/config diffusion links in access section

This dosent fix the branch section where refs/meta/config links are still
broken.

This fixes the refs/meta/config link in the access tab so that we can get
to refs/meta/config in diffusion better since it is still broken on the
branch tab.

For example going to 
https://gerrit.wikimedia.org/r/#/admin/projects/operations/puppet,access
and clicking the diffusion link under History:

This is what this patch fixes since that diffusion link is broken.

Bug: T137354
Change-Id: If664c1684a943af0ddcdf21e16d9cecb045d4cfb
---
M modules/gerrit/templates/gerrit.config.erb
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  20after4: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/gerrit/templates/gerrit.config.erb 
b/modules/gerrit/templates/gerrit.config.erb
index 57330b5..6d3b202 100644
--- a/modules/gerrit/templates/gerrit.config.erb
+++ b/modules/gerrit/templates/gerrit.config.erb
@@ -83,7 +83,7 @@
 revision = "/r/revision/${project};${commit}"
 project = /r/project/${project}
 branch = "/r/branch/${project};${branch}"
-filehistory = "/r/p/${project}/;history/${branch}/${file}"
+filehistory = "/r/p/${project}/;history/${file}/;${branch}"
 file = "/r/p/${project}/;browse/HEAD/${file}/;${commit}"
 roottree = "/r/p/${project}/;browse/HEAD/;${commit}"
 linkname = diffusion

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If664c1684a943af0ddcdf21e16d9cecb045d4cfb
Gerrit-PatchSet: 10
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Paladox 
Gerrit-Reviewer: 20after4 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Muehlenhoff 
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]: Convert LoadBalancer/Database class logging to PSR

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

Change subject: Convert LoadBalancer/Database class logging to PSR
..


Convert LoadBalancer/Database class logging to PSR

Reorder DatabaseBase constructor/factory to the top.

Change-Id: I2950b9170d6ff15dcd46b64dd366f1e441a8
---
M includes/db/ChronologyProtector.php
M includes/db/Database.php
M includes/db/loadbalancer/LBFactory.php
M includes/db/loadbalancer/LoadBalancer.php
M includes/db/loadbalancer/LoadMonitor.php
M includes/db/loadbalancer/LoadMonitorMySQL.php
6 files changed, 299 insertions(+), 235 deletions(-)

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



diff --git a/includes/db/ChronologyProtector.php 
b/includes/db/ChronologyProtector.php
index 1cdb49f..9b01adc 100644
--- a/includes/db/ChronologyProtector.php
+++ b/includes/db/ChronologyProtector.php
@@ -20,14 +20,19 @@
  * @file
  * @ingroup Database
  */
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\LoggerInterface;
+use MediaWiki\Logger\LoggerFactory;
 
 /**
  * Class for ensuring a consistent ordering of events as seen by the user, 
despite replication.
  * Kind of like Hawking's [[Chronology Protection Agency]].
  */
-class ChronologyProtector {
+class ChronologyProtector implements LoggerAwareInterface{
/** @var BagOStuff */
protected $store;
+   /** @var LoggerInterface */
+   protected $logger;
 
/** @var string Storage key name */
protected $key;
@@ -67,6 +72,11 @@
$this->clientId = md5( $client['ip'] . "\n" . $client['agent'] 
);
$this->key = $store->makeGlobalKey( __CLASS__, $this->clientId 
);
$this->waitForPosTime = $posTime;
+   $this->logger = LoggerFactory::getInstance( 'DBReplication' );
+   }
+
+   public function setLogger( LoggerInterface $logger ) {
+   $this->logger = $logger;
}
 
/**
@@ -106,7 +116,7 @@
$masterName = $lb->getServerName( $lb->getWriterIndex() );
if ( !empty( $this->startupPositions[$masterName] ) ) {
$pos = $this->startupPositions[$masterName];
-   wfDebugLog( 'replication', __METHOD__ . ": LB for 
'$masterName' set to pos $pos\n" );
+   $this->logger->info( __METHOD__ . ": LB for 
'$masterName' set to pos $pos\n" );
$lb->waitFor( $pos );
}
}
@@ -129,10 +139,10 @@
$masterName = $lb->getServerName( $lb->getWriterIndex() );
if ( $lb->getServerCount() > 1 ) {
$pos = $lb->getMasterPos();
-   wfDebugLog( 'replication', __METHOD__ . ": LB for 
'$masterName' has pos $pos\n" );
+   $this->logger->info( __METHOD__ . ": LB for 
'$masterName' has pos $pos\n" );
$this->shutdownPositions[$masterName] = $pos;
} else {
-   wfDebugLog( 'replication', __METHOD__ . ": DB 
'$masterName' touched\n" );
+   $this->logger->info( __METHOD__ . ": DB '$masterName' 
touched\n" );
}
$this->shutdownTouchDBs[$masterName] = 1;
}
@@ -165,8 +175,7 @@
return []; // nothing to save
}
 
-   wfDebugLog( 'replication',
-   __METHOD__ . ": saving master pos for " .
+   $this->logger->info( __METHOD__ . ": saving master pos for " .
implode( ', ', array_keys( $this->shutdownPositions ) ) 
. "\n"
);
 
@@ -193,16 +202,14 @@
if ( !$ok ) {
$bouncedPositions = $this->shutdownPositions;
// Raced out too many times or stash is down
-   wfDebugLog( 'replication',
-   __METHOD__ . ": failed to save master pos for " 
.
+   $this->logger->warning( __METHOD__ . ": failed to save 
master pos for " .
implode( ', ', array_keys( 
$this->shutdownPositions ) ) . "\n"
);
} elseif ( $mode === 'sync' &&
$store->getQoS( $store::ATTR_SYNCWRITES ) < 
$store::QOS_SYNCWRITES_BE
) {
// Positions may not be in all datacenters, force 
LBFactory to play it safe
-   wfDebugLog( 'replication',
-   __METHOD__ . ": store does not report ability 
to sync replicas. " );
+   $this->logger->info( __METHOD__ . ": store may not 
support synchronous writes." );
$bouncedPositions = $this->shutdownPositions;
} else {
$bouncedPositions = [];
@@ -267,10 +274,10 @@
}
 

[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Move generic TextView assertion method to ViewTest

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

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

Change subject: Move generic TextView assertion method to ViewTest
..

Move generic TextView assertion method to ViewTest

assertText() will be used by other ViewTest subclasses.

Change-Id: I05ff167cc00ef4f76f8bf2ddcacf116db8b0b060
---
M app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
M app/src/androidTest/java/org/wikipedia/test/ViewTest.java
2 files changed, 15 insertions(+), 6 deletions(-)


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

diff --git 
a/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java 
b/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
index bb914e2..83123a1 100644
--- 
a/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
+++ 
b/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
@@ -4,7 +4,6 @@
 import android.support.annotation.NonNull;
 import android.support.annotation.StringRes;
 import android.view.View;
-import android.widget.TextView;
 
 import org.junit.Test;
 import org.junit.experimental.theories.Theory;
@@ -19,7 +18,6 @@
 import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
-import static org.wikipedia.util.StringUtil.emptyIfNull;
 
 public class CardLargeHeaderViewTest extends ViewTest {
 private CardLargeHeaderView subject;
@@ -61,10 +59,9 @@
 }
 
 @Theory public void testSetTitle(@TestedOn(ints = {0,
-R.string.reading_list_name_sample}) int title) {
-setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, 0, title);
-TextView text = findById(subject, R.id.view_card_header_large_title);
-assertThat(text.getText().toString(), is(emptyIfNull(str(title;
+R.string.reading_list_name_sample}) int text) {
+setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, 0, text);
+assertText(subject, R.id.view_card_header_large_title, text);
 }
 
 @Test public void testOnClickListener() {
diff --git a/app/src/androidTest/java/org/wikipedia/test/ViewTest.java 
b/app/src/androidTest/java/org/wikipedia/test/ViewTest.java
index bafc199..9adc32b 100644
--- a/app/src/androidTest/java/org/wikipedia/test/ViewTest.java
+++ b/app/src/androidTest/java/org/wikipedia/test/ViewTest.java
@@ -6,6 +6,7 @@
 import android.os.Build;
 import android.os.LocaleList;
 import android.support.annotation.DrawableRes;
+import android.support.annotation.IdRes;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
 import android.support.annotation.StringRes;
@@ -14,6 +15,7 @@
 import android.support.v4.view.ViewCompat;
 import android.support.v7.view.ContextThemeWrapper;
 import android.view.View;
+import android.widget.TextView;
 
 import com.facebook.common.util.UriUtil;
 import com.facebook.testing.screenshot.Screenshot;
@@ -29,6 +31,11 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
+
+import static butterknife.ButterKnife.findById;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.wikipedia.util.StringUtil.emptyIfNull;
 
 @RunWith(Theories.class) public abstract class ViewTest {
 protected static final int WIDTH_DP_XL = 720;
@@ -91,6 +98,11 @@
 Screenshot.snap(subject).setName(testName(list)).record();
 }
 
+protected void assertText(@NonNull View subject, @IdRes int id, @StringRes 
int text) {
+TextView textView = findById(subject, id);
+assertThat(textView.getText().toString(), is(emptyIfNull(str(text;
+}
+
 protected void runOnMainSync(@NonNull Runnable runnable) {
 InstrumentationRegistry.getInstrumentation().runOnMainSync(runnable);
 }

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

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

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Test null listener in CardLargeHeaderViewTest

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

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

Change subject: Test null listener in CardLargeHeaderViewTest
..

Test null listener in CardLargeHeaderViewTest

Change-Id: I34d32e4708fc01d1c5627ccb45eee9aa9a646dba
---
M app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
1 file changed, 5 insertions(+), 4 deletions(-)


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

diff --git 
a/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java 
b/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
index 83123a1..95328fb 100644
--- 
a/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
+++ 
b/app/src/androidTest/java/org/wikipedia/feed/view/CardLargeHeaderViewTest.java
@@ -5,7 +5,6 @@
 import android.support.annotation.StringRes;
 import android.view.View;
 
-import org.junit.Test;
 import org.junit.experimental.theories.Theory;
 import org.junit.experimental.theories.suppliers.TestedOn;
 import org.wikipedia.R;
@@ -64,14 +63,16 @@
 assertText(subject, R.id.view_card_header_large_title, text);
 }
 
-@Test public void testOnClickListener() {
+@Theory public void testOnClickListener(@TestedOn(ints = {0, 1}) int 
nonnull) {
 setUp(WIDTH_DP_L, LayoutDirection.LOCALE, 1, Theme.LIGHT, 
R.drawable.checkerboard,
 R.string.reading_list_name_sample);
 
-OnClickListener listener = mock(View.OnClickListener.class);
+OnClickListener listener = nonnull == 0 ? null : 
mock(View.OnClickListener.class);
 subject.onClickListener(listener);
 subject.performClick();
-verify(listener);
+if (listener != null) {
+verify(listener);
+}
 }
 
 private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection, 
float fontScale,

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

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

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


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6

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

Change subject: Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6
..


Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6

Change-Id: I8bbfd9e07d0a9f5bfa8f28b44c183ebeb9454182
---
M wmf-config/CommonSettings.php
M wmf-config/db-codfw.php
M wmf-config/db-eqiad.php
3 files changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index cfba96c..31c03da 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -225,7 +225,7 @@
 $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;
+$wgAPIMaxLagThreshold = 3;
 
 ini_set( 'memory_limit', $wmgMemoryLimit );
 
diff --git a/wmf-config/db-codfw.php b/wmf-config/db-codfw.php
index 8ced6aa..68ad197 100644
--- a/wmf-config/db-codfw.php
+++ b/wmf-config/db-codfw.php
@@ -164,7 +164,7 @@
'password'=> $wgDBpassword,
'type'=> 'mysql',
'flags'   => DBO_DEFAULT,
-   'max lag' => 8, // should be safely less than 
$wgCdnReboundPurgeDelay
+   'max lag' => 6, // should be safely less than 
$wgCdnReboundPurgeDelay
'variables'   => [
'innodb_lock_wait_timeout' => 15
]
diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php
index 4951b5b..a92ee59 100644
--- a/wmf-config/db-eqiad.php
+++ b/wmf-config/db-eqiad.php
@@ -185,7 +185,7 @@
'password'=> $wgDBpassword,
'type'=> 'mysql',
'flags'   => DBO_DEFAULT,
-   'max lag' => 8, // should be safely less than 
$wgCdnReboundPurgeDelay
+   'max lag' => 6, // should be safely less than 
$wgCdnReboundPurgeDelay
'variables'   => [
'innodb_lock_wait_timeout' => 15
]

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8bbfd9e07d0a9f5bfa8f28b44c183ebeb9454182
Gerrit-PatchSet: 1
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]: Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6

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

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

Change subject: Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6
..

Set $wgAPIMaxLagThreshold => 3 and "max lag" => 6

Change-Id: I8bbfd9e07d0a9f5bfa8f28b44c183ebeb9454182
---
M wmf-config/CommonSettings.php
M wmf-config/db-codfw.php
M wmf-config/db-eqiad.php
3 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index cfba96c..31c03da 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -225,7 +225,7 @@
 $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;
+$wgAPIMaxLagThreshold = 3;
 
 ini_set( 'memory_limit', $wmgMemoryLimit );
 
diff --git a/wmf-config/db-codfw.php b/wmf-config/db-codfw.php
index 8ced6aa..68ad197 100644
--- a/wmf-config/db-codfw.php
+++ b/wmf-config/db-codfw.php
@@ -164,7 +164,7 @@
'password'=> $wgDBpassword,
'type'=> 'mysql',
'flags'   => DBO_DEFAULT,
-   'max lag' => 8, // should be safely less than 
$wgCdnReboundPurgeDelay
+   'max lag' => 6, // should be safely less than 
$wgCdnReboundPurgeDelay
'variables'   => [
'innodb_lock_wait_timeout' => 15
]
diff --git a/wmf-config/db-eqiad.php b/wmf-config/db-eqiad.php
index 4951b5b..a92ee59 100644
--- a/wmf-config/db-eqiad.php
+++ b/wmf-config/db-eqiad.php
@@ -185,7 +185,7 @@
'password'=> $wgDBpassword,
'type'=> 'mysql',
'flags'   => DBO_DEFAULT,
-   'max lag' => 8, // should be safely less than 
$wgCdnReboundPurgeDelay
+   'max lag' => 6, // should be safely less than 
$wgCdnReboundPurgeDelay
'variables'   => [
'innodb_lock_wait_timeout' => 15
]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bbfd9e07d0a9f5bfa8f28b44c183ebeb9454182
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]: wdqs - make RWStore configuration file configureable

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

Change subject: wdqs - make RWStore configuration file configureable
..


wdqs - make RWStore configuration file configureable

To use scap based configuration management, we need to point blazegraph
at the location of the generated file. This is does not change the config
file yet, but it provides the required parameters to do it in the future.

* wdqs::service::config_file can be used to set the location of the
  blazegraph config
* /etc/wdqs is made writeable to the deploy user so that the config file
  can be written by scap
* wdqs::version is removed as it is unused

Bug: T144380
Change-Id: Ib214b857dd46b725afa974232a6e6b8537342e8a
---
M hieradata/labs/wikidata-query/common.yaml
M modules/wdqs/.fixtures.yml
M modules/wdqs/manifests/init.pp
M modules/wdqs/manifests/service.pp
A modules/wdqs/spec/classes/wdqs_service_spec.rb
A modules/wdqs/spec/classes/wdqs_spec.rb
M modules/wdqs/templates/initscripts/wdqs-blazegraph.systemd.erb
M modules/wdqs/templates/initscripts/wdqs-blazegraph.upstart.erb
8 files changed, 68 insertions(+), 12 deletions(-)

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



diff --git a/hieradata/labs/wikidata-query/common.yaml 
b/hieradata/labs/wikidata-query/common.yaml
index 445e514..10e0830 100644
--- a/hieradata/labs/wikidata-query/common.yaml
+++ b/hieradata/labs/wikidata-query/common.yaml
@@ -1,6 +1,6 @@
 "wdqs::gui::log_aggregator":  
'deployment-logstash2.deployment-prep.eqiad.wmflabs:10514'
 "wdqs::updater::options": '-n wdq -s'
-"wdqs::service::use_git_deploy": false
+"wdqs::use_git_deploy": false
 "wdqs::package_dir": '/srv/wdqs/blazegraph'
 "wdqs::data_dir": '/srv/wdqs/blazegraph'
 
diff --git a/modules/wdqs/.fixtures.yml b/modules/wdqs/.fixtures.yml
index 97bb046..a568185 100644
--- a/modules/wdqs/.fixtures.yml
+++ b/modules/wdqs/.fixtures.yml
@@ -3,7 +3,9 @@
 wdqs: "#{source_dir}"
 base: "../../../../base"
 diamond: "../../../../diamond"
+ferm: "../../../../ferm"
 java: "../../../../java"
 monitoring: "../../../../monitoring"
+scap: "../../../../scap"
 stdlib: "../../../../stdlib"
 wmflib: "../../../../wmflib"
diff --git a/modules/wdqs/manifests/init.pp b/modules/wdqs/manifests/init.pp
index ae1cf15..c1da181 100644
--- a/modules/wdqs/manifests/init.pp
+++ b/modules/wdqs/manifests/init.pp
@@ -4,18 +4,19 @@
 # for now a manual process.
 #
 # == Parameters:
-# - $version: Version of the service to install
 # - $username: Username owning the service
 # - $package_dir:  Directory where the service should be installed.
 # - $data_dir: Directory where the database should be stored
 # - $log_dir: Directory where the logs go
 class wdqs(
-$version = '0.0.2',
+$use_git_deploy = true,
 $username = 'blazegraph',
 $package_dir = '/srv/deployment/wdqs/wdqs',
 $data_dir = '/var/lib/wdqs',
 $log_dir = '/var/log/wdqs',
 ) {
+
+$deploy_user = 'deploy-service'
 
 group { $username:
 ensure => present,
@@ -61,11 +62,16 @@
 }
 }
 
+$config_dir_group = $use_git_deploy ? {
+true=> $deploy_user,
+default => 'root',
+}
+
 file { '/etc/wdqs':
 ensure => directory,
 owner  => 'root',
-group  => 'root',
-mode   => '0755',
+group  => $config_dir_group,
+mode   => '0775',
 }
 
 file { '/etc/wdqs/vars.yaml':
@@ -90,7 +96,7 @@
 # Deployment
 scap::target { 'wdqs/wdqs':
 service_name => 'wdqs-blazegraph',
-deploy_user  => 'deploy-service',
+deploy_user  => $deploy_user,
 manage_user  => true,
 }
 }
diff --git a/modules/wdqs/manifests/service.pp 
b/modules/wdqs/manifests/service.pp
index f8f65b2..ee27ebb 100644
--- a/modules/wdqs/manifests/service.pp
+++ b/modules/wdqs/manifests/service.pp
@@ -3,13 +3,14 @@
 # Provisions WDQS service package
 #
 class wdqs::service(
-$use_git_deploy=true,
 $package_dir=$::wdqs::package_dir,
-$username=$::wdqs::username
-) {
+$username=$::wdqs::username,
+$config_file='RWStore.properties',
+) {
+
 include ::wdqs::packages
 
-if $use_git_deploy {
+if $::wdqs::use_git_deploy {
 
 package { 'wdqs':
 ensure   => present,
diff --git a/modules/wdqs/spec/classes/wdqs_service_spec.rb 
b/modules/wdqs/spec/classes/wdqs_service_spec.rb
new file mode 100644
index 000..ebf078a
--- /dev/null
+++ b/modules/wdqs/spec/classes/wdqs_service_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe 'wdqs::service', :type => :class do
+
+  context 'with systemd' do
+let(:facts) { { :initsystem => 'systemd' } }
+
+it { is_expected.to 
contain_file('/lib/systemd/system/wdqs-blazegraph.service')
+  .with_content(/runBlazegraph.sh -f RWStore.properties/)
+
+}
+  end
+
+  context 'with upstart' do
+let(:facts) { { :initsystem => 

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.19]: Partially reverting I8e684f06 to restore some legacy behavior

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

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

Change subject: Partially reverting I8e684f06 to restore some legacy behavior
..

Partially reverting I8e684f06 to restore some legacy behavior

Apparently some calls to getDateCond() expect it to not set an offset.
Also, removing some of the new tests that no longer work since they
don't pass all the required parameters. (Before I8e684f06, the year
and month were both required parameters.)

Bug: T145597
Change-Id: I3a90b3da48e49ec9723b7100a7d92146154f74e3
---
M includes/pager/ReverseChronologicalPager.php
M tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
2 files changed, 12 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/310478/1

diff --git a/includes/pager/ReverseChronologicalPager.php 
b/includes/pager/ReverseChronologicalPager.php
index af6d039..4895b4f 100644
--- a/includes/pager/ReverseChronologicalPager.php
+++ b/includes/pager/ReverseChronologicalPager.php
@@ -64,12 +64,12 @@
/**
 * Set and return the mOffset timestamp such that we can get all 
revisions with
 * a timestamp up to the specified parameters.
-* @param int $year [optional] Year up to which we want revisions. 
Default is current year.
-* @param int $month [optional] Month up to which we want revisions. 
Default is end of year.
+* @param int $year Year up to which we want revisions
+* @param int $month Month up to which we want revisions
 * @param int $day [optional] Day up to which we want revisions. 
Default is end of month.
-* @return string Timestamp
+* @return string|null Timestamp or null if year and month are 
false/invalid
 */
-   function getDateCond( $year = -1, $month = -1, $day = -1 ) {
+   function getDateCond( $year, $month, $day = -1 ) {
$year = intval( $year );
$month = intval( $month );
$day = intval( $day );
@@ -78,6 +78,11 @@
$this->mYear = $year > 0 ? $year : false;
$this->mMonth = ( $month > 0 && $month < 13 ) ? $month : false;
 
+   // If year and month are false, don't update the mOffset
+   if ( !$this->mYear && !$this->mMonth ) {
+   return;
+   }
+
// Given an optional year, month, and day, we need to generate 
a timestamp
// to use as "WHERE rev_timestamp <= result"
// Examples: year = 2006  equals < 20070101 (+00)
diff --git a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php 
b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
index 824b5c4..fc5d660 100644
--- a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
+++ b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
@@ -19,14 +19,9 @@
 
$currYear = $timestamp->format( 'Y' );
$currMonth = $timestamp->format( 'n' );
-   $currYearTimestamp = $db->timestamp( $currYear + 1 . 
'010100' );
 
// Test that getDateCond sets and returns mOffset
-   $this->assertEquals( $pager->getDateCond( 2006 ), 
$pager->mOffset );
-
-   // Test year
-   $pager->getDateCond( 2006 );
-   $this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
+   $this->assertEquals( $pager->getDateCond( 2006, 6 ), 
$pager->mOffset );
 
// Test year and month
$pager->getDateCond( 2006, 6 );
@@ -44,21 +39,13 @@
$pager->getDateCond( 2006, 6, 30 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
 
-   // Test invalid year (should use current year)
-   $pager->getDateCond( -1337 );
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
-
-   // Test invalid month
+   // Test invalid month (should use end of year)
$pager->getDateCond( 2006, -1 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
 
-   // Test invalid day
+   // Test invalid day (should use end of month)
$pager->getDateCond( 2006, 6, 1337 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
-
-   // Test no year or month (should use end of current year)
-   $pager->getDateCond();
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
 
// Test last day of year
$pager->getDateCond( 2006, 12, 31 );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Partially reverting I8e684f06 to restore some legacy behavior

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

Change subject: Partially reverting I8e684f06 to restore some legacy behavior
..


Partially reverting I8e684f06 to restore some legacy behavior

Apparently some calls to getDateCond() expect it to not set an offset.
Also, removing some of the new tests that no longer work since they
don't pass all the required parameters. (Before I8e684f06, the year
and month were both required parameters.)

Bug: T145597
Change-Id: I3a90b3da48e49ec9723b7100a7d92146154f74e3
---
M includes/pager/ReverseChronologicalPager.php
M tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
2 files changed, 12 insertions(+), 20 deletions(-)

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



diff --git a/includes/pager/ReverseChronologicalPager.php 
b/includes/pager/ReverseChronologicalPager.php
index af6d039..4895b4f 100644
--- a/includes/pager/ReverseChronologicalPager.php
+++ b/includes/pager/ReverseChronologicalPager.php
@@ -64,12 +64,12 @@
/**
 * Set and return the mOffset timestamp such that we can get all 
revisions with
 * a timestamp up to the specified parameters.
-* @param int $year [optional] Year up to which we want revisions. 
Default is current year.
-* @param int $month [optional] Month up to which we want revisions. 
Default is end of year.
+* @param int $year Year up to which we want revisions
+* @param int $month Month up to which we want revisions
 * @param int $day [optional] Day up to which we want revisions. 
Default is end of month.
-* @return string Timestamp
+* @return string|null Timestamp or null if year and month are 
false/invalid
 */
-   function getDateCond( $year = -1, $month = -1, $day = -1 ) {
+   function getDateCond( $year, $month, $day = -1 ) {
$year = intval( $year );
$month = intval( $month );
$day = intval( $day );
@@ -78,6 +78,11 @@
$this->mYear = $year > 0 ? $year : false;
$this->mMonth = ( $month > 0 && $month < 13 ) ? $month : false;
 
+   // If year and month are false, don't update the mOffset
+   if ( !$this->mYear && !$this->mMonth ) {
+   return;
+   }
+
// Given an optional year, month, and day, we need to generate 
a timestamp
// to use as "WHERE rev_timestamp <= result"
// Examples: year = 2006  equals < 20070101 (+00)
diff --git a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php 
b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
index 824b5c4..fc5d660 100644
--- a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
+++ b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
@@ -19,14 +19,9 @@
 
$currYear = $timestamp->format( 'Y' );
$currMonth = $timestamp->format( 'n' );
-   $currYearTimestamp = $db->timestamp( $currYear + 1 . 
'010100' );
 
// Test that getDateCond sets and returns mOffset
-   $this->assertEquals( $pager->getDateCond( 2006 ), 
$pager->mOffset );
-
-   // Test year
-   $pager->getDateCond( 2006 );
-   $this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
+   $this->assertEquals( $pager->getDateCond( 2006, 6 ), 
$pager->mOffset );
 
// Test year and month
$pager->getDateCond( 2006, 6 );
@@ -44,21 +39,13 @@
$pager->getDateCond( 2006, 6, 30 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
 
-   // Test invalid year (should use current year)
-   $pager->getDateCond( -1337 );
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
-
-   // Test invalid month
+   // Test invalid month (should use end of year)
$pager->getDateCond( 2006, -1 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
 
-   // Test invalid day
+   // Test invalid day (should use end of month)
$pager->getDateCond( 2006, 6, 1337 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
-
-   // Test no year or month (should use end of current year)
-   $pager->getDateCond();
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
 
// Test last day of year
$pager->getDateCond( 2006, 12, 31 );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a90b3da48e49ec9723b7100a7d92146154f74e3

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move PECL memcached class to /libs

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

Change subject: Move PECL memcached class to /libs
..


Move PECL memcached class to /libs

Remove IP class dependency, which is simple enough here

Change-Id: I3aed6ae6747d8d2b9e75b492e5d5293ba4ce9edd
---
M autoload.php
R includes/libs/objectcache/MemcachedPeclBagOStuff.php
2 files changed, 8 insertions(+), 2 deletions(-)

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



diff --git a/autoload.php b/autoload.php
index 71f1809..309a7d0 100644
--- a/autoload.php
+++ b/autoload.php
@@ -910,7 +910,7 @@
'MemcLockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/MemcLockManager.php',
'MemcachedBagOStuff' => __DIR__ . 
'/includes/libs/objectcache/MemcachedBagOStuff.php',
'MemcachedClient' => __DIR__ . 
'/includes/libs/objectcache/MemcachedClient.php',
-   'MemcachedPeclBagOStuff' => __DIR__ . 
'/includes/objectcache/MemcachedPeclBagOStuff.php',
+   'MemcachedPeclBagOStuff' => __DIR__ . 
'/includes/libs/objectcache/MemcachedPeclBagOStuff.php',
'MemcachedPhpBagOStuff' => __DIR__ . 
'/includes/libs/objectcache/MemcachedPhpBagOStuff.php',
'MemoizedCallable' => __DIR__ . '/includes/libs/MemoizedCallable.php',
'MemoryFileBackend' => __DIR__ . 
'/includes/filebackend/MemoryFileBackend.php',
diff --git a/includes/objectcache/MemcachedPeclBagOStuff.php 
b/includes/libs/objectcache/MemcachedPeclBagOStuff.php
similarity index 96%
rename from includes/objectcache/MemcachedPeclBagOStuff.php
rename to includes/libs/objectcache/MemcachedPeclBagOStuff.php
index aefda79..5983c1b 100644
--- a/includes/objectcache/MemcachedPeclBagOStuff.php
+++ b/includes/libs/objectcache/MemcachedPeclBagOStuff.php
@@ -115,7 +115,13 @@
}
$servers = [];
foreach ( $params['servers'] as $host ) {
-   $servers[] = IP::splitHostAndPort( $host ); // (ip, 
port)
+   if ( preg_match( '/^\[(.+)\]:(\d+)$/', $host, $m ) ) {
+   $servers[] = [ $m[1], (int)$m[2] ]; // (ip, 
port)
+   } elseif ( preg_match( '/^([^:]+):(\d+)$/', $host, $m ) 
) {
+   $servers[] = [ $m[1], (int)$m[2] ]; // (ip or 
path, port)
+   } else {
+   $servers[] = [ $host, false ]; // (ip or path, 
port)
+   }
}
$this->client->addServers( $servers );
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3aed6ae6747d8d2b9e75b492e5d5293ba4ce9edd
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: BryanDavis 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add ILoadBalancer interface

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

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

Change subject: Add ILoadBalancer interface
..

Add ILoadBalancer interface

Remove redundant LoadBalancer docs (those without @since).

Change-Id: I981177b6854cfdbea4a51b6db7e365dac0da258a
---
M autoload.php
M includes/db/loadbalancer/LoadBalancer.php
2 files changed, 14 insertions(+), 203 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/77/310477/1

diff --git a/autoload.php b/autoload.php
index 71f1809..c48e172 100644
--- a/autoload.php
+++ b/autoload.php
@@ -580,6 +580,7 @@
'IEUrlExtension' => __DIR__ . '/includes/libs/IEUrlExtension.php',
'IExpiringStore' => __DIR__ . 
'/includes/libs/objectcache/IExpiringStore.php',
'IJobSpecification' => __DIR__ . 
'/includes/jobqueue/JobSpecification.php',
+   'ILoadBalancer' => __DIR__ . 
'/includes/db/loadbalancer/ILoadBalancer.php',
'IP' => __DIR__ . '/includes/utils/IP.php',
'IPSet' => __DIR__ . '/includes/compat/IPSetCompat.php',
'IPTC' => __DIR__ . '/includes/media/IPTC.php',
diff --git a/includes/db/loadbalancer/LoadBalancer.php 
b/includes/db/loadbalancer/LoadBalancer.php
index a02c759..cedb133 100644
--- a/includes/db/loadbalancer/LoadBalancer.php
+++ b/includes/db/loadbalancer/LoadBalancer.php
@@ -27,7 +27,7 @@
  * @todo document
  * @ingroup Database
  */
-class LoadBalancer {
+class LoadBalancer implements ILoadBalancer {
/** @var array[] Map of (server index => server config array) */
private $mServers;
/** @var array[] Map of (local/foreignUsed/foreignFree => server index 
=> DatabaseBase array) */
@@ -40,8 +40,6 @@
private $mAllowLagged;
/** @var integer Seconds to spend waiting on replica DB lag to resolve 
*/
private $mWaitTimeout;
-   /** @var array LBFactory information */
-   private $mParentInfo;
 
/** @var string The LoadMonitor subclass name */
private $mLoadMonitorClass;
@@ -93,18 +91,6 @@
 */
private $disabled = false;
 
-   /**
-* @param array $params Array with keys:
-*  - servers : Required. Array of server info structures.
-*  - loadMonitor : Name of a class used to fetch server lag and load.
-*  - readOnlyReason : Reason the master DB is read-only if so 
[optional]
-*  - waitTimeout : Maximum time to wait for replicas for consistency 
[optional]
-*  - srvCache : BagOStuff object [optional]
-*  - wanCache : WANObjectCache object [optional]
-*  - localDomain: The wiki ID of the "local"/"current" wiki [optional]
-*  - errorLogger: Callback that takes an Exception and logs it 
[optional]
-* @throws MWException
-*/
public function __construct( array $params ) {
if ( !isset( $params['servers'] ) ) {
throw new MWException( __CLASS__ . ': missing servers 
parameter' );
@@ -116,7 +102,6 @@
$this->localDomain = isset( $params['localDomain'] ) ? 
$params['localDomain'] : '';
 
$this->mReadIndex = -1;
-   $this->mWriteIndex = -1;
$this->mConns = [
'local' => [],
'foreignUsed' => [],
@@ -241,17 +226,6 @@
return ArrayUtils::pickRandom( $loads );
}
 
-   /**
-* Get the index of the reader connection, which may be a replica DB
-* This takes into account load ratios and lag times. It should
-* always return a consistent index during a given invocation
-*
-* Side effect: opens connections to databases
-* @param string|bool $group Query group, or false for the generic 
reader
-* @param string|bool $wiki Wiki ID, or false for the current wiki
-* @throws MWException
-* @return bool|int|string
-*/
public function getReaderIndex( $group = false, $wiki = false ) {
if ( count( $this->mServers ) == 1 ) {
# Skip the load balancing if there's only one server
@@ -371,12 +345,6 @@
return $i;
}
 
-   /**
-* Set the master wait position
-* If a DB_REPLICA connection has been opened already, waits
-* Otherwise sets a variable telling it to wait if such a connection is 
opened
-* @param DBMasterPos $pos
-*/
public function waitFor( $pos ) {
$this->mWaitForPos = $pos;
$i = $this->mReadIndex;
@@ -419,12 +387,6 @@
return $ok;
}
 
-   /**
-* Set the master wait position and wait for ALL replica DBs to catch 
up to it
-* @param DBMasterPos $pos
-* @param int $timeout Max seconds to wait; default is mWaitTimeout
-* @return bool Success (able to connect and no timeouts reached)
-  

[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Add document versioning to FullyFeaturedConfig.php

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

Change subject: Add document versioning to FullyFeaturedConfig.php
..


Add document versioning to FullyFeaturedConfig.php

This must not be merged until vagrant is updated with a new version
of the search-extra plugin that supports document versioning, or
cindy will break.

Bug: T144039
Change-Id: I43f96b11b9b7bab444b2ddd6433ab4472c40225b
---
M tests/jenkins/FullyFeaturedConfig.php
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/tests/jenkins/FullyFeaturedConfig.php 
b/tests/jenkins/FullyFeaturedConfig.php
index fc3bc8d..bfc87bd 100644
--- a/tests/jenkins/FullyFeaturedConfig.php
+++ b/tests/jenkins/FullyFeaturedConfig.php
@@ -31,6 +31,7 @@
 $wgCirrusSearchQueryStringMaxDeterminizedStates = 500;
 $wgCirrusSearchWikimediaExtraPlugin[ 'super_detect_noop' ] = true;
 $wgCirrusSearchWikimediaExtraPlugin[ 'id_hash_mod_filter' ] = true;
+$wgCirrusSearchWikimediaExtraPlugin[ 'documentVersion' ] = true;
 
 $wgCirrusSearchUseCompletionSuggester = 'yes';
 $wgCirrusSearchCompletionSuggesterUseDefaultSort = true;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I43f96b11b9b7bab444b2ddd6433ab4472c40225b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson 
Gerrit-Reviewer: Cindy-the-browser-test-bot 
Gerrit-Reviewer: DCausse 
Gerrit-Reviewer: EBernhardson 
Gerrit-Reviewer: Gehel 
Gerrit-Reviewer: Manybubbles 
Gerrit-Reviewer: Smalyshev 
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]: Partially reverting I8e684f06 to restore some legacy behavior

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

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

Change subject: Partially reverting I8e684f06 to restore some legacy behavior
..

Partially reverting I8e684f06 to restore some legacy behavior

Apparently some calls to getDateCond() expect it to not set an offset.

Bug: T145597
Change-Id: I3a90b3da48e49ec9723b7100a7d92146154f74e3
---
M includes/pager/ReverseChronologicalPager.php
M tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
2 files changed, 19 insertions(+), 22 deletions(-)


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

diff --git a/includes/pager/ReverseChronologicalPager.php 
b/includes/pager/ReverseChronologicalPager.php
index af6d039..4895b4f 100644
--- a/includes/pager/ReverseChronologicalPager.php
+++ b/includes/pager/ReverseChronologicalPager.php
@@ -64,12 +64,12 @@
/**
 * Set and return the mOffset timestamp such that we can get all 
revisions with
 * a timestamp up to the specified parameters.
-* @param int $year [optional] Year up to which we want revisions. 
Default is current year.
-* @param int $month [optional] Month up to which we want revisions. 
Default is end of year.
+* @param int $year Year up to which we want revisions
+* @param int $month Month up to which we want revisions
 * @param int $day [optional] Day up to which we want revisions. 
Default is end of month.
-* @return string Timestamp
+* @return string|null Timestamp or null if year and month are 
false/invalid
 */
-   function getDateCond( $year = -1, $month = -1, $day = -1 ) {
+   function getDateCond( $year, $month, $day = -1 ) {
$year = intval( $year );
$month = intval( $month );
$day = intval( $day );
@@ -78,6 +78,11 @@
$this->mYear = $year > 0 ? $year : false;
$this->mMonth = ( $month > 0 && $month < 13 ) ? $month : false;
 
+   // If year and month are false, don't update the mOffset
+   if ( !$this->mYear && !$this->mMonth ) {
+   return;
+   }
+
// Given an optional year, month, and day, we need to generate 
a timestamp
// to use as "WHERE rev_timestamp <= result"
// Examples: year = 2006  equals < 20070101 (+00)
diff --git a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php 
b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
index 824b5c4..ed7ec0c 100644
--- a/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
+++ b/tests/phpunit/includes/pager/ReverseChronologicalPagerTest.php
@@ -19,14 +19,9 @@
 
$currYear = $timestamp->format( 'Y' );
$currMonth = $timestamp->format( 'n' );
-   $currYearTimestamp = $db->timestamp( $currYear + 1 . 
'010100' );
 
// Test that getDateCond sets and returns mOffset
-   $this->assertEquals( $pager->getDateCond( 2006 ), 
$pager->mOffset );
-
-   // Test year
-   $pager->getDateCond( 2006 );
-   $this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
+   $this->assertEquals( $pager->getDateCond( 2006, 6 ), 
$pager->mOffset );
 
// Test year and month
$pager->getDateCond( 2006, 6 );
@@ -44,21 +39,18 @@
$pager->getDateCond( 2006, 6, 30 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
 
-   // Test invalid year (should use current year)
-   $pager->getDateCond( -1337 );
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
-
-   // Test invalid month
+   // Test invalid month (should use end of year)
$pager->getDateCond( 2006, -1 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2007010100' ) );
 
-   // Test invalid day
+   // Test invalid day (should use end of month)
$pager->getDateCond( 2006, 6, 1337 );
$this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006070100' ) );
 
-   // Test no year or month (should use end of current year)
-   $pager->getDateCond();
-   $this->assertEquals( $pager->mOffset, $currYearTimestamp );
+   // Test year and month set to false. mOffset should stay the 
same.
+   $pager->getDateCond( 2006, 7, 23 );
+   $pager->getDateCond( false, false );
+   $this->assertEquals( $pager->mOffset, $db->timestamp( 
'2006072400' ) );
 
// Test last day of year
$pager->getDateCond( 2006, 12, 31 );
@@ -69,9 +61,9 @@
$this->assertEquals( 

[MediaWiki-commits] [Gerrit] mediawiki/vagrant[master]: Upgrade to elastic 2.3.5

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

Change subject: Upgrade to elastic 2.3.5
..


Upgrade to elastic 2.3.5

Bug: T145404
Change-Id: Ibbaa6c79dbc810803389120dc280c448db6f2d71
---
M puppet/modules/elasticsearch/manifests/init.pp
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/puppet/modules/elasticsearch/manifests/init.pp 
b/puppet/modules/elasticsearch/manifests/init.pp
index b586475..fa6ad0e 100644
--- a/puppet/modules/elasticsearch/manifests/init.pp
+++ b/puppet/modules/elasticsearch/manifests/init.pp
@@ -4,7 +4,7 @@
 # engine, much like Solr, but with a more user-friendly inteface.
 #
 class elasticsearch {
-$version = '2.3.4'
+$version = '2.3.5'
 
 package { 'elasticsearch':
 ensure => $version

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibbaa6c79dbc810803389120dc280c448db6f2d71
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: DCausse 
Gerrit-Reviewer: BryanDavis 
Gerrit-Reviewer: Dduvall 
Gerrit-Reviewer: EBernhardson 
Gerrit-Reviewer: Gehel 
Gerrit-Reviewer: Smalyshev 
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]: chromium: Ubuntu and Debian compatibility

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

Change subject: chromium: Ubuntu and Debian compatibility
..


chromium: Ubuntu and Debian compatibility

Add Debian (jessie) / systemd compatibility for chromium.

The package name is different on Ubuntu vs. Debian.

And we need a unit file for systemd. 

Bug: T141023
Change-Id: I87affcc0877aa095c1696f79408bfc0fa9b9b465
---
M modules/chromium/manifests/init.pp
A modules/chromium/templates/chromium.systemd.unit.erb
2 files changed, 49 insertions(+), 9 deletions(-)

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



diff --git a/modules/chromium/manifests/init.pp 
b/modules/chromium/manifests/init.pp
index d83f6d6..2d5ec49 100644
--- a/modules/chromium/manifests/init.pp
+++ b/modules/chromium/manifests/init.pp
@@ -53,20 +53,41 @@
 managehome => true,
 }
 
-package { [ 'chromium-browser', 'chromium-browser-l10n' ]:
-ensure => $ensure,
-notify => Service['chromium'],
+if $::operatingsystem == 'Debian' {
+package { [ 'chromium', 'chromium-l10n' ]:
+ensure => $ensure,
+notify => Service['chromium'],
+}
 }
 
-file { '/etc/init/chromium.conf':
-ensure  => $ensure,
-content => template('chromium/chromium.conf.erb'),
-require => User['chromium'],
-notify  => Service['chromium'],
+if $::operatingsystem == 'Ubuntu' {
+package { [ 'chromium-browser', 'chromium-browser-l10n' ]:
+ensure => $ensure,
+notify => Service['chromium'],
+}
 }
 
+if $::initsystem == 'upstart' {
+
+file { '/etc/init/chromium.conf':
+ensure  => $ensure,
+content => template('chromium/chromium.conf.erb'),
+require => User['chromium'],
+notify  => Service['chromium'],
+}
+}
+
+if $::initsystem == 'systemd' {
+
+file { '/etc/systemd/system/chromium.service':
+ensure  => $ensure,
+content => template('chromium/chromium.systemd.unit.erb'),
+require => User['chromium'],
+notify  => Service['chromium'],
+}
+}
 service { 'chromium':
 ensure   => ensure_service($ensure),
-provider => 'upstart',
+provider => $::initsystem,
 }
 }
diff --git a/modules/chromium/templates/chromium.systemd.unit.erb 
b/modules/chromium/templates/chromium.systemd.unit.erb
new file mode 100644
index 000..35435ea
--- /dev/null
+++ b/modules/chromium/templates/chromium.systemd.unit.erb
@@ -0,0 +1,19 @@
+[Unit]
+Description="Chromium web browser"
+
+After=xvfb.service
+
+[Service]
+User=chromium
+Group=chromium
+
+Restart=always
+
+ExecStart=/usr/bin/chromium \
+<% if @incognito %>--incognito<% end %> \
+--remote-debugging-port=<%= @remote_debugging_port %> \
+--display=:<%= @display.to_s.sub(/\D/, '') %> \
+<%= Array(@extra_args).join(" \\\n") %>
+
+[Install]
+WantedBy=multi-user.target

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I87affcc0877aa095c1696f79408bfc0fa9b9b465
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Faidon Liambotis 
Gerrit-Reviewer: Ori.livneh 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Only set position_increment_gap on fields where positions ar...

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

Change subject: Only set position_increment_gap on fields where positions are 
stored
..


Only set position_increment_gap on fields where positions are stored

This is now a requirement, we cannot set this mapping value for :
- non indexed fields
- non analyzed fields
- analyzed fields with index_options set to freqs or docs

Bug: T145405
Change-Id: I06c799adb9ecef0c9ce4bc2edaef327ce6586fbd
---
M includes/Maintenance/MappingConfigBuilder.php
M includes/Search/TextIndexField.php
2 files changed, 0 insertions(+), 3 deletions(-)

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



diff --git a/includes/Maintenance/MappingConfigBuilder.php 
b/includes/Maintenance/MappingConfigBuilder.php
index aee0d29..edaeb7a 100644
--- a/includes/Maintenance/MappingConfigBuilder.php
+++ b/includes/Maintenance/MappingConfigBuilder.php
@@ -233,7 +233,6 @@
'type' => 'string',
'analyzer' => 'near_match',
'index_options' => 'freqs',
-   'position_increment_gap' => 
TextIndexField::POSITION_INCREMENT_GAP,
'norms' => [ 'enabled' => false ],
'similarity' => TextIndexField::getSimilarity( 
$this->config, 'all_near_match' ),
'fields' => [
@@ -241,7 +240,6 @@
'type' => 'string',
'analyzer' => 
'near_match_asciifolding',
'index_options' => 'freqs',
-   'position_increment_gap' => 
TextIndexField::POSITION_INCREMENT_GAP,
'norms' => [ 'enabled' => false 
],
'similarity' => 
TextIndexField::getSimilarity( $this->config, 'all_near_match', 'asciifolding' 
),
],
diff --git a/includes/Search/TextIndexField.php 
b/includes/Search/TextIndexField.php
index 63d1eab..b661c3d 100644
--- a/includes/Search/TextIndexField.php
+++ b/includes/Search/TextIndexField.php
@@ -157,7 +157,6 @@
$field[ 'fields' ][ $extraName ] = array_merge( [
'similarity' => self::getSimilarity( 
$this->config, $this->name, $extraName ),
'type' => 'string',
-   'position_increment_gap' => 
self::POSITION_INCREMENT_GAP,
], $extraField );
if ( $disableNorms ) {
$field[ 'fields' ][ $extraName ] = array_merge(

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I06c799adb9ecef0c9ce4bc2edaef327ce6586fbd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse 
Gerrit-Reviewer: Cindy-the-browser-test-bot 
Gerrit-Reviewer: EBernhardson 
Gerrit-Reviewer: Gehel 
Gerrit-Reviewer: Manybubbles 
Gerrit-Reviewer: Smalyshev 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Reindexer should not remove unused fields

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

Change subject: Reindexer should not remove unused fields
..


Reindexer should not remove unused fields

The Reindex process uses the elasticsearch mapping to identify
and remove unused fields from indexed documents.
There are cases where we do not want to declare fields in the
mapping:
- version is only used by the super noop script
- defaultsort used only in the completion suggester

Added an option to updateOneSearchIndexConfig to allow setting
an explicit list of fields to cleanup.

Change-Id: If811847d232cdd56d9930eee15f56310f03c65c1
---
M includes/Maintenance/Reindexer.php
M includes/Util.php
M maintenance/updateOneSearchIndexConfig.php
M tests/unit/UtilTest.php
4 files changed, 15 insertions(+), 237 deletions(-)

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



diff --git a/includes/Maintenance/Reindexer.php 
b/includes/Maintenance/Reindexer.php
index 8397a59..cd90962 100644
--- a/includes/Maintenance/Reindexer.php
+++ b/includes/Maintenance/Reindexer.php
@@ -97,6 +97,11 @@
private $out;
 
/**
+* @var string[] list of fields to delete
+*/
+   private $fieldsToDelete;
+
+   /**
 * @param SearchConfig $searchConfig
 * @param Connection $source
 * @param Connection $target
@@ -109,7 +114,7 @@
 * @param Maintenance $out
 * @throws \Exception
 */
-   public function __construct( SearchConfig $searchConfig, Connection 
$source, Connection $target, array $types, array $oldTypes, $shardCount, 
$replicaCount, array $mergeSettings, array $mappingConfig, Maintenance $out = 
null ) {
+   public function __construct( SearchConfig $searchConfig, Connection 
$source, Connection $target, array $types, array $oldTypes, $shardCount, 
$replicaCount, array $mergeSettings, array $mappingConfig, Maintenance $out = 
null, $fieldsToDelete = [] ) {
// @todo: this constructor has too many arguments - refactor!
$this->searchConfig = $searchConfig;
$this->oldConnection = $source;
@@ -121,6 +126,7 @@
$this->mergeSettings = $mergeSettings;
$this->mappingConfig = $mappingConfig;
$this->out = $out;
+   $this->fieldsToDelete = $fieldsToDelete;
 
if ( empty($types) || empty($oldTypes) ) {
throw new \Exception( "Types list should be non-empty" 
);
@@ -304,7 +310,6 @@
$filter = new \CirrusSearch\Extra\Query\IdHashMod( 
$children, $childNumber );
}
$numberOfDocsInOldType = $oldType->count();
-   $properties = 
$this->mappingConfig[$oldType->getName()]['properties'];
$scrollId = null;
try {
$query = new Query();
@@ -354,7 +359,7 @@
 
$documents = [];
foreach( $results as $result ) {
-   $documents[] = $this->buildNewDocument( 
$result, $properties );
+   $documents[] = $this->buildNewDocument( 
$result );
}
 
// We will retry bulk failures by sending index 
operations
@@ -424,11 +429,9 @@
 * @param array $properties mapping properties
 * @return Document
 */
-   private function buildNewDocument( \Elastica\Result $result, array 
$properties ) {
-   // Build the new document to just contain keys which have a 
mapping in the new properties.  To clean
-   // out any old fields that we no longer use.
-   $data = Util::cleanUnusedFields( $result->getSource(), 
$properties );
-
+   private function buildNewDocument( \Elastica\Result $result ) {
+   // FIXME: support inner properties
+   $data = array_diff_key( $result->getSource(), array_flip( 
$this->fieldsToDelete ) );
// This field was added July, 2016. For the first reindex that 
occurs after it was added it will
// not exist in the documents, so add it here.
if ( !isset( $data['wiki'] ) ) {
diff --git a/includes/Util.php b/includes/Util.php
index 94320c4..c2b3030 100644
--- a/includes/Util.php
+++ b/includes/Util.php
@@ -220,48 +220,6 @@
}
 
/**
-* Matches $data against $properties to clear keys that no longer exist.
-* E.g.:
-* $data = array(
-* 'title' => "I'm a title",
-* 'useless' => "I'm useless",
-* );
-* $properties = array(
-* 'title' => 'params-for-title'
-* );
-*
-* Will 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Various dependency injection cleanups to LoadBalancer

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

Change subject: Various dependency injection cleanups to LoadBalancer
..


Various dependency injection cleanups to LoadBalancer

* Inject wfWikiID() and MWExceptionHandler into LoadBalancer.
* Factor out LBFactory duplication into baseLoadBalancerParams().
* Remove $wgDBtype hack. Presumably, sites with others DBs would
  not have multiple servers configured if does not work anyway.
* Make use of injected TransactionProfiler rather than calling
  Profiler::instance()->getTransactionProfiler().
* Avoid use of trivial wfSplitWikiID() function.
* Make DBConnRef enforce its arguments more strongly and
  optimize getWiki() to avoid causing a connection attempt.
* Avoid deprecated method call in LBFactory::destroyInstance().

Change-Id: If134b62d4f48cd68cb48ccbe149e72f12aa26819
---
M includes/db/CloneDatabase.php
M includes/db/DBConnRef.php
M includes/db/loadbalancer/LBFactory.php
M includes/db/loadbalancer/LBFactoryMulti.php
M includes/db/loadbalancer/LBFactorySimple.php
M includes/db/loadbalancer/LBFactorySingle.php
M includes/db/loadbalancer/LoadBalancer.php
7 files changed, 83 insertions(+), 45 deletions(-)

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



diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index 577c98d..cab9438 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -129,8 +129,9 @@
 */
public static function changePrefix( $prefix ) {
global $wgDBprefix;
-   wfGetLBFactory()->forEachLB( function( $lb ) use ( $prefix ) {
-   $lb->forEachOpenConnection( function ( $db ) use ( 
$prefix ) {
+   wfGetLBFactory()->forEachLB( function( LoadBalancer $lb ) use ( 
$prefix ) {
+   $lb->setDomainPrefix( $prefix );
+   $lb->forEachOpenConnection( function ( DatabaseBase $db 
) use ( $prefix ) {
$db->tablePrefix( $prefix );
} );
} );
diff --git a/includes/db/DBConnRef.php b/includes/db/DBConnRef.php
index 9997f2c..8604295 100644
--- a/includes/db/DBConnRef.php
+++ b/includes/db/DBConnRef.php
@@ -17,16 +17,22 @@
/** @var array|null */
private $params;
 
+   const FLD_INDEX = 0;
+   const FLD_GROUP = 1;
+   const FLD_WIKI = 2;
+
/**
 * @param LoadBalancer $lb
-* @param DatabaseBase|array $conn Connection or (server index, group, 
wiki ID) array
+* @param DatabaseBase|array $conn Connection or (server index, group, 
wiki ID)
 */
public function __construct( LoadBalancer $lb, $conn ) {
$this->lb = $lb;
if ( $conn instanceof DatabaseBase ) {
$this->conn = $conn;
-   } else {
+   } elseif ( count( $conn ) >= 3 && $conn[self::FLD_WIKI] !== 
false ) {
$this->params = $conn;
+   } else {
+   throw new InvalidArgumentException( "Missing lazy 
connection arguments." );
}
}
 
@@ -136,6 +142,11 @@
}
 
public function getWikiID() {
+   if ( $this->conn === null ) {
+   // Avoid triggering a connection
+   return $this->params[self::FLD_WIKI];
+   }
+
return $this->__call( __FUNCTION__, func_get_args() );
}
 
diff --git a/includes/db/loadbalancer/LBFactory.php 
b/includes/db/loadbalancer/LBFactory.php
index cd8dff3..df1d948 100644
--- a/includes/db/loadbalancer/LBFactory.php
+++ b/includes/db/loadbalancer/LBFactory.php
@@ -147,7 +147,7 @@
 * @deprecated since 1.27, use LBFactory::destroy()
 */
public static function destroyInstance() {
-   self::singleton()->destroy();
+   
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy();
}
 
/**
@@ -621,6 +621,20 @@
}
 
/**
+* Base parameters to LoadBalancer::__construct()
+*/
+   final protected function baseLoadBalancerParams() {
+   return [
+   'readOnlyReason' => $this->readOnlyReason,
+   'trxProfiler' => $this->trxProfiler,
+   'srvCache' => $this->srvCache,
+   'wanCache' => $this->wanCache,
+   'localDomain' => wfWikiID(),
+   'errorLogger' => [ MWExceptionHandler::class, 
'logException' ]
+   ];
+   }
+
+   /**
 * @param LoadBalancer $lb
 */
protected function initLoadBalancer( LoadBalancer $lb ) {
diff --git a/includes/db/loadbalancer/LBFactoryMulti.php 
b/includes/db/loadbalancer/LBFactoryMulti.php
index e860840..d486e13 100644
--- 

[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: [WIP] Only make hidenondamaging available if damaging is ena...

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

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

Change subject: [WIP] Only make hidenondamaging available if damaging is enabled
..

[WIP] Only make hidenondamaging available if damaging is enabled

Change-Id: Ie45ff1ff57eebb9bff80cc6d809a836429648c89
---
M includes/Hooks.php
1 file changed, 12 insertions(+), 9 deletions(-)


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

diff --git a/includes/Hooks.php b/includes/Hooks.php
index d7faa53..8835165 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -82,25 +82,28 @@
 * @return bool
 */
public static function onChangesListSpecialPageFilters( 
ChangesListSpecialPage $clsp, &$filters ) {
+   global $wgOresModels;
if ( self::oresEnabled( $clsp->getUser() ) === false ) {
return true;
}
 
-   switch ( $clsp->getName() ) {
-   case 'Watchlist':
+   if ( isset( $wgOresModels['damaging'] ) && 
$wgOresModels['damaging'] ) {
+   switch ( $clsp->getName() ) {
+   case 'Watchlist':
$default = $clsp->getUser()->getOption( 
'oresWatchlistHideNonDamaging' );
break;
-   case 'Recentchanges':
+   case 'Recentchanges':
$default = $clsp->getUser()->getOption( 
'oresRCHideNonDamaging' );
break;
-   default:
+   default:
$default = false;
-   }
+   }
 
-   $filters['hidenondamaging'] = [
-   'msg' => 'ores-damaging-filter',
-   'default' => $default,
-   ];
+   $filters['hidenondamaging'] = [
+   'msg' => 'ores-damaging-filter',
+   'default' => $default,
+   ];
+   }
 
return true;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Rename getThreshold() to getDamagingThreshold()

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

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

Change subject: Rename getThreshold() to getDamagingThreshold()
..

Rename getThreshold() to getDamagingThreshold()

Also make it take a User object.

Remove concerns about calling it repeatedly,
the User object caches preferences so it's fine.

Change-Id: I3c1ea2ea9feb93e32372b0a184d3b665ff796df7
---
M includes/Hooks.php
1 file changed, 8 insertions(+), 12 deletions(-)


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

diff --git a/includes/Hooks.php b/includes/Hooks.php
index c4cbd93..d7faa53 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -126,7 +126,7 @@
return true;
}
 
-   $threshold = self::getThreshold();
+   $threshold = self::getDamagingThreshold( $wgUser );
$dbr = \wfGetDB( DB_SLAVE );
 
$tables[] = 'ores_classification';
@@ -250,7 +250,7 @@
return true;
}
 
-   $threshold = self::getThreshold( $pager->getUser() );
+   $threshold = self::getDamagingThreshold( $pager->getUser() );
$dbr = \wfGetDB( DB_SLAVE );
 
$query['tables'][] = 'ores_classification';
@@ -365,14 +365,10 @@
 * @return bool
 */
public static function getScoreRecentChangesList( $rcObj ) {
-
+   global $wgUser;
$threshold = $rcObj->getAttribute( 'ores_threshold' );
if ( $threshold === null ) {
-   // FIXME: What is the impact of this
-   $logger = LoggerFactory::getInstance( 'ORES' );
-   $logger->warning( 'Running low performance actions, ' .
-   'getting threshold for each edit seperately' );
-   $threshold = self::getThreshold();
+   $threshold = self::getDamagingThreshold( $wgUser );
}
$score = $rcObj->getAttribute( 'oresc_probability' );
$patrolled = $rcObj->getAttribute( 'rc_patrolled' );
@@ -382,13 +378,13 @@
 
/**
 * Internal helper to get threshold
-* It's better to avoid using $wgUser as much as possible
+* @param User $user
+* @return int
 */
-   public static function getThreshold() {
+   public static function getDamagingThreshold( User $user ) {
global $wgOresDamagingThresholds;
-   global $wgUser;
 
-   $pref = $wgUser->getOption( 'oresDamagingPref' );
+   $pref = $user->getOption( 'oresDamagingPref' );
 
return $wgOresDamagingThresholds[$pref];
}

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

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

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


[MediaWiki-commits] [Gerrit] wikimedia...golden[master]: Expand "other" countries data

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

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

Change subject: Expand "other" countries data
..

Expand "other" countries data

- Traffic and clickthrough rate by all countries and US regions
- Last action by all countries and US regions
- Most common section clicked per visit by all countries and US regions
- First visit clickthrough by all countries and US regions

Also fixed two bugs in:
- Most common section clicked
- Generate click breakdown (last action): 1) add sort by timestamp 2) delete 
lines which modify raw data

Bug: T138107
Change-Id: I51c8ca4222175d0ba5c1c48d187c9b0bbe8f7a3d
---
M portal/portal.R
1 file changed, 74 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/golden 
refs/changes/73/310473/1

diff --git a/portal/portal.R b/portal/portal.R
index bf8d3b6..475aa00 100644
--- a/portal/portal.R
+++ b/portal/portal.R
@@ -46,7 +46,6 @@
 dplyr::arrange(session, ts) %>%
 dplyr::group_by(session) %>%
 dplyr::mutate(visit = cumsum(type == "landing")) %>%
-dplyr::filter(visit == 1) %>%
 dplyr::filter(type == "clickthrough") %>%
 dplyr::group_by(date, session, visit, section_used) %>%
 dplyr::tally() %>%
@@ -75,10 +74,13 @@
 dplyr::mutate(date = data$date[1]) %>%
 dplyr::select(c(date, `no action`, `primary links`, `search`, `secondary 
links`, `other languages`, `other projects`))
   
-  # Generate click breakdown
-  data <- data[order(data$type, decreasing = FALSE), ]
-  data <- data[!duplicated(data$session), ]
-  breakdown_data <- data[, j = list(events = .N), by = c("date", 
"section_used")]
+  # Generate click breakdown (last action)
+  breakdown_data <- data %>%
+dplyr::arrange(ts) %>%
+   dplyr::filter(!duplicated(session, fromLast = TRUE)) %>%
+   dplyr::group_by(date, section_used) %>%
+   dplyr::summarize(events = n()) %>%
+   data.table::as.data.table()
   
   # Generate by-country breakdown with regional data for US
   regions <- data.frame(abb = paste0("US:", c(as.character(state.abb), "DC")),
@@ -110,6 +112,67 @@
 dplyr::select(c(date, country, events)) %>%
 dplyr::arrange(desc(country))
 
+  # Experimental: Generate all countries breakdown
+  data("ISO_3166_1", package = "ISOcodes")
+  all_countries <- data.frame(abb = c(regions$abb, ISO_3166_1$Alpha_2),
+  name = c(regions$region, ISO_3166_1$Name),
+  stringsAsFactors = FALSE)
+  all_country_data <- as.data.frame(data) %>%
+dplyr::mutate(country = ifelse(country %in% all_countries$abb, country, 
"Other")) %>%
+dplyr::left_join(all_countries, by = c("country" = "abb")) %>%
+dplyr::mutate(name = ifelse(is.na(name), "Other", name)) %>%
+dplyr::select(-country) %>% dplyr::rename(country = name) %>%
+dplyr::group_by(country) %>%
+dplyr::summarize(events = n(), ctr = sum(type=="clickthrough")/n()) %>%
+dplyr::mutate(date = date) %>%
+dplyr::select(c(date, country, events, ctr)) %>%
+dplyr::arrange(desc(country))   
+  
+  # Last action by country
+  last_action_country <- as.data.frame(data) %>%
+dplyr::mutate(country = ifelse(country %in% all_countries$abb, country, 
"Other")) %>%
+dplyr::left_join(all_countries, by = c("country" = "abb")) %>%
+dplyr::mutate(name = ifelse(is.na(name), "Other", name)) %>%
+dplyr::select(-country) %>% dplyr::rename(country = name) %>%
+dplyr::arrange(ts) %>%
+   dplyr::filter(!duplicated(session, fromLast = TRUE)) %>%
+   dplyr::group_by(date, country, section_used) %>%
+   dplyr::summarize(events = n()) %>%
+   dplyr::mutate(prop = events/sum(events))
+
+  # Most common section clicked by country
+  most_common_country <- as.data.frame(data) %>%
+dplyr::mutate(country = ifelse(country %in% all_countries$abb, country, 
"Other")) %>%
+dplyr::left_join(all_countries, by = c("country" = "abb")) %>%
+dplyr::mutate(name = ifelse(is.na(name), "Other", name)) %>%
+dplyr::select(-country) %>% dplyr::rename(country = name) %>%
+dplyr::arrange(session, ts) %>%
+dplyr::group_by(session) %>%
+dplyr::mutate(visit = cumsum(type == "landing")) %>%
+dplyr::filter(type == "clickthrough") %>%
+dplyr::group_by(date, country, session, visit, section_used) %>%
+dplyr::tally() %>%
+dplyr::top_n(1, n) %>%
+dplyr::ungroup() %>%
+dplyr::group_by(date, country, section_used) %>%
+dplyr::summarize(visits = n()) %>%
+   dplyr::mutate(prop = visits/sum(visits)) %>%
+dplyr::ungroup()
+
+  # First visit clickthrough rates by country
+  first_visits_country <- as.data.frame(data) %>%
+dplyr::mutate(country = ifelse(country %in% all_countries$abb, country, 
"Other")) %>%
+dplyr::left_join(all_countries, by = c("country" = "abb")) %>%
+dplyr::mutate(name = ifelse(is.na(name), "Other", name)) %>%
+

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [WIP] Create fields & data for image data

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

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

Change subject: [WIP] Create fields & data for image data
..

[WIP] Create fields & data for image data

Bug: T145558
Change-Id: I23d4c8235d0e4150eefec31cea4b2cfdd32bf32a
---
A includes/content/FileContentHandler.php
M includes/content/WikitextContentHandler.php
2 files changed, 65 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/72/310472/1

diff --git a/includes/content/FileContentHandler.php 
b/includes/content/FileContentHandler.php
new file mode 100644
index 000..fc47f13
--- /dev/null
+++ b/includes/content/FileContentHandler.php
@@ -0,0 +1,57 @@
+makeSearchFieldMapping( 'file_media_type', 
SearchIndexField::INDEX_TYPE_KEYWORD );
+   $fields['file_mime'] =
+   $engine->makeSearchFieldMapping( 'file_mime', 
SearchIndexField::INDEX_TYPE_KEYWORD );
+   $fields['file_size'] =
+   $engine->makeSearchFieldMapping( 'file_size', 
SearchIndexField::INDEX_TYPE_INTEGER );
+   $fields['file_width'] =
+   $engine->makeSearchFieldMapping( 'file_width', 
SearchIndexField::INDEX_TYPE_INTEGER );
+   $fields['file_height'] =
+   $engine->makeSearchFieldMapping( 'file_height', 
SearchIndexField::INDEX_TYPE_INTEGER );
+   $fields['file_bits'] =
+   $engine->makeSearchFieldMapping( 'file_bits', 
SearchIndexField::INDEX_TYPE_INTEGER );
+   $fields['file_resolution'] =
+   $engine->makeSearchFieldMapping( 'file_resolution', 
SearchIndexField::INDEX_TYPE_NUMBER );
+   $fields['file_description'] =
+   $engine->makeSearchFieldMapping( 'file_description', 
SearchIndexField::INDEX_TYPE_TEXT );
+   $fields['file_text'] =
+   $engine->makeSearchFieldMapping( 'file_text', 
SearchIndexField::INDEX_TYPE_TEXT );
+   }
+
+   public function getDataForSearchIndex( WikiPage $page, ParserOutput 
$parserOutput,
+  SearchEngine $engine ) {
+   $fields = [];
+
+   $title = $page->getTitle();
+   if ( NS_FILE != $title->getNamespace() ) {
+   return [];
+   }
+   $file = wfLocalFile( $title );
+   if ( !$file || !$file->exists() ) {
+   return [];
+   }
+
+   $handler = $file->getHandler();
+   if ( $handler ) {
+   $fields['file_text'] = $handler->getEntireText( $file );
+   }
+   $fields['file_media_type'] = $file->getMediaType();
+   $fields['file_mime'] = $file->getMimeType();
+   $fields['file_size'] = $file->getSize();
+   $fields['file_width'] = $file->getWidth();
+   $fields['file_height'] = $file->getHeight();
+   $fields['file_bits'] = $file->getBitDepth();
+   $fields['file_resolution'] = 
sqrt($fields['file_width']*$fields['file_height']);
+   $fields['file_description'] = $file->getDescriptionText();
+
+   return $fields;
+   }
+}
\ No newline at end of file
diff --git a/includes/content/WikitextContentHandler.php 
b/includes/content/WikitextContentHandler.php
index 978ac44..044e519 100644
--- a/includes/content/WikitextContentHandler.php
+++ b/includes/content/WikitextContentHandler.php
@@ -122,32 +122,11 @@
$engine->makeSearchFieldMapping( 'opening_text', 
SearchIndexField::INDEX_TYPE_TEXT );
$fields['opening_text']->setFlag( 
SearchIndexField::FLAG_SCORING |
  
SearchIndexField::FLAG_NO_HIGHLIGHT );
-
-   // FIXME: this really belongs in separate file handler but files
-   // do not have separate handler. Sadness.
-   $fields['file_text'] =
-   $engine->makeSearchFieldMapping( 'file_text', 
SearchIndexField::INDEX_TYPE_TEXT );
+   // Until we have full first-class content handler for files, we 
invoke it explicitly here
+   $fileHandler = new FileContentHandler();
+   $fields = array_merge( $fields, 
$fileHandler->getFieldsForSearchIndex( $engine ) );
 
return $fields;
-   }
-
-   /**
-* Extract text of the file
-* TODO: probably should go to file handler?
-* @param Title $title
-* @return string|null
-*/
-   protected function getFileText( Title $title ) {
-   $file = wfLocalFile( $title );
-   if ( $file && $file->exists() ) {
-   $handler = $file->getHandler();
-   if ( !$handler ) {
- 

[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Revert "Hygiene: Remove BogusMobileContext"

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

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

Change subject: Revert "Hygiene: Remove BogusMobileContext"
..

Revert "Hygiene: Remove BogusMobileContext"

This reverts commit c7098f21aeb39f0ea5e7606f2c75d1deec6b724f.

Change-Id: I6bf794fa422f83cbd8f677b296fb957dbb42d085
---
M includes/MobileContext.php
M tests/phpunit/MobileContextTest.php
2 files changed, 22 insertions(+), 0 deletions(-)


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

diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index dadf7a0..a848cb7 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -132,6 +132,20 @@
}
 
/**
+* Overrides the singleton instance.
+*
+* @deprecated See `MobileContext::singleton`.
+*
+* @warning This method should only accept instances of 
`MobileContext`. The `BogusMobileContext`
+*  class is used in the `MobileContextTest` test suite and will be 
removed.
+*
+* @param {MobileContext} $instance
+*/
+   public static function setInstanceForTesting( $instance ) {
+   self::$instance = $instance;
+   }
+
+   /**
 * Resets the `MobileFrontend.MobileContext` service and singleton 
instance.
 *
 * @deprecated See `MobileContext::singleton`.
diff --git a/tests/phpunit/MobileContextTest.php 
b/tests/phpunit/MobileContextTest.php
index c7a42ee..b98b6cd 100644
--- a/tests/phpunit/MobileContextTest.php
+++ b/tests/phpunit/MobileContextTest.php
@@ -34,6 +34,8 @@
 
protected function setUp() {
parent::setUp();
+   // Permit no access to the singleton
+   MobileContext::setInstanceForTesting( new BogusMobileContext() 
);
 
$this->config = new GlobalVarConfig();
$this->baseContext = RequestContext::getMain();
@@ -691,3 +693,9 @@
$this->assertSame( $this->config, $context->getMFConfig() );
}
 }
+
+class BogusMobileContext {
+   public function __call( $who, $cares ) {
+   throw new Exception( "Don't touch me!" );
+   }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6bf794fa422f83cbd8f677b296fb957dbb42d085
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
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...MobileFrontend[master]: Revert "Add MobileFrontend.Context service"

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

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

Change subject: Revert "Add MobileFrontend.Context service"
..

Revert "Add MobileFrontend.Context service"

This is problematic because it tries to access the service inside the 
extension.json callback, which is before the service container is reset. 
Extension services cannot be used before that happens, so depending upon other 
services in initialization, this will cause exceptions to be thrown.

This reverts commit f3cf72ba636f250aa018d833c3a49d094ef16b3f.

Change-Id: Idb3d07586c825fc830d79e40156b0adc0d7af6ea
---
M includes/MobileContext.php
M includes/ServiceWiring.php
M tests/phpunit/MobileContextTest.php
M tests/phpunit/MobileFrontend.hooksTest.php
M tests/phpunit/specials/SpecialMobileDiffTest.php
5 files changed, 24 insertions(+), 85 deletions(-)


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

diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index a848cb7..d88da4b 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -99,7 +99,7 @@
/**
 * @var Config MobileFrontend's config object
 */
-   private $config;
+   private $configObj;
/**
 * @var String Domain to use for the stopMobileRedirect cookie
 */
@@ -110,57 +110,31 @@
private $mobileUrlTemplate = false;
 
/**
-* Gets the singleton instance.
-*
-* @deprecated Removing this method is one of the goals
-*  [T143189][https://phabricator.wikimedia.org/T143875].
-* @deprecated If you're creating a new class, then it should accept an 
instance of
-* `MobileContext` at construction time.
-* @deprecated If you're adding code to a pre-existing class, then 
first consider if the class can
-*  be split apart so that you can do the above. If you're confident 
that this can't be done,
-*  then you can use this method.
-*
-* @return {MobileContext}
+* Returns the actual MobileContext Instance or create a new if no 
exists
+* @return MobileContext
 */
public static function singleton() {
if ( !self::$instance ) {
-   self::$instance =
-   MediaWikiServices::getInstance()->getService( 
'MobileFrontend.MobileContext' );
+   self::$instance = new MobileContext( 
RequestContext::getMain() );
}
-
return self::$instance;
}
 
/**
-* Overrides the singleton instance.
-*
-* @deprecated See `MobileContext::singleton`.
-*
-* @warning This method should only accept instances of 
`MobileContext`. The `BogusMobileContext`
-*  class is used in the `MobileContextTest` test suite and will be 
removed.
-*
-* @param {MobileContext} $instance
+* Set $this->instance to the given instance of MobileContext or null
+* @param MobileContext|null $instance MobileContext instance or null 
to set
+* @return MobileContext|null
 */
-   public static function setInstanceForTesting( $instance ) {
+   public static function setInstance( /* MobileContext|null */ $instance 
) {
self::$instance = $instance;
}
 
/**
-* Resets the `MobileFrontend.MobileContext` service and singleton 
instance.
-*
-* @deprecated See `MobileContext::singleton`.
-*
-* @throws MWException If called outside the MediaWiki PHPUnit test 
suite
-*  (see `MediaWikiServices#resetServiceForTesting`).
+* Set the IontextSource Object
+* @param IContextSource $context The IContextSource Object has to set
 */
-   public static function resetServiceForTesting() {
-   self::$instance = null;
-   MediaWikiServices::getInstance()->resetServiceForTesting( 
'MobileFrontend.MobileContext' );
-   }
-
-   public function __construct( IContextSource $context, Config $config ) {
+   protected function __construct( IContextSource $context ) {
$this->setContext( $context );
-   $this->config = $config;
}
 
/**
@@ -168,7 +142,7 @@
 * @return Config
 */
public function getMFConfig() {
-   return $this->config;
+   return MediaWikiServices::getInstance()->getService( 
'MobileFrontend.Config' );
}
 
/**
diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php
index 8aad19d..efc21e1 100644
--- a/includes/ServiceWiring.php
+++ b/includes/ServiceWiring.php
@@ -6,10 +6,5 @@
'MobileFrontend.Config' => function ( MediaWikiServices $services ) {
return $services->getService( 'ConfigFactory' )
  

[MediaWiki-commits] [Gerrit] operations/puppet[production]: partman: delete analytics-cisco recipe

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

Change subject: partman: delete analytics-cisco recipe
..


partman: delete analytics-cisco recipe

This partman recipe is unused and it has been confirmed
on Ic05660855aab95e9 by ottomata that we can delete it.

Change-Id: I4b860c117f64cc767d6f2fac89f317149f726d10
---
D modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
1 file changed, 0 insertions(+), 34 deletions(-)

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



diff --git 
a/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg 
b/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
deleted file mode 100644
index 30e1433..000
--- a/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
-# Automatic software RAID partitioning
-
-d-i partman-auto/method string raid
-
-# Use the first two disks
-d-i partman-auto/disk   string /dev/sdc /dev/sdd
-
-# Define physical partitions
-d-i partman-auto/expert_recipe  string  \
-multiraid ::\
-2500029000   raid   \
-$primary{ } method{ raid } \
-.   \
-100010001raid   \
-$primary{ } method{ raid } \
-.
-
-# Parameters are:
-#  \
-#   
-d-ipartman-auto-raid/recipestring  \
-   1   2   0   ext4/   \
-   /dev/sdc1#/dev/sdd1 \
-   .   \
-   1   2   0   swap-   \
-   /dev/sdc2#/dev/sdd2 \
-   .
-
-d-ipartman-md/confirm  boolean true
-d-i partman-md/device_remove_md boolean true
-d-ipartman/confirm_write_new_label boolean true
-d-ipartman/choose_partitionselect  finish
-d-ipartman/confirm boolean true
-d-ipartman/confirm_nooverwrite boolean true

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4b860c117f64cc767d6f2fac89f317149f726d10
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Ottomata 
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]: partman: delete analytics-cisco recipe

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

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

Change subject: partman: delete analytics-cisco recipe
..

partman: delete analytics-cisco recipe

This partman recipe is unused and it has been confirmed
on Ic05660855aab95e9 by ottomata that we can delete it.

Change-Id: I4b860c117f64cc767d6f2fac89f317149f726d10
---
D modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
1 file changed, 0 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/69/310469/1

diff --git 
a/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg 
b/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
deleted file mode 100644
index 30e1433..000
--- a/modules/install_server/files/autoinstall/partman/analytics-cisco.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
-# Automatic software RAID partitioning
-
-d-i partman-auto/method string raid
-
-# Use the first two disks
-d-i partman-auto/disk   string /dev/sdc /dev/sdd
-
-# Define physical partitions
-d-i partman-auto/expert_recipe  string  \
-multiraid ::\
-2500029000   raid   \
-$primary{ } method{ raid } \
-.   \
-100010001raid   \
-$primary{ } method{ raid } \
-.
-
-# Parameters are:
-#  \
-#   
-d-ipartman-auto-raid/recipestring  \
-   1   2   0   ext4/   \
-   /dev/sdc1#/dev/sdd1 \
-   .   \
-   1   2   0   swap-   \
-   /dev/sdc2#/dev/sdd2 \
-   .
-
-d-ipartman-md/confirm  boolean true
-d-i partman-md/device_remove_md boolean true
-d-ipartman/confirm_write_new_label boolean true
-d-ipartman/choose_partitionselect  finish
-d-ipartman/confirm boolean true
-d-ipartman/confirm_nooverwrite boolean true

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: Set differential.allow-self-accept to true in phabricator

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

Change subject: Set differential.allow-self-accept to true in phabricator
..


Set differential.allow-self-accept to true in phabricator

By setting this users that do arc diff and upload can self review meaning they 
can accept there own change and do arc land.
This way they can use all available differential tools.

Use case: config repository where a lot of changes are self reviewed or
self merged after a discussion outside the tracker.

Bug: T131622
Change-Id: Ibddf088f20b9d9b7f1e31404025fc1cc3078f35c
---
M modules/role/manifests/phabricator/main.pp
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/modules/role/manifests/phabricator/main.pp 
b/modules/role/manifests/phabricator/main.pp
index 6ec0043..d7b0951 100644
--- a/modules/role/manifests/phabricator/main.pp
+++ b/modules/role/manifests/phabricator/main.pp
@@ -53,6 +53,7 @@
   "${phab_root_dir}/libext/misc/" ],
 settings => {
 'darkconsole.enabled'=> false,
+'differential.allow-self-accept' => true,
 'phabricator.base-uri'   => "https://${domain};,
 'security.alternate-file-domain' => "https://${altdom};,
 'mysql.user' => 
$passwords::mysql::phabricator::app_user,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibddf088f20b9d9b7f1e31404025fc1cc3078f35c
Gerrit-PatchSet: 8
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Paladox 
Gerrit-Reviewer: 20after4 
Gerrit-Reviewer: Dereckson 
Gerrit-Reviewer: Dzahn 
Gerrit-Reviewer: Muehlenhoff 
Gerrit-Reviewer: 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...SecurePoll[master]: Show statistics above the list of votes

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

Change subject: Show statistics above the list of votes
..


Show statistics above the list of votes

Bug: T145542
Change-Id: I807b2f083873c332eaebe8eb74b3ada08e90574b
---
M i18n/en.json
M i18n/qqq.json
M includes/pages/ListPage.php
3 files changed, 51 insertions(+), 0 deletions(-)

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



diff --git a/i18n/en.json b/i18n/en.json
index 17d28c3..680ea01 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -254,6 +254,8 @@
"right-securepoll-create-poll": "Create polls",
"action-securepoll-create-poll": "create polls",
"securepoll-ns-readonly": "The {{ns:SecurePoll}} namespace is 
read-only",
+   "securepoll-voter-stats": "Out of all eligible voters, $1 
{{PLURAL:$1|voter has|voters have}} voted.",
+   "securepoll-vote-stats": "A total of $1 {{PLURAL:$1|vote has|votes 
have}} been cast. Of these, $2 {{PLURAL:$2|is|are}} thrown away because the 
voter has voted again, and $3 {{PLURAL:$3|is|are}} struck.",
"apihelp-strikevote-description": "Allows admins to strike or unstrike 
a vote.",
"apihelp-strikevote-param-option": "Which action to take: strike or 
unstrike a vote.",
"apihelp-strikevote-paramvalue-option-strike": "Strike a vote (remove 
it from the count).",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 747e5b5..45f7215 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -235,6 +235,8 @@
"right-securepoll-create-poll": "{{doc-right|securepoll-create-poll}}",
"action-securepoll-create-poll": 
"{{Doc-action|securepoll-create-poll}}",
"securepoll-ns-readonly": "Error message to inform the user that the 
SecurePoll namespace cannot be edited.",
+   "securepoll-voter-stats": "Explanation of the unique number of voters 
who participated in the election; shown above the vote list.",
+   "securepoll-vote-stats": "Explanation of the total number of votes 
cast, as well as the number that were excluded because the voter had voted 
again, and the number that have been struck by an election admin; shown above 
the vote list.",
"apihelp-strikevote-description": 
"{{doc-apihelp-description|strikevote}}",
"apihelp-strikevote-param-option": 
"{{doc-apihelp-param|strikevote|option}}",
"apihelp-strikevote-paramvalue-option-strike": 
"{{doc-apihelp-paramvalue|strikevote|option|strike}}",
diff --git a/includes/pages/ListPage.php b/includes/pages/ListPage.php
index cd9fcf5..44b9ed8 100644
--- a/includes/pages/ListPage.php
+++ b/includes/pages/ListPage.php
@@ -5,6 +5,7 @@
  * Provides an administrator interface for striking fraudulent votes.
  */
 class SecurePoll_ListPage extends SecurePoll_ActionPage {
+   /** @var SecurePoll_Election */
public $election;
 
/**
@@ -37,6 +38,52 @@
return;
}
 
+   $dbr = $this->election->context->getDB( DB_REPLICA );
+
+   $res = $dbr->select(
+   'securepoll_votes',
+   array( 'DISTINCT vote_voter' ),
+   array(
+   'vote_election' => $this->election->getID()
+   )
+   );
+   $distinct_voters = $res->result->num_rows;
+
+   $res = $dbr->select(
+   'securepoll_votes',
+   array( 'vote_id' ),
+   array(
+   'vote_election' => $this->election->getID()
+   )
+   );
+   $all_votes = $res->result->num_rows;
+
+   $res = $dbr->select(
+   'securepoll_votes',
+   array( 'vote_id' ),
+   array(
+   'vote_election' => $this->election->getID(),
+   'vote_current' => 0
+   )
+   );
+   $not_current_votes = $res->result->num_rows;
+
+   $res = $dbr->select(
+   'securepoll_votes',
+   array( 'vote_id' ),
+   array(
+   'vote_election' => $this->election->getID(),
+   'vote_struck' => 1
+   )
+   );
+   $struck_votes = $res->result->num_rows;
+
+   $out->addHTML('' .
+   $this->msg( 'securepoll-voter-stats', $distinct_voters 
) .
+   '' .
+   $this->msg( 'securepoll-vote-stats', $all_votes, 
$not_current_votes, $struck_votes ) .
+   '');
+
$pager = new SecurePoll_ListPager( $this );
$out->addHTML(
$pager->getLimitForm() .

-- 
To view, visit 

[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Let SecurePoll_Context::getDB() use DB_REPLICA connections

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

Change subject: Let SecurePoll_Context::getDB() use DB_REPLICA connections
..


Let SecurePoll_Context::getDB() use DB_REPLICA connections

Change-Id: I988551a28b65418603af9ecf4206237db2ae62e6
---
M includes/main/Context.php
M includes/main/Store.php
2 files changed, 8 insertions(+), 12 deletions(-)

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



diff --git a/includes/main/Context.php b/includes/main/Context.php
index 9cc896f..1d7c3cf 100644
--- a/includes/main/Context.php
+++ b/includes/main/Context.php
@@ -42,9 +42,6 @@
/** The SecurePoll_Random instance */
public $random;
 
-   /** The Database instance */
-   public $db;
-
/**
 * Create a new SecurePoll_Context with an XML file as the storage 
backend.
 * Returns false if there was a problem with the file, like a parse 
error.
@@ -251,13 +248,11 @@
/**
 * Get a database object, or throw an exception if the current store 
object
 * does not support database operations.
+* @param integer $index DB_MASTER or DB_REPLICA
 * @return DatabaseBase
 */
-   function getDB() {
-   if ( !isset( $this->db ) ) {
-   $this->db = $this->getStore()->getDB();
-   }
-   return $this->db;
+   function getDB( $index = DB_MASTER ) {
+   return $this->getStore()->getDB( $index );
}
 
/**
diff --git a/includes/main/Store.php b/includes/main/Store.php
index 9782dbe..776e5ae 100644
--- a/includes/main/Store.php
+++ b/includes/main/Store.php
@@ -61,8 +61,9 @@
 
/**
 * Get a database connection object.
+* @param integer $index DB_MASTER or DB_REPLICA
 */
-   function getDB();
+   function getDB( $index = DB_MASTER );
 
/**
 * Get an associative array of information about all questions in a 
given
@@ -181,8 +182,8 @@
return $info;
}
 
-   function getDB() {
-   return wfGetDB( DB_MASTER );
+   function getDB( $index = DB_MASTER ) {
+   return wfGetDB( $index );
}
 
function getQuestionInfo( $electionId ) {
@@ -337,7 +338,7 @@
'a storage class that doesn\'t support it.' );
}
 
-   function getDB() {
+   function getDB( $index = DB_MASTER ) {
throw new MWException( 'Internal error: attempt to use getDB() 
when the database ' .
'is disabled.' );
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I988551a28b65418603af9ecf4206237db2ae62e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Huji 
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]: ParserTests: Make sure WikiPage::doEditContent() succeeds

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

Change subject: ParserTests: Make sure WikiPage::doEditContent() succeeds
..


ParserTests: Make sure WikiPage::doEditContent() succeeds

If a parser test tries to create a page with invalid content (rejected
by Content::prepareSave() or Content::isValid()), throw an exception
instead of silently failing.

Change-Id: I89642604216699f27884120b3c297a0b277c47a6
---
M tests/parser/ParserTestRunner.php
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/tests/parser/ParserTestRunner.php 
b/tests/parser/ParserTestRunner.php
index 6659ff8..4ef778d 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -1517,7 +1517,10 @@
throw new MWException( "duplicate article '$name' at 
$file:$line\n" );
}
 
-   $page->doEditContent( ContentHandler::makeContent( $text, 
$title ), '', EDIT_NEW );
+   $status = $page->doEditContent( ContentHandler::makeContent( 
$text, $title ), '', EDIT_NEW );
+   if ( !$status->isOK() ) {
+   throw new MWException( $status->getWikiText( false, 
false, 'en' ) );
+   }
 
// The RepoGroup cache is invalidated by the creation of file 
redirects
if ( $title->getNamespace() === NS_IMAGE ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I89642604216699f27884120b3c297a0b277c47a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: C. Scott Ananian 
Gerrit-Reviewer: Jackmcbarn 
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]: ParserTests: Make sure WikiPage::doEditContent() succeeds

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

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

Change subject: ParserTests: Make sure WikiPage::doEditContent() succeeds
..

ParserTests: Make sure WikiPage::doEditContent() succeeds

If a parser test tries to create a page with invalid content (rejected
by Content::prepareSave() or Content::isValid()), throw an exception
instead of silently failing.

Change-Id: I89642604216699f27884120b3c297a0b277c47a6
---
M tests/parser/ParserTestRunner.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/68/310468/1

diff --git a/tests/parser/ParserTestRunner.php 
b/tests/parser/ParserTestRunner.php
index 6659ff8..4ef778d 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -1517,7 +1517,10 @@
throw new MWException( "duplicate article '$name' at 
$file:$line\n" );
}
 
-   $page->doEditContent( ContentHandler::makeContent( $text, 
$title ), '', EDIT_NEW );
+   $status = $page->doEditContent( ContentHandler::makeContent( 
$text, $title ), '', EDIT_NEW );
+   if ( !$status->isOK() ) {
+   throw new MWException( $status->getWikiText( false, 
false, 'en' ) );
+   }
 
// The RepoGroup cache is invalidated by the creation of file 
redirects
if ( $title->getNamespace() === NS_IMAGE ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89642604216699f27884120b3c297a0b277c47a6
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]: Make sure emails from RecentChange::save() are for comitted ...

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

Change subject: Make sure emails from RecentChange::save() are for comitted rows
..


Make sure emails from RecentChange::save() are for comitted rows

Change-Id: I9086a70348d2f0843527e3805e9f6aef3356ee03
---
M includes/changes/RecentChange.php
1 file changed, 8 insertions(+), 4 deletions(-)

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



diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index a5d1fc5..8e74674 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -336,9 +336,13 @@
$title = $this->getTitle();
 
// Never send an RC notification email about 
categorization changes
-   if ( $this->mAttribs['rc_type'] != RC_CATEGORIZE ) {
-   if ( Hooks::run( 'AbortEmailNotification', [ 
$editor, $title, $this ] ) ) {
-   # @todo FIXME: This would be better as 
an extension hook
+   if (
+   $this->mAttribs['rc_type'] != RC_CATEGORIZE &&
+   Hooks::run( 'AbortEmailNotification', [ 
$editor, $title, $this ] )
+   ) {
+   // @FIXME: This would be better as an extension 
hook
+   // Send emails or email jobs once this row is 
safely committed
+   $dbw->onTransactionIdle( function () use ( 
$editor, $title ) {
$enotif = new EmailNotification();
$enotif->notifyOnPageChange(
$editor,
@@ -349,7 +353,7 @@

$this->mAttribs['rc_last_oldid'],
$this->mExtra['pageStatus']
);
-   }
+   } );
}
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9086a70348d2f0843527e3805e9f6aef3356ee03
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Gergő Tisza 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Open meta dialog to edit categories when user clicks on the ...

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

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

Change subject: Open meta dialog to edit categories when user clicks on the 
category footer
..

Open meta dialog to edit categories when user clicks on the category footer

Bug: T145267
Change-Id: Ie88c4d9c6327baffdb83c1affbc0515a68c0fc03
---
M modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
2 files changed, 17 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css 
b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css
index 7299a8e..57d7d89 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.DesktopArticleTarget.init.css
@@ -44,9 +44,15 @@
 .ve-loading #content > :not( .ve-init-mw-desktopArticleTarget-loading-overlay 
),
 /* Once activated, everything except the progress bar and the edit target */
 .ve-activated .ve-init-mw-desktopArticleTarget-uneditableContent {
+   opacity: 0.5;
+}
+
+/* While loading, everything except the progress bar */
+.ve-loading #content > :not( .ve-init-mw-desktopArticleTarget-loading-overlay 
),
+/* Once activated, everything except the progress bar, the edit target, and 
the category footer */
+.ve-activated .ve-init-mw-desktopArticleTarget-uneditableContent 
:not([id=catlinks]) {
/* IE9 is supported with JS events */
/* stylelint-disable no-unsupported-browser-features */
-   opacity: 0.5;
pointer-events: none;
-webkit-user-select: none;
-moz-user-select: none;
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index a6eb3ce..757efed 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1176,7 +1176,8 @@
  * Page modifications for switching to edit mode.
  */
 ve.init.mw.DesktopArticleTarget.prototype.transformPage = function () {
-   var $content;
+   var target = this,
+   $content;
 
this.updateTabs( true );
this.emit( 'transformPage' );
@@ -1194,7 +1195,14 @@
$content = $content.parent();
}
// Support IE9: Disable links
-   $( '.ve-init-mw-desktopArticleTarget-uneditableContent' ).on( 
'click.ve-target', function () { return false; } );
+   $( '.ve-init-mw-desktopArticleTarget-uneditableContent' ).on( 
'click.ve-target', function () {
+   var windowAction;
+   if ( $( this ).attr( 'id' ) == 'catlinks' ) {
+   windowAction = ve.ui.actionFactory.create( 'window', 
target.getSurface() );
+   windowAction.open( 'meta', { page: 'categories' } );
+   }
+   return false;
+   } );
 
this.updateHistoryState();
 };

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: More specific ".sitelinkgroupview h3" selector

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

Change subject: More specific ".sitelinkgroupview h3" selector
..


More specific ".sitelinkgroupview h3" selector

The original selector does have the exact same specifity. It depends on
the loading order which one is active. This makes sure the headlines do
not render in bold while the page is loading.

Bug: T143332
Change-Id: I81564dc65a0d845f869d1929eb4fbf82b3b9
---
M 
view/resources/jquery/wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
1 file changed, 1 insertion(+), 3 deletions(-)

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



diff --git 
a/view/resources/jquery/wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
 
b/view/resources/jquery/wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
index b8ffad6..05676b3 100644
--- 
a/view/resources/jquery/wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
+++ 
b/view/resources/jquery/wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
@@ -33,9 +33,7 @@
background-color: #D6F3FF;
 }
 
-.wikibase-sitelinkgroupview h2, /* TODO: Temporarily kept for compatibility, 
remove after July 2015 */
-.wikibase-sitelinkgroupview h3 {
-   border-bottom: 0; /* TODO: Temporarily kept for compatibility, remove 
after July 2015 */
+.wikibase-sitelinkgroupview .wikibase-sitelinkgroupview-heading-section h3 {
display: inline;
float: none;
font-weight: normal;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I81564dc65a0d845f869d1929eb4fbf82b3b9
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: Jonas Kress (WMDE) 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
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]: ApiScribuntoConsole: Don't use $wgUser

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

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

Change subject: ApiScribuntoConsole: Don't use $wgUser
..

ApiScribuntoConsole: Don't use $wgUser

Change-Id: I41d9b0961e98d7836e8d5e8236ec2503f30713b1
---
M common/ApiScribuntoConsole.php
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/common/ApiScribuntoConsole.php b/common/ApiScribuntoConsole.php
index 3f8f12d..7276b3c 100644
--- a/common/ApiScribuntoConsole.php
+++ b/common/ApiScribuntoConsole.php
@@ -22,8 +22,7 @@
$sessionId = mt_rand( 0, 0x7fff );
}
 
-   global $wgUser;
-   $sessionKey = wfMemcKey( 'scribunto-console', $wgUser->getId(), 
$sessionId );
+   $sessionKey = wfMemcKey( 'scribunto-console', 
$this->getUser()->getId(), $sessionId );
$cache = ObjectCache::getInstance( CACHE_ANYTHING );
$session = null;
$sessionIsNew = false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41d9b0961e98d7836e8d5e8236ec2503f30713b1
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...VisualEditor[master]: Don't allow auto-enroll of new wikitext editor Beta Feature

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

Change subject: Don't allow auto-enroll of new wikitext editor Beta Feature
..


Don't allow auto-enroll of new wikitext editor Beta Feature

Change-Id: Icc8e27a8e2a7d88fbbdeaf31b1ef8a5f5c85311f
---
M VisualEditor.hooks.php
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 2c70154..e875c7a 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -622,7 +622,8 @@
'javascript' => true,
'blacklist' => $veConfig->get( 
'VisualEditorBrowserBlacklist' ),
'skins' => $veConfig->get( 
'VisualEditorSupportedSkins' ),
-   ]
+   ],
+   'exempt-from-auto-enrollment' => true
];
 
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Break words on semicolon for source_text.plain

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

Change subject: Break words on semicolon for source_text.plain
..


Break words on semicolon for source_text.plain

Added a new word_breaker_helper char_filter specific
to the source_text field to avoid conflicts with normal
searches.
Created a new field class to crate a custom mapping for
the source_text field. Mostly to save space, the root field
does not seem to be used so there's no need to index it.

Bug: T145023
Change-Id: I49739a9ea3b0794303cfecf8edeb960fc786387a
---
M autoload.php
M includes/Maintenance/AnalysisConfigBuilder.php
M includes/Maintenance/MappingConfigBuilder.php
A includes/Search/SourceTextIndexField.php
M includes/Search/TextIndexField.php
M tests/browser/features/insource_api.feature
M tests/browser/features/support/hooks.rb
7 files changed, 143 insertions(+), 28 deletions(-)

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



diff --git a/autoload.php b/autoload.php
index bc2747a..6e1d1b2 100644
--- a/autoload.php
+++ b/autoload.php
@@ -89,9 +89,9 @@
'CirrusSearch\\OtherIndexes' => __DIR__ . '/includes/OtherIndexes.php',
'CirrusSearch\\PhraseSuggesterProfiles' => __DIR__ . 
'/profiles/PhraseSuggesterProfiles.php',
'CirrusSearch\\Query\\BoostTemplatesFeature' => __DIR__ . 
'/includes/Query/BoostTemplatesFeature.php',
-   'CirrusSearch\\Query\\FullTextSimpleMatchQueryBuilder' => __DIR__ . 
'/includes/Query/FullTextSimpleMatchQueryBuilder.php',
'CirrusSearch\\Query\\FullTextQueryBuilder' => __DIR__ . 
'/includes/Query/FullTextQueryBuilder.php',
'CirrusSearch\\Query\\FullTextQueryStringQueryBuilder' => __DIR__ . 
'/includes/Query/FullTextQueryStringQueryBuilder.php',
+   'CirrusSearch\\Query\\FullTextSimpleMatchQueryBuilder' => __DIR__ . 
'/includes/Query/FullTextSimpleMatchQueryBuilder.php',
'CirrusSearch\\Query\\GeoFeature' => __DIR__ . 
'/includes/Query/GeoFeature.php',
'CirrusSearch\\Query\\HasTemplateFeature' => __DIR__ . 
'/includes/Query/HasTemplateFeature.php',
'CirrusSearch\\Query\\InCategoryFeature' => __DIR__ . 
'/includes/Query/InCategoryFeature.php',
@@ -149,6 +149,7 @@
'CirrusSearch\\Search\\SatuFunctionScoreBuilder' => __DIR__ . 
'/includes/Search/RescoreBuilders.php',
'CirrusSearch\\Search\\ScriptScoreFunctionScoreBuilder' => __DIR__ . 
'/includes/Search/RescoreBuilders.php',
'CirrusSearch\\Search\\SearchContext' => __DIR__ . 
'/includes/Search/SearchContext.php',
+   'CirrusSearch\\Search\\SourceTextIndexField' => __DIR__ . 
'/includes/Search/SourceTextIndexField.php',
'CirrusSearch\\Search\\TextIndexField' => __DIR__ . 
'/includes/Search/TextIndexField.php',
'CirrusSearch\\Search\\TitleResultsType' => __DIR__ . 
'/includes/Search/ResultsType.php',
'CirrusSearch\\Searcher' => __DIR__ . '/includes/Searcher.php',
diff --git a/includes/Maintenance/AnalysisConfigBuilder.php 
b/includes/Maintenance/AnalysisConfigBuilder.php
index 6852942..8a5feb6 100644
--- a/includes/Maintenance/AnalysisConfigBuilder.php
+++ b/includes/Maintenance/AnalysisConfigBuilder.php
@@ -33,7 +33,7 @@
 * and change the minor version when it changes but isn't
 * incompatible
 */
-   const VERSION = '0.11';
+   const VERSION = '0.12';
 
/**
 * @var string Language code we're building analysis for
@@ -140,6 +140,18 @@
'tokenizer' => 'standard',
'filter' => [ 'standard', 'lowercase' ],
'char_filter' => [ 'word_break_helper' 
],
+   ],
+   'source_text_plain' => [
+   'type' => 'custom',
+   'tokenizer' => 'standard',
+   'filter' => [ 'standard', 'lowercase' ],
+   'char_filter' => [ 
'word_break_helper_source_text' ],
+   ],
+   'source_text_plain_search' => [
+   'type' => 'custom',
+   'tokenizer' => 'standard',
+   'filter' => [ 'standard', 'lowercase' ],
+   'char_filter' => [ 
'word_break_helper_source_text' ],
],
'suggest' => [
'type' => 'custom',
@@ -265,6 +277,17 @@
')=>\u0020',
],
],
+   'word_break_helper_source_text' => [
+  

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

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

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


Update VE core submodule to master (ed76839)

New changes:
7a06bb7 Fix 'new ve.dm.Transaction.newFromDocumentInsertion' typo
db9b7a7 Make ve.dm.Transaction plain data by removing the .doc property
62c662c Localisation updates from https://translatewiki.net.
455e949 TableKeyDownHandler: return early if any modifier other than shift is 
used
9440e38 Localisation updates from https://translatewiki.net.
ed76839 Update OOjs UI to v0.17.9

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

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



diff --git a/lib/ve b/lib/ve
index 38b5572..ed76839 16
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit 38b5572c2742391e50da557cc2ad7be2ca3276c7
+Subproject commit ed7683959c28e78851480a2e0573c6fac7048771

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I70a6387e6ea6d986ed132998df592f12274adf1a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: Alex Monk 
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[REL1_27]: Make JobQueueGroup::push() update the queuesHaveJobs() cache

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

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

Change subject: Make JobQueueGroup::push() update the queuesHaveJobs() cache
..

Make JobQueueGroup::push() update the queuesHaveJobs() cache

This makes it so jobs can run sooner with $wgJobRunRate

Bug: T145206
Change-Id: Ia7673f51312f90a696fa056bd3daf7f3f440782b
(cherry picked from commit 6f9a246d25b29d406e68e366e707822f14be8a2d)
---
M includes/jobqueue/JobQueueGroup.php
1 file changed, 15 insertions(+), 1 deletion(-)


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

diff --git a/includes/jobqueue/JobQueueGroup.php 
b/includes/jobqueue/JobQueueGroup.php
index 2dd0615..3b7c2b8 100644
--- a/includes/jobqueue/JobQueueGroup.php
+++ b/includes/jobqueue/JobQueueGroup.php
@@ -142,6 +142,20 @@
$this->cache->clear( 'queues-ready' );
}
}
+
+   $cache = ObjectCache::getLocalClusterInstance();
+   $cache->set(
+   $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', self::TYPE_ANY ),
+   'true',
+   15
+   );
+   if ( array_intersect( array_keys( $jobsByType ), 
$this->getDefaultQueueTypes() ) ) {
+   $cache->set(
+   $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', self::TYPE_DEFAULT ),
+   'true',
+   15
+   );
+   }
}
 
/**
@@ -298,8 +312,8 @@
 * @since 1.23
 */
public function queuesHaveJobs( $type = self::TYPE_ANY ) {
-   $key = wfMemcKey( 'jobqueue', 'queueshavejobs', $type );
$cache = ObjectCache::getLocalClusterInstance();
+   $key = $cache->makeGlobalKey( 'jobqueue', $this->wiki, 
'hasjobs', $type );
 
$value = $cache->get( $key );
if ( $value === false ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7673f51312f90a696fa056bd3daf7f3f440782b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_27
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...CirrusSearch[master]: CompletionSuggester: add support for subphrase/subpage sugge...

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

Change subject: CompletionSuggester: add support for subphrase/subpage 
suggestions
..


CompletionSuggester: add support for subphrase/subpage suggestions

Use a new 'suggest-subphrases' field to store subphrase suggestions.
Two types of subphrase suggestions are supported:
 - sub pages: only generate suggestions based on subpages
 - any words: generate subphrases that start at any words in the title

Suited for relatively small wikis with long titles.
This might greatly help recall but some testing is needed to figure
out what kind of wikis could benefit from this feature.

Bug: T123015
Change-Id: Icf2dcaa91fd0362c304e0e5fa3d7571aeaea0f77
---
M CirrusSearch.php
M autoload.php
A includes/BuildDocument/Completion/NaiveSubphrasesSuggestionsBuilder.php
M includes/CirrusSearch.php
M includes/Maintenance/SuggesterAnalysisConfigBuilder.php
M includes/Maintenance/SuggesterMappingConfigBuilder.php
M maintenance/updateSuggesterIndex.php
M profiles/SuggestProfiles.php
M tests/browser/features/prefix_search_api.feature
M tests/browser/features/support/hooks.rb
M tests/jenkins/FullyFeaturedConfig.php
M tests/unit/SuggestBuilderTest.php
12 files changed, 634 insertions(+), 26 deletions(-)

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



diff --git a/CirrusSearch.php b/CirrusSearch.php
index 7a393f6..04d2d9a 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -797,6 +797,22 @@
 $wgCirrusSearchUseCompletionSuggester = 'no';
 
 /**
+ * Tell the completion suggest to build and use an
+ * extra field built with subphrases suggestions.
+ * 2 types of subphrases are supported:
+ * - subpages: generate subphrase suggestions based on subpages
+ * - anywords: generate subphrase suggestions starting with any words in the
+ *   title
+ * limit: limits the number of subphrases generated
+ */
+$wgCirrusSearchCompletionSuggesterSubphrases = [
+   'build' => false,
+   'use' => false,
+   'type' => 'anywords',
+   'limit' => 10,
+];
+
+/**
  * Use defaultsort as an additional title suggestion
  * Useful in case the title does not start with a representative
  * name ( e.g. Republic of Ireland ) or for names where defaultsort
diff --git a/autoload.php b/autoload.php
index b5bd324..42ee10b 100644
--- a/autoload.php
+++ b/autoload.php
@@ -16,6 +16,7 @@
'CirrusSearch\\BuildDocument\\Completion\\ExtraSuggestionsBuilder' => 
__DIR__ . '/includes/BuildDocument/Completion/ExtraSuggestionsBuilder.php',
'CirrusSearch\\BuildDocument\\Completion\\GeoSuggestionsBuilder' => 
__DIR__ . '/includes/BuildDocument/Completion/GeoSuggestionsBuilder.php',
'CirrusSearch\\BuildDocument\\Completion\\IncomingLinksScoringMethod' 
=> __DIR__ . '/includes/BuildDocument/Completion/SuggestScoring.php',
+   
'CirrusSearch\\BuildDocument\\Completion\\NaiveSubphrasesSuggestionsBuilder' => 
__DIR__ . 
'/includes/BuildDocument/Completion/NaiveSubphrasesSuggestionsBuilder.php',
'CirrusSearch\\BuildDocument\\Completion\\PQScore' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestScoring.php',
'CirrusSearch\\BuildDocument\\Completion\\QualityScore' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestScoring.php',
'CirrusSearch\\BuildDocument\\Completion\\SuggestBuilder' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestBuilder.php',
diff --git 
a/includes/BuildDocument/Completion/NaiveSubphrasesSuggestionsBuilder.php 
b/includes/BuildDocument/Completion/NaiveSubphrasesSuggestionsBuilder.php
new file mode 100644
index 000..99d61da
--- /dev/null
+++ b/includes/BuildDocument/Completion/NaiveSubphrasesSuggestionsBuilder.php
@@ -0,0 +1,176 @@
+ '\/',
+   self::STARTS_WITH_ANY_WORDS_TYPE => '\/\s',
+   ];
+
+   /** @var int */
+   private $maxSubPhrases;
+
+   /**
+* @var string regex character range, this value must be a valid char
+* range and will be used to build a regular expression like
+* '[' . $charRange . ']'
+*/
+   private $charRange;
+
+   /**
+* @param string $charRange character range used to split subphrases
+* @param int $maxSubPhrases defaults to MAX_SUBPHRASES
+*/
+   public function __construct( $charRange, $maxSubPhrases = 
self::MAX_SUBPHRASES ) {
+   $this->charRange = $charRange;
+   $this->maxSubPhrases = $maxSubPhrases;
+   }
+
+   public static function create( array $config ) {
+   $limit = isset( $config['limit'] ) ? $config['limit'] : 
self::MAX_SUBPHRASES;
+   if ( !isset( self::$RANGES_BY_TYPE[$config['type']] ) ) {
+   throw new \Exception( "Unsupported 
NaiveSubphrasesSuggestionsBuilder type " .
+   $config['type'] );
+ 

[MediaWiki-commits] [Gerrit] mediawiki...SecurePoll[master]: Let SecurePoll_Context::getDB() use DB_REPLICA connections

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

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

Change subject: Let SecurePoll_Context::getDB() use DB_REPLICA connections
..

Let SecurePoll_Context::getDB() use DB_REPLICA connections

Change-Id: I988551a28b65418603af9ecf4206237db2ae62e6
---
M includes/main/Context.php
M includes/main/Store.php
2 files changed, 8 insertions(+), 12 deletions(-)


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

diff --git a/includes/main/Context.php b/includes/main/Context.php
index 9cc896f..1d7c3cf 100644
--- a/includes/main/Context.php
+++ b/includes/main/Context.php
@@ -42,9 +42,6 @@
/** The SecurePoll_Random instance */
public $random;
 
-   /** The Database instance */
-   public $db;
-
/**
 * Create a new SecurePoll_Context with an XML file as the storage 
backend.
 * Returns false if there was a problem with the file, like a parse 
error.
@@ -251,13 +248,11 @@
/**
 * Get a database object, or throw an exception if the current store 
object
 * does not support database operations.
+* @param integer $index DB_MASTER or DB_REPLICA
 * @return DatabaseBase
 */
-   function getDB() {
-   if ( !isset( $this->db ) ) {
-   $this->db = $this->getStore()->getDB();
-   }
-   return $this->db;
+   function getDB( $index = DB_MASTER ) {
+   return $this->getStore()->getDB( $index );
}
 
/**
diff --git a/includes/main/Store.php b/includes/main/Store.php
index 9782dbe..776e5ae 100644
--- a/includes/main/Store.php
+++ b/includes/main/Store.php
@@ -61,8 +61,9 @@
 
/**
 * Get a database connection object.
+* @param integer $index DB_MASTER or DB_REPLICA
 */
-   function getDB();
+   function getDB( $index = DB_MASTER );
 
/**
 * Get an associative array of information about all questions in a 
given
@@ -181,8 +182,8 @@
return $info;
}
 
-   function getDB() {
-   return wfGetDB( DB_MASTER );
+   function getDB( $index = DB_MASTER ) {
+   return wfGetDB( $index );
}
 
function getQuestionInfo( $electionId ) {
@@ -337,7 +338,7 @@
'a storage class that doesn\'t support it.' );
}
 
-   function getDB() {
+   function getDB( $index = DB_MASTER ) {
throw new MWException( 'Internal error: attempt to use getDB() 
when the database ' .
'is disabled.' );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I988551a28b65418603af9ecf4206237db2ae62e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
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...ConfirmEdit[master]: Reset the LocalClusterObjectCache service in tests

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

Change subject: Reset the LocalClusterObjectCache service in tests
..


Reset the LocalClusterObjectCache service in tests

Change-Id: I0886e749dee19d729bcd4f398d65b78aa22a8065
---
M tests/phpunit/CaptchaPreAuthenticationProviderTest.php
1 file changed, 6 insertions(+), 1 deletion(-)

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



diff --git a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php 
b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php
index 334393e..3dcc63d 100644
--- a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php
+++ b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php
@@ -23,7 +23,12 @@
] );
CaptchaStore::unsetInstanceForTests();
CaptchaStore::get()->clearAll();
-   ObjectCache::$instances[__METHOD__] = new HashBagOStuff();
+   $services = \MediaWiki\MediaWikiServices::getInstance();
+   if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) 
{
+   $this->setService( 'LocalClusterObjectCache', new 
HashBagOStuff() );
+   } else {
+   ObjectCache::$instances[__METHOD__] = new 
HashBagOStuff();
+   }
}
 
public function tearDown() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0886e749dee19d729bcd4f398d65b78aa22a8065
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Reedy 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[master]: Improve validation of ScribuntoContent

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

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

Change subject: Improve validation of ScribuntoContent
..

Improve validation of ScribuntoContent

First, use the EditFilterMergedContent hook instead of EditFilterMerged,
which has been deprecated since 1.21. This lets us pass our errors on
through the Status object instead of constructing wikitext.

Then implement Content::prepareSave() to ensure that any content
directly passed to WikiPage::doEditContent() that doesn't run edit
filters will still be validated. We have to use prepareSave() instead of
Content::isValid() because validation depends upon the current Title.

Create a ScribuntoContent::validate() convenience function to hold the
logic for both functions.

Bug: T145548
Change-Id: Ie57eff36100963f02899d669df7375577f7375e1
---
M Scribunto.php
M common/Hooks.php
M common/ScribuntoContent.php
3 files changed, 35 insertions(+), 23 deletions(-)


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

diff --git a/Scribunto.php b/Scribunto.php
index f92419f..d344606 100644
--- a/Scribunto.php
+++ b/Scribunto.php
@@ -71,7 +71,7 @@
 $wgHooks['EditPageBeforeEditChecks'][] = 'ScribuntoHooks::beforeEditChecks';
 $wgHooks['EditPage::showReadOnlyForm:initial'][] = 
'ScribuntoHooks::showReadOnlyFormInitial';
 $wgHooks['EditPageBeforeEditButtons'][] = 'ScribuntoHooks::beforeEditButtons';
-$wgHooks['EditFilterMerged'][] = 'ScribuntoHooks::validateScript';
+$wgHooks['EditFilterMergedContent'][] = 'ScribuntoHooks::validateScript';
 $wgHooks['ArticleViewHeader'][] = 'ScribuntoHooks::showDocPageHeader';
 $wgHooks['ContentHandlerDefaultModelFor'][] = 
'ScribuntoHooks::contentHandlerDefaultModelFor';
 
diff --git a/common/Hooks.php b/common/Hooks.php
index 7969a33..11f1507 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -367,38 +367,34 @@
}
 
/**
-* @param EditPage $editor
-* @param string $text
-* @param string $error
+* @param IContextSource $context
+* @param Content $content
+* @param Status $status
 * @param string $summary
+* @param User $user
+* @param bool $minoredit
 * @return bool
 */
-   public static function validateScript( EditPage $editor, $text, 
&$error, $summary ) {
-   $title = $editor->getTitle();
-
-   if ( !$title->hasContentModel( CONTENT_MODEL_SCRIBUNTO ) ) {
+   public static function validateScript( IContextSource $context, Content 
$content,
+   Status $status, $summary, User $user, $minoredit
+   ) {
+   if ( !$content instanceof ScribuntoContent ) {
return true;
}
 
-   $engine = Scribunto::newDefaultEngine();
-   $engine->setTitle( $title );
-   $status = $engine->validate( $text, $title->getPrefixedDBkey() 
);
-   if ( $status->isOK() ) {
+   $title = $context->getTitle();
+   $validateStatus = $content->validate( $title );
+   if ( $validateStatus->isOK() ) {
return true;
}
 
-   $errmsg = $status->getWikiText( 'scribunto-error-short', 
'scribunto-error-long' );
-   $error = <<
-{$errmsg}
-
-
-WIKI;
-   if ( isset( $status->scribunto_error->params['module'] ) ) {
-   $module = $status->scribunto_error->params['module'];
-   $line = $status->scribunto_error->params['line'];
+   $status->merge( $validateStatus );
+
+   if ( isset( $validateStatus->scribunto_error->params['module'] 
) ) {
+   $module = 
$validateStatus->scribunto_error->params['module'];
+   $line = 
$validateStatus->scribunto_error->params['line'];
if ( $module === $title->getPrefixedDBkey() && 
preg_match( '/^\d+$/', $line ) ) {
-   $out = 
$editor->getArticle()->getContext()->getOutput();
+   $out = $context->getOutput();
$out->addInlineScript( 'window.location.hash = 
' . Xml::encodeJsVar( "#mw-ce-l$line" ) );
}
}
diff --git a/common/ScribuntoContent.php b/common/ScribuntoContent.php
index 4a4325d..23237dd 100644
--- a/common/ScribuntoContent.php
+++ b/common/ScribuntoContent.php
@@ -19,6 +19,22 @@
}
 
/**
+* Checks whether the script is valid
+*
+* @param Title $title
+* @return Status
+*/
+   public function validate( Title $title ) {
+   $engine = Scribunto::newDefaultEngine();
+   $engine->setTitle( $title );
+   return $engine->validate( $this->getNativeData(), 
$title->getPrefixedDBkey() );
+   }
+

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix login API for users with @ in their usernames

2016-09-13 Thread Code Review
Gergő Tisza has uploaded a new change for review.

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

Change subject: Fix login API for users with @ in their usernames
..

Fix login API for users with @ in their usernames

An @ in the username caused the password to be treated as a bot password,
but apparently some real usernames still contain it. Try both logins
instead. Security considerations are the same as for the other bot
password syntax: the length check makes sure we do not provide any
information on a timing side channel about the password unless it is
extremely long.

Change-Id: I58f42544a08c3208c41f54cfae932632d9c5affa
---
M includes/user/BotPassword.php
M tests/phpunit/includes/user/BotPasswordTest.php
2 files changed, 8 insertions(+), 5 deletions(-)


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

diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php
index 0bbe12e..eae57f4 100644
--- a/includes/user/BotPassword.php
+++ b/includes/user/BotPassword.php
@@ -411,11 +411,13 @@
 */
public static function canonicalizeLoginData( $username, $password ) {
$sep = BotPassword::getSeparator();
-   if ( strpos( $username, $sep ) !== false ) {
-   // the separator is not valid in usernames so this must 
be a bot login
-   return [ $username, $password, false ];
+   // the strlen check helps minimize the password information 
obtainable from timing
+   if ( strlen( $password ) >= 32 && strpos( $username, $sep ) !== 
false ) {
+   // the separator is not valid in new usernames but 
might appear in legacy ones
+   if ( preg_match( '/^[0-9a-w]{32,}$/', $password ) ) {
+   return [ $username, $password, true ];
+   }
} elseif ( strlen( $password ) > 32 && strpos( $password, $sep 
) !== false ) {
-   // the strlen check helps minimize the password 
information obtainable from timing
$segments = explode( $sep, $password );
$password = array_pop( $segments );
$appId = implode( $sep, $segments );
diff --git a/tests/phpunit/includes/user/BotPasswordTest.php 
b/tests/phpunit/includes/user/BotPasswordTest.php
index d637704..cb27fde 100644
--- a/tests/phpunit/includes/user/BotPasswordTest.php
+++ b/tests/phpunit/includes/user/BotPasswordTest.php
@@ -244,8 +244,9 @@
return [
[ 'user', 'pass', false ],
[ 'user', 'abc@def', false ],
+   [ 'legacy@user', 'pass', false ],
[ 'user@bot', '12345678901234567890123456789012',
-   [ 'user@bot', 
'12345678901234567890123456789012', false ] ],
+   [ 'user@bot', 
'12345678901234567890123456789012', true ] ],
[ 'user', 'bot@12345678901234567890123456789012',
[ 'user@bot', 
'12345678901234567890123456789012', true ] ],
[ 'user', 'bot@12345678901234567890123456789012345',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58f42544a08c3208c41f54cfae932632d9c5affa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza 

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


[MediaWiki-commits] [Gerrit] wikimedia...rainbow[master]: Add PaulScore approximations

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

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

Change subject: Add PaulScore approximations
..

Add PaulScore approximations

Bug: T144424
Change-Id: I83e36bf757850d43eb150f8207835750c8ab927c
---
M server.R
A tab_documentation/paulscore_approx.md
M ui.R
M utils.R
4 files changed, 54 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/rainbow 
refs/changes/61/310461/1

diff --git a/server.R b/server.R
index 11bd239..17a3679 100644
--- a/server.R
+++ b/server.R
@@ -21,10 +21,12 @@
 read_api()
 progress$set(message = "Downloading zero results data", value = 0.5)
 read_failures(existing_date)
-progress$set(message = "Downloading engagement data", value = 0.8)
+progress$set(message = "Downloading engagement data", value = 0.7)
 read_augmented_clickthrough()
-progress$set(message = "Downloading survival data", value = 0.9)
+progress$set(message = "Downloading survival data", value = 0.8)
 read_lethal_dose()
+progress$set(message = "Downloading PaulScore data", value = 0.9)
+read_paul_score()
 progress$set(message = "Finished downloading datasets", value = 1)
 existing_date <<- Sys.Date()
 progress$close()
@@ -82,6 +84,24 @@
   dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = "bottom")
   })
 
+  output$paulscore_approx_plot_fulltext <- renderDygraph({
+paulscore_fulltext %>%
+  polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_paulscore_approx)) %>%
+  
polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, 
input$paulscore_approx_timeframe_daterange)) %>%
+  polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = 
"PaulScore for fulltext searches, by day", use_si = FALSE, group = 
"paulscore_approx") %>%
+  dyRangeSelector %>%
+  dyLegend(labelsDiv = "paulscore_approx_legend", show = "always")
+  })
+
+  output$paulscore_approx_plot_autocomplete <- renderDygraph({
+paulscore_autocomplete %>%
+  polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_paulscore_approx)) %>%
+  
polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, 
input$paulscore_approx_timeframe_daterange)) %>%
+  polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = 
"PaulScore for autocomplete searches, by day", use_si = FALSE, group = 
"paulscore_approx") %>%
+  dyRangeSelector %>%
+  dyLegend(labelsDiv = "paulscore_approx_legend", show = "always")
+  })
+
   ## Mobile value boxes
   output$mobile_event_searches <- renderValueBox(
 valueBox(
diff --git a/tab_documentation/paulscore_approx.md 
b/tab_documentation/paulscore_approx.md
new file mode 100644
index 000..4163a00
--- /dev/null
+++ b/tab_documentation/paulscore_approx.md
@@ -0,0 +1,15 @@
+PaulScore Approximations
+===
+...
+
+Questions, bug reports, and feature suggestions
+--
+For technical, non-bug questions, [email 
Mikhail](mailto:mpo...@wikimedia.org?subject=Dashboard%20Question). If you 
experience a bug or notice something wrong or have a suggestion, [open a ticket 
in 
Phabricator](https://phabricator.wikimedia.org/maniphest/task/create/?projects=Discovery)
 in the Discovery board or [email 
Deb](mailto:d...@wikimedia.org?subject=Dashboard%20Question).
+
+
+
+  Link to this dashboard:
+  http://discovery.wmflabs.org/metrics/#paulscore_approx;>
+http://discovery.wmflabs.org/metrics/#paulscore_approx
+  
+
diff --git a/ui.R b/ui.R
index 248db73..4f91cee 100644
--- a/ui.R
+++ b/ui.R
@@ -27,7 +27,8 @@
  icon = icon("star", lib = "glyphicon")),
 menuItem(text = "Desktop",
  menuSubItem(text = "Events", tabName = "desktop_events"),
- menuSubItem(text = "Load times", tabName = "desktop_load")),
+ menuSubItem(text = "Load times", tabName = "desktop_load"),
+ menuSubItem(text = "PaulScore", tabName = "paulscore_approx")),
 menuItem(text = "Mobile Web",
  menuSubItem(text = "Events", tabName = "mobile_events"),
  menuSubItem(text = "Load times", tabName = "mobile_load")),
@@ -149,6 +150,15 @@
   column(polloi::timeframe_daterange("desktop_load_timeframe"), 
width = 4)),
 dygraphOutput("desktop_load_plot"),
 includeMarkdown("./tab_documentation/desktop_load.md")),
+tabItem(tabName = "paulscore_approx",
+fluidRow(
+  column(polloi::smooth_select("smoothing_paulscore_approx"), 
width = 4),
+  column(polloi::timeframe_select("paulscore_approx_timeframe"), 
width = 4),
+  
column(polloi::timeframe_daterange("paulscore_approx_timeframe"), width = 4)),
+dygraphOutput("paulscore_approx_plot_fulltext"),
+div(id = "paulscore_approx_legend", style = 

[MediaWiki-commits] [Gerrit] wikimedia...rainbow[master]: Add PaulScore approximations

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

Change subject: Add PaulScore approximations
..


Add PaulScore approximations

Bug: T144424
Change-Id: I83e36bf757850d43eb150f8207835750c8ab927c
---
M server.R
A tab_documentation/paulscore_approx.md
M ui.R
M utils.R
4 files changed, 54 insertions(+), 3 deletions(-)

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



diff --git a/server.R b/server.R
index 11bd239..17a3679 100644
--- a/server.R
+++ b/server.R
@@ -21,10 +21,12 @@
 read_api()
 progress$set(message = "Downloading zero results data", value = 0.5)
 read_failures(existing_date)
-progress$set(message = "Downloading engagement data", value = 0.8)
+progress$set(message = "Downloading engagement data", value = 0.7)
 read_augmented_clickthrough()
-progress$set(message = "Downloading survival data", value = 0.9)
+progress$set(message = "Downloading survival data", value = 0.8)
 read_lethal_dose()
+progress$set(message = "Downloading PaulScore data", value = 0.9)
+read_paul_score()
 progress$set(message = "Finished downloading datasets", value = 1)
 existing_date <<- Sys.Date()
 progress$close()
@@ -82,6 +84,24 @@
   dyEvent(as.Date("2016-07-12"), "A (schema switch)", labelLoc = "bottom")
   })
 
+  output$paulscore_approx_plot_fulltext <- renderDygraph({
+paulscore_fulltext %>%
+  polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_paulscore_approx)) %>%
+  
polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, 
input$paulscore_approx_timeframe_daterange)) %>%
+  polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = 
"PaulScore for fulltext searches, by day", use_si = FALSE, group = 
"paulscore_approx") %>%
+  dyRangeSelector %>%
+  dyLegend(labelsDiv = "paulscore_approx_legend", show = "always")
+  })
+
+  output$paulscore_approx_plot_autocomplete <- renderDygraph({
+paulscore_autocomplete %>%
+  polloi::smoother(smooth_level = 
polloi::smooth_switch(input$smoothing_global, 
input$smoothing_paulscore_approx)) %>%
+  
polloi::subset_by_date_range(time_frame_range(input$paulscore_approx_timeframe, 
input$paulscore_approx_timeframe_daterange)) %>%
+  polloi::make_dygraph(xlab = "Date", ylab = "PaulScore", title = 
"PaulScore for autocomplete searches, by day", use_si = FALSE, group = 
"paulscore_approx") %>%
+  dyRangeSelector %>%
+  dyLegend(labelsDiv = "paulscore_approx_legend", show = "always")
+  })
+
   ## Mobile value boxes
   output$mobile_event_searches <- renderValueBox(
 valueBox(
diff --git a/tab_documentation/paulscore_approx.md 
b/tab_documentation/paulscore_approx.md
new file mode 100644
index 000..4163a00
--- /dev/null
+++ b/tab_documentation/paulscore_approx.md
@@ -0,0 +1,15 @@
+PaulScore Approximations
+===
+...
+
+Questions, bug reports, and feature suggestions
+--
+For technical, non-bug questions, [email 
Mikhail](mailto:mpo...@wikimedia.org?subject=Dashboard%20Question). If you 
experience a bug or notice something wrong or have a suggestion, [open a ticket 
in 
Phabricator](https://phabricator.wikimedia.org/maniphest/task/create/?projects=Discovery)
 in the Discovery board or [email 
Deb](mailto:d...@wikimedia.org?subject=Dashboard%20Question).
+
+
+
+  Link to this dashboard:
+  http://discovery.wmflabs.org/metrics/#paulscore_approx;>
+http://discovery.wmflabs.org/metrics/#paulscore_approx
+  
+
diff --git a/ui.R b/ui.R
index 248db73..4f91cee 100644
--- a/ui.R
+++ b/ui.R
@@ -27,7 +27,8 @@
  icon = icon("star", lib = "glyphicon")),
 menuItem(text = "Desktop",
  menuSubItem(text = "Events", tabName = "desktop_events"),
- menuSubItem(text = "Load times", tabName = "desktop_load")),
+ menuSubItem(text = "Load times", tabName = "desktop_load"),
+ menuSubItem(text = "PaulScore", tabName = "paulscore_approx")),
 menuItem(text = "Mobile Web",
  menuSubItem(text = "Events", tabName = "mobile_events"),
  menuSubItem(text = "Load times", tabName = "mobile_load")),
@@ -149,6 +150,15 @@
   column(polloi::timeframe_daterange("desktop_load_timeframe"), 
width = 4)),
 dygraphOutput("desktop_load_plot"),
 includeMarkdown("./tab_documentation/desktop_load.md")),
+tabItem(tabName = "paulscore_approx",
+fluidRow(
+  column(polloi::smooth_select("smoothing_paulscore_approx"), 
width = 4),
+  column(polloi::timeframe_select("paulscore_approx_timeframe"), 
width = 4),
+  
column(polloi::timeframe_daterange("paulscore_approx_timeframe"), width = 4)),
+dygraphOutput("paulscore_approx_plot_fulltext"),
+div(id = "paulscore_approx_legend", style = "text-align: center;"),
+

[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: [wip] Convert 'seenTime' to a global property

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

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

Change subject: [wip] Convert 'seenTime' to a global property
..

[wip] Convert 'seenTime' to a global property

This transforms seenTime concept to a global property for all wikis
and sources, and updates the global seen time on opening the badge.

Bug: T134855
Change-Id: I67bcc4b346237317c7a9204dd43cd0e9ee02792f
---
M includes/SeenTime.php
M modules/api/mw.echo.api.EchoApi.js
M modules/api/mw.echo.api.NetworkHandler.js
M modules/controller/mw.echo.Controller.js
M modules/model/mw.echo.dm.BundleNotificationItem.js
M modules/model/mw.echo.dm.CrossWikiNotificationItem.js
M modules/model/mw.echo.dm.ModelManager.js
M modules/model/mw.echo.dm.NotificationItem.js
M modules/model/mw.echo.dm.NotificationsList.js
M modules/model/mw.echo.dm.SeenTimeModel.js
M modules/ui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ui/mw.echo.ui.NotificationsInboxWidget.js
12 files changed, 123 insertions(+), 96 deletions(-)


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

diff --git a/includes/SeenTime.php b/includes/SeenTime.php
index 4a33720..43962c6 100644
--- a/includes/SeenTime.php
+++ b/includes/SeenTime.php
@@ -41,12 +41,12 @@
private static function cache() {
static $c = null;
 
-   // Use db-replicated for persistent storage, and
+   // Use main stash for persistent storage, and
// wrap it with CachedBagOStuff for an in-process
// cache. (T144534)
if ( $c === null ) {
$c = new CachedBagOStuff(
-   ObjectCache::getInstance( 'db-replicated' )
+   ObjectCache::getMainStashInstance()
);
}
 
@@ -75,9 +75,8 @@
return false;
}
 
-   $key = wfMemcKey( 'echo', 'seen', $type, 'time', 
$this->user->getId() );
$cas = 0; // Unused, but we have to pass something by reference
-   $data = self::cache()->get( $key, $cas, $flags );
+   $data = self::cache()->get( $this->getMemcKey( $type ), $cas, 
$flags );
 
if ( $data === false ) {
// Check if the user still has it set in their 
preferences
@@ -108,9 +107,7 @@
}
} else {
if ( $this->validateType( $type ) ) {
-   $key = wfMemcKey( 'echo', 'seen', $type, 
'time', $this->user->getId() );
-
-   return self::cache()->set( $key, $time );
+   return self::cache()->set( $this->getMemcKey( 
$type ), $time );
}
}
}
@@ -124,4 +121,32 @@
private function validateType( $type ) {
return in_array( $type, self::$allowedTypes );
}
+
+   /**
+* Build a memcached key.
+*
+* @param string $key Key, typically prefixed with echo-notification-
+* @param bool $global If true, return a global memc key; if false, 
return one local to this wiki
+* @return string|false Memcached key, or false if one could not be 
generated
+*/
+   protected function getMemcKey( $type = 'all' ) {
+   global $wgEchoConfig;
+
+   $localKey = wfMemcKey( 'echo', 'seen', $type, 'time', 
$this->user->getId() );
+
+
+   if ( !$this->user->getOption( 'echo-cross-wiki-notifications' ) 
) {
+   return $localKey;
+   }
+
+   $lookup = CentralIdLookup::factory();
+   $globalId = $lookup->centralIdFromLocalUser( $this->mUser, 
CentralIdLookup::AUDIENCE_RAW );
+
+   if ( !$globalId ) {
+   return $localKey;
+   }
+
+   return wfGlobalCacheKey( 'echo', 'seen', $type, 'time', 
$globalId );
+
+   }
 }
diff --git a/modules/api/mw.echo.api.EchoApi.js 
b/modules/api/mw.echo.api.EchoApi.js
index 3ea96b7..d340540 100644
--- a/modules/api/mw.echo.api.EchoApi.js
+++ b/modules/api/mw.echo.api.EchoApi.js
@@ -271,16 +271,19 @@
};
 
/**
-* Update the seenTime property for the given type and source.
+* Update the seenTime property for the given type.
+* We only need to update this in a single source for the seenTime
+* to be updated globally - but we will let the consumer of
+* this method override the choice of which source to update.
 *
 * @param {string} [type='alert,message'] Notification type
-* @param {string} [source='local'] Notification source
 * @return {jQuery.Promise} A promise that is resolved when the 
operation is complete.
 */

[MediaWiki-commits] [Gerrit] operations/puppet[production]: conftool: get conf from class parameters

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

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

Change subject: conftool: get conf from class parameters
..

conftool: get conf from class parameters

So hiera can be used to easily override values

Change-Id: I76610eb7205ab319ba1835397e2966fbc9adfffa
---
D modules/conftool/files/production.config.yaml
M modules/conftool/manifests/init.pp
2 files changed, 19 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/59/310459/1

diff --git a/modules/conftool/files/production.config.yaml 
b/modules/conftool/files/production.config.yaml
deleted file mode 100644
index 0aed92b..000
--- a/modules/conftool/files/production.config.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-hosts:
-  - https://conf1001.eqiad.wmnet:2379
-  - https://conf1002.eqiad.wmnet:2379
-  - https://conf1003.eqiad.wmnet:2379
-driver_options:
-  allow_reconnect: true
-tcpircbot_host: neon.wikimedia.org
-tcpircbot_port: 9200
diff --git a/modules/conftool/manifests/init.pp 
b/modules/conftool/manifests/init.pp
index e2f670a..b27a084 100644
--- a/modules/conftool/manifests/init.pp
+++ b/modules/conftool/manifests/init.pp
@@ -4,11 +4,17 @@
 # a post-receive hook.
 
 class conftool(
-$config_file = 'puppet:///modules/conftool/production.config.yaml',
 $ssl_dir = '/var/lib/puppet/ssl',
 $use_ssl = true,
 $auth= true,
 $password= undef,
+$hosts   = [
+'https://conf1001.eqiad.wmnet:2379',
+'https://conf1002.eqiad.wmnet:2379',
+'https://conf1003.eqiad.wmnet:2379'
+],
+$tcpircbot_host = 'neon.wikimedia.org',
+$tcpircbot_port = 9200,
 ) {
 require_package('python-conftool')
 
@@ -22,11 +28,18 @@
 }
 
 file { '/etc/conftool/config.yaml':
-ensure => present,
-owner  => root,
-group  => root,
-mode   => '0444',
-source => $config_file,
+ensure  => present,
+owner   => root,
+group   => root,
+mode=> '0444',
+content => ordered_yaml({
+hosts  => $hosts,
+tcpircbot_host => $tcpircbot_host,
+tcpircbot_port => $tcpircbot_port,
+driver_options => {
+allow_reconnect => true
+}
+}),
 }
 
 if $auth {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76610eb7205ab319ba1835397e2966fbc9adfffa
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alex Monk 

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


[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: Refactor SuggestBuilder

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

Change subject: Refactor SuggestBuilder
..


Refactor SuggestBuilder

Externalize "non defaults" suggestion building strategies.

Change-Id: I8235fcabd9a261cb53f686d6e1d1f40c08d2bdf9
---
M CirrusSearch.php
M autoload.php
A includes/BuildDocument/Completion/DefaultSortSuggestionsBuilder.php
A includes/BuildDocument/Completion/ExtraSuggestionsBuilder.php
A includes/BuildDocument/Completion/GeoSuggestionsBuilder.php
R includes/BuildDocument/Completion/SuggestBuilder.php
R includes/BuildDocument/Completion/SuggestScoring.php
M includes/CompletionSuggester.php
M maintenance/updateSuggesterIndex.php
M tests/unit/CompletionSuggesterTest.php
M tests/unit/SuggestBuilderTest.php
M tests/unit/SuggestScoringTest.php
12 files changed, 342 insertions(+), 109 deletions(-)

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



diff --git a/CirrusSearch.php b/CirrusSearch.php
index d424981..7a393f6 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -806,6 +806,13 @@
 $wgCirrusSearchCompletionSuggesterUseDefaultSort = false;
 
 /**
+ * Builds extra fst with a geo context.
+ * Can generate a very large in-memory FST
+ * NOTE: Experimental, no API endpoints are available yet.
+ */
+$wgCirrusSearchCompletionSuggesterGeoContext = ['build' => false];
+
+/**
  * Maximum number of results to ask from the elasticsearch completion
  * api, note that this value will be multiplied by fetch_limit_factor
  * set in Completion profiles (default to 2)
diff --git a/autoload.php b/autoload.php
index bc2747a..b5bd324 100644
--- a/autoload.php
+++ b/autoload.php
@@ -12,14 +12,17 @@
'CirrusSearch\\Api\\SettingsDump' => __DIR__ . 
'/includes/Api/SettingsDump.php',
'CirrusSearch\\Api\\SuggestIndex' => __DIR__ . 
'/includes/Api/SuggestIndex.php',
'CirrusSearch\\BuildDocument\\Builder' => __DIR__ . 
'/includes/BuildDocument/Builder.php',
-   'CirrusSearch\\BuildDocument\\IncomingLinksScoringMethod' => __DIR__ . 
'/includes/BuildDocument/SuggestScoring.php',
-   'CirrusSearch\\BuildDocument\\PQScore' => __DIR__ . 
'/includes/BuildDocument/SuggestScoring.php',
+   
'CirrusSearch\\BuildDocument\\Completion\\DefaultSortSuggestionsBuilder' => 
__DIR__ . 
'/includes/BuildDocument/Completion/DefaultSortSuggestionsBuilder.php',
+   'CirrusSearch\\BuildDocument\\Completion\\ExtraSuggestionsBuilder' => 
__DIR__ . '/includes/BuildDocument/Completion/ExtraSuggestionsBuilder.php',
+   'CirrusSearch\\BuildDocument\\Completion\\GeoSuggestionsBuilder' => 
__DIR__ . '/includes/BuildDocument/Completion/GeoSuggestionsBuilder.php',
+   'CirrusSearch\\BuildDocument\\Completion\\IncomingLinksScoringMethod' 
=> __DIR__ . '/includes/BuildDocument/Completion/SuggestScoring.php',
+   'CirrusSearch\\BuildDocument\\Completion\\PQScore' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestScoring.php',
+   'CirrusSearch\\BuildDocument\\Completion\\QualityScore' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestScoring.php',
+   'CirrusSearch\\BuildDocument\\Completion\\SuggestBuilder' => __DIR__ . 
'/includes/BuildDocument/Completion/SuggestBuilder.php',
+   'CirrusSearch\\BuildDocument\\Completion\\SuggestScoringMethod' => 
__DIR__ . '/includes/BuildDocument/Completion/SuggestScoring.php',
+   'CirrusSearch\\BuildDocument\\Completion\\SuggestScoringMethodFactory' 
=> __DIR__ . '/includes/BuildDocument/Completion/SuggestScoring.php',
'CirrusSearch\\BuildDocument\\ParseBuilder' => __DIR__ . 
'/includes/BuildDocument/Builder.php',
-   'CirrusSearch\\BuildDocument\\QualityScore' => __DIR__ . 
'/includes/BuildDocument/SuggestScoring.php',
'CirrusSearch\\BuildDocument\\RedirectsAndIncomingLinks' => __DIR__ . 
'/includes/BuildDocument/RedirectsAndIncomingLinks.php',
-   'CirrusSearch\\BuildDocument\\SuggestBuilder' => __DIR__ . 
'/includes/BuildDocument/SuggestBuilder.php',
-   'CirrusSearch\\BuildDocument\\SuggestScoringMethod' => __DIR__ . 
'/includes/BuildDocument/SuggestScoring.php',
-   'CirrusSearch\\BuildDocument\\SuggestScoringMethodFactory' => __DIR__ . 
'/includes/BuildDocument/SuggestScoring.php',
'CirrusSearch\\CheckIndexes' => __DIR__ . 
'/maintenance/checkIndexes.php',
'CirrusSearch\\CirrusIsSetup' => __DIR__ . 
'/maintenance/cirrusNeedsToBeBuilt.php',
'CirrusSearch\\ClusterSettings' => __DIR__ . 
'/includes/ClusterSettings.php',
@@ -89,9 +92,9 @@
'CirrusSearch\\OtherIndexes' => __DIR__ . '/includes/OtherIndexes.php',
'CirrusSearch\\PhraseSuggesterProfiles' => __DIR__ . 
'/profiles/PhraseSuggesterProfiles.php',
'CirrusSearch\\Query\\BoostTemplatesFeature' => __DIR__ . 
'/includes/Query/BoostTemplatesFeature.php',
-   'CirrusSearch\\Query\\FullTextSimpleMatchQueryBuilder' => 

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.19]: momentjs: Hack around bug in node/browser compat wrapper in ...

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

Change subject: momentjs: Hack around bug in node/browser compat wrapper in 
locale files
..


momentjs: Hack around bug in node/browser compat wrapper in locale files

If there is an element with id="global" on the page,
typeof global !== 'undefined' is true, but global.moment will
still be undefined and shouldn't be used.

For now, comment out the wrapper and just use 'this'.
We should look into upgrading to momentjs 2.14 where this bug is fixed.

Bug: T145382
Change-Id: Ia6e3b46e42248a5ee3c61c5fcda7d020d012e89e
(cherry picked from commit 939c85ac7fe2c187a480f7c9fc06b46b3a3e05a0)
---
M resources/lib/moment/locale/af.js
M resources/lib/moment/locale/ar-ma.js
M resources/lib/moment/locale/ar-sa.js
M resources/lib/moment/locale/ar.js
M resources/lib/moment/locale/az.js
M resources/lib/moment/locale/be.js
M resources/lib/moment/locale/bg.js
M resources/lib/moment/locale/bn.js
M resources/lib/moment/locale/bo.js
M resources/lib/moment/locale/br.js
M resources/lib/moment/locale/bs.js
M resources/lib/moment/locale/ca.js
M resources/lib/moment/locale/cs.js
M resources/lib/moment/locale/cv.js
M resources/lib/moment/locale/cy.js
M resources/lib/moment/locale/da.js
M resources/lib/moment/locale/de-at.js
M resources/lib/moment/locale/de.js
M resources/lib/moment/locale/el.js
M resources/lib/moment/locale/en-au.js
M resources/lib/moment/locale/en-ca.js
M resources/lib/moment/locale/en-gb.js
M resources/lib/moment/locale/eo.js
M resources/lib/moment/locale/es.js
M resources/lib/moment/locale/et.js
M resources/lib/moment/locale/eu.js
M resources/lib/moment/locale/fa.js
M resources/lib/moment/locale/fi.js
M resources/lib/moment/locale/fo.js
M resources/lib/moment/locale/fr-ca.js
M resources/lib/moment/locale/fr.js
M resources/lib/moment/locale/gl.js
M resources/lib/moment/locale/he.js
M resources/lib/moment/locale/hi.js
M resources/lib/moment/locale/hr.js
M resources/lib/moment/locale/hu.js
M resources/lib/moment/locale/hy-am.js
M resources/lib/moment/locale/id.js
M resources/lib/moment/locale/is.js
M resources/lib/moment/locale/it.js
M resources/lib/moment/locale/ja.js
M resources/lib/moment/locale/ka.js
M resources/lib/moment/locale/km.js
M resources/lib/moment/locale/ko.js
M resources/lib/moment/locale/lb.js
M resources/lib/moment/locale/lt.js
M resources/lib/moment/locale/lv.js
M resources/lib/moment/locale/mk.js
M resources/lib/moment/locale/ml.js
M resources/lib/moment/locale/mr.js
M resources/lib/moment/locale/ms-my.js
M resources/lib/moment/locale/my.js
M resources/lib/moment/locale/nb.js
M resources/lib/moment/locale/ne.js
M resources/lib/moment/locale/nl.js
M resources/lib/moment/locale/nn.js
M resources/lib/moment/locale/pl.js
M resources/lib/moment/locale/pt-br.js
M resources/lib/moment/locale/pt.js
M resources/lib/moment/locale/ro.js
M resources/lib/moment/locale/ru.js
M resources/lib/moment/locale/sk.js
M resources/lib/moment/locale/sl.js
M resources/lib/moment/locale/sq.js
M resources/lib/moment/locale/sr-cyrl.js
M resources/lib/moment/locale/sr.js
M resources/lib/moment/locale/sv.js
M resources/lib/moment/locale/ta.js
M resources/lib/moment/locale/th.js
M resources/lib/moment/locale/tl-ph.js
M resources/lib/moment/locale/tr.js
M resources/lib/moment/locale/tzm-latn.js
M resources/lib/moment/locale/tzm.js
M resources/lib/moment/locale/uk.js
M resources/lib/moment/locale/uz.js
M resources/lib/moment/locale/vi.js
M resources/lib/moment/locale/zh-cn.js
M resources/lib/moment/locale/zh-tw.js
78 files changed, 312 insertions(+), 156 deletions(-)

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



diff --git a/resources/lib/moment/locale/af.js 
b/resources/lib/moment/locale/af.js
index 2fb7adf..55a41bd 100644
--- a/resources/lib/moment/locale/af.js
+++ b/resources/lib/moment/locale/af.js
@@ -3,13 +3,15 @@
 // author : Werner Mollentze : https://github.com/wernerm
 
 (function (factory) {
-if (typeof define === 'function' && define.amd) {
+// Comment out broken wrapper, see T145382
+/*if (typeof define === 'function' && define.amd) {
 define(['moment'], factory); // AMD
 } else if (typeof exports === 'object') {
 module.exports = factory(require('../moment')); // Node
 } else {
 factory((typeof global !== 'undefined' ? global : this).moment); // 
node or other global
-}
+}*/
+factory(this.moment);
 }(function (moment) {
 return moment.defineLocale('af', {
 months : 
'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
diff --git a/resources/lib/moment/locale/ar-ma.js 
b/resources/lib/moment/locale/ar-ma.js
index 7add172..871e41c 100644
--- a/resources/lib/moment/locale/ar-ma.js
+++ b/resources/lib/moment/locale/ar-ma.js
@@ -4,13 +4,15 @@
 // author : Abdel Said : https://github.com/abdelsaid
 
 (function (factory) {
-if (typeof define === 

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.18]: momentjs: Hack around bug in node/browser compat wrapper in ...

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

Change subject: momentjs: Hack around bug in node/browser compat wrapper in 
locale files
..


momentjs: Hack around bug in node/browser compat wrapper in locale files

If there is an element with id="global" on the page,
typeof global !== 'undefined' is true, but global.moment will
still be undefined and shouldn't be used.

For now, comment out the wrapper and just use 'this'.
We should look into upgrading to momentjs 2.14 where this bug is fixed.

Bug: T145382
Change-Id: Ia6e3b46e42248a5ee3c61c5fcda7d020d012e89e
(cherry picked from commit 939c85ac7fe2c187a480f7c9fc06b46b3a3e05a0)
---
M resources/lib/moment/locale/af.js
M resources/lib/moment/locale/ar-ma.js
M resources/lib/moment/locale/ar-sa.js
M resources/lib/moment/locale/ar.js
M resources/lib/moment/locale/az.js
M resources/lib/moment/locale/be.js
M resources/lib/moment/locale/bg.js
M resources/lib/moment/locale/bn.js
M resources/lib/moment/locale/bo.js
M resources/lib/moment/locale/br.js
M resources/lib/moment/locale/bs.js
M resources/lib/moment/locale/ca.js
M resources/lib/moment/locale/cs.js
M resources/lib/moment/locale/cv.js
M resources/lib/moment/locale/cy.js
M resources/lib/moment/locale/da.js
M resources/lib/moment/locale/de-at.js
M resources/lib/moment/locale/de.js
M resources/lib/moment/locale/el.js
M resources/lib/moment/locale/en-au.js
M resources/lib/moment/locale/en-ca.js
M resources/lib/moment/locale/en-gb.js
M resources/lib/moment/locale/eo.js
M resources/lib/moment/locale/es.js
M resources/lib/moment/locale/et.js
M resources/lib/moment/locale/eu.js
M resources/lib/moment/locale/fa.js
M resources/lib/moment/locale/fi.js
M resources/lib/moment/locale/fo.js
M resources/lib/moment/locale/fr-ca.js
M resources/lib/moment/locale/fr.js
M resources/lib/moment/locale/gl.js
M resources/lib/moment/locale/he.js
M resources/lib/moment/locale/hi.js
M resources/lib/moment/locale/hr.js
M resources/lib/moment/locale/hu.js
M resources/lib/moment/locale/hy-am.js
M resources/lib/moment/locale/id.js
M resources/lib/moment/locale/is.js
M resources/lib/moment/locale/it.js
M resources/lib/moment/locale/ja.js
M resources/lib/moment/locale/ka.js
M resources/lib/moment/locale/km.js
M resources/lib/moment/locale/ko.js
M resources/lib/moment/locale/lb.js
M resources/lib/moment/locale/lt.js
M resources/lib/moment/locale/lv.js
M resources/lib/moment/locale/mk.js
M resources/lib/moment/locale/ml.js
M resources/lib/moment/locale/mr.js
M resources/lib/moment/locale/ms-my.js
M resources/lib/moment/locale/my.js
M resources/lib/moment/locale/nb.js
M resources/lib/moment/locale/ne.js
M resources/lib/moment/locale/nl.js
M resources/lib/moment/locale/nn.js
M resources/lib/moment/locale/pl.js
M resources/lib/moment/locale/pt-br.js
M resources/lib/moment/locale/pt.js
M resources/lib/moment/locale/ro.js
M resources/lib/moment/locale/ru.js
M resources/lib/moment/locale/sk.js
M resources/lib/moment/locale/sl.js
M resources/lib/moment/locale/sq.js
M resources/lib/moment/locale/sr-cyrl.js
M resources/lib/moment/locale/sr.js
M resources/lib/moment/locale/sv.js
M resources/lib/moment/locale/ta.js
M resources/lib/moment/locale/th.js
M resources/lib/moment/locale/tl-ph.js
M resources/lib/moment/locale/tr.js
M resources/lib/moment/locale/tzm-latn.js
M resources/lib/moment/locale/tzm.js
M resources/lib/moment/locale/uk.js
M resources/lib/moment/locale/uz.js
M resources/lib/moment/locale/vi.js
M resources/lib/moment/locale/zh-cn.js
M resources/lib/moment/locale/zh-tw.js
78 files changed, 312 insertions(+), 156 deletions(-)

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



diff --git a/resources/lib/moment/locale/af.js 
b/resources/lib/moment/locale/af.js
index 2fb7adf..55a41bd 100644
--- a/resources/lib/moment/locale/af.js
+++ b/resources/lib/moment/locale/af.js
@@ -3,13 +3,15 @@
 // author : Werner Mollentze : https://github.com/wernerm
 
 (function (factory) {
-if (typeof define === 'function' && define.amd) {
+// Comment out broken wrapper, see T145382
+/*if (typeof define === 'function' && define.amd) {
 define(['moment'], factory); // AMD
 } else if (typeof exports === 'object') {
 module.exports = factory(require('../moment')); // Node
 } else {
 factory((typeof global !== 'undefined' ? global : this).moment); // 
node or other global
-}
+}*/
+factory(this.moment);
 }(function (moment) {
 return moment.defineLocale('af', {
 months : 
'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
diff --git a/resources/lib/moment/locale/ar-ma.js 
b/resources/lib/moment/locale/ar-ma.js
index 7add172..871e41c 100644
--- a/resources/lib/moment/locale/ar-ma.js
+++ b/resources/lib/moment/locale/ar-ma.js
@@ -4,13 +4,15 @@
 // author : Abdel Said : https://github.com/abdelsaid
 
 (function (factory) {
-if (typeof define === 

[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Talk browser test should check JS has loaded before continuing

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

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

Change subject: Talk browser test should check JS has loaded before continuing
..

Talk browser test should check JS has loaded before continuing

When testing Sam's MobileFormatter changes there were a few browser
test failures around this scenario due to the page not completely
loading. This change asserts that the JS that enhances the talk button
has fully loaded.

Other changes:
* Given we now use this method in 3 places I've generalised this
into a separate rule so other browser tests can make use of it

Change-Id: I575f4d44ed9f18872710605482c1438a4a8385f8
---
M tests/browser/features/step_definitions/common_steps.rb
M tests/browser/features/step_definitions/notification_steps.rb
M tests/browser/features/step_definitions/ui_links_steps.rb
M tests/browser/features/talk.feature
4 files changed, 15 insertions(+), 13 deletions(-)


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

diff --git a/tests/browser/features/step_definitions/common_steps.rb 
b/tests/browser/features/step_definitions/common_steps.rb
index 6710eac..f2ce36e 100644
--- a/tests/browser/features/step_definitions/common_steps.rb
+++ b/tests/browser/features/step_definitions/common_steps.rb
@@ -12,6 +12,18 @@
   end
 end
 
+Given(/^the module "(.*?)" has loaded$/) do |module_name|
+  on(ArticlePage) do |page|
+page.wait_until do
+  # Wait for JS to hijack standard link
+  # TODO: If this approach works well, we should implement general
+  # `wait_for_resource` and `resource_ready?` helper methods in
+  # mw-selenium, and document this pattern on mw.org
+  browser.execute_script("return mw.loader.getState('#{module_name}') === 
'ready'")
+end
+  end
+end
+
 Given /^I am logged in as a new user$/ do
   step 'I am on the "Main Page" page'
   step 'I click on "Log in" in the main navigation menu'
diff --git a/tests/browser/features/step_definitions/notification_steps.rb 
b/tests/browser/features/step_definitions/notification_steps.rb
index d73cec0..0a70e18 100644
--- a/tests/browser/features/step_definitions/notification_steps.rb
+++ b/tests/browser/features/step_definitions/notification_steps.rb
@@ -1,13 +1,6 @@
 When /^I click on the notification icon$/ do
+  step 'the module "skins.minerva.notifications" has loaded'
   on(ArticlePage) do |page|
-page.wait_until do
-  # Wait for JS to hijack standard link
-  # TODO: If this approach works well, we should implement general
-  # `wait_for_resource` and `resource_ready?` helper methods in
-  # mw-selenium, and document this pattern on mw.org
-  browser.execute_script("return 
mw.loader.getState('skins.minerva.notifications') === 'ready'")
-end
-
 page.notifications_button_element.when_present.click
   end
 end
diff --git a/tests/browser/features/step_definitions/ui_links_steps.rb 
b/tests/browser/features/step_definitions/ui_links_steps.rb
index 8d0d77d..27c4e52 100644
--- a/tests/browser/features/step_definitions/ui_links_steps.rb
+++ b/tests/browser/features/step_definitions/ui_links_steps.rb
@@ -8,11 +8,7 @@
 
 Then(/^I should see the link to the user page of the last editor$/) do
   # T132753
-  on(ArticlePage) do |page|
-page.wait_until do
-  browser.execute_script("return 
mw.loader.getState('skins.minerva.scripts') === 'ready'")
-end
-  end
+  step 'the module "skins.minerva.scripts" has loaded'
   expect(on(ArticlePage).last_modified_bar_history_userpage_link_element).to 
be_visible
 end
 
diff --git a/tests/browser/features/talk.feature 
b/tests/browser/features/talk.feature
index 48c2aa0..c601d46 100644
--- a/tests/browser/features/talk.feature
+++ b/tests/browser/features/talk.feature
@@ -29,6 +29,7 @@
 Given the page "Talk:Selenium talk test" exists
   And I am logged in as a user with a > 5 edit count
   And the page "Selenium talk test" exists
+  And the module "skins.minerva.talk" has loaded
 When I click the talk button
 Then there should be an add discussion button
 

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: puppet panel: Fix incorrect path

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

Change subject: puppet panel:  Fix incorrect path
..


puppet panel:  Fix incorrect path

Change-Id: If386f302c95fdd3adbf1c940d82c318e7c6bf3aa
---
M modules/openstack/files/liberty/horizon/puppet_tab_enable.py
M modules/openstack/files/liberty/horizon/puppettab/projectpanel.py
2 files changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/modules/openstack/files/liberty/horizon/puppet_tab_enable.py 
b/modules/openstack/files/liberty/horizon/puppet_tab_enable.py
index a8891d4..a2d62ed 100644
--- a/modules/openstack/files/liberty/horizon/puppet_tab_enable.py
+++ b/modules/openstack/files/liberty/horizon/puppet_tab_enable.py
@@ -1,7 +1,7 @@
 PANEL = 'projectpuppetpanel'
 PANEL_GROUP = 'puppet'
 PANEL_DASHBOARD = 'project'
-ADD_PANEL = ('wikimediapuppettab.panel.ProjectPuppetPanel')
+ADD_PANEL = ('wikimediapuppettab.projectpanel.ProjectPuppetPanel')
 ADD_INSTALLED_APPS = ['wikimediapuppettab']
 AUTO_DISCOVER_STATIC_FILES = True
 ADD_SCSS_FILES = ['dashboard/puppet/puppet.scss']
diff --git a/modules/openstack/files/liberty/horizon/puppettab/projectpanel.py 
b/modules/openstack/files/liberty/horizon/puppettab/projectpanel.py
index 16d35e1..b28fdfc 100644
--- a/modules/openstack/files/liberty/horizon/puppettab/projectpanel.py
+++ b/modules/openstack/files/liberty/horizon/puppettab/projectpanel.py
@@ -55,7 +55,7 @@
 caption = _("These puppet settings will affect all VMs"
 " in the %s project.") % tenant_id
 return self.tab_group_class(request,
-prefix=' ',
+prefix='_',
 caption=caption,
 tenant_id=tenant_id,
 **kwargs)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If386f302c95fdd3adbf1c940d82c318e7c6bf3aa
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] mediawiki...CentralNotice[master]: WIP MariaDB strict mode

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

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

Change subject: WIP MariaDB strict mode
..

WIP MariaDB strict mode

Thanks for the handy 'mysql-only' comments on the transitional code!

Bug: T145591
Change-Id: Ib4e5531acf8dd250feff84bdff2394e95c30aa1d
---
M includes/Banner.php
M includes/Campaign.php
2 files changed, 2 insertions(+), 22 deletions(-)


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

diff --git a/includes/Banner.php b/includes/Banner.php
index 3c37227..840e33c 100644
--- a/includes/Banner.php
+++ b/includes/Banner.php
@@ -1378,17 +1378,7 @@
'tmplog_content_change'=> 
(int)$this->dirtyFlags['content'],
);
 
-   // TODO temporary code for soft dependency on schema change
-   // Note: MySQL-specific
-   global $wgDBtype;
-   if ( $wgDBtype === 'mysql' && $dbw->query(
-   'SHOW COLUMNS FROM ' .
-   $dbw->tableName( 'cn_template_log' )
-   . ' LIKE ' . $dbw->addQuotes( 'tmplog_comment' )
-   )->numRows() === 1 ) {
-
-   $log['tmplog_comment'] = $summary;
-   }
+   $log['tmplog_comment'] = $summary;
 
foreach ( $endSettings as $key => $value ) {
if ( is_array( $value ) ) {
diff --git a/includes/Campaign.php b/includes/Campaign.php
index e77d1d5..1d1ffe7 100644
--- a/includes/Campaign.php
+++ b/includes/Campaign.php
@@ -1348,17 +1348,7 @@
'notlog_not_name'  => Campaign::getNoticeName( 
$campaignId )
);
 
-   // TODO temporary code for soft dependency on schema 
change
-   // Note: MySQL-specific
-   global $wgDBtype;
-   if ( $wgDBtype === 'mysql' && $dbw->query(
-   'SHOW COLUMNS FROM ' .
-   $dbw->tableName( 'cn_notice_log' )
-   . ' LIKE ' . $dbw->addQuotes( 
'notlog_comment' )
-   )->numRows() === 1 ) {
-
-   $log['notlog_comment'] = $summary;
-   }
+   $log['notlog_comment'] = $summary;
 
foreach ( $beginSettings as $key => $value ) {
$log[ 'notlog_begin_' . $key ] = $value;

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

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

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


[MediaWiki-commits] [Gerrit] operations/dumps[master]: fix up the find page in last 500 lines "temporary" hack

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

Change subject: fix up the find page in last 500 lines "temporary" hack
..


fix up the find page in last 500 lines "temporary" hack

Change-Id: Ica301abea7cdfa77b66d90acfcc4160828999f1a
---
M xmldumps-backup/dumps/xmljobs.py
1 file changed, 35 insertions(+), 3 deletions(-)

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



diff --git a/xmldumps-backup/dumps/xmljobs.py b/xmldumps-backup/dumps/xmljobs.py
index c5b60aa..afa4a5f 100644
--- a/xmldumps-backup/dumps/xmljobs.py
+++ b/xmldumps-backup/dumps/xmljobs.py
@@ -532,7 +532,7 @@
 if error:
 raise BackupError("failed to write partial stub file %s" % 
output_file.filename)
 
-def get_last_500_lines(self, fileobj, runner):
+def get_last_lines_from_n(self, fileobj, runner, count):
 if not fileobj.filename or not 
exists(runner.dump_dir.filename_public_path(fileobj)):
 return None
 
@@ -545,7 +545,7 @@
 if not exists(tail):
 raise BackupError("tail command %s not found" % tail)
 tail_esc = MiscUtils.shell_escape(tail)
-pipeline.append([tail, "-500"])
+pipeline.append([tail, "-n", "+%s" % count])
 # without shell
 proc = CommandPipeline(pipeline, quiet=True)
 proc.run_pipeline_get_output()
@@ -557,8 +557,40 @@
 last_lines = proc.output()
 return last_lines
 
+def get_lineno_last_page(self, fileobj, runner):
+if not fileobj.filename or not 
exists(runner.dump_dir.filename_public_path(fileobj)):
+return None
+dumpfile = DumpFile(self.wiki,
+runner.dump_dir.filename_public_path(fileobj, 
self.wiki.date),
+fileobj, self.verbose)
+pipeline = dumpfile.setup_uncompression_command()
+grep = self.wiki.config.grep
+if not exists(grep):
+raise BackupError("grep command %s not found" % grep)
+pipeline.append([grep, "-n", ""])
+tail = self.wiki.config.tail
+if not exists(tail):
+raise BackupError("tail command %s not found" % tail)
+pipeline.append([tail, "-1"])
+# without shell
+proc = CommandPipeline(pipeline, quiet=True)
+proc.run_pipeline_get_output()
+if (proc.exited_successfully() or
+(proc.get_failed_cmds_with_retcode() ==
+ [[-signal.SIGPIPE, pipeline[0]]]) or
+(proc.get_failed_cmds_with_retcode() ==
+ [[signal.SIGPIPE + 128, pipeline[0]]])):
+output = proc.output()
+# 339915646:  
+if ':' in output:
+linecount = output.split(':')[0]
+if linecount.isdigit():
+return linecount
+return None
+
 def find_last_page_id(self, fileobj, runner):
-lastlines = self.get_last_500_lines(fileobj, runner)
+count = self.get_lineno_last_page(fileobj, runner)
+lastlines = self.get_last_lines_from_n(fileobj, runner, count)
 # now look for the last page id in here. eww
 if not lastlines:
 return None

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ica301abea7cdfa77b66d90acfcc4160828999f1a
Gerrit-PatchSet: 2
Gerrit-Project: operations/dumps
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn 
Gerrit-Reviewer: ArielGlenn 
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]: Remove wmf_zendesk_reports

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

Change subject: Remove wmf_zendesk_reports
..


Remove wmf_zendesk_reports

Donor services is no longer using it, and the API is about to go away.

Bug: T143142
Change-Id: I3d3deaad8e60fb663a85c72eae4a258f297e7b26
---
D sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.info
D sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.module
M sites/default/enabled_modules
3 files changed, 0 insertions(+), 216 deletions(-)

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



diff --git a/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.info 
b/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.info
deleted file mode 100644
index ece25d6..000
--- a/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.info
+++ /dev/null
@@ -1,4 +0,0 @@
-name = WMF ZenDesk Reports
-description = Custom reports from ZenDesk
-core = 7.x
-package = Wikimedia
diff --git a/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.module 
b/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.module
deleted file mode 100644
index 1dbf13b..000
--- a/sites/all/modules/wmf_zendesk_reports/wmf_zendesk_reports.module
+++ /dev/null
@@ -1,211 +0,0 @@
- array(
-  'title' => t('Access WMF ZenDesk Reports Query Page'),
-)
-  );
-}
-
-/**
- * Implements hook_menu().
- */
-function wmf_zendesk_reports_menu() {
-  $items['admin/zendesk_query'] = array(
-'title' => 'Zendesk Tickets Query',
-'access arguments' => array('access 
wmf_zendesk_reports query page'),
-'page callback' => 'drupal_get_form',
-'page arguments' => 
array('wmf_zendesk_reports_ticket_query_page'),
-);
-
- return $items;
-}
-
-
-function wmf_zendesk_reports_ticket_query_page() {
-
-  $form['username'] = array(
-'#type' => 'textfield',
-'#title' => t('Your ZenDesk Username'),
-  );
-  $form['password'] = array(
-'#type' => 'password',
-'#title' => t('Your ZenDesk Password'),
-  );
-  $form['tags'] = array(
-'#type' => 'textfield',
-'#title' => t('Tags to search for'),
-'#description' => t('Separate multiple tags with commas'),
-  );
-  $form['active'] = array(
-'#type' => 'checkbox',
-'#title' => t('Include Active Support Tickets Only'),
-  );
-  $form['submit_query'] = array(
-'#type' => 'submit',
-'#value' => 'Get Results',
-'#submit' => array('wmf_zendesk_reports_make_query'),
-  );
-  return $form;
-}
-
-function wmf_zendesk_reports_make_query($form, &$form_state) {
-
-  // Get username, password from form
-  $username = $form_state['values']['username'];
-  $password = $form_state['values']['password'];
-
-  // Get tag from form, strip leading/trailing whitespace, and replace 
remaining spaces with underscores
-  $tags = $form_state['values']['tags'];
-  $tags_array = explode(',', $tags);
-  foreach ($tags_array as $key => $tag) {
-$tags_array[$key] = str_replace(" ", "_", trim($tag));
-  }
-
-  $tags = implode(',', $tags_array);
-  $url = 
"https://wikimedia.zendesk.com/api/v2/search.json?query=type:ticket%20tags:; . 
$tags;
-
-  // Modify url for Active tickets only
-  if ($form_state['values']['active'] === 1) {
-$url .= '%20status%3Cclosed';
-  }
-
-  $query_result = wmf_zendesk_reports_make_single_query_request($url, 
$username, $password);
-  $some_results = 
wmf_zendesk_reports_flatten_result_array($query_result['results']);
-  $csv_headers = 
wmf_zendesk_reports_get_headers_from_flattened_results($some_results);
-
-  if (ob_get_level()) {
-ob_end_clean();
-  }
-
-  drupal_add_http_header('Content-Type', 'text/csv; utf-8');
-  drupal_add_http_header('Content-Disposition', 'attachment; filename = 
zendesk.csv');
-  drupal_send_headers();
-
-  $out = fopen('php://output', 'w');
-  wmf_zendesk_reports_fputcsv($out, $csv_headers, ',', '"');
-  wmf_zendesk_reports_write_some_results_to_csv($some_results, $out);
-
-  while ($query_result['next_page'] != null) {
-$query_result = 
wmf_zendesk_reports_make_single_query_request($query_result['next_page'], 
$username, $password);
-$some_results = 
wmf_zendesk_reports_flatten_result_array($query_result['results']);
-wmf_zendesk_reports_write_some_results_to_csv($some_results, $out);
-  }
-
-  fclose($out);
-  drupal_exit();
-}
-
-function wmf_zendesk_reports_write_some_results_to_csv($some_results, 
$file_handle) {
-  foreach ($some_results as $key => $val) {
-wmf_zendesk_reports_fputcsv($file_handle, $val, ',', '"');
-  }
-}
-
-function 
wmf_zendesk_reports_fputcsv($filePointer,$dataArray,$delimiter,$enclosure) {
-  // Write a line to a file
-  // $filePointer = the file resource to write to
-  // $dataArray = the data to write out
-  // $delimeter = the field 

[MediaWiki-commits] [Gerrit] operations/dumps[master]: fix up the find page in last 500 lines "temporary" hack

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

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

Change subject: fix up the find page in last 500 lines "temporary" hack
..

fix up the find page in last 500 lines "temporary" hack

Change-Id: Ica301abea7cdfa77b66d90acfcc4160828999f1a
---
M xmldumps-backup/dumps/xmljobs.py
1 file changed, 35 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/dumps 
refs/changes/56/310456/1

diff --git a/xmldumps-backup/dumps/xmljobs.py b/xmldumps-backup/dumps/xmljobs.py
index c5b60aa..20eb75a 100644
--- a/xmldumps-backup/dumps/xmljobs.py
+++ b/xmldumps-backup/dumps/xmljobs.py
@@ -532,7 +532,7 @@
 if error:
 raise BackupError("failed to write partial stub file %s" % 
output_file.filename)
 
-def get_last_500_lines(self, fileobj, runner):
+def get_last_lines_from_n(self, fileobj, runner, count):
 if not fileobj.filename or not 
exists(runner.dump_dir.filename_public_path(fileobj)):
 return None
 
@@ -545,7 +545,7 @@
 if not exists(tail):
 raise BackupError("tail command %s not found" % tail)
 tail_esc = MiscUtils.shell_escape(tail)
-pipeline.append([tail, "-500"])
+pipeline.append([tail, "-n", "+%s" % count])
 # without shell
 proc = CommandPipeline(pipeline, quiet=True)
 proc.run_pipeline_get_output()
@@ -557,8 +557,40 @@
 last_lines = proc.output()
 return last_lines
 
+def get_lineno_last_page(self, fileobj, runner):
+if not fileobj.filename or not 
exists(runner.dump_dir.filename_public_path(fileobj)):
+return None
+dumpfile = DumpFile(self.wiki,
+runner.dump_dir.filename_public_path(fileobj, 
self.wiki.date),
+fileobj, self.verbose)
+pipeline = dumpfile.setup_uncompression_command()
+grep = self.wiki.config.grep
+if not exists(grep):
+raise BackupError("grep command %s not found" % grep)
+pipeline.append([grep, "-n", ""])
+tail = self.wiki.config.tail
+if not exists(tail):
+raise BackupError("tail command %s not found" % tail)
+pipeline.append([tail, "-1"])
+# without shell
+proc = CommandPipeline(pipeline, quiet=True)
+proc.run_pipeline_get_output()
+if (proc.exited_successfully() or
+(proc.get_failed_cmds_with_retcode() ==
+ [[-signal.SIGPIPE, pipeline[0]]]) or
+(proc.get_failed_cmds_with_retcode() ==
+ [[signal.SIGPIPE + 128, pipeline[0]]])):
+output = proc.output()
+#339915646:  
+if ':' in output:
+linecount = output.split(':')[0]
+if linecount.isdigit():
+return linecount
+return None
+
 def find_last_page_id(self, fileobj, runner):
-lastlines = self.get_last_500_lines(fileobj, runner)
+count = self.get_lineno_last_page(fileobj, runner)
+lastlines = self.get_last_lines_from_n(fileobj, runner, count)
 # now look for the last page id in here. eww
 if not lastlines:
 return None

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica301abea7cdfa77b66d90acfcc4160828999f1a
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn 

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


[MediaWiki-commits] [Gerrit] mediawiki...PerformanceInspector[master]: Link to template performance.

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

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

Change subject: Link to template performance.
..

Link to template performance.

Make it easier for users to understand what you can do to
improve template parsing.

Change-Id: Id1a1adc442545152c01665fd540a66fa95727855
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/templates/newpp.mustache
4 files changed, 11 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PerformanceInspector 
refs/changes/55/310455/1

diff --git a/extension.json b/extension.json
index fae312e..3b5f848 100644
--- a/extension.json
+++ b/extension.json
@@ -108,6 +108,8 @@
"performanceinspector-modules-css-description",

"performanceinspector-modules-module-description",
"performanceinspector-newpp-description",
+   "performanceinspector-newpp-description-link",
+   
"performanceinspector-newpp-description-link-text",

"performanceinspector-newpp-timingprofile-description",

"performanceinspector-newpp-scribunto-description",

"performanceinspector-newpp-cachereport-description",
diff --git a/i18n/en.json b/i18n/en.json
index e4b1d74..5bd0d9a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -66,7 +66,9 @@
"performanceinspector-modules-localstorage-description": "How many 
ResourceLoader modules were loaded from local storage.",
"performanceinspector-modules-css-description": "For each 
ResourceLoader module with styles, count the number of selectors, and count how 
many match against some element currently in the DOM",
"performanceinspector-modules-module-description": "The ResourceLoader 
modules used by this page.",
-   "performanceinspector-newpp-description": "Information collected when 
the page was parsed in the backend. Most users will get a cached copy where the 
page is already parsed.",
+   "performanceinspector-newpp-description": "Information collected when 
the page was parsed in the backend. You can read more how to increase the 
parsing performance ",
+   "performanceinspector-newpp-description-link": 
"https://en.wikipedia.org/wiki/Wikipedia:Template_limits;,
+   "performanceinspector-newpp-description-link-text": "here",
"performanceinspector-newpp-timingprofile-description": "Time spent 
parsing the templates for this page.",
"performanceinspector-newpp-scribunto-description": "Memory and time 
usage spent in Lua scripting.",
"performanceinspector-newpp-cachereport-description": "When was this 
page cached in the parser cache.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index b72f099..2ea0bc7 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -63,7 +63,9 @@
"performanceinspector-modules-localstorage-description": "Description 
explaining the local storage metrics",
"performanceinspector-modules-css-description": "Description explaining 
the CSS list metrics",
"performanceinspector-modules-module-description": "Description 
explaining the module list",
-   "performanceinspector-newpp-description": "Descriptiont explaining the 
parser report metrics",
+   "performanceinspector-newpp-description": "Description explaining the 
parser report metrics",
+   "performanceinspector-newpp-description-link": "URL that explains how 
you can improve parser/template performance",
+   "performanceinspector-newpp-description-link-text": "The text for the 
parser/template performance URL",
"performanceinspector-newpp-timingprofile-description": "Description 
explaining the timing profile metrics",
"performanceinspector-newpp-scribunto-description": "Description 
explaining the scribuntu metrics",
"performanceinspector-newpp-cachereport-description": "Description 
explaining the cache report metrics",
diff --git a/modules/templates/newpp.mustache b/modules/templates/newpp.mustache
index d7a9f47..e1ab7aa 100644
--- a/modules/templates/newpp.mustache
+++ b/modules/templates/newpp.mustache
@@ -1,4 +1,6 @@
-{{#msg}}performanceinspector-newpp-description{{/msg}}
+{{#msg}}performanceinspector-newpp-description{{/msg}}
+   {{#msg}}performanceinspector-newpp-description-link-text{{/msg}}.
+
 



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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1a1adc442545152c01665fd540a66fa95727855
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PerformanceInspector
Gerrit-Branch: master
Gerrit-Owner: Phedenskog 

___
MediaWiki-commits mailing list

[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Fix "complete" status label

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

Change subject: Fix "complete" status label
..


Fix "complete" status label

Also adds logging.

Bug: T143945
Change-Id: Id1f87b17c96c0eaf334ed10cbf72d5b7b864cc20
---
M Core/DataStores/PaymentsInitialDatabase.php
M Core/QueueConsumers/PendingQueueConsumer.php
M Tests/PendingQueueConsumerTest.php
3 files changed, 9 insertions(+), 5 deletions(-)

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



diff --git a/Core/DataStores/PaymentsInitialDatabase.php 
b/Core/DataStores/PaymentsInitialDatabase.php
index a49752e..d18701f 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -24,7 +24,7 @@
if ( $message === null ) {
return false;
}
-   if ( in_array( $message['payments_final_status'], array( 
'failed', 'completed' ) ) ) {
+   if ( in_array( $message['payments_final_status'], array( 
'failed', 'complete' ) ) ) {
return true;
}
return false;
diff --git a/Core/QueueConsumers/PendingQueueConsumer.php 
b/Core/QueueConsumers/PendingQueueConsumer.php
index b79428e..7868487 100644
--- a/Core/QueueConsumers/PendingQueueConsumer.php
+++ b/Core/QueueConsumers/PendingQueueConsumer.php
@@ -2,6 +2,7 @@
 
 use SmashPig\Core\DataStores\PaymentsInitialDatabase;
 use SmashPig\Core\DataStores\PendingDatabase;
+use SmashPig\Core\Logging\Logger;
 
 class PendingQueueConsumer extends BaseQueueConsumer {
 
@@ -22,9 +23,12 @@
}
 
public function processMessage( $message ) {
-   if ( !$this->paymentsInitialDatabase->isTransactionFinalized( 
$message ) ) {
+   if ( $this->paymentsInitialDatabase->isTransactionFinalized( 
$message ) ) {
// Throw the message out if it's already completed or 
failed, and
// exists in the fredge database.
+   Logger::info( "Skipping finalized message", $message );
+   } else {
+   Logger::info( "Storing message in database", $message );
$this->pendingDatabase->storeMessage( $message );
}
}
diff --git a/Tests/PendingQueueConsumerTest.php 
b/Tests/PendingQueueConsumerTest.php
index 17b6bc1..4b1fe15 100644
--- a/Tests/PendingQueueConsumerTest.php
+++ b/Tests/PendingQueueConsumerTest.php
@@ -94,11 +94,11 @@
 
/**
 * We refuse to consume a message and drop it if the corresponding
-* payments_initial row is completed.
+* payments_initial row is complete.
 */
-   public function testPendingMessageInitialCompleted() {
+   public function testPendingMessageInitialComplete() {
$initRow = PaymentsInitialDatabaseTest::generateTestMessage();
-   $initRow['payments_final_status'] = 'completed';
+   $initRow['payments_final_status'] = 'complete';
 
$this->paymentsInitialDb->storeMessage( $initRow );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id1f87b17c96c0eaf334ed10cbf72d5b7b864cc20
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Cdentinger 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: Conftool: Create script that checks the state after (de)pooling

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

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

Change subject: Conftool: Create script that checks the state after (de)pooling
..

Conftool: Create script that checks the state after (de)pooling

On certain occasions, hosts do not get (de)pooled from Pybal. This patch
adds a script to all hosts that include conftool::scripts that checks
the LVS state after issuing a command. The script is configurable in
that it can wait up to a certain interval before retrying the command,
and can also repeat the whole procedure up to N times (if needed).

This commit also adds service::node wrapper scripts for (de)pooling a
specific service.

Bug: T145518
Change-Id: If1be5238493960d272ba692094cc900c6aa5e779
---
M manifests/role/restbase.pp
M modules/conftool/manifests/scripts.pp
A modules/conftool/templates/pooler-loop.erb
A modules/service/manifests/conftool.pp
M modules/service/manifests/node.pp
A modules/service/templates/conftool/depool-service.erb
A modules/service/templates/conftool/pool-service.erb
7 files changed, 159 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/54/310454/1

diff --git a/manifests/role/restbase.pp b/manifests/role/restbase.pp
index 42a6edc..d348270 100644
--- a/manifests/role/restbase.pp
+++ b/manifests/role/restbase.pp
@@ -12,7 +12,11 @@
 include lvs::realserver
 
 # Add conftool scripts and credentials
-include ::conftool::scripts
+# TODO: remove this once RESTBase starts using
+# Scap3 for deploys
+service::conftool { 'restbase'
+port => 7231,
+}
 
 # RESTBase rate limiting DHT firewall rule
 $rb_hosts_ferm = join(hiera('restbase::hosts'), ' ')
diff --git a/modules/conftool/manifests/scripts.pp 
b/modules/conftool/manifests/scripts.pp
index 0add7da..967cade 100644
--- a/modules/conftool/manifests/scripts.pp
+++ b/modules/conftool/manifests/scripts.pp
@@ -1,9 +1,15 @@
-# == Class conftool::scripts
+# == Class: conftool::scripts
 #
 # Install some useful scripts that can be used to pool/depool/drain a server
 # from all the pools it is in.
 #
-# Example:
+# === Parameters
+#
+# [*lvs_uri*]
+#   The LVS host:port to contact when seeking information about the state of 
the
+#   target host. Default: "appservers.svc.${::site}.wmnet:9092"
+#
+# === Examples
 #
 #class some::service {
 #user { 'foo': }
@@ -12,7 +18,9 @@
 #
 #include conftool::scripts
 #}
-class conftool::scripts {
+class conftool::scripts(
+$lvs_uri = "appservers.svc.${::site}.wmnet:9092",
+) {
 require conftool
 
 file { '/usr/local/bin/pool':
@@ -31,6 +39,14 @@
 content => template('conftool/depool.erb')
 }
 
+file { '/usr/local/bin/pooler-loop':
+ensure  => present,
+owner   => 'root',
+group   => 'root',
+mode=> '0555',
+content => template('conftool/pooler-loop.erb')
+}
+
 file { '/usr/local/bin/drain':
 ensure  => present,
 owner   => 'root',
diff --git a/modules/conftool/templates/pooler-loop.erb 
b/modules/conftool/templates/pooler-loop.erb
new file mode 100755
index 000..947f044
--- /dev/null
+++ b/modules/conftool/templates/pooler-loop.erb
@@ -0,0 +1,92 @@
+#!/usr/bin/env ruby
+
+<%- if scope.lookupvar('realm') == 'labs' -%>
+# labs don't have LVS nor Pybal, so there's nothing to do
+exit 0
+<%- else -%>
+
+require 'optparse'
+require 'net/http'
+
+
+PATH_ROOT = '/usr/local/bin/'
+
+# default values
+args = {
+  host: '<%= scope.lookupvar("fqdn") %>',
+  command: PATH_ROOT + 'pool',
+  pool: true,
+  depool: false,
+  lvs_uri: '<%= @lvs_uri %>',
+  pool_name: nil,
+  pool_subject: '',
+  interval: 1,
+  wait: 9,
+  cycles: 3
+}
+
+# parse the command-line arguments
+OptionParser.new do |opts|
+  opts.banner = "Usage: pooler-loop [options] [service]"
+  opts.on('-p', '--pool', '(Re)pool the host') do |v|
+args[:command] = PATH_ROOT + 'pool'
+args[:pool] = true
+args[:depool] = false
+  end
+  opts.on('-d', '--depool', 'Depool the host') do |v|
+args[:command] = PATH_ROOT + 'depool'
+args[:depool] = true
+args[:pool] = false
+  end
+  opts.on('-l', '--lvs-uri URI', 'The LVS host:port to contact') do |uri|
+args[:lvs_uri] = uri
+  end
+  opts.on('-P', '--pool-name POOL', 'The pool name to use') do |pool|
+args[:pool_name] = pool
+  end
+  opts.on('-i', '--interval INTERVAL', Float,
+  'The check interval, in seconds') do |i|
+args[:interval] = i
+  end
+  opts.on('-w', '--wait TIMES', Integer, 'The number of intervals to wait ' +
+  'before', 're-issuing the (de)pool command') do |w|
+args[:wait] = w
+  end
+  opts.on('-c', '--cycles N', Integer, 'The number of times to repeat',
+  'the process') do |n|
+args[:cycles] = n
+  end
+  opts.on_tail('-h', '--help', 'Show this text and exit') do
+puts opts
+exit
+  end
+end.parse!
+

[MediaWiki-commits] [Gerrit] wikimedia...golden[master]: Fix language counting

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

Change subject: Fix language counting
..


Fix language counting

Change-Id: I3973720e5c521fbdb6198e8a7f870306a528f2f6
---
M portal/languages.R
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/portal/languages.R b/portal/languages.R
index b9bc94f..9f1eb7c 100644
--- a/portal/languages.R
+++ b/portal/languages.R
@@ -14,7 +14,7 @@
table = table,
conditionals = "((event_cohort IS NULL) OR 
(event_cohort IN ('null','baseline')))
AND event_country != 'US'
-   AND NOT INSTR(event_destination, 
'translate.googleusercontent.com')")
+   AND (NOT INSTR(event_destination, 
'translate.googleusercontent.com') OR event_destination IS NULL)")
   
   # Sanitise
   data$date <- as.Date(lubridate::ymd(data$date))
@@ -24,7 +24,7 @@
   
   # Extract the prefix
   data$prefix <- sub("^https?://(.*)\\.wikipedia\\.org.*", "\\1", 
data$destination)
-  data$prefix[data$section_used == "search" && grepl("search-redirect.php", 
data$destination, fixed = TRUE)] <- data$selected_language
+  data$prefix[data$section_used == "search" & grepl("search-redirect.php", 
data$destination, fixed = TRUE)] <- data$selected_language[data$section_used == 
"search" & grepl("search-redirect.php", data$destination, fixed = TRUE)]
   
   # Update the internal dataset of prefixes and languages
   if (lubridate::wday(lubridate::today(), label = TRUE, abbr = FALSE) == 
"Friday") {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3973720e5c521fbdb6198e8a7f870306a528f2f6
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: Bearloga 
Gerrit-Reviewer: Chelsyx 

___
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-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

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(+), 1 deletion(-)

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



diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index 022abd9..ed3aa9a 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -280,7 +280,6 @@
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: merged
Gerrit-Change-Id: I12a2e6db326af25a3a276a477fbff505feac87b6
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...UserGroups[master]: Fix jQuery errors

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

Change subject: Fix jQuery errors
..


Fix jQuery errors

Change Html::inlineScript to ResourceLoader::makeInlineScript

Bug: T138466
Change-Id: I3a73879a948ba4332efa63f19745fd932fdde466
---
M SpecialUserGroups.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/SpecialUserGroups.php b/SpecialUserGroups.php
index 42e3ff3..cb90927 100644
--- a/SpecialUserGroups.php
+++ b/SpecialUserGroups.php
@@ -146,7 +146,7 @@
$this->getOutput()->addHTML(
'
' .
-   Html::inlineScript( '
+   ResourceLoader::makeInlineScript( '
$(function() {
$("#groupname").change(function() {
location = $("#groupname 
option:selected").val();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a73879a948ba4332efa63f19745fd932fdde466
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/UserGroups
Gerrit-Branch: master
Gerrit-Owner: Paladox 
Gerrit-Reviewer: 20after4 
Gerrit-Reviewer: JanZerebecki 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Paladox 
Gerrit-Reviewer: Reedy 
Gerrit-Reviewer: Withoutaname 
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]: API: Expose $wgEnableMagicLinks in meta=siteinfo

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

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

Change subject: API: Expose $wgEnableMagicLinks in meta=siteinfo
..

API: Expose $wgEnableMagicLinks in meta=siteinfo

So Parsoid can use it.

Change-Id: Id792e07dc6fffec6d02b34168220b3a4e24b222b
---
M includes/api/ApiQuerySiteinfo.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/includes/api/ApiQuerySiteinfo.php 
b/includes/api/ApiQuerySiteinfo.php
index 5d32497..99f722d 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -275,6 +275,7 @@
$data['allcentralidlookupproviders'] = $providerIds;
 
$data['interwikimagic'] = (bool)$config->get( 'InterwikiMagic' 
);
+   $data['magiclinks'] = $config->get( 'EnableMagicLinks' );
 
Hooks::run( 'APIQuerySiteInfoGeneralInfo', [ $this, &$data ] );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id792e07dc6fffec6d02b34168220b3a4e24b222b
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...GlobalUserPage[master]: Remove SkinTemplateNavigationUniversal hook

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

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

Change subject: Remove SkinTemplateNavigationUniversal hook
..

Remove SkinTemplateNavigationUniversal hook

As of 67d589450e in MediaWiki core, this is no longer needed.

Change-Id: I8f45ed0b151d3356754c0cd653163cac9907
---
M GlobalUserPage.hooks.php
M extension.json
2 files changed, 1 insertion(+), 28 deletions(-)


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

diff --git a/GlobalUserPage.hooks.php b/GlobalUserPage.hooks.php
index 1054c06..6883808 100644
--- a/GlobalUserPage.hooks.php
+++ b/GlobalUserPage.hooks.php
@@ -42,30 +42,6 @@
}
 
/**
-* Turn red links into blue in the navigation tabs (Monobook's 
p-cactions).
-*
-* @param SkinTemplate $sktemplate
-* @param array $links
-* @return bool
-*/
-   public static function onSkinTemplateNavigationUniversal( &$sktemplate, 
&$links ) {
-   $title = $sktemplate->getTitle()->getSubjectPage(); // We want 
the user page
-
-   if ( !$title->exists() && 
GlobalUserPage::shouldDisplayGlobalPage( $title ) ) {
-   // Removes ?action=edit=1
-   $links['namespaces']['user']['href'] = 
$title->getFullURL();
-   // Remove the "new" class:
-   // "selected new" --> "selected"
-   // "new" --> ""
-   $links['namespaces']['user']['class'] = trim(
-   str_replace( 'new', '', 
$links['namespaces']['user']['class'] )
-   );
-   }
-
-   return true;
-   }
-
-   /**
 * Mark global user pages as known so they appear in blue
 *
 * @param Title $title title to check
diff --git a/extension.json b/extension.json
index 69d4549..1fc2d0a 100644
--- a/extension.json
+++ b/extension.json
@@ -10,7 +10,7 @@
"license-name": "CC0-1.0",
"type": "other",
"requires": {
-   "MediaWiki": ">= 1.27.0"
+   "MediaWiki": ">= 1.28.0"
},
"MessagesDirs": {
"GlobalUserPage": [
@@ -23,9 +23,6 @@
"Hooks": {
"GetPreferences": [
"GlobalUserPageHooks::onGetPreferences"
-   ],
-   "SkinTemplateNavigation::Universal": [
-   "GlobalUserPageHooks::onSkinTemplateNavigationUniversal"
],
"TitleIsAlwaysKnown": [
"GlobalUserPageHooks::onTitleIsAlwaysKnown"

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

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

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


[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Create dom elements explicitly

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

Change subject: Create dom elements explicitly
..


Create dom elements explicitly

The use of innerHTML here makes it open to XSS, clean that up by
explicitly creating dom elements and text nodes, rather than using
innerHTML.

Bug: T145563
Change-Id: Id5d6bf2fcd1666b5ec90bfb36d8a708a10330f2f
---
M public/js/discernadeck.js
1 file changed, 37 insertions(+), 5 deletions(-)

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



diff --git a/public/js/discernadeck.js b/public/js/discernadeck.js
index ace3dd7..fa01437 100644
--- a/public/js/discernadeck.js
+++ b/public/js/discernadeck.js
@@ -159,12 +159,44 @@
}
},
createCardDOM: function() {
-   var el = document.createElement('div'),
-   link = window.scoringData.baseWikiUrl + '/' + 
this.cardData.title;
-   snippet = 
this.cardData.snippet.split('\uE000').join('').split('\uE001').join('');
+   var i, b,
+   el = document.createElement('div'),
+   snippetPieces = 
this.cardData.snippet.split('\uE000').map(function (s) { return 
s.split('\uE001') }),
+
+   a = document.createElement('a'),
+   p = document.createElement('p');
+
+   a.setAttribute('target', '_blank');
+   a.setAttribute('href', window.scoringData.baseWikiUrl + '/' + 
this.cardData.title);
+   a.appendChild(document.createTextNode(this.cardData.title));
+
+   /**
+* The snippet has markers that indicate which part should be 
bolded,
+* by splitting above we have converted
+*   -some+ text that should be -bold+
+* into
+*  [[""], ["some", " text that should be "], ["bold, ""]]
+* This loop then works through those pieces and bolds the 
appropriate parts.
+*/
+   for (i = 0; i < snippetPieces.length; i++) {
+   if ( snippetPieces[i].length == 1 ) {
+   if (snippetPieces[i][0].length > 0) {
+   
p.appendChild(document.createTextNode(snippetPieces[i][0]));
+   }
+   } else {
+   b = document.createElement('b');
+   
b.appendChild(document.createTextNode(snippetPieces[i][0]));
+   p.appendChild(b);
+   if (snippetPieces[i][1].length > 0) {
+   
p.appendChild(document.createTextNode(snippetPieces[i][1]));
+   }
+   }
+   }
+
+   el.appendChild(a);
+   el.appendChild(p);
el.classList.add('card');
-   // note this isn't safe from XSS. should use 
document.createElement
-   el.innerHTML = "" + 
this.cardData.title + "" + snippet + "";
+
this.domEl = el;
document.querySelector( '.stack' ).appendChild( this.domEl );
},

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5d6bf2fcd1666b5ec90bfb36d8a708a10330f2f
Gerrit-PatchSet: 3
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...OpenID[master]: Add option $wgOpenIDUseNicknameAsUsername to use provider ni...

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

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

Change subject: Add option $wgOpenIDUseNicknameAsUsername to use provider 
nickname as username
..

Add option $wgOpenIDUseNicknameAsUsername to use provider nickname as username

This will also take the nickname if that would result in reusing an existing 
account,
to facilitate installations moving to OpenID with an existing authentication 
backend.

Change-Id: I689ee4ef264041e9ee62dece82a02442fa3511c6
---
M OpenID.php
M README
M SpecialOpenIDLogin.body.php
3 files changed, 28 insertions(+), 2 deletions(-)


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

diff --git a/OpenID.php b/OpenID.php
index 7ca1ce7..50ba07f 100644
--- a/OpenID.php
+++ b/OpenID.php
@@ -285,6 +285,13 @@
 $wgOpenIDUseEmailAsNickname = false;
 
 /**
+ * when logging in with OpenID: take the nickname as provided by the provider 
and
+ * use that as the username, logging in with an existing user if one already 
existed
+ * with the same username.
+ */
+$wgOpenIDUseNicknameAsUsername = false;
+
+/**
  * when creating a new account or associating an existing account with OpenID:
  * propose and allow new account names from OpenID SREG data such as
  * fullname or nickname (if such data is available)
diff --git a/README b/README
index 7a057f8..f8abb31 100644
--- a/README
+++ b/README
@@ -238,6 +238,11 @@
   the e-mail address provided by your provider and use the user component
   as the MediaWiki username.
 
+* $wgOpenIDUseNicknameAsUsername -- designer for users with the above, take
+  the nickname field as provided by yoru provider and use it as the MediaWiki
+  username. This will also reuse existing accounts with the same name, allowing
+  migration from an existing user database to OpenID.
+
 * $wgOpenIDProposeUsernameFromSREG
   defaults to true; when first-time logging in with OpenID, propose and
   allow new account names from OpenID SREG data such as fullname or nickname
diff --git a/SpecialOpenIDLogin.body.php b/SpecialOpenIDLogin.body.php
index 9a259dc..9c33fb9 100644
--- a/SpecialOpenIDLogin.body.php
+++ b/SpecialOpenIDLogin.body.php
@@ -618,7 +618,7 @@
 * form
 */
function finish() {
-   global $wgOut, $wgUser, $wgOpenIDUseEmailAsNickname;
+   global $wgOut, $wgUser, $wgOpenIDUseEmailAsNickname, 
$wgOpenIDUseNicknameAsUsername;
 
wfSuppressWarnings();
$consumer = $this->getConsumer();
@@ -678,8 +678,22 @@
 
} else {
 
+   // if we are forcing to use nickname as 
username, use that
+   if ( $wgOpenIDUseNicknameAsUsername && 
isset($sreg['nickname']) ) {
+   $user = User::newFromName( 
$sreg['nickname'] );
+
+   if( $user instanceof User ) {
+   $this->updateUser( $user, 
$sreg, $ax ); # update from server
+   $wgUser = $user;
+   $this->displaySuccessLogin( 
$openid );
+   return;
+   } else {
+   $wgUser = $this->createUser( 
$openid, $sreg, $ax, $name );
+   $this->displaySuccessLogin( 
$openid );
+   return;
+   }
// if we are hardcoding nickname, and a valid 
e-mail address was returned, create a user with this name
-   if ( $wgOpenIDUseEmailAsNickname ) {
+   } else if ( $wgOpenIDUseEmailAsNickname ) {
 
$name = $this->getNameFromEmail( 
$openid, $sreg, $ax );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I689ee4ef264041e9ee62dece82a02442fa3511c6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Puiterwijk 

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


[MediaWiki-commits] [Gerrit] wikimedia...golden[master]: Fix language counting

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

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

Change subject: Fix language counting
..

Fix language counting

Change-Id: I3973720e5c521fbdb6198e8a7f870306a528f2f6
---
M portal/languages.R
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/golden 
refs/changes/50/310450/1

diff --git a/portal/languages.R b/portal/languages.R
index b9bc94f..9f1eb7c 100644
--- a/portal/languages.R
+++ b/portal/languages.R
@@ -14,7 +14,7 @@
table = table,
conditionals = "((event_cohort IS NULL) OR 
(event_cohort IN ('null','baseline')))
AND event_country != 'US'
-   AND NOT INSTR(event_destination, 
'translate.googleusercontent.com')")
+   AND (NOT INSTR(event_destination, 
'translate.googleusercontent.com') OR event_destination IS NULL)")
   
   # Sanitise
   data$date <- as.Date(lubridate::ymd(data$date))
@@ -24,7 +24,7 @@
   
   # Extract the prefix
   data$prefix <- sub("^https?://(.*)\\.wikipedia\\.org.*", "\\1", 
data$destination)
-  data$prefix[data$section_used == "search" && grepl("search-redirect.php", 
data$destination, fixed = TRUE)] <- data$selected_language
+  data$prefix[data$section_used == "search" & grepl("search-redirect.php", 
data$destination, fixed = TRUE)] <- data$selected_language[data$section_used == 
"search" & grepl("search-redirect.php", data$destination, fixed = TRUE)]
   
   # Update the internal dataset of prefixes and languages
   if (lubridate::wday(lubridate::today(), label = TRUE, abbr = FALSE) == 
"Friday") {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3973720e5c521fbdb6198e8a7f870306a528f2f6
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: Bearloga 

___
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.19]: momentjs: Hack around bug in node/browser compat wrapper in ...

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

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

Change subject: momentjs: Hack around bug in node/browser compat wrapper in 
locale files
..

momentjs: Hack around bug in node/browser compat wrapper in locale files

If there is an element with id="global" on the page,
typeof global !== 'undefined' is true, but global.moment will
still be undefined and shouldn't be used.

For now, comment out the wrapper and just use 'this'.
We should look into upgrading to momentjs 2.14 where this bug is fixed.

Bug: T145382
Change-Id: Ia6e3b46e42248a5ee3c61c5fcda7d020d012e89e
(cherry picked from commit 939c85ac7fe2c187a480f7c9fc06b46b3a3e05a0)
---
M resources/lib/moment/locale/af.js
M resources/lib/moment/locale/ar-ma.js
M resources/lib/moment/locale/ar-sa.js
M resources/lib/moment/locale/ar.js
M resources/lib/moment/locale/az.js
M resources/lib/moment/locale/be.js
M resources/lib/moment/locale/bg.js
M resources/lib/moment/locale/bn.js
M resources/lib/moment/locale/bo.js
M resources/lib/moment/locale/br.js
M resources/lib/moment/locale/bs.js
M resources/lib/moment/locale/ca.js
M resources/lib/moment/locale/cs.js
M resources/lib/moment/locale/cv.js
M resources/lib/moment/locale/cy.js
M resources/lib/moment/locale/da.js
M resources/lib/moment/locale/de-at.js
M resources/lib/moment/locale/de.js
M resources/lib/moment/locale/el.js
M resources/lib/moment/locale/en-au.js
M resources/lib/moment/locale/en-ca.js
M resources/lib/moment/locale/en-gb.js
M resources/lib/moment/locale/eo.js
M resources/lib/moment/locale/es.js
M resources/lib/moment/locale/et.js
M resources/lib/moment/locale/eu.js
M resources/lib/moment/locale/fa.js
M resources/lib/moment/locale/fi.js
M resources/lib/moment/locale/fo.js
M resources/lib/moment/locale/fr-ca.js
M resources/lib/moment/locale/fr.js
M resources/lib/moment/locale/gl.js
M resources/lib/moment/locale/he.js
M resources/lib/moment/locale/hi.js
M resources/lib/moment/locale/hr.js
M resources/lib/moment/locale/hu.js
M resources/lib/moment/locale/hy-am.js
M resources/lib/moment/locale/id.js
M resources/lib/moment/locale/is.js
M resources/lib/moment/locale/it.js
M resources/lib/moment/locale/ja.js
M resources/lib/moment/locale/ka.js
M resources/lib/moment/locale/km.js
M resources/lib/moment/locale/ko.js
M resources/lib/moment/locale/lb.js
M resources/lib/moment/locale/lt.js
M resources/lib/moment/locale/lv.js
M resources/lib/moment/locale/mk.js
M resources/lib/moment/locale/ml.js
M resources/lib/moment/locale/mr.js
M resources/lib/moment/locale/ms-my.js
M resources/lib/moment/locale/my.js
M resources/lib/moment/locale/nb.js
M resources/lib/moment/locale/ne.js
M resources/lib/moment/locale/nl.js
M resources/lib/moment/locale/nn.js
M resources/lib/moment/locale/pl.js
M resources/lib/moment/locale/pt-br.js
M resources/lib/moment/locale/pt.js
M resources/lib/moment/locale/ro.js
M resources/lib/moment/locale/ru.js
M resources/lib/moment/locale/sk.js
M resources/lib/moment/locale/sl.js
M resources/lib/moment/locale/sq.js
M resources/lib/moment/locale/sr-cyrl.js
M resources/lib/moment/locale/sr.js
M resources/lib/moment/locale/sv.js
M resources/lib/moment/locale/ta.js
M resources/lib/moment/locale/th.js
M resources/lib/moment/locale/tl-ph.js
M resources/lib/moment/locale/tr.js
M resources/lib/moment/locale/tzm-latn.js
M resources/lib/moment/locale/tzm.js
M resources/lib/moment/locale/uk.js
M resources/lib/moment/locale/uz.js
M resources/lib/moment/locale/vi.js
M resources/lib/moment/locale/zh-cn.js
M resources/lib/moment/locale/zh-tw.js
78 files changed, 312 insertions(+), 156 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/49/310449/1

diff --git a/resources/lib/moment/locale/af.js 
b/resources/lib/moment/locale/af.js
index 2fb7adf..55a41bd 100644
--- a/resources/lib/moment/locale/af.js
+++ b/resources/lib/moment/locale/af.js
@@ -3,13 +3,15 @@
 // author : Werner Mollentze : https://github.com/wernerm
 
 (function (factory) {
-if (typeof define === 'function' && define.amd) {
+// Comment out broken wrapper, see T145382
+/*if (typeof define === 'function' && define.amd) {
 define(['moment'], factory); // AMD
 } else if (typeof exports === 'object') {
 module.exports = factory(require('../moment')); // Node
 } else {
 factory((typeof global !== 'undefined' ? global : this).moment); // 
node or other global
-}
+}*/
+factory(this.moment);
 }(function (moment) {
 return moment.defineLocale('af', {
 months : 
'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
diff --git a/resources/lib/moment/locale/ar-ma.js 
b/resources/lib/moment/locale/ar-ma.js
index 7add172..871e41c 100644
--- a/resources/lib/moment/locale/ar-ma.js
+++ b/resources/lib/moment/locale/ar-ma.js
@@ -4,13 +4,15 @@
 // author : Abdel Said : https://github.com/abdelsaid
 
 

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.18]: momentjs: Hack around bug in node/browser compat wrapper in ...

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

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

Change subject: momentjs: Hack around bug in node/browser compat wrapper in 
locale files
..

momentjs: Hack around bug in node/browser compat wrapper in locale files

If there is an element with id="global" on the page,
typeof global !== 'undefined' is true, but global.moment will
still be undefined and shouldn't be used.

For now, comment out the wrapper and just use 'this'.
We should look into upgrading to momentjs 2.14 where this bug is fixed.

Bug: T145382
Change-Id: Ia6e3b46e42248a5ee3c61c5fcda7d020d012e89e
(cherry picked from commit 939c85ac7fe2c187a480f7c9fc06b46b3a3e05a0)
---
M resources/lib/moment/locale/af.js
M resources/lib/moment/locale/ar-ma.js
M resources/lib/moment/locale/ar-sa.js
M resources/lib/moment/locale/ar.js
M resources/lib/moment/locale/az.js
M resources/lib/moment/locale/be.js
M resources/lib/moment/locale/bg.js
M resources/lib/moment/locale/bn.js
M resources/lib/moment/locale/bo.js
M resources/lib/moment/locale/br.js
M resources/lib/moment/locale/bs.js
M resources/lib/moment/locale/ca.js
M resources/lib/moment/locale/cs.js
M resources/lib/moment/locale/cv.js
M resources/lib/moment/locale/cy.js
M resources/lib/moment/locale/da.js
M resources/lib/moment/locale/de-at.js
M resources/lib/moment/locale/de.js
M resources/lib/moment/locale/el.js
M resources/lib/moment/locale/en-au.js
M resources/lib/moment/locale/en-ca.js
M resources/lib/moment/locale/en-gb.js
M resources/lib/moment/locale/eo.js
M resources/lib/moment/locale/es.js
M resources/lib/moment/locale/et.js
M resources/lib/moment/locale/eu.js
M resources/lib/moment/locale/fa.js
M resources/lib/moment/locale/fi.js
M resources/lib/moment/locale/fo.js
M resources/lib/moment/locale/fr-ca.js
M resources/lib/moment/locale/fr.js
M resources/lib/moment/locale/gl.js
M resources/lib/moment/locale/he.js
M resources/lib/moment/locale/hi.js
M resources/lib/moment/locale/hr.js
M resources/lib/moment/locale/hu.js
M resources/lib/moment/locale/hy-am.js
M resources/lib/moment/locale/id.js
M resources/lib/moment/locale/is.js
M resources/lib/moment/locale/it.js
M resources/lib/moment/locale/ja.js
M resources/lib/moment/locale/ka.js
M resources/lib/moment/locale/km.js
M resources/lib/moment/locale/ko.js
M resources/lib/moment/locale/lb.js
M resources/lib/moment/locale/lt.js
M resources/lib/moment/locale/lv.js
M resources/lib/moment/locale/mk.js
M resources/lib/moment/locale/ml.js
M resources/lib/moment/locale/mr.js
M resources/lib/moment/locale/ms-my.js
M resources/lib/moment/locale/my.js
M resources/lib/moment/locale/nb.js
M resources/lib/moment/locale/ne.js
M resources/lib/moment/locale/nl.js
M resources/lib/moment/locale/nn.js
M resources/lib/moment/locale/pl.js
M resources/lib/moment/locale/pt-br.js
M resources/lib/moment/locale/pt.js
M resources/lib/moment/locale/ro.js
M resources/lib/moment/locale/ru.js
M resources/lib/moment/locale/sk.js
M resources/lib/moment/locale/sl.js
M resources/lib/moment/locale/sq.js
M resources/lib/moment/locale/sr-cyrl.js
M resources/lib/moment/locale/sr.js
M resources/lib/moment/locale/sv.js
M resources/lib/moment/locale/ta.js
M resources/lib/moment/locale/th.js
M resources/lib/moment/locale/tl-ph.js
M resources/lib/moment/locale/tr.js
M resources/lib/moment/locale/tzm-latn.js
M resources/lib/moment/locale/tzm.js
M resources/lib/moment/locale/uk.js
M resources/lib/moment/locale/uz.js
M resources/lib/moment/locale/vi.js
M resources/lib/moment/locale/zh-cn.js
M resources/lib/moment/locale/zh-tw.js
78 files changed, 312 insertions(+), 156 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/310448/1

diff --git a/resources/lib/moment/locale/af.js 
b/resources/lib/moment/locale/af.js
index 2fb7adf..55a41bd 100644
--- a/resources/lib/moment/locale/af.js
+++ b/resources/lib/moment/locale/af.js
@@ -3,13 +3,15 @@
 // author : Werner Mollentze : https://github.com/wernerm
 
 (function (factory) {
-if (typeof define === 'function' && define.amd) {
+// Comment out broken wrapper, see T145382
+/*if (typeof define === 'function' && define.amd) {
 define(['moment'], factory); // AMD
 } else if (typeof exports === 'object') {
 module.exports = factory(require('../moment')); // Node
 } else {
 factory((typeof global !== 'undefined' ? global : this).moment); // 
node or other global
-}
+}*/
+factory(this.moment);
 }(function (moment) {
 return moment.defineLocale('af', {
 months : 
'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
diff --git a/resources/lib/moment/locale/ar-ma.js 
b/resources/lib/moment/locale/ar-ma.js
index 7add172..871e41c 100644
--- a/resources/lib/moment/locale/ar-ma.js
+++ b/resources/lib/moment/locale/ar-ma.js
@@ -4,13 +4,15 @@
 // author : Abdel Said : https://github.com/abdelsaid
 
 

[MediaWiki-commits] [Gerrit] mediawiki/core[wmf/1.28.0-wmf.19]: Avoid warnings when unable to parse the URL given to us

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

Change subject: Avoid warnings when unable to parse the URL given to us
..


Avoid warnings when unable to parse the URL given to us

Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
(cherry picked from commit 3635881b44a3b1069b1f44218fe6269cb2dfd3df)
---
M includes/MediaWiki.php
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 7f20de1..0bd183f 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -648,7 +648,11 @@
);
 
foreach ( $clusterHosts as $clusterHost ) {
-   $infoHost = array_intersect_key( wfParseUrl( 
$clusterHost ), $relevantKeys );
+   $parseUrl = wfParseUrl( $clusterHost );
+   if ( !$parseUrl ) {
+   continue;
+   }
+   $infoHost = array_intersect_key( $parseUrl, 
$relevantKeys );
if ( $infoCandidate === $infoHost ) {
return true;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.19
Gerrit-Owner: Chad 
Gerrit-Reviewer: Chad 
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...MobileFrontend[master]: Hygiene: Remove BogusMobileContext

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

Change subject: Hygiene: Remove BogusMobileContext
..


Hygiene: Remove BogusMobileContext

The BogusMobileContext and MobileContext::setInstanceForTesting method
were used to create an implicit test that MobileContext::singleton
wasn't called throughout the MobileContextTest test suite.

Since MobileContext::singleton, ::setInstanceForTesting, and
::resetServiceForTesting were deprecated in 535f18b1 and will be removed
as part of T143189, it's no longer worth maintaining BogusMobileContext

Bug: T143875
Change-Id: I4f42c7062a8b6ebff8f3b3c70616fb0719b933a2
---
M includes/MobileContext.php
M tests/phpunit/MobileContextTest.php
2 files changed, 0 insertions(+), 22 deletions(-)

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



diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index a848cb7..dadf7a0 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -132,20 +132,6 @@
}
 
/**
-* Overrides the singleton instance.
-*
-* @deprecated See `MobileContext::singleton`.
-*
-* @warning This method should only accept instances of 
`MobileContext`. The `BogusMobileContext`
-*  class is used in the `MobileContextTest` test suite and will be 
removed.
-*
-* @param {MobileContext} $instance
-*/
-   public static function setInstanceForTesting( $instance ) {
-   self::$instance = $instance;
-   }
-
-   /**
 * Resets the `MobileFrontend.MobileContext` service and singleton 
instance.
 *
 * @deprecated See `MobileContext::singleton`.
diff --git a/tests/phpunit/MobileContextTest.php 
b/tests/phpunit/MobileContextTest.php
index b98b6cd..c7a42ee 100644
--- a/tests/phpunit/MobileContextTest.php
+++ b/tests/phpunit/MobileContextTest.php
@@ -34,8 +34,6 @@
 
protected function setUp() {
parent::setUp();
-   // Permit no access to the singleton
-   MobileContext::setInstanceForTesting( new BogusMobileContext() 
);
 
$this->config = new GlobalVarConfig();
$this->baseContext = RequestContext::getMain();
@@ -691,11 +689,5 @@
$context = $this->makeContext();
 
$this->assertSame( $this->config, $context->getMFConfig() );
-   }
-}
-
-class BogusMobileContext {
-   public function __call( $who, $cares ) {
-   throw new Exception( "Don't touch me!" );
}
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4f42c7062a8b6ebff8f3b3c70616fb0719b933a2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Phuedx 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] apps...wikipedia[master]: Hygiene: Convert two fields in PageFragment class to local v...

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

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

Change subject: Hygiene: Convert two fields in PageFragment class to local 
variables
..

Hygiene: Convert two fields in PageFragment class to local variables

This patch convers two fields in the class to local variables as they are
only used in a single method. This generally improves code cleanliness and
slightly improves performance.

Change-Id: I753d39f99de4ba58cb9429bd19e5bf12d91a61e2
---
M app/src/main/java/org/wikipedia/page/PageFragment.java
1 file changed, 2 insertions(+), 5 deletions(-)


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

diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 2987fc9..1b84651 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -148,11 +148,8 @@
 
 @Nullable
 private PageScrollFunnel pageScrollFunnel;
-
-private ArticleHeaderView articleHeaderView;
 private LeadImagesHandler leadImagesHandler;
 private PageToolbarHideHandler toolbarHideHandler;
-private PageActionToolbarHideHandler pageActionToolbarHideHandler;
 private ObservableWebView webView;
 private SwipeRefreshLayoutWithScroll refreshView;
 private WikiErrorView errorView;
@@ -287,7 +284,7 @@
 tabLayout = (TabLayout) 
rootView.findViewById(R.id.page_actions_tab_layout);
 tabLayout.addOnTabSelectedListener(pageActionTabListener);
 
-pageActionToolbarHideHandler = new 
PageActionToolbarHideHandler(tabLayout);
+PageActionToolbarHideHandler pageActionToolbarHideHandler = new 
PageActionToolbarHideHandler(tabLayout);
 pageActionToolbarHideHandler.setScrollView(webView);
 
 errorView = (WikiErrorView)rootView.findViewById(R.id.page_error);
@@ -383,7 +380,7 @@
 tocHandler = new ToCHandler(this, tocDrawer, bridge);
 
 // TODO: initialize View references in onCreateView().
-articleHeaderView = findById(getView(), R.id.page_header_view);
+ArticleHeaderView articleHeaderView = findById(getView(), 
R.id.page_header_view);
 leadImagesHandler = new LeadImagesHandler(this, bridge, webView, 
articleHeaderView);
 toolbarHideHandler = getSearchBarHideHandler();
 toolbarHideHandler.setScrollView(webView);

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceExtensions[master]: UsageTracker: Added page properties for tags

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

Change subject: UsageTracker: Added page properties for tags
..


UsageTracker: Added page properties for tags

Change-Id: Ibc1a6746eafd5ab559d33455d2abd51691331d04
---
M Checklist/Checklist.class.php
M PageAccess/PageAccess.class.php
M PagesVisited/PagesVisited.class.php
M SmartList/SmartList.class.php
M Statistics/Statistics.class.php
M UniversalExport/UniversalExport.class.php
M UniversalExport/includes/UniversalExportTagLibrary.class.php
M WantedArticle/WantedArticle.class.php
M WatchList/WatchList.class.php
M WhoIsOnline/WhoIsOnline.class.php
10 files changed, 221 insertions(+), 9 deletions(-)

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



diff --git a/Checklist/Checklist.class.php b/Checklist/Checklist.class.php
index 304146c..b1ff129 100644
--- a/Checklist/Checklist.class.php
+++ b/Checklist/Checklist.class.php
@@ -52,6 +52,7 @@
$this->setHook( 'VisualEditorConfig' );
$this->mCore->registerPermission( 'checklistmodify', array( 
'user' ) );
wfProfileOut( 'BS::'.__METHOD__ );
+   $this->setHook( 'BSUsageTrackerRegisterCollectors' );
}
 
/**
@@ -164,7 +165,7 @@
 
public function onMagicWordBsChecklist( $input, $args, $parser ) {
$parser->disableCache();
-
+   $parser->getOutput()->setProperty( 'bs-tag-checklist', 1 );
$this->bCheckboxFound = true;
$sOut = array();
 
@@ -241,4 +242,17 @@
return true;
}
 
+   /**
+* Register tag with UsageTracker extension
+* @param array $aCollectorsConfig
+* @return Always true to keep hook running
+*/
+   public function onBSUsageTrackerRegisterCollectors( &$aCollectorsConfig 
) {
+   $aCollectorsConfig['bs:checklist'] = array(
+   'class' => 'Property',
+   'config' => array(
+   'identifier' => 'bs-tag-checklist'
+   )
+   );
+   }
 }
diff --git a/PageAccess/PageAccess.class.php b/PageAccess/PageAccess.class.php
index 605218e..00a902c 100644
--- a/PageAccess/PageAccess.class.php
+++ b/PageAccess/PageAccess.class.php
@@ -44,6 +44,7 @@
$this->setHook( 'ParserFirstCallInit' );
$this->setHook( 'userCan' );
$this->setHook( 'BSInsertMagicAjaxGetData', 
'onBSInsertMagicAjaxGetData' );
+   $this->setHook( 'BSUsageTrackerRegisterCollectors' );
 
$this->mCore->registerPermission( 'pageaccess-viewspecialpage', 
array('user'), array( 'type' => 'global' ) );
 
@@ -176,6 +177,7 @@
if( $parser->getTitle()->equals( Title::newMainPage() ) === 
true ) return '';
 
$parser->disableCache();
+   $parser->getOutput()->setProperty( 'bs-tag-pageaccess', 1 );
 
if ( !isset( $args['groups'] ) ) {
$oErrorView = new ViewTagError( wfMessage( 
'bs-pageaccess-error-no-groups-given' )->escaped() );
@@ -207,4 +209,19 @@
 
return true;
}
+
+   /**
+* Register tag with UsageTracker extension
+* @param array $aCollectorsConfig
+* @return Always true to keep hook running
+*/
+   public function onBSUsageTrackerRegisterCollectors( &$aCollectorsConfig 
) {
+   $aCollectorsConfig['bs:pageaccess'] = array(
+   'class' => 'Property',
+   'config' => array(
+   'identifier' => 'bs-tag-pageaccess'
+   )
+   );
+   return true;
+   }
 }
diff --git a/PagesVisited/PagesVisited.class.php 
b/PagesVisited/PagesVisited.class.php
index 04d41e6..f8dbdb4 100644
--- a/PagesVisited/PagesVisited.class.php
+++ b/PagesVisited/PagesVisited.class.php
@@ -43,7 +43,7 @@
 * @var array
 */
private static $prResultListViewCache = array();
-/**
+   /**
 * Initialization of PagesVisited extension
 */
protected function initExt() {
@@ -52,6 +52,7 @@
$this->setHook( 'BSUserSidebarDefaultWidgets' );
$this->setHook( 'BSWidgetListHelperInitKeyWords' );
$this->setHook( 'BSInsertMagicAjaxGetData' );
+   $this->setHook( 'BSUsageTrackerRegisterCollectors' );
 
BsConfig::registerVar( 'MW::PagesVisited::WidgetLimit', 10, 
BsConfig::LEVEL_USER|BsConfig::TYPE_INT, 'bs-pagesvisited-pref-widgetlimit', 
'int' );
BsConfig::registerVar( 'MW::PagesVisited::WidgetNS', array( 0 
), 
BsConfig::LEVEL_USER|BsConfig::TYPE_ARRAY_STRING|BsConfig::USE_PLUGIN_FOR_PREFS,
 'bs-pagesvisited-pref-widgetns', 'multiselectex' );
@@ -145,6 +146,8 @@
 */
public function onPagesVisitedTag( 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: momentjs: Hack around bug in node/browser compat wrapper in ...

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

Change subject: momentjs: Hack around bug in node/browser compat wrapper in 
locale files
..


momentjs: Hack around bug in node/browser compat wrapper in locale files

If there is an element with id="global" on the page,
typeof global !== 'undefined' is true, but global.moment will
still be undefined and shouldn't be used.

For now, comment out the wrapper and just use 'this'.
We should look into upgrading to momentjs 2.14 where this bug is fixed.

Bug: T145382
Change-Id: Ia6e3b46e42248a5ee3c61c5fcda7d020d012e89e
---
M resources/lib/moment/locale/af.js
M resources/lib/moment/locale/ar-ma.js
M resources/lib/moment/locale/ar-sa.js
M resources/lib/moment/locale/ar.js
M resources/lib/moment/locale/az.js
M resources/lib/moment/locale/be.js
M resources/lib/moment/locale/bg.js
M resources/lib/moment/locale/bn.js
M resources/lib/moment/locale/bo.js
M resources/lib/moment/locale/br.js
M resources/lib/moment/locale/bs.js
M resources/lib/moment/locale/ca.js
M resources/lib/moment/locale/cs.js
M resources/lib/moment/locale/cv.js
M resources/lib/moment/locale/cy.js
M resources/lib/moment/locale/da.js
M resources/lib/moment/locale/de-at.js
M resources/lib/moment/locale/de.js
M resources/lib/moment/locale/el.js
M resources/lib/moment/locale/en-au.js
M resources/lib/moment/locale/en-ca.js
M resources/lib/moment/locale/en-gb.js
M resources/lib/moment/locale/eo.js
M resources/lib/moment/locale/es.js
M resources/lib/moment/locale/et.js
M resources/lib/moment/locale/eu.js
M resources/lib/moment/locale/fa.js
M resources/lib/moment/locale/fi.js
M resources/lib/moment/locale/fo.js
M resources/lib/moment/locale/fr-ca.js
M resources/lib/moment/locale/fr.js
M resources/lib/moment/locale/gl.js
M resources/lib/moment/locale/he.js
M resources/lib/moment/locale/hi.js
M resources/lib/moment/locale/hr.js
M resources/lib/moment/locale/hu.js
M resources/lib/moment/locale/hy-am.js
M resources/lib/moment/locale/id.js
M resources/lib/moment/locale/is.js
M resources/lib/moment/locale/it.js
M resources/lib/moment/locale/ja.js
M resources/lib/moment/locale/ka.js
M resources/lib/moment/locale/km.js
M resources/lib/moment/locale/ko.js
M resources/lib/moment/locale/lb.js
M resources/lib/moment/locale/lt.js
M resources/lib/moment/locale/lv.js
M resources/lib/moment/locale/mk.js
M resources/lib/moment/locale/ml.js
M resources/lib/moment/locale/mr.js
M resources/lib/moment/locale/ms-my.js
M resources/lib/moment/locale/my.js
M resources/lib/moment/locale/nb.js
M resources/lib/moment/locale/ne.js
M resources/lib/moment/locale/nl.js
M resources/lib/moment/locale/nn.js
M resources/lib/moment/locale/pl.js
M resources/lib/moment/locale/pt-br.js
M resources/lib/moment/locale/pt.js
M resources/lib/moment/locale/ro.js
M resources/lib/moment/locale/ru.js
M resources/lib/moment/locale/sk.js
M resources/lib/moment/locale/sl.js
M resources/lib/moment/locale/sq.js
M resources/lib/moment/locale/sr-cyrl.js
M resources/lib/moment/locale/sr.js
M resources/lib/moment/locale/sv.js
M resources/lib/moment/locale/ta.js
M resources/lib/moment/locale/th.js
M resources/lib/moment/locale/tl-ph.js
M resources/lib/moment/locale/tr.js
M resources/lib/moment/locale/tzm-latn.js
M resources/lib/moment/locale/tzm.js
M resources/lib/moment/locale/uk.js
M resources/lib/moment/locale/uz.js
M resources/lib/moment/locale/vi.js
M resources/lib/moment/locale/zh-cn.js
M resources/lib/moment/locale/zh-tw.js
78 files changed, 312 insertions(+), 156 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  Mattflaschen: Looks good to me, approved
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/resources/lib/moment/locale/af.js 
b/resources/lib/moment/locale/af.js
index 2fb7adf..55a41bd 100644
--- a/resources/lib/moment/locale/af.js
+++ b/resources/lib/moment/locale/af.js
@@ -3,13 +3,15 @@
 // author : Werner Mollentze : https://github.com/wernerm
 
 (function (factory) {
-if (typeof define === 'function' && define.amd) {
+// Comment out broken wrapper, see T145382
+/*if (typeof define === 'function' && define.amd) {
 define(['moment'], factory); // AMD
 } else if (typeof exports === 'object') {
 module.exports = factory(require('../moment')); // Node
 } else {
 factory((typeof global !== 'undefined' ? global : this).moment); // 
node or other global
-}
+}*/
+factory(this.moment);
 }(function (moment) {
 return moment.defineLocale('af', {
 months : 
'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
diff --git a/resources/lib/moment/locale/ar-ma.js 
b/resources/lib/moment/locale/ar-ma.js
index 7add172..871e41c 100644
--- a/resources/lib/moment/locale/ar-ma.js
+++ b/resources/lib/moment/locale/ar-ma.js
@@ -4,13 +4,15 @@
 // author : Abdel Said : 

[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Treat list items as inline

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

Change subject: Treat list items as inline
..


Treat list items as inline

By default an `li` element is inline. So any img tags inside
that are also inline should also be inline.

When a `li` tag is not inline it means classes have been applied
to it and thus any `img` tags inside the `li` element should also
be explicitly styled via classes.

Since we copy classes across to the placeholder, it should be safe
to assume any img inside a list item should be treated as inline.

Bug: T144567
Change-Id: I911f305fa130e60991e830708d6680599870cc13
---
M resources/skins.minerva.base.styles/images.less
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/resources/skins.minerva.base.styles/images.less 
b/resources/skins.minerva.base.styles/images.less
index f594c3a..a9cdfee 100644
--- a/resources/skins.minerva.base.styles/images.less
+++ b/resources/skins.minerva.base.styles/images.less
@@ -7,6 +7,8 @@
 .lazy-image-placeholder {
// If the placeholder itself is inside an inline element do not use 
block
// See https://phabricator.wikimedia.org/T143558
+   // and https://phabricator.wikimedia.org/T144567
+   li &,
span & {
display: inline;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I911f305fa130e60991e830708d6680599870cc13
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson 
Gerrit-Reviewer: Bmansurov 
Gerrit-Reviewer: Hashar 
Gerrit-Reviewer: Jdlrobson 
Gerrit-Reviewer: Jhobs 
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...BlueSpiceFoundation[master]: Updated release notes and version number to 2.27.0

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

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

Change subject: Updated release notes and version number to 2.27.0
..

Updated release notes and version number to 2.27.0

Preparation for upcoming 2.27.0 release

Change-Id: I0a4ae5c989d428e3c64078409a08ed13ef1ddeeb
---
M BLUESPICE-RELEASE-HISTORY
M BLUESPICE-RELEASE-NOTES
M extension.json
3 files changed, 688 insertions(+), 391 deletions(-)


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

diff --git a/BLUESPICE-RELEASE-HISTORY b/BLUESPICE-RELEASE-HISTORY
index 043d180..98271f9 100644
--- a/BLUESPICE-RELEASE-HISTORY
+++ b/BLUESPICE-RELEASE-HISTORY
@@ -5,6 +5,480 @@
 
 = BlueSpice release notes =
 
+== BlueSpice 2.23.3 ==
+
+BlueSpice 2.23.3 is a minor and maintenance release.
+This is a stable release.
+
+=== Notable new features ===
+* BlueSpice API: There is now a standardized API for many BlueSpice actions.
+* Compatibility: BlueSpice can now be used with MediaWiki 1.27.
+* ContextMenu: The extension is now enabled by default.
+* Dashboards: There is a wiki page portlet, which allows you to use any wiki
+  page as a dashboard item.
+* ExtendedSearch: Introduces facet operators, which indicated whether multiple
+  selections in a facet should be combined using AND or OR logic.
+* ExtendedSearch: It is possible to open articles in the autocomplete list in
+  new windows or tabs.
+* Flexiskin: It is now possible to disable the background image.
+* GroupManager: Raised group name character limit to 255 (was 16).
+* InsertMagic: Tag descriptions are now much more descriptive.
+* PermissionManager: Add hint flyout for every right.
+* Upload: XML and SVG files can now be uploaded by default.
+* UserMerge: Added extension to Distribution.
+* UserSidebar: There is now a "global actions" navigation tab for every user.
+* VisualEditor: Set default style for table to contenttable. This makes nicer
+  tables.
+
+=== BlueSpice Foundation ===
+* General: ArticleHelper: Fixed fatal getRedirectTarget call on null
+* General: Updated all URLs to bluespice.com and removed "Medienwerkstatt" from
+  company name.
+
+=== BlueSpice Extensions ===
+* ArticleInfo: Stop using deprecated Skin::link
+* Checklist: Fixed error when inserting checklists several times
+* Checklist: Improved tag documentation
+* ContextMenu: Added dependencies to fix runtime errors
+* CountThings: Improved tag documentation
+* Dashboards: Fixed Notice
+* Dashboards: Fixed wikipage portlet error messages
+* Flexiskin: Add some hook points
+* General: Updated all URLs to bluespice.com and removed "Medienwerkstatt" from
+  company name.
+* InsertCategory: Removed wrong user information
+* InsertLink: use user config var instead of browser settings to trigger java
+  applet for file links
+* InsertMagic: Added examples to description and reference implementation
+* InsertMagic: Improve example code line wrapping
+* PageAccess: Improved tag documentation
+* PageTemplates: Remove loadmask workaround
+* PagesVisited: Improved tag documentation
+* ResponsibleEditors: Remove loadmask workaround
+* Review: Added dependencies to fix runtime errors
+* SmartList: Added exception for getToplist for mw > 1.24
+* Smartlist: Improved tag documentation
+* UniversalExport: Improved tag documentation
+* WantedArticle: Improved tag documentation
+* Watchlist: Improved tag documentation
+* WhoIsOnline: Improved tag documentation
+
+=== BlueSpice Skin ===
+* Fix for different line height since mw 1.27
+* Development: Upgrade jsonlint to report file/line
+* General: Updated all URLs to bluespice.com and removed "Medienwerkstatt" from
+  company name.
+
+=== BlueSpice Distribution ===
+* General: Improved tag documentation
+* General: Updated all URLs to bluespice.com and removed "Medienwerkstatt" from
+  company name.
+* RSS: Updated RSS to 1.26 - works for 1.23 - 1.27
+
+=== BlueSpice Pro ===
+* Bookmaker: ExtJS/RL runtime issues
+* Bookmaker: New global navigation implementation
+* Bookmaker: Color book icon when inside a book
+* Bookmaker: Switch to book navigation when inside a book
+* Bookmaker: Added special page to global actions widget
+* Bookmaker: used mw.config.get( 'wgScriptPath') instead of global wgScriptPath
+* Bookmaker: Fixed link for module pdf in UI manager
+* Bookmaker: Improved tag descriptions
+* ExportTables: Added to BlueSpice pro. This allows to export tables as xls
+  file
+* General: Updated all URLs to bluespice.com and removed "Medienwerkstatt" from
+  company name.
+* GuidedEditing: ExtJS/RL fixed runtime issues
+* GuidedEditing: Modified insertCategory button id
+* PasteImage: Intermediate save, base64 image in var, base64 img replaced with
+  replacebin, next fix dialog and replace replacebin with uploaded version
+* PasteImage: Re-implementation of ie11/edge, ff und chrome version, pure
+  javascript, no java used anymore

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Don't allow auto-enroll of new wikitext editor Beta Feature

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

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

Change subject: Don't allow auto-enroll of new wikitext editor Beta Feature
..

Don't allow auto-enroll of new wikitext editor Beta Feature

Change-Id: Icc8e27a8e2a7d88fbbdeaf31b1ef8a5f5c85311f
---
M VisualEditor.hooks.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 2c70154..e875c7a 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -622,7 +622,8 @@
'javascript' => true,
'blacklist' => $veConfig->get( 
'VisualEditorBrowserBlacklist' ),
'skins' => $veConfig->get( 
'VisualEditorSupportedSkins' ),
-   ]
+   ],
+   'exempt-from-auto-enrollment' => true
];
 
}

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

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

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


[MediaWiki-commits] [Gerrit] wikimedia...discernatron[master]: Create dom elements explicitly

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

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

Change subject: Create dom elements explicitly
..

Create dom elements explicitly

The use of innerHTML here makes it open to XSS, clean that up by
explicitly creating dom elements and text nodes, rather than using
innerHTML.

Bug: T145563
Change-Id: Id5d6bf2fcd1666b5ec90bfb36d8a708a10330f2f
---
M public/js/discernadeck.js
1 file changed, 24 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/discernatron 
refs/changes/44/310444/1

diff --git a/public/js/discernadeck.js b/public/js/discernadeck.js
index ace3dd7..5a3201f 100644
--- a/public/js/discernadeck.js
+++ b/public/js/discernadeck.js
@@ -159,12 +159,31 @@
}
},
createCardDOM: function() {
-   var el = document.createElement('div'),
-   link = window.scoringData.baseWikiUrl + '/' + 
this.cardData.title;
-   snippet = 
this.cardData.snippet.split('\uE000').join('').split('\uE001').join('');
+   var i, b,
+el = document.createElement('div'),
+   snippetPieces = 
this.cardData.snippet.split('\uE000').map(function (s) { return 
s.split('\uE001') }),
+a = document.createElement('a'),
+p = document.createElement('p');
+
+a.setAttribute('target', '_blank');
+a.setAttribute('href', window.scoringData.baseWikiUrl + '/' + 
this.cardData.title);
+a.appendChild(document.createTextNode(this.cardData.title));
+
+for (var i = 0; i < snippetPieces.length; i++) {
+if ( snippetPieces[i].length == 1 ) {
+p.appendChild(document.createTextNode(snippetPieces[i][0]));
+} else {
+b = document.createElement('b');
+b.appendChild(document.createTextNode(snippetPieces[i][0]));
+p.appendChild(b);
+p.appendChild(document.createTextNode(snippetPieces[i][1]));
+}
+}
+
+el.appendChild(a);
+el.appendChild(p);
el.classList.add('card');
-   // note this isn't safe from XSS. should use 
document.createElement
-   el.innerHTML = "" + 
this.cardData.title + "" + snippet + "";
+
this.domEl = el;
document.querySelector( '.stack' ).appendChild( this.domEl );
},

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5d6bf2fcd1666b5ec90bfb36d8a708a10330f2f
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] mediawiki/core[wmf/1.28.0-wmf.19]: Avoid warnings when unable to parse the URL given to us

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

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

Change subject: Avoid warnings when unable to parse the URL given to us
..

Avoid warnings when unable to parse the URL given to us

Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
(cherry picked from commit 3635881b44a3b1069b1f44218fe6269cb2dfd3df)
---
M includes/MediaWiki.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/310443/1

diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 7f20de1..0bd183f 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -648,7 +648,11 @@
);
 
foreach ( $clusterHosts as $clusterHost ) {
-   $infoHost = array_intersect_key( wfParseUrl( 
$clusterHost ), $relevantKeys );
+   $parseUrl = wfParseUrl( $clusterHost );
+   if ( !$parseUrl ) {
+   continue;
+   }
+   $infoHost = array_intersect_key( $parseUrl, 
$relevantKeys );
if ( $infoCandidate === $infoHost ) {
return true;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.19
Gerrit-Owner: Chad 

___
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.19]: Revert "Grant 'editcontentmodel' permission to 'user' group"

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

Change subject: Revert "Grant 'editcontentmodel' permission to 'user' group"
..


Revert "Grant 'editcontentmodel' permission to 'user' group"

This reverts Iad834e75 / b43ac35351e70f3b6429cc527509ac33f52c6404

And updates a test case that depended upon it.

Change-Id: Ibf04e9d2ba8619c0c6bf535a9eeece82882e3615
---
M RELEASE-NOTES-1.28
M includes/DefaultSettings.php
M tests/phpunit/includes/api/ApiEditPageTest.php
3 files changed, 7 insertions(+), 4 deletions(-)

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



diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28
index 116dc2a..c099b9b 100644
--- a/RELEASE-NOTES-1.28
+++ b/RELEASE-NOTES-1.28
@@ -29,9 +29,6 @@
 * When $EditSubmitButtonLabelPublish is true, MediaWiki will label the button
   to store-to-database-and-show-to-others as "Publish page"/"Publish changes";
   if false, the default, they will be "Save page"/"Save changes".
-* The 'editcontentmodel' permission is now granted to all logged-in users 
('user').
-  instead of just administrators ('sysop'). Documentation for this feature is
-  available at .
 * $wgRevisionCacheExpiry is now set to one week by default instead of being 
disabled.
 
 === New features in 1.28 ===
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 57d5239..fb6bb09 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -5089,7 +5089,6 @@
 $wgGroupPermissions['user']['sendemail'] = true;
 $wgGroupPermissions['user']['applychangetags'] = true;
 $wgGroupPermissions['user']['changetags'] = true;
-$wgGroupPermissions['user']['editcontentmodel'] = true;
 
 // Implicit group for accounts that pass $wgAutoConfirmAge
 $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;
@@ -5120,6 +5119,7 @@
 $wgGroupPermissions['sysop']['editinterface'] = true;
 $wgGroupPermissions['sysop']['editusercss'] = true;
 $wgGroupPermissions['sysop']['edituserjs'] = true;
+$wgGroupPermissions['sysop']['editcontentmodel'] = true;
 $wgGroupPermissions['sysop']['import'] = true;
 $wgGroupPermissions['sysop']['importupload'] = true;
 $wgGroupPermissions['sysop']['move'] = true;
diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php 
b/tests/phpunit/includes/api/ApiEditPageTest.php
index 02d0a0d..d21d498 100644
--- a/tests/phpunit/includes/api/ApiEditPageTest.php
+++ b/tests/phpunit/includes/api/ApiEditPageTest.php
@@ -25,6 +25,12 @@
'wgContLang' => $wgContLang,
] );
 
+   // Make sure 'user' can edit content model
+   $this->mergeMwGlobalArrayValue(
+   'wgGroupPermissions',
+   [ 'user' => [ 'editcontentmodel' => true ] ]
+   );
+
$wgExtraNamespaces[12312] = 'Dummy';
$wgExtraNamespaces[12313] = 'Dummy_talk';
$wgExtraNamespaces[12314] = 'DummyNonText';

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf04e9d2ba8619c0c6bf535a9eeece82882e3615
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.28.0-wmf.19
Gerrit-Owner: Chad 
Gerrit-Reviewer: Chad 
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...Echo[master]: Revert "Make seen/unseen badge more consistent across wikis"

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

Change subject: Revert "Make seen/unseen badge more consistent across wikis"
..


Revert "Make seen/unseen badge more consistent across wikis"

Has bugs, and will likely cause deployment problems.
This'll need to be reverted in wmf.19 at least
until we fix it up.

This reverts commit 00e0b9f45d8951b2a1faf320740295058a961996.

Change-Id: Ia9d220ebcb607f96dee6bc856755305ed8501fcc
---
M Hooks.php
M includes/NotifUser.php
M includes/SeenTime.php
M includes/api/ApiEchoNotifications.php
M modules/controller/mw.echo.Controller.js
M modules/model/mw.echo.dm.CrossWikiNotificationItem.js
M modules/model/mw.echo.dm.ModelManager.js
M modules/model/mw.echo.dm.SeenTimeModel.js
M modules/ui/mw.echo.ui.NotificationBadgeWidget.js
M tests/phpunit/NotifUserTest.php
10 files changed, 45 insertions(+), 283 deletions(-)

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



diff --git a/Hooks.php b/Hooks.php
index f0af4bb..0a719fb 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -858,20 +858,13 @@
$msgNotificationTimestamp = 
$notifUser->getLastUnreadMessageTime();
$alertNotificationTimestamp = 
$notifUser->getLastUnreadAlertTime();
 
-   // The variable wgEchoSeenTime is being replaced, but we should 
keep it around
-   // as a backup for at least one deployment cycle.
-   $seenTimeForUser = EchoSeenTime::newFromUser( $user );
-   $seenAlertTime = $seenTimeForUser->getTime( 'alert', /*flags*/ 
0, TS_ISO_8601 );
-   $seenMsgTime = $seenTimeForUser->getTime( 'message', /*flags*/ 
0, TS_ISO_8601 );
-   // Output local seen time (backwards compatibility)
+   $seenAlertTime = EchoSeenTime::newFromUser( $user )->getTime( 
'alert', /*flags*/ 0, TS_ISO_8601 );
+   $seenMsgTime = EchoSeenTime::newFromUser( $user )->getTime( 
'message', /*flags*/ 0, TS_ISO_8601 );
+
$sk->getOutput()->addJsConfigVars( 'wgEchoSeenTime', array(
'alert' => $seenAlertTime,
'notice' => $seenMsgTime,
) );
-
-   // Output seen time for all sources; this is the more robust
-   // variable that the UI uses instead of the old (local-only) 
wgEchoSeenTime
-   $sk->getOutput()->addJsConfigVars( 'wgEchoSeenTimeSources', 
$notifUser->getSeenTimeForAllSources() );
 
if (
$wgEchoShowFooterNotice &&
@@ -896,7 +889,7 @@
if (
$msgCount != 0 && // no unread notifications
$msgNotificationTimestamp !== false && // should 
already always be false if count === 0
-   ( $notifUser->hasUnseenNotificationsAnywhere( 
EchoAttributeManager::MESSAGE ) ) // there are unseen notifications
+   ( $seenMsgTime === null || $seenMsgTime < 
$msgNotificationTimestamp->getTimestamp( TS_ISO_8601 ) ) // there are no unseen 
notifications
) {
$msgLinkClasses[] = 'mw-echo-unseen-notifications';
$hasUnseen = true;
@@ -907,7 +900,7 @@
if (
$alertCount != 0 && // no unread notifications
$alertNotificationTimestamp !== false && // should 
already always be false if count === 0
-   ( $notifUser->hasUnseenNotificationsAnywhere( 
EchoAttributeManager::ALERT ) ) // there are unseen notifications
+   ( $seenAlertTime === null || $seenAlertTime < 
$alertNotificationTimestamp->getTimestamp( TS_ISO_8601 ) ) // all notifications 
have already been seen
) {
$alertLinkClasses[] = 'mw-echo-unseen-notifications';
$hasUnseen = true;
@@ -1054,7 +1047,8 @@
$modifiedTimes['notifications-global'] = 
$lastUpdate;
}
 
-   $modifiedTimes[ 'notifications-seen' ] = 
$notifUser->getGlobalSeenTime();
+   $modifiedTimes['notifications-seen-alert'] = 
EchoSeenTime::newFromUser( $user )->getTime( 'alert' );
+   $modifiedTimes['notifications-seen-message'] = 
EchoSeenTime::newFromUser( $user )->getTime( 'message' );
}
}
 
diff --git a/includes/NotifUser.php b/includes/NotifUser.php
index 04d9b52..e7d6ded 100644
--- a/includes/NotifUser.php
+++ b/includes/NotifUser.php
@@ -50,11 +50,6 @@
 */
private $mForeignData = null;
 
-   /**
-* @var EchoSeenTime
-*/
-   private $seenTime = null;
-
// The max notification count shown in badge
 
// The max number shown in bundled message, eg,  and 99+ others 
.
@@ -78,15 +73,13 @@
BagOStuff $cache,

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid warnings when unable to parse the URL given to us

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

Change subject: Avoid warnings when unable to parse the URL given to us
..


Avoid warnings when unable to parse the URL given to us

Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
---
M includes/MediaWiki.php
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 7f20de1..0bd183f 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -648,7 +648,11 @@
);
 
foreach ( $clusterHosts as $clusterHost ) {
-   $infoHost = array_intersect_key( wfParseUrl( 
$clusterHost ), $relevantKeys );
+   $parseUrl = wfParseUrl( $clusterHost );
+   if ( !$parseUrl ) {
+   continue;
+   }
+   $infoHost = array_intersect_key( $parseUrl, 
$relevantKeys );
if ( $infoCandidate === $infoHost ) {
return true;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I56f1f36a3a54c6c23579f011d65dc75f30cb6dcf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad 
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] operations/puppet[production]: labspuppetbackend: Use _ to denote empty

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

Change subject: labspuppetbackend: Use _ to denote empty
..


labspuppetbackend: Use _ to denote empty

Empty URL segments are not generally supported, and _
is an invalid character in DNS! This makes it much
easier to use from client libraries

Change-Id: I40534bbf734bb414ecd20047fce5e82f5738e6ce
---
M modules/labspuppetbackend/files/labspuppetbackend.py
1 file changed, 19 insertions(+), 1 deletion(-)

Approvals:
  Andrew Bogott: Looks good to me, but someone else must approve
  Yuvipanda: Verified; Looks good to me, approved



diff --git a/modules/labspuppetbackend/files/labspuppetbackend.py 
b/modules/labspuppetbackend/files/labspuppetbackend.py
index edab32b..c55758d 100644
--- a/modules/labspuppetbackend/files/labspuppetbackend.py
+++ b/modules/labspuppetbackend/files/labspuppetbackend.py
@@ -9,6 +9,19 @@
 app.config['PROPAGATE_EXCEPTIONS'] = True
 
 
+def _preprocess_prefix(prefix):
+"""
+Preprocess prefixes to provide some convenience features
+
+- Take a single _ to mean empty. The empty prefix applies to all
+  instances in a project, and this makes it easier than trying
+  to have an empty url segment
+"""
+if prefix == '_':
+return ''
+return prefix
+
+
 @app.before_request
 def before_request():
 g.db = pymysql.connect(
@@ -29,6 +42,7 @@
 @statsd.timer('get_roles')
 @app.route('/v1//prefix//roles', 
methods=['GET'])
 def get_roles(project, prefix):
+prefix = _preprocess_prefix(prefix)
 cur = g.db.cursor()
 try:
 cur.execute("""
@@ -55,6 +69,7 @@
 @statsd.timer('set_roles')
 @app.route('/v1//prefix//roles', 
methods=['POST'])
 def set_roles(project, prefix):
+prefix = _preprocess_prefix(prefix)
 try:
 roles = yaml.safe_load(request.data)
 except yaml.YAMLError:
@@ -109,6 +124,7 @@
 @statsd.timer('get_hiera')
 @app.route('/v1//prefix//hiera', 
methods=['GET'])
 def get_hiera(project, prefix):
+prefix = _preprocess_prefix(prefix)
 cur = g.db.cursor()
 try:
 cur.execute("""
@@ -135,6 +151,7 @@
 @statsd.timer('set_hiera')
 @app.route('/v1//prefix//hiera', 
methods=['POST'])
 def set_hiera(project, prefix):
+prefix = _preprocess_prefix(prefix)
 try:
 hiera = yaml.safe_load(request.data)
 except yaml.YAMLError:
@@ -231,8 +248,9 @@
 cur.execute("""
 SELECT prefix FROM prefix WHERE project = %s
 """, (project, ))
+# Do the inverse of _preprocess_prefix, so callers get a consistent 
view
 return Response(
-yaml.safe_dump({'prefixes': [r[0] for r in cur.fetchall()]}),
+yaml.safe_dump({'prefixes': ['_' if r[0] == '' else r[0] for r in 
cur.fetchall()]}),
 status=200,
 mimetype='application/x-yaml'
 )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I40534bbf734bb414ecd20047fce5e82f5738e6ce
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda 
Gerrit-Reviewer: Andrew Bogott 
Gerrit-Reviewer: Volans 
Gerrit-Reviewer: Yuvipanda 
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...MobileFrontend[master]: Add MobileFrontend.Context service

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

Change subject: Add MobileFrontend.Context service
..


Add MobileFrontend.Context service

This service allows us to break apart classes that rely heavily on
MobileContext::singleton, i.e. MobileFrontendHooks, and also to extract
real services from MobileContext while maintaining compatibility with
existing clients, e.g. DeviceFormFactorDetector (see T143891).

To be clear, this service should be considered temporary.

Notes:
* Because MobileContext::singleton is used everywhere, there were calls
  to MobileContext::setInstance in several test cases which were meant
  to reset the object's state. Create the ::resetServiceForTesting
  method which service this use case.

Changes:
* Make MobileContext::singleton return the MobileFrontend.Context
  service, if the singleton instance hasn't been set
* Make MobileContext accept instance of Config at construction, which
  can then be returned MobileContext#getMFConfig
* Update test suites to use MobileContext::resetServiceForTesting
* Deprecate MobileContext::singleton, ::setInstanceForTesting, and
  ::resetServiceForTesting as they are superseded by the service

Co-Author: Joaquín Hernández 
Bug: T143189
Bug: T143875
Change-Id: I8d57f485d5814dd8ecce151a1064dd3f6b20f73b
---
M includes/MobileContext.php
M includes/ServiceWiring.php
M tests/phpunit/MobileContextTest.php
M tests/phpunit/MobileFrontend.hooksTest.php
M tests/phpunit/specials/SpecialMobileDiffTest.php
5 files changed, 85 insertions(+), 24 deletions(-)

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



diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index d88da4b..a848cb7 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -99,7 +99,7 @@
/**
 * @var Config MobileFrontend's config object
 */
-   private $configObj;
+   private $config;
/**
 * @var String Domain to use for the stopMobileRedirect cookie
 */
@@ -110,31 +110,57 @@
private $mobileUrlTemplate = false;
 
/**
-* Returns the actual MobileContext Instance or create a new if no 
exists
-* @return MobileContext
+* Gets the singleton instance.
+*
+* @deprecated Removing this method is one of the goals
+*  [T143189][https://phabricator.wikimedia.org/T143875].
+* @deprecated If you're creating a new class, then it should accept an 
instance of
+* `MobileContext` at construction time.
+* @deprecated If you're adding code to a pre-existing class, then 
first consider if the class can
+*  be split apart so that you can do the above. If you're confident 
that this can't be done,
+*  then you can use this method.
+*
+* @return {MobileContext}
 */
public static function singleton() {
if ( !self::$instance ) {
-   self::$instance = new MobileContext( 
RequestContext::getMain() );
+   self::$instance =
+   MediaWikiServices::getInstance()->getService( 
'MobileFrontend.MobileContext' );
}
+
return self::$instance;
}
 
/**
-* Set $this->instance to the given instance of MobileContext or null
-* @param MobileContext|null $instance MobileContext instance or null 
to set
-* @return MobileContext|null
+* Overrides the singleton instance.
+*
+* @deprecated See `MobileContext::singleton`.
+*
+* @warning This method should only accept instances of 
`MobileContext`. The `BogusMobileContext`
+*  class is used in the `MobileContextTest` test suite and will be 
removed.
+*
+* @param {MobileContext} $instance
 */
-   public static function setInstance( /* MobileContext|null */ $instance 
) {
+   public static function setInstanceForTesting( $instance ) {
self::$instance = $instance;
}
 
/**
-* Set the IontextSource Object
-* @param IContextSource $context The IContextSource Object has to set
+* Resets the `MobileFrontend.MobileContext` service and singleton 
instance.
+*
+* @deprecated See `MobileContext::singleton`.
+*
+* @throws MWException If called outside the MediaWiki PHPUnit test 
suite
+*  (see `MediaWikiServices#resetServiceForTesting`).
 */
-   protected function __construct( IContextSource $context ) {
+   public static function resetServiceForTesting() {
+   self::$instance = null;
+   MediaWikiServices::getInstance()->resetServiceForTesting( 
'MobileFrontend.MobileContext' );
+   }
+
+   public function __construct( IContextSource $context, Config $config ) {

[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Inline generic_attribute_newline_value and table_attribute_v...

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

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

Change subject: Inline generic_attribute_newline_value and table_attribute_value
..

Inline generic_attribute_newline_value and table_attribute_value

 * They only have one use site each.  Also, that use site isn't expecting
   an array to be returned, so fix that up as well.

Change-Id: Ie7b3fb7451ed4a570cec316e2277c09cff9a9784
---
M lib/wt2html/pegTokenizer.pegjs.txt
1 file changed, 2 insertions(+), 16 deletions(-)


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

diff --git a/lib/wt2html/pegTokenizer.pegjs.txt 
b/lib/wt2html/pegTokenizer.pegjs.txt
index 22c9577..434d7cd 100644
--- a/lib/wt2html/pegTokenizer.pegjs.txt
+++ b/lib/wt2html/pegTokenizer.pegjs.txt
@@ -1215,8 +1215,7 @@
 namePos0:("" { return endOffset(); })
 name:generic_attribute_name
 namePos:("" { return endOffset(); })
-valueData:( space_or_newline*
-v:generic_attribute_newline_value { return v; })?
+valueData:(space_or_newline* "=" v:generic_att_value? { return v; })?
 {
 var res;
 // Encapsulate protected attributes.
@@ -1242,8 +1241,7 @@
 namePos0:("" { return endOffset(); })
 name:table_attribute_name
 namePos:("" { return endOffset(); })
-valueData:(optionalSpaceToken
-v:table_attribute_value { return v; })?
+valueData:(optionalSpaceToken "=" v:table_att_value? { return v; })?
 {
 var res;
 // Encapsulate protected attributes.
@@ -1301,18 +1299,6 @@
 ) { return t; }
   )+ {
 return tu.flattenString(r);
-  }
-
-// A generic attribute, possibly spanning multiple lines.
-generic_attribute_newline_value
-  = "=" v:generic_att_value? {
-  return v === null ? [] : v;
-  }
-
-// A generic but single-line attribute.
-table_attribute_value
-  = "=" v:table_att_value? {
-  return v === null ? [] : v;
   }
 
 // Attribute value, quoted variants can span multiple lines.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7b3fb7451ed4a570cec316e2277c09cff9a9784
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


  1   2   3   4   5   >