[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: Update the badges' seen state when Special:Notifications is ...

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

Change subject: Update the badges' seen state when Special:Notifications is 
visited
..


Update the badges' seen state when Special:Notifications is visited

When the special page is loaded, all notifications should be marked
as seen for both the no-js and JS versions.

Bug: T134855
Change-Id: I053ce07ca26a858fd42c9d070b7dce73cc161e4b
---
M Hooks.php
1 file changed, 7 insertions(+), 3 deletions(-)

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



diff --git a/Hooks.php b/Hooks.php
index 0a719fb..5c37247 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -850,7 +850,6 @@
$notifUser = MWEchoNotifUser::newFromUser( $user );
$msgCount = $notifUser->getMessageCount() - $subtractMessages;
$alertCount = $notifUser->getAlertCount() - $subtractAlerts;
-
// But make sure we never show a negative number (T130853)
$msgCount = max( 0, $msgCount );
$alertCount = max( 0, $alertCount );
@@ -858,8 +857,13 @@
$msgNotificationTimestamp = 
$notifUser->getLastUnreadMessageTime();
$alertNotificationTimestamp = 
$notifUser->getLastUnreadAlertTime();
 
-   $seenAlertTime = EchoSeenTime::newFromUser( $user )->getTime( 
'alert', /*flags*/ 0, TS_ISO_8601 );
-   $seenMsgTime = EchoSeenTime::newFromUser( $user )->getTime( 
'message', /*flags*/ 0, TS_ISO_8601 );
+   $seenTime = EchoSeenTime::newFromUser( $user );
+   if ( $title->isSpecial( 'Notifications' ) ) {
+   // If this is the Special:Notifications page, seenTime 
to now
+   $seenTime->setTime( wfTimestamp( TS_MW ), 
EchoAttributeManager::ALL );
+   }
+   $seenAlertTime = $seenTime->getTime( 'alert', /*flags*/ 0, 
TS_ISO_8601 );
+   $seenMsgTime = $seenTime->getTime( 'message', /*flags*/ 0, 
TS_ISO_8601 );
 
$sk->getOutput()->addJsConfigVars( 'wgEchoSeenTime', array(
'alert' => $seenAlertTime,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I053ce07ca26a858fd42c9d070b7dce73cc161e4b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Mattflaschen 
Gerrit-Reviewer: Sbisson 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: On CBN detach, mark contentBranchNodeChanged in the CE Surface

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

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

Change subject: On CBN detach, mark contentBranchNodeChanged in the CE Surface
..

On CBN detach, mark contentBranchNodeChanged in the CE Surface

Bug: T122291
Change-Id: I0930ac8d227a8a1cff86bd5fdd38be42ec979b61
---
M src/ce/ve.ce.ContentBranchNode.js
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/71/311371/1

diff --git a/src/ce/ve.ce.ContentBranchNode.js 
b/src/ce/ve.ce.ContentBranchNode.js
index ee7ad80..94e6c0c 100644
--- a/src/ce/ve.ce.ContentBranchNode.js
+++ b/src/ce/ve.ce.ContentBranchNode.js
@@ -33,6 +33,7 @@
 
// Events
this.connect( this, { childUpdate: 'onChildUpdate' } );
+   this.model.connect( this, { detach: 'onModelDetach' } );
// Some browsers allow clicking links inside contenteditable, such as 
in iOS Safari when the
// keyboard is closed
this.$element.on( 'click', this.onClickHandler );
@@ -354,6 +355,12 @@
return wrapper;
 };
 
+ve.ce.ContentBranchNode.prototype.onModelDetach = function () {
+   if ( this.root instanceof ve.ce.DocumentNode ) {
+   this.root.getSurface().setContentBranchNodeChanged();
+   }
+};
+
 /**
  * Render contents.
  *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0930ac8d227a8a1cff86bd5fdd38be42ec979b61
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Divec 

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


[MediaWiki-commits] [Gerrit] mediawiki/debian[trusty]: Rebuild for trusty

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

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

Change subject: Rebuild for trusty
..

Rebuild for trusty

Change-Id: I81dc93863b33ef3494c2c02070b6159dff3da3bc
---
M debian/changelog
M debian/gbp.conf
2 files changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/debian 
refs/changes/70/311370/1

diff --git a/debian/changelog b/debian/changelog
index 8905bb0..3f86ddb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,10 @@
-mediawiki (1:1.27.1-2~bpo8+1) UNRELEASED; urgency=medium
+mediawiki (1:1.27.1-2ppa1~trusty1) trusty; urgency=medium
+
+  * Rebuild for trusty
+
+ -- Kunal Mehta   Sun, 18 Sep 2016 00:08:55 -0700
+
+mediawiki (1:1.27.1-2~bpo8+1) jessie-backports; urgency=medium
 
   * Rebuild for jessie-backports.
   * Update gbp.conf for jessie
diff --git a/debian/gbp.conf b/debian/gbp.conf
index a492122..eca4365 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,4 +1,4 @@
 [DEFAULT]
-debian-branch = jessie
-dist = jessie
+debian-branch = trusty
+dist = trusty
 sign-tags = true

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81dc93863b33ef3494c2c02070b6159dff3da3bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/debian
Gerrit-Branch: trusty
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]: Remove wf* function dependencies from FSLockManager

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

Change subject: Remove wf* function dependencies from FSLockManager
..


Remove wf* function dependencies from FSLockManager

Change-Id: I52f08c6e7372ddbbcc1b5f82d505e435b01ff138
---
M includes/db/DatabaseSqlite.php
M includes/filebackend/lockmanager/FSLockManager.php
M includes/filebackend/lockmanager/LockManager.php
3 files changed, 16 insertions(+), 6 deletions(-)

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



diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php
index 28fb5b5..a52c2ed 100644
--- a/includes/db/DatabaseSqlite.php
+++ b/includes/db/DatabaseSqlite.php
@@ -69,8 +69,10 @@
// Super doesn't open when $user is false, but we can 
work with $dbName,
// which is derived from the file path in this case.
$this->openFile( $p['dbFilePath'] );
+   $lockDomain = md5( $p['dbFilePath'] );
} else {
$this->mDBname = $p['dbname'];
+   $lockDomain = $this->mDBname;
// Stock wiki mode using standard file names per DB.
parent::__construct( $p );
// Super doesn't open when $user is false, but we can 
work with $dbName
@@ -96,7 +98,10 @@
wfWarn( "Invalid SQLite transaction mode provided." );
}
 
-   $this->lockMgr = new FSLockManager( [ 'lockDirectory' => 
"{$this->dbDir}/locks" ] );
+   $this->lockMgr = new FSLockManager( [
+   'domain' => $lockDomain,
+   'lockDirectory' => "{$this->dbDir}/locks"
+   ] );
}
 
/**
diff --git a/includes/filebackend/lockmanager/FSLockManager.php 
b/includes/filebackend/lockmanager/FSLockManager.php
index 8e149d6..b6629aa 100644
--- a/includes/filebackend/lockmanager/FSLockManager.php
+++ b/includes/filebackend/lockmanager/FSLockManager.php
@@ -41,10 +41,14 @@
self::LOCK_EX => self::LOCK_EX
];
 
-   protected $lockDir; // global dir for all servers
+   /** @var string Global dir for all servers */
+   protected $lockDir;
 
/** @var array Map of (locked key => lock file handle) */
protected $handles = [];
+
+   /** @var bool */
+   protected $isWindows;
 
/**
 * Construct a new instance from configuration.
@@ -56,6 +60,7 @@
parent::__construct( $config );
 
$this->lockDir = $config['lockDirectory'];
+   $this->isWindows = ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 
'WIN' );
}
 
/**
@@ -119,11 +124,11 @@
} else {
MediaWiki\suppressWarnings();
$handle = fopen( $this->getLockPath( $path ), 
'a+' );
-   MediaWiki\restoreWarnings();
if ( !$handle ) { // lock dir missing?
-   wfMkdirParents( $this->lockDir );
+   mkdir( $this->lockDir, 0777, true );
$handle = fopen( $this->getLockPath( 
$path ), 'a+' ); // try again
}
+   MediaWiki\restoreWarnings();
}
if ( $handle ) {
// Either a shared or exclusive lock
@@ -173,7 +178,7 @@
}
// Unlock handles to release locks and delete
// any lock files that end up with no locks on them...
-   if ( wfIsWindows() ) {
+   if ( $this->isWindows ) {
// Windows: for any process, including this one,
// calling unlink() on a locked file will fail
$status->merge( $this->closeLockHandles( $path, 
$handlesToClose ) );
diff --git a/includes/filebackend/lockmanager/LockManager.php 
b/includes/filebackend/lockmanager/LockManager.php
index eff031b..e7f37ed 100644
--- a/includes/filebackend/lockmanager/LockManager.php
+++ b/includes/filebackend/lockmanager/LockManager.php
@@ -70,7 +70,7 @@
 *   This only applies if locks are not tied to a 
connection/process.
 */
public function __construct( array $config ) {
-   $this->domain = isset( $config['domain'] ) ? $config['domain'] 
: wfWikiID();
+   $this->domain = isset( $config['domain'] ) ? $config['domain'] 
: 'global';
if ( isset( $config['lockTTL'] ) ) {
$this->lockTTL = max( 5, $config['lockTTL'] );
} elseif ( PHP_SAPI === 'cli' ) {

-- 
To view, 

[MediaWiki-commits] [Gerrit] mediawiki...InterwikiIntegration[master]: Avoid calling awful DatabaseBase::strictIPs() method

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

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

Change subject: Avoid calling awful DatabaseBase::strictIPs() method
..

Avoid calling awful DatabaseBase::strictIPs() method

That method should be removed since it encourages incompatibility

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


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

diff --git a/InterwikiIntegrationRecentChange.php 
b/InterwikiIntegrationRecentChange.php
index 32dc494..96fe5f1 100755
--- a/InterwikiIntegrationRecentChange.php
+++ b/InterwikiIntegrationRecentChange.php
@@ -149,7 +149,8 @@
}
 
# If our database is strict about IP addresses, use NULL 
instead of an empty string
-   if( $dbw->strictIPs() and $this->mAttribs['integration_rc_ip'] 
== '' ) {
+   $strictIPs = in_array( $dbw->getType(), [ 'oracle', 'postgres' 
] ); // legacy
+   if ( $strictIPs and $this->mAttribs['integration_rc_ip'] == '' 
) {
unset( $this->mAttribs['integration_rc_ip'] );
}
 
@@ -710,4 +711,4 @@
}
return 
InterwikiIntegrationChangesList::showCharacterDifference( $old, $new );
}
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c2dd6525e271d9fe7405963b67906505a90ea01
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/InterwikiIntegration
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...Graph[master]: Bumped vega to 2.6.3

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

Change subject: Bumped vega to 2.6.3
..


Bumped vega to 2.6.3

Change-Id: I4d29586efed9445308fe50ddb36973165fa938f7
---
M lib/vega2/vega.js
1 file changed, 487 insertions(+), 486 deletions(-)

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



diff --git a/lib/vega2/vega.js b/lib/vega2/vega.js
index 1863166..c94bec4 100644
--- a/lib/vega2/vega.js
+++ b/lib/vega2/vega.js
@@ -1,6 +1,6 @@
 (function(f){if(typeof exports==="object"& 
module!=="undefined"){module.exports=f()}else if(typeof 
define==="function"&){define([],f)}else{var g;if(typeof 
window!=="undefined"){g=window}else if(typeof 
global!=="undefined"){g=global}else if(typeof 
self!=="undefined"){g=self}else{g=this}g.vg = f()}})(function(){var 
define,module,exports;return (function e(t,n,r){function 
s(o,u){if(!n[o]){if(!t[o]){var a=typeof 
require=="function"&if(!u&)return a(o,!0);if(i)return i(o,!0);var 
f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var 
l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return 
s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof 
require=="function"&for(var o=0;o>> 1;
+if (a[mid] < x) lo = mid + 1;
+else hi = mid;
+  }
+  return lo;
+}
+
+function feature(topology, o) {
+  return o.type === "GeometryCollection" ? {
+type: "FeatureCollection",
+features: o.geometries.map(function(o) { return feature$1(topology, o); })
+  } : feature$1(topology, o);
+}
+
+function feature$1(topology, o) {
+  var f = {
+type: "Feature",
+id: o.id,
+properties: o.properties || {},
+geometry: object(topology, o)
+  };
+  if (o.id == null) delete f.id;
+  return f;
+}
+
+function object(topology, o) {
+  var absolute = transformAbsolute(topology.transform),
+  arcs = topology.arcs;
+
+  function arc(i, points) {
+if (points.length) points.pop();
+for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {
+  points.push(p = 

[MediaWiki-commits] [Gerrit] mediawiki...Graph[master]: Bumped vega to 2.6.3

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

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

Change subject: Bumped vega to 2.6.3
..

Bumped vega to 2.6.3

Change-Id: I4d29586efed9445308fe50ddb36973165fa938f7
---
M lib/vega2/vega.js
1 file changed, 487 insertions(+), 486 deletions(-)


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

diff --git a/lib/vega2/vega.js b/lib/vega2/vega.js
index 1863166..c94bec4 100644
--- a/lib/vega2/vega.js
+++ b/lib/vega2/vega.js
@@ -1,6 +1,6 @@
 (function(f){if(typeof exports==="object"& 
module!=="undefined"){module.exports=f()}else if(typeof 
define==="function"&){define([],f)}else{var g;if(typeof 
window!=="undefined"){g=window}else if(typeof 
global!=="undefined"){g=global}else if(typeof 
self!=="undefined"){g=self}else{g=this}g.vg = f()}})(function(){var 
define,module,exports;return (function e(t,n,r){function 
s(o,u){if(!n[o]){if(!t[o]){var a=typeof 
require=="function"&if(!u&)return a(o,!0);if(i)return i(o,!0);var 
f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var 
l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return 
s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof 
require=="function"&for(var o=0;o>> 1;
+if (a[mid] < x) lo = mid + 1;
+else hi = mid;
+  }
+  return lo;
+}
+
+function feature(topology, o) {
+  return o.type === "GeometryCollection" ? {
+type: "FeatureCollection",
+features: o.geometries.map(function(o) { return feature$1(topology, o); })
+  } : feature$1(topology, o);
+}
+
+function feature$1(topology, o) {
+  var f = {
+type: "Feature",
+id: o.id,
+properties: o.properties || {},
+geometry: object(topology, o)
+  };
+  if (o.id == null) delete f.id;
+  return f;
+}
+
+function object(topology, o) {
+  var absolute = transformAbsolute(topology.transform),
+  arcs = topology.arcs;
+
+  function arc(i, points) {
+if (points.length) points.pop();
+for (var a = arcs[i < 0 ? ~i : i], k = 0, n = 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Avoid direct StatusValue->ok calls in File classes

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

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

Change subject: Avoid direct StatusValue->ok calls in File classes
..

Avoid direct StatusValue->ok calls in File classes

Also fixed a few other small IDEA warnings.

Change-Id: I463885a9f425491cd040cb1cdbc4c16925522848
---
M includes/filerepo/FileRepo.php
M includes/filerepo/RepoGroup.php
M includes/filerepo/file/ForeignAPIFile.php
M includes/filerepo/file/LocalFile.php
4 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/311367/1

diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index b8b1cf6..8fee3bf 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -825,7 +825,7 @@
 
$status = $this->storeBatch( [ [ $srcPath, $dstZone, $dstRel ] 
], $flags );
if ( $status->successCount == 0 ) {
-   $status->ok = false;
+   $status->setOK( false );
}
 
return $status;
@@ -1166,7 +1166,7 @@
$status = $this->publishBatch(
[ [ $src, $dstRel, $archiveRel, $options ] ], $flags );
if ( $status->successCount == 0 ) {
-   $status->ok = false;
+   $status->setOK( false );
}
if ( isset( $status->value[0] ) ) {
$status->value = $status->value[0];
diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php
index d515b05..bd32de04 100644
--- a/includes/filerepo/RepoGroup.php
+++ b/includes/filerepo/RepoGroup.php
@@ -135,17 +135,18 @@
}
 
# Check the cache
+   $dbkey = $title->getDBkey();
if ( empty( $options['ignoreRedirect'] )
&& empty( $options['private'] )
&& empty( $options['bypassCache'] )
) {
$time = isset( $options['time'] ) ? $options['time'] : 
'';
-   $dbkey = $title->getDBkey();
if ( $this->cache->has( $dbkey, $time, 60 ) ) {
return $this->cache->get( $dbkey, $time );
}
$useCache = true;
} else {
+   $time = false;
$useCache = false;
}
 
diff --git a/includes/filerepo/file/ForeignAPIFile.php 
b/includes/filerepo/file/ForeignAPIFile.php
index f6752d8..5c3d643 100644
--- a/includes/filerepo/file/ForeignAPIFile.php
+++ b/includes/filerepo/file/ForeignAPIFile.php
@@ -344,9 +344,6 @@
return $files;
}
 
-   /**
-* @see File::purgeCache()
-*/
function purgeCache( $options = [] ) {
$this->purgeThumbnails( $options );
$this->purgeDescriptionPage();
diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 618272c..210aa7a 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -2692,7 +2692,7 @@
// Even if some files could be copied, fail 
entirely as that is the
// easiest thing to do without data loss
$this->cleanupFailedBatch( $storeStatus, 
$storeBatch );
-   $status->ok = false;
+   $status->setOK( false );
$this->file->unlock();
 
return $status;
@@ -2952,7 +2952,7 @@
if ( !$statusDb->isGood() ) {
$destFile->unlock();
$this->file->unlock();
-   $statusDb->ok = false;
+   $statusDb->setOK( false );
 
return $statusDb;
}
@@ -2971,7 +2971,7 @@
$this->file->unlock();
wfDebugLog( 'imagemove', "Error in moving 
files: "
. $statusMove->getWikiText( false, 
false, 'en' ) );
-   $statusMove->ok = false;
+   $statusMove->setOK( false );
 
return $statusMove;
}

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

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

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

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Migrate callers to new MimeMagic::getPropsFromPath() method

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

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

Change subject: Migrate callers to new MimeMagic::getPropsFromPath() method
..

Migrate callers to new MimeMagic::getPropsFromPath() method

FSFile should not be responsible for handling this much

Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
---
M includes/MimeMagic.php
M includes/filebackend/FSFile.php
M includes/filerepo/RepoGroup.php
M includes/filerepo/file/LocalFile.php
M includes/upload/UploadBase.php
M includes/upload/UploadStash.php
M maintenance/importImages.php
7 files changed, 94 insertions(+), 10 deletions(-)


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

diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php
index a432d44..d33b436 100644
--- a/includes/MimeMagic.php
+++ b/includes/MimeMagic.php
@@ -373,6 +373,88 @@
}
 
/**
+* Get an associative array containing information about
+* a file with the given storage path.
+*
+* Resulting array fields include:
+*   - fileExists
+*   - size (filesize in bytes)
+*   - mime (as major/minor)
+*   - media_type (value to be used with the MEDIATYPE_xxx constants)
+*   - metadata (handler specific)
+*   - sha1 (in base 36)
+*   - width
+*   - height
+*   - bits (bitrate)
+*   - file-mime
+*   - major_mime
+*   - minor_mime
+*
+* @param string $path Filesystem path to a file
+* @param string|bool $ext The file extension, or true to extract it 
from the filename.
+* Set it to false to ignore the extension.
+* @return array
+* @since 1.28
+*/
+   public function getPropsFromPath( $path, $ext ) {
+   $fsFile = new FSFile( $path );
+   $info = $fsFile->getProps( $ext );
+
+   if ( $info['fileExists'] ) {
+   // Enhance FSFile's mime type detection
+   $path = $fsFile->getPath();
+   $magic = MimeMagic::singleton();
+
+   if ( $ext === true ) {
+   $ext = FileBackend::extensionFromPath( $path );
+   }
+
+   # MIME type according to file contents
+   $info['file-mime'] = $magic->guessMimeType( $path, 
false );
+   # logical MIME type
+   $info['mime'] = $magic->improveTypeFromExtension( 
$info['file-mime'], $ext );
+
+   list( $info['major_mime'], $info['minor_mime'] ) = 
File::splitMime( $info['mime'] );
+   $info['media_type'] = $magic->getMediaType( $path, 
$info['mime'] );
+
+   # Height, width and metadata
+   $handler = MediaHandler::getHandler( $info['mime'] );
+   if ( $handler ) {
+   $tempImage = (object)[]; // XXX (hack for File 
object)
+   /** @noinspection PhpParamsInspection */
+   $info['metadata'] = $handler->getMetadata( 
$tempImage, $path );
+   /** @noinspection PhpParamsInspection */
+   $gis = $handler->getImageSize( $tempImage, 
$path, $info['metadata'] );
+   if ( is_array( $gis ) ) {
+   $info = $this->extractImageSizeInfo( 
$gis ) + $info;
+   }
+   }
+   }
+
+   return $info;
+   }
+
+   /**
+* Exract image size information
+*
+* @param array $gis
+* @return array
+*/
+   protected function extractImageSizeInfo( array $gis ) {
+   $info = [];
+   # NOTE: $gis[2] contains a code for the image type. This is no 
longer used.
+   $info['width'] = $gis[0];
+   $info['height'] = $gis[1];
+   if ( isset( $gis['bits'] ) ) {
+   $info['bits'] = $gis['bits'];
+   } else {
+   $info['bits'] = 0;
+   }
+
+   return $info;
+   }
+
+   /**
 * Adds to the list mapping MIME to file extensions.
 * As an extension author, you are encouraged to submit patches to
 * MediaWiki's core to add new MIME types to mime.types.
@@ -1046,6 +1128,7 @@
}
}
 
+   $type = null;
// Check for entry for full MIME type
if ( $mime ) {
$type = $this->findMediaType( $mime );
diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php
index 221fe9f..c40e48d 100644
--- a/includes/filebackend/FSFile.php
+++ 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove MimeMagic depedency from FSFile and move it to /libs

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

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

Change subject: Remove MimeMagic depedency from FSFile and move it to /libs
..

Remove MimeMagic depedency from FSFile and move it to /libs

Change-Id: Ieaae909b49c798b6e9bed65d15961cefbdaec49b
---
M autoload.php
M includes/MimeMagic.php
R includes/libs/filebackend/FSFile.php
R includes/libs/filebackend/TempFSFile.php
4 files changed, 18 insertions(+), 40 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index a07df96..6188a93 100644
--- a/autoload.php
+++ b/autoload.php
@@ -432,7 +432,7 @@
'ExternalStoreHttp' => __DIR__ . 
'/includes/externalstore/ExternalStoreHttp.php',
'ExternalStoreMedium' => __DIR__ . 
'/includes/externalstore/ExternalStoreMedium.php',
'ExternalStoreMwstore' => __DIR__ . 
'/includes/externalstore/ExternalStoreMwstore.php',
-   'FSFile' => __DIR__ . '/includes/filebackend/FSFile.php',
+   'FSFile' => __DIR__ . '/includes/libs/filebackend/FSFile.php',
'FSFileBackend' => __DIR__ . '/includes/filebackend/FSFileBackend.php',
'FSFileBackendDirList' => __DIR__ . 
'/includes/filebackend/FSFileBackend.php',
'FSFileBackendFileList' => __DIR__ . 
'/includes/filebackend/FSFileBackend.php',
@@ -1402,7 +1402,7 @@
'TableDiffFormatter' => __DIR__ . 
'/includes/diff/TableDiffFormatter.php',
'TablePager' => __DIR__ . '/includes/pager/TablePager.php',
'TagLogFormatter' => __DIR__ . '/includes/logging/TagLogFormatter.php',
-   'TempFSFile' => __DIR__ . '/includes/filebackend/TempFSFile.php',
+   'TempFSFile' => __DIR__ . '/includes/libs/filebackend/TempFSFile.php',
'TempFileRepo' => __DIR__ . '/includes/filerepo/FileRepo.php',
'TemplateParser' => __DIR__ . '/includes/TemplateParser.php',
'TemplatesOnThisPageFormatter' => __DIR__ . 
'/includes/TemplatesOnThisPageFormatter.php',
diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php
index d33b436..824678f 100644
--- a/includes/MimeMagic.php
+++ b/includes/MimeMagic.php
@@ -380,13 +380,13 @@
 *   - fileExists
 *   - size (filesize in bytes)
 *   - mime (as major/minor)
+*   - file-mime (as major/minor)
 *   - media_type (value to be used with the MEDIATYPE_xxx constants)
 *   - metadata (handler specific)
 *   - sha1 (in base 36)
 *   - width
 *   - height
 *   - bits (bitrate)
-*   - file-mime
 *   - major_mime
 *   - minor_mime
 *
@@ -405,13 +405,10 @@
$path = $fsFile->getPath();
$magic = MimeMagic::singleton();
 
-   if ( $ext === true ) {
-   $ext = FileBackend::extensionFromPath( $path );
-   }
-
# MIME type according to file contents
$info['file-mime'] = $magic->guessMimeType( $path, 
false );
# logical MIME type
+   $ext = ( $ext === true ) ? 
FileBackend::extensionFromPath( $path ) : $ext;
$info['mime'] = $magic->improveTypeFromExtension( 
$info['file-mime'], $ext );
 
list( $info['major_mime'], $info['minor_mime'] ) = 
File::splitMime( $info['mime'] );
diff --git a/includes/filebackend/FSFile.php 
b/includes/libs/filebackend/FSFile.php
similarity index 81%
rename from includes/filebackend/FSFile.php
rename to includes/libs/filebackend/FSFile.php
index c40e48d..e77e7eb 100644
--- a/includes/filebackend/FSFile.php
+++ b/includes/libs/filebackend/FSFile.php
@@ -93,18 +93,17 @@
 *   - fileExists
 *   - size (filesize in bytes)
 *   - mime (as major/minor)
-*   - media_type (value to be used with the MEDIATYPE_xxx constants)
+*   - file-mime (as major/minor)
 *   - metadata (handler specific)
 *   - sha1 (in base 36)
 *   - width
 *   - height
 *   - bits (bitrate)
-*   - file-mime
 *   - major_mime
 *   - minor_mime
 *
 * @param string|bool $ext The file extension, or true to extract it 
from the filename.
-* Set it to false to ignore the extension.
+* Set it to false to ignore the extension. Currently 
unused.
 * @return array
 */
public function getProps( $ext = true ) {
@@ -113,35 +112,19 @@
 
if ( $info['fileExists'] ) {
$info['size'] = $this->getSize(); // bytes
-
-   // @TODO: replace the below with bare FileInfo use so 
this can go in /libs
-   $magic = MimeMagic::singleton();
-
-   if ( $ext === true ) {
-   $ext 

[MediaWiki-commits] [Gerrit] mediawiki...Thanks[master]: Specify which revision was thanked in Special:Log/thanks

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

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

Change subject: Specify which revision was thanked in Special:Log/thanks
..

Specify which revision was thanked in Special:Log/thanks

Introduces config setting $wgThanksLoggingRevIds; if set to true,
will add to log_params "5::revid" and the revision ID

Bug: T51087
Change-Id: I95a69a48eab2b285e79e88fd6a91feac302f8e18
---
M ApiRevThank.php
M ApiThank.php
2 files changed, 8 insertions(+), 3 deletions(-)


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

diff --git a/ApiRevThank.php b/ApiRevThank.php
index febe356..f0a3974 100644
--- a/ApiRevThank.php
+++ b/ApiRevThank.php
@@ -99,7 +99,7 @@
$user->getRequest()->setSessionData( 
"thanks-thanked-{$revision->getId()}", true );
// Set success message
$this->markResultSuccess( $recipient->getName() );
-   $this->logThanks( $user, $recipient, $uniqueId );
+   $this->logThanks( $user, $recipient, $uniqueId, 
$revision->getId() );
}
 
public function getAllowedParams() {
diff --git a/ApiThank.php b/ApiThank.php
index 67bf6e1..cb0bcdd 100644
--- a/ApiThank.php
+++ b/ApiThank.php
@@ -68,14 +68,19 @@
 * @param string $uniqueId A unique Id to identify the event being 
thanked for, to use
 * when checking for duplicate thanks
 */
-   protected function logThanks( User $user, User $recipient, $uniqueId ) {
-   global $wgThanksLogging;
+   protected function logThanks( User $user, User $recipient, $uniqueId, 
$revId = 0 ) {
+   global $wgThanksLogging, $wgThanksLoggingRevIds;
if ( !$wgThanksLogging ) {
return;
}
$logEntry = new ManualLogEntry( 'thanks', 'thank' );
$logEntry->setPerformer( $user );
$logEntry->setRelations( [ 'thankid' => $uniqueId ] );
+   if ( $wgThanksLoggingRevIds && $revId ) {
+   $logEntry->setParameters( [
+   '5::revid' => $revId
+   ] );
+   }
$target = $recipient->getUserPage();
$logEntry->setTarget( $target );
$logId = $logEntry->insert();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95a69a48eab2b285e79e88fd6a91feac302f8e18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Tjlsangria 

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


[MediaWiki-commits] [Gerrit] mediawiki...Graph[master]: Restore wordcloud vega plugin

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

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

Change subject: Restore wordcloud vega plugin
..

Restore wordcloud vega plugin

wordcloud support has been restored in vega by
https://github.com/vega/vega/pull/317

Fixes https://phabricator.wikimedia.org/T16
Fixes https://phabricator.wikimedia.org/T100642

Change-Id: Iffdf231e4bb82b12691d72a7bb1e819767959547
---
M extension.json
A lib/d3.layout.cloud.js
2 files changed, 506 insertions(+), 0 deletions(-)


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

diff --git a/extension.json b/extension.json
index 028bfee..336b229 100644
--- a/extension.json
+++ b/extension.json
@@ -70,6 +70,7 @@
"scripts": [
"lib/d3.js",
"lib/d3-global.js",
+   "lib/d3.layout.cloud.js",
"lib/vega2/vega.js",
"lib/graph2.compiled.js"
],
diff --git a/lib/d3.layout.cloud.js b/lib/d3.layout.cloud.js
new file mode 100644
index 000..8165a41
--- /dev/null
+++ b/lib/d3.layout.cloud.js
@@ -0,0 +1,505 @@
+(function(f){if(typeof exports==="object"& 
module!=="undefined"){module.exports=f()}else if(typeof 
define==="function"&){define([],f)}else{var g;if(typeof 
window!=="undefined"){g=window}else if(typeof 
global!=="undefined"){g=global}else if(typeof 
self!=="undefined"){g=self}else{g=this}g=(g.d3||(g.d3 = 
{}));g=(g.layout||(g.layout = {}));g.cloud = f()}})(function(){var 
define,module,exports;return (function e(t,n,r){function 
s(o,u){if(!n[o]){if(!t[o]){var a=typeof 
require=="function"&if(!u&)return a(o,!0);if(i)return i(o,!0);var 
f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var 
l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return 
s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof 
require=="function"&for(var o=0;o> 5,
+ch = 1 << 11;
+
+module.exports = function() {
+  var size = [256, 256],
+  text = cloudText,
+  font = cloudFont,
+  fontSize = cloudFontSize,
+  fontStyle = cloudFontNormal,
+  fontWeight = cloudFontNormal,
+  rotate = cloudRotate,
+  padding = cloudPadding,
+  spiral = archimedeanSpiral,
+  words = [],
+  timeInterval = Infinity,
+  event = dispatch("word", "end"),
+  timer = null,
+  random = Math.random,
+  cloud = {},
+  canvas = cloudCanvas;
+
+  cloud.canvas = function(_) {
+return arguments.length ? (canvas = functor(_), cloud) : canvas;
+  };
+
+  cloud.start = function() {
+var contextAndRatio = getContext(canvas()),
+board = zeroArray((size[0] >> 5) * size[1]),
+bounds = null,
+n = words.length,
+i = -1,
+tags = [],
+data = words.map(function(d, i) {
+  d.text = text.call(this, d, i);
+  d.font = font.call(this, d, i);
+  d.style = fontStyle.call(this, d, i);
+  d.weight = fontWeight.call(this, d, i);
+  d.rotate = rotate.call(this, d, i);
+  d.size = ~~fontSize.call(this, d, i);
+  d.padding = padding.call(this, d, i);
+  return d;
+}).sort(function(a, b) { return b.size - a.size; });
+
+if (timer) clearInterval(timer);
+timer = setInterval(step, 0);
+step();
+
+return cloud;
+
+function step() {
+  var start = Date.now();
+  while (Date.now() - start < timeInterval && ++i < n && timer) {
+var d = data[i];
+d.x = (size[0] * (random() + .5)) >> 1;
+d.y = (size[1] * (random() + .5)) >> 1;
+cloudSprite(contextAndRatio, d, data, i);
+if (d.hasText && place(board, d, bounds)) {
+  tags.push(d);
+  event.word(d);
+  if (bounds) cloudBounds(bounds, d);
+  else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: 
d.y + d.y1}];
+  // Temporary hack
+  d.x -= size[0] >> 1;
+  d.y -= size[1] >> 1;
+}
+  }
+  if (i >= n) {
+cloud.stop();
+event.end(tags, bounds);
+  }
+}
+  }
+
+  cloud.stop = function() {
+if (timer) {
+  clearInterval(timer);
+  timer = null;
+}
+return cloud;
+  };
+
+  function getContext(canvas) {
+canvas.width = canvas.height = 1;
+var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 
1).data.length >> 2);
+canvas.width = (cw << 5) / ratio;
+canvas.height = ch / ratio;
+
+

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: FSFile and TempFSFile cleanups

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

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

Change subject: FSFile and TempFSFile cleanups
..

FSFile and TempFSFile cleanups

* Remove wf* function dependencies. This includes wfTempDir().
  Callers now should specify the directory, though it will try to do
  most of the wfTempDir() logic anyway if they do not.
* Update callers to inject wfTempDir() so $wgTmpDirectory is used by
  TempFSFile instead of it proping to find a valid directory itself.
* Move most of the wfTempDir() logic to TempFSFile::getUsableTempDirectory().
* Remove unused getMimeType() method.

Change-Id: Idd55936b07f9448a6c90577708722b7b52b8fe66
---
M includes/GlobalFunctions.php
M includes/api/ApiImageRotate.php
M includes/filebackend/FSFile.php
M includes/filebackend/TempFSFile.php
M includes/filerepo/file/File.php
M includes/upload/UploadFromChunks.php
M includes/upload/UploadFromUrl.php
M tests/phpunit/includes/filebackend/FileBackendTest.php
M tests/phpunit/includes/filerepo/MigrateFileRepoLayoutTest.php
M tests/phpunit/mocks/filebackend/MockFSFile.php
10 files changed, 57 insertions(+), 62 deletions(-)


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

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 90bba53..e5f518f 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2078,35 +2078,7 @@
return $wgTmpDirectory;
}
 
-   $tmpDir = array_map( "getenv", [ 'TMPDIR', 'TMP', 'TEMP' ] );
-   $tmpDir[] = sys_get_temp_dir();
-   $tmpDir[] = ini_get( 'upload_tmp_dir' );
-
-   foreach ( $tmpDir as $tmp ) {
-   if ( $tmp && file_exists( $tmp ) && is_dir( $tmp ) && 
is_writable( $tmp ) ) {
-   return $tmp;
-   }
-   }
-
-   /**
-* PHP on Windows will detect C:\Windows\Temp as not writable even 
though PHP can write to it
-* so create a directory within that called 'mwtmp' with a suffix of 
the user running the
-* current process.
-* The user is included as if various scripts are run by different 
users they will likely
-* not be able to access each others temporary files.
-*/
-   if ( wfIsWindows() ) {
-   $tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mwtmp' . '-' 
. get_current_user();
-   if ( !file_exists( $tmp ) ) {
-   mkdir( $tmp );
-   }
-   if ( file_exists( $tmp ) && is_dir( $tmp ) && is_writable( $tmp 
) ) {
-   return $tmp;
-   }
-   }
-
-   throw new MWException( 'No writable temporary directory could be found. 
' .
-   'Please set $wgTmpDirectory to a writable directory.' );
+   return TempFSFile::getUsableTempDirectory();
 }
 
 /**
diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php
index 2b99353..966bcbf 100644
--- a/includes/api/ApiImageRotate.php
+++ b/includes/api/ApiImageRotate.php
@@ -108,7 +108,7 @@
continue;
}
$ext = strtolower( pathinfo( "$srcPath", 
PATHINFO_EXTENSION ) );
-   $tmpFile = TempFSFile::factory( 'rotate_', $ext );
+   $tmpFile = TempFSFile::factory( 'rotate_', $ext, 
wfTempDir() );
$dstPath = $tmpFile->getPath();
$err = $handler->rotate( $file, [
'srcPath' => $srcPath,
diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php
index 8aa11b6..221fe9f 100644
--- a/includes/filebackend/FSFile.php
+++ b/includes/filebackend/FSFile.php
@@ -86,15 +86,6 @@
}
 
/**
-* Guess the MIME type from the file contents alone
-*
-* @return string
-*/
-   public function getMimeType() {
-   return MimeMagic::singleton()->guessMimeType( $this->path, 
false );
-   }
-
-   /**
 * Get an associative array containing information about
 * a file with the given storage path.
 *
@@ -117,8 +108,6 @@
 * @return array
 */
public function getProps( $ext = true ) {
-   wfDebug( __METHOD__ . ": Getting file info for $this->path\n" );
-
$info = self::placeholderProps();
$info['fileExists'] = $this->exists();
 
@@ -131,7 +120,7 @@
}
 
# MIME type according to file contents
-   $info['file-mime'] = $this->getMimeType();
+   $info['file-mime'] = $magic->guessMimeType( 
$this->path, false );
# logical MIME type
$info['mime'] = $magic->improveTypeFromExtension( 
$info['file-mime'], $ext );
 
@@ -145,17 +134,15 @@
  

[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Better explode() for CargoLuaLibrary

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

Change subject: Better explode() for CargoLuaLibrary
..


Better explode() for CargoLuaLibrary

Change-Id: Id2956fdb30279275ecab18094f04537ac1c41169
---
M CargoLua.library.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/CargoLua.library.php b/CargoLua.library.php
index b480283..3bf4644 100644
--- a/CargoLua.library.php
+++ b/CargoLua.library.php
@@ -51,7 +51,7 @@
 
$result = array();
 
-   $fieldArray = array_map( 'trim', explode( ',', $fields ) );
+   $fieldArray = CargoUtils::smartSplit( ',', $fields );
 
$rowIndex = 1; // because Lua arrays start at 1
foreach ( $rows as $row ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id2956fdb30279275ecab18094f04537ac1c41169
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: Yaron Koren 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Better explode() for CargoLuaLibrary

2016-09-18 Thread Yaron Koren (Code Review)
Yaron Koren has uploaded a new change for review.

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

Change subject: Better explode() for CargoLuaLibrary
..

Better explode() for CargoLuaLibrary

Change-Id: Id2956fdb30279275ecab18094f04537ac1c41169
---
M CargoLua.library.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/61/311361/2

diff --git a/CargoLua.library.php b/CargoLua.library.php
index b480283..3bf4644 100644
--- a/CargoLua.library.php
+++ b/CargoLua.library.php
@@ -51,7 +51,7 @@
 
$result = array();
 
-   $fieldArray = array_map( 'trim', explode( ',', $fields ) );
+   $fieldArray = CargoUtils::smartSplit( ',', $fields );
 
$rowIndex = 1; // because Lua arrays start at 1
foreach ( $rows as $row ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2956fdb30279275ecab18094f04537ac1c41169
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move DatabaseSqlite to /libs/rdbms

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

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

Change subject: Move DatabaseSqlite to /libs/rdbms
..

Move DatabaseSqlite to /libs/rdbms

Change-Id: Ibda20041803deb922b7e3803cba6fc8d15214169
---
M autoload.php
R includes/libs/rdbms/database/DatabaseSqlite.php
2 files changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/autoload.php b/autoload.php
index ff7d488..5c132fe 100644
--- a/autoload.php
+++ b/autoload.php
@@ -328,7 +328,7 @@
'DatabaseMysqli' => __DIR__ . 
'/includes/libs/rdbms/database/DatabaseMysqli.php',
'DatabaseOracle' => __DIR__ . '/includes/db/DatabaseOracle.php',
'DatabasePostgres' => __DIR__ . '/includes/db/DatabasePostgres.php',
-   'DatabaseSqlite' => __DIR__ . '/includes/db/DatabaseSqlite.php',
+   'DatabaseSqlite' => __DIR__ . 
'/includes/libs/rdbms/database/DatabaseSqlite.php',
'DatabaseUpdater' => __DIR__ . 
'/includes/installer/DatabaseUpdater.php',
'DateFormats' => __DIR__ . '/maintenance/language/date-formats.php',
'DateFormatter' => __DIR__ . '/includes/parser/DateFormatter.php',
diff --git a/includes/db/DatabaseSqlite.php 
b/includes/libs/rdbms/database/DatabaseSqlite.php
similarity index 100%
rename from includes/db/DatabaseSqlite.php
rename to includes/libs/rdbms/database/DatabaseSqlite.php

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move FileBackendStore and FileOp classes to /libs

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

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

Change subject: Move FileBackendStore and FileOp classes to /libs
..

Move FileBackendStore and FileOp classes to /libs

Change-Id: If490f64bec282e5dfcdaf7feb1cbf46d3dce1064
---
D includes/filebackend/FileOp.php
R includes/libs/filebackend/FileBackendStore.php
R includes/libs/filebackend/FileOpBatch.php
A includes/libs/filebackend/fileop/CopyFileOp.php
A includes/libs/filebackend/fileop/CreateFileOp.php
A includes/libs/filebackend/fileop/DeleteFileOp.php
A includes/libs/filebackend/fileop/DescribeFileOp.php
A includes/libs/filebackend/fileop/FileOp.php
A includes/libs/filebackend/fileop/MoveFileOp.php
A includes/libs/filebackend/fileop/NullFileOp.php
A includes/libs/filebackend/fileop/StoreFileOp.php
11 files changed, 1,014 insertions(+), 855 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/59/311359/1

diff --git a/includes/filebackend/FileOp.php b/includes/filebackend/FileOp.php
deleted file mode 100644
index 8e1cf62..000
--- a/includes/filebackend/FileOp.php
+++ /dev/null
@@ -1,855 +0,0 @@
-http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup FileBackend
- * @author Aaron Schulz
- */
-use Psr\Log\LoggerInterface;
-
-/**
- * FileBackend helper class for representing operations.
- * Do not use this class from places outside FileBackend.
- *
- * Methods called from FileOpBatch::attempt() should avoid throwing
- * exceptions at all costs. FileOp objects should be lightweight in order
- * to support large arrays in memory and serialization.
- *
- * @ingroup FileBackend
- * @since 1.19
- */
-abstract class FileOp {
-   /** @var array */
-   protected $params = [];
-
-   /** @var FileBackendStore */
-   protected $backend;
-   /** @var LoggerInterface */
-   protected $logger;
-
-   /** @var int */
-   protected $state = self::STATE_NEW;
-
-   /** @var bool */
-   protected $failed = false;
-
-   /** @var bool */
-   protected $async = false;
-
-   /** @var string */
-   protected $batchId;
-
-   /** @var bool Operation is not a no-op */
-   protected $doOperation = true;
-
-   /** @var string */
-   protected $sourceSha1;
-
-   /** @var bool */
-   protected $overwriteSameCase;
-
-   /** @var bool */
-   protected $destExists;
-
-   /* Object life-cycle */
-   const STATE_NEW = 1;
-   const STATE_CHECKED = 2;
-   const STATE_ATTEMPTED = 3;
-
-   /**
-* Build a new batch file operation transaction
-*
-* @param FileBackendStore $backend
-* @param array $params
-* @param LoggerInterface $logger PSR logger instance
-* @throws FileBackendError
-*/
-   final public function __construct(
-   FileBackendStore $backend, array $params, LoggerInterface 
$logger
-   ) {
-   $this->backend = $backend;
-   $this->logger = $logger;
-   list( $required, $optional, $paths ) = $this->allowedParams();
-   foreach ( $required as $name ) {
-   if ( isset( $params[$name] ) ) {
-   $this->params[$name] = $params[$name];
-   } else {
-   throw new FileBackendError( "File operation 
missing parameter '$name'." );
-   }
-   }
-   foreach ( $optional as $name ) {
-   if ( isset( $params[$name] ) ) {
-   $this->params[$name] = $params[$name];
-   }
-   }
-   foreach ( $paths as $name ) {
-   if ( isset( $this->params[$name] ) ) {
-   // Normalize paths so the paths to the same 
file have the same string
-   $this->params[$name] = 
self::normalizeIfValidStoragePath( $this->params[$name] );
-   }
-   }
-   }
-
-   /**
-* Normalize a string if it is a valid storage path
-*
-* @param string $path
-* @return string
-*/
-   protected static function normalizeIfValidStoragePath( $path ) {
-   if ( FileBackend::isStoragePath( $path ) ) {
-   $res = FileBackend::normalizeStoragePath( $path );
-
-   return ( $res !== null ) ? $res : $path;
-   }
-
-   return $path;
-   }
-
-   /**
-* Set the batch UUID this operation belongs to
-*
-* @param string $batchId
-*/
-   final public function setBatchId( $batchId ) {
-   $this->batchId = $batchId;
-   }
-
-   /**
-* Get the value of the parameter with the given name
-*
-* @param string $name
-* @return mixed 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove wfDebugLog() dependency from FileOp classes

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

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

Change subject: Remove wfDebugLog() dependency from FileOp classes
..

Remove wfDebugLog() dependency from FileOp classes

Change-Id: Ib8ab9edd1afdb28f7444f5e13cf34a696a066234
---
M includes/filebackend/FileBackendStore.php
M includes/filebackend/FileOp.php
2 files changed, 10 insertions(+), 3 deletions(-)


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

diff --git a/includes/filebackend/FileBackendStore.php 
b/includes/filebackend/FileBackendStore.php
index 9450843..0f36180 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -1020,7 +1020,7 @@
// Get params for this operation
$params = $operation;
// Append the FileOp class
-   $performOps[] = new $class( $this, $params );
+   $performOps[] = new $class( $this, $params, 
$this->logger );
} else {
throw new FileBackendError( "Operation 
'$opName' is not supported." );
}
diff --git a/includes/filebackend/FileOp.php b/includes/filebackend/FileOp.php
index 916366c..8e1cf62 100644
--- a/includes/filebackend/FileOp.php
+++ b/includes/filebackend/FileOp.php
@@ -21,6 +21,7 @@
  * @ingroup FileBackend
  * @author Aaron Schulz
  */
+use Psr\Log\LoggerInterface;
 
 /**
  * FileBackend helper class for representing operations.
@@ -39,6 +40,8 @@
 
/** @var FileBackendStore */
protected $backend;
+   /** @var LoggerInterface */
+   protected $logger;
 
/** @var int */
protected $state = self::STATE_NEW;
@@ -74,10 +77,14 @@
 *
 * @param FileBackendStore $backend
 * @param array $params
+* @param LoggerInterface $logger PSR logger instance
 * @throws FileBackendError
 */
-   final public function __construct( FileBackendStore $backend, array 
$params ) {
+   final public function __construct(
+   FileBackendStore $backend, array $params, LoggerInterface 
$logger
+   ) {
$this->backend = $backend;
+   $this->logger = $logger;
list( $required, $optional, $paths ) = $this->allowedParams();
foreach ( $required as $name ) {
if ( isset( $params[$name] ) ) {
@@ -454,7 +461,7 @@
$params = $this->params;
$params['failedAction'] = $action;
try {
-   wfDebugLog( 'FileOperation', get_class( $this ) .
+   $this->logger->error( get_class( $this ) .
" failed (batch #{$this->batchId}): " . 
FormatJson::encode( $params ) );
} catch ( Exception $e ) {
// bad config? debug log error?

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

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

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


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

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

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

Change subject: Add HTTPFileStreamer class
..

Add HTTPFileStreamer class

* Move most StreamFile code to this new class
* Remove StreamFile depedency from FileBackendStore

Change-Id: I4a272ef49497b589114fc2b37ba800bc26d9161f
---
M autoload.php
M includes/StreamFile.php
M includes/filebackend/FileBackendGroup.php
M includes/filebackend/FileBackendStore.php
M includes/libs/filebackend/FileBackend.php
A includes/libs/filebackend/HTTPFileStreamer.php
6 files changed, 324 insertions(+), 170 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/311357/1

diff --git a/autoload.php b/autoload.php
index 998450c..8fbc98c 100644
--- a/autoload.php
+++ b/autoload.php
@@ -557,6 +557,7 @@
'HTMLTextFieldWithButton' => __DIR__ . 
'/includes/htmlform/fields/HTMLTextFieldWithButton.php',
'HTMLTitleTextField' => __DIR__ . 
'/includes/htmlform/fields/HTMLTitleTextField.php',
'HTMLUserTextField' => __DIR__ . 
'/includes/htmlform/fields/HTMLUserTextField.php',
+   'HTTPFileStreamer' => __DIR__ . 
'/includes/libs/filebackend/HTTPFileStreamer.php',
'HWLDFWordAccumulator' => __DIR__ . '/includes/diff/DairikiDiff.php',
'HashBagOStuff' => __DIR__ . 
'/includes/libs/objectcache/HashBagOStuff.php',
'HashConfig' => __DIR__ . '/includes/config/HashConfig.php',
diff --git a/includes/StreamFile.php b/includes/StreamFile.php
index 0fc7980..cce3fc4 100644
--- a/includes/StreamFile.php
+++ b/includes/StreamFile.php
@@ -25,9 +25,9 @@
  */
 class StreamFile {
// Do not send any HTTP headers unless requested by caller (e.g. body 
only)
-   const STREAM_HEADLESS = 1;
+   const STREAM_HEADLESS = HTTPFileStreamer::STREAM_HEADLESS;
// Do not try to tear down any PHP output buffers
-   const STREAM_ALLOW_OB = 2;
+   const STREAM_ALLOW_OB = HTTPFileStreamer::STREAM_ALLOW_OB;
 
/**
 * Stream a file to the browser, adding all the headings and fun stuff.
@@ -45,115 +45,19 @@
public static function stream(
$fname, $headers = [], $sendErrors = true, $optHeaders = [], 
$flags = 0
) {
-   $section = new ProfileSection( __METHOD__ );
-
if ( FileBackend::isStoragePath( $fname ) ) { // sanity
-   throw new MWException( __FUNCTION__ . " given storage 
path '$fname'." );
+   throw new InvalidArgumentException( __FUNCTION__ . " 
given storage path '$fname'." );
}
 
-   // Don't stream it out as text/html if there was a PHP error
-   if ( ( ( $flags & self::STREAM_HEADLESS ) == 0 || $headers ) && 
headers_sent() ) {
-   echo "Headers already sent, terminating.\n";
-   return false;
-   }
+   $streamer = new HTTPFileStreamer(
+   $fname,
+   [
+   'obResetFunc' => 'wfResetOutputBuffers',
+   'streamMimeFunc' => [ __CLASS__, 
'contentTypeFromPath' ]
+   ]
+   );
 
-   $headerFunc = ( $flags & self::STREAM_HEADLESS )
-   ? function ( $header ) {
-// no-op
-   }
-   : function ( $header ) {
-   is_int( $header ) ? HttpStatus::header( $header 
) : header( $header );
-   };
-
-   MediaWiki\suppressWarnings();
-   $info = stat( $fname );
-   MediaWiki\restoreWarnings();
-
-   if ( !is_array( $info ) ) {
-   if ( $sendErrors ) {
-   self::send404Message( $fname, $flags );
-   }
-   return false;
-   }
-
-   // Send Last-Modified HTTP header for client-side caching
-   $headerFunc( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, 
$info['mtime'] ) );
-
-   if ( ( $flags & self::STREAM_ALLOW_OB ) == 0 ) {
-   // Cancel output buffering and gzipping if set
-   wfResetOutputBuffers();
-   }
-
-   $type = self::contentTypeFromPath( $fname );
-   if ( $type && $type != 'unknown/unknown' ) {
-   $headerFunc( "Content-type: $type" );
-   } else {
-   // Send a content type which is not known to Internet 
Explorer, to
-   // avoid triggering IE's content type detection. 
Sending a standard
-   // unknown content type here essentially gives IE 
license to apply
-   // whatever content type it likes.
-   $headerFunc( 'Content-type: 

[MediaWiki-commits] [Gerrit] oojs/ui[master]: [WIP] Reorder Less elements & widgets rules alphabetically

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

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

Change subject: [WIP] Reorder Less elements & widgets rules alphabetically
..

[WIP] Reorder Less elements & widgets rules alphabetically

Reordering Less elements & widgets rules alphabetically to address
historically grown clutter

Bug: T145995
Change-Id: If6305c530088acc559bd0d65578e460210b8cd3f
---
M src/themes/mediawiki/elements.less
M src/themes/mediawiki/widgets.less
2 files changed, 1,022 insertions(+), 1,022 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/56/311356/1

diff --git a/src/themes/mediawiki/elements.less 
b/src/themes/mediawiki/elements.less
index 91804b1..8dd42b1 100644
--- a/src/themes/mediawiki/elements.less
+++ b/src/themes/mediawiki/elements.less
@@ -375,15 +375,15 @@
 
 .theme-oo-ui-clippableElement () {}
 
+.theme-oo-ui-draggableElement () {}
+
+.theme-oo-ui-draggableGroupElement () {}
+
 .theme-oo-ui-floatableElement () {}
 
 .theme-oo-ui-flaggedElement () {}
 
-.theme-oo-ui-draggableElement () {}
-
 .theme-oo-ui-groupElement () {}
-
-.theme-oo-ui-draggableGroupElement () {}
 
 .theme-oo-ui-iconElement () {}
 
@@ -397,14 +397,14 @@
 
 .theme-oo-ui-lookupElement () {}
 
-.theme-oo-ui-popupElement () {}
-
-.theme-oo-ui-tabIndexedElement () {}
-
-.theme-oo-ui-titledElement () {}
-
 .theme-oo-ui-pendingElement () {
&-pending {
.oo-ui-background-image( 
'@{oo-ui-default-image-path}/textures/pending.gif' );
}
 }
+
+.theme-oo-ui-popupElement () {}
+
+.theme-oo-ui-tabIndexedElement () {}
+
+.theme-oo-ui-titledElement () {}
diff --git a/src/themes/mediawiki/widgets.less 
b/src/themes/mediawiki/widgets.less
index 80d3a92..9fe2b6f 100644
--- a/src/themes/mediawiki/widgets.less
+++ b/src/themes/mediawiki/widgets.less
@@ -2,26 +2,11 @@
 
 .theme-oo-ui-widget () {}
 
-.theme-oo-ui-outlineControlsWidget () {
-   height: 3em;
-   background-color: @background-color-default;
+.theme-oo-ui-actionWidget () {}
 
-   &-items,
-   &-movers {
-   height: 2em;
-   margin: 0.5em 0.5em 0.5em 0;
-   padding: 0;
-   }
-
-   > .oo-ui-iconElement-icon {
-   width: 1.5em;
-   height: 2em;
-   margin: 0.5em 0 0.5em 0.5em;
-   opacity: 0.2;
-   }
+.theme-oo-ui-buttonWidget () {
+   .oo-ui-inline-spacing( 0.5em );
 }
-
-.theme-oo-ui-toggleWidget () {}
 
 .theme-oo-ui-buttonGroupWidget () {
display: inline-block;
@@ -61,46 +46,413 @@
}
 }
 
-.theme-oo-ui-buttonWidget () {
-   .oo-ui-inline-spacing( 0.5em );
-}
+.theme-oo-ui-buttonInputWidget () {}
 
-.theme-oo-ui-actionWidget () {}
+.theme-oo-ui-buttonOptionWidget () {
+   padding: 0;
 
-.theme-oo-ui-popupButtonWidget () {
-   &.oo-ui-buttonElement-frameless > .oo-ui-popupWidget {
-   // Compensate for icon being inset
-   /* @noflip */
-   left: @size-icon / 2;
-   }
-
-   &.oo-ui-buttonElement-framed > .oo-ui-popupWidget {
-   // Compensate for icon being inset
-   // elements.less positions the icon with left: 1.5em - 
@size-icon / 2; , so we need:
-   // @size-icon / 2 + ( 1.5em - @size-icon / 2 ) which is 1.5em.
-   /* @noflip */
-   left: 1.5em;
+   &.oo-ui-optionWidget-selected,
+   &.oo-ui-optionWidget-pressed,
+   &.oo-ui-optionWidget-highlighted {
+   background-color: transparent;
}
 }
 
-.theme-oo-ui-toggleButtonWidget () {
+.theme-oo-ui-buttonSelectWidget () {
+   border-radius: @border-radius-default;
.oo-ui-inline-spacing( 0.5em );
+
+   &:focus {
+   outline: 0;
+   }
+
+   .oo-ui-buttonOptionWidget {
+   .oo-ui-buttonElement-button {
+   border-radius: 0;
+   margin-left: -1px;
+   }
+
+   &:first-child .oo-ui-buttonElement-button {
+   border-bottom-left-radius: @border-radius-default;
+   border-top-left-radius: @border-radius-default;
+   margin-left: 0;
+   }
+
+   &:last-child .oo-ui-buttonElement-button {
+   border-bottom-right-radius: @border-radius-default;
+   border-top-right-radius: @border-radius-default;
+   }
+
+   }
+
+   &.oo-ui-widget-enabled {
+   &:focus {
+   .oo-ui-buttonOptionWidget.oo-ui-optionWidget-selected {
+   .oo-ui-buttonElement-button {
+   border-color: 
@border-color-default-focus;
+   box-shadow: @box-shadow-focus-inset;
+   }
+   }
+   }
+   }
 }
 
-.theme-oo-ui-iconWidget () 

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ce.MWTransclusionNode: Clean up href normalization

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

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

Change subject: ce.MWTransclusionNode: Clean up href normalization
..

ce.MWTransclusionNode: Clean up href normalization

This became a special case when decodeURIComponentIntoArticleTitle()
was introduced, presumably because we skipped underscore transformation
out of laziness here. It doesn't matter whether we do underscore normalization
because we do title normalization right after, so make this code
less exceptional by using the fully decoded title.

Change-Id: I036cc7f1e08895d36224c94b8edc3ad700af1947
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index cef9f69..9654097 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -201,7 +201,7 @@
var targetData = 
ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref(
this.href, 
transclusionNode.getModelHtmlDocument()
),
-   normalisedHref = 
ve.decodeURIComponentIntoArticleTitle( targetData.rawTitle, false );
+   normalisedHref = targetData.title;
if ( mw.Title.newFromText( normalisedHref ) ) {
normalisedHref = mw.Title.newFromText( 
normalisedHref ).getPrefixedText();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I036cc7f1e08895d36224c94b8edc3ad700af1947
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
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...VisualEditor[master]: MWInternalLinkAnnotation: Fix href normalization for special...

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

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

Change subject: MWInternalLinkAnnotation: Fix href normalization for special 
characters
..

MWInternalLinkAnnotation: Fix href normalization for special characters

 would dirty-diff to  and also render
as such, pointing to the wrong page.

We also called decodeURIComponent() on the href twice, which can't
have been good.

Move URI decoding and underscore normalization into getTargetDataFromHref(),
and add rawTitle for callers that need it. Put rawTitle in the
origTitle attribute, so that equivalence comparisons (decode(origTitle) === 
title)
work as intended.

Bug: T145978
Change-Id: I29331a4ab0f8f7ef059c109f6813fa670a2c7390
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
M modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
M modules/ve-mw/tests/dm/ve.dm.mwExample.js
3 files changed, 30 insertions(+), 4 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 14a31f5..cef9f69 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -201,7 +201,7 @@
var targetData = 
ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref(
this.href, 
transclusionNode.getModelHtmlDocument()
),
-   normalisedHref = 
ve.decodeURIComponentIntoArticleTitle( targetData.title, false );
+   normalisedHref = 
ve.decodeURIComponentIntoArticleTitle( targetData.rawTitle, false );
if ( mw.Title.newFromText( normalisedHref ) ) {
normalisedHref = mw.Title.newFromText( 
normalisedHref ).getPrefixedText();
}
diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js 
b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
index 588cb7e..c2dfa35 100644
--- a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
+++ b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
@@ -42,10 +42,10 @@
type: this.name,
attributes: {
hrefPrefix: targetData.hrefPrefix,
-   title: ve.decodeURIComponentIntoArticleTitle( 
targetData.title ),
+   title: targetData.title,
normalizedTitle: this.normalizeTitle( targetData.title 
),
lookupTitle: this.getLookupTitle( targetData.title ),
-   origTitle: targetData.title
+   origTitle: targetData.rawTitle
}
};
 };
@@ -88,6 +88,8 @@
  * @return {Object} Information about the given href
  * @return {string} return.title
  *The title of the internal link, else the original href if href is 
external
+ * @return {string} return.rawTitle
+ *The title without URL decoding and underscore normalization applied
  * @return {string} return.hrefPrefix
  *Any ./ or ../ prefixes on a relative link
  * @return {boolean} return.isInternal
@@ -125,7 +127,8 @@
// point. So decode them, otherwise this is going to cause failures
// elsewhere.
return {
-   title: ve.safeDecodeURIComponent( matches[ 2 ] ),
+   title: ve.decodeURIComponentIntoArticleTitle( matches[ 2 ] ),
+   rawTitle: matches[ 2 ],
hrefPrefix: matches[ 1 ],
isInternal: isInternal
};
diff --git a/modules/ve-mw/tests/dm/ve.dm.mwExample.js 
b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
index c2bfb6c..f8dc2b4 100644
--- a/modules/ve-mw/tests/dm/ve.dm.mwExample.js
+++ b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
@@ -1076,6 +1076,29 @@
{ type: '/internalList' }
]
},
+   'internal link with special characters': {
+   body: 'x',
+   head: 'http://example.com; />',
+   data: [
+   { type: 'paragraph' },
+   [
+   'x',
+   [ {
+   type: 'link/mwInternal',
+   attributes: {
+   title: 'Foo?+%',
+   origTitle: 'Foo%3F+%25',
+   normalizedTitle: 'Foo?+%',
+   lookupTitle: 'Foo?+%',
+   hrefPrefix: './'
+   }

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Dependency cleanups to FileBackendStore

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

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

Change subject: Dependency cleanups to FileBackendStore
..

Dependency cleanups to FileBackendStore

* Inject a PSR logger in place of wf* logging methods.
* Replace wfTimestamp() call with ConvertableTimestamp.
* Inject the Profiler object.
* Rename $wiki => $domain to avoid "wiki" mentions.

Change-Id: I3e3a43d36506bec341dc5727b52f5f5a5d32bff5
---
M includes/filebackend/FileBackendGroup.php
M includes/filebackend/FileBackendMultiWrite.php
M includes/filebackend/FileBackendStore.php
M includes/filebackend/FileOpBatch.php
M includes/libs/filebackend/FileBackend.php
5 files changed, 102 insertions(+), 54 deletions(-)


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

diff --git a/includes/filebackend/FileBackendGroup.php 
b/includes/filebackend/FileBackendGroup.php
index 0bae5ff..8abe794 100644
--- a/includes/filebackend/FileBackendGroup.php
+++ b/includes/filebackend/FileBackendGroup.php
@@ -21,6 +21,7 @@
  * @ingroup FileBackend
  * @author Aaron Schulz
  */
+use \MediaWiki\Logger\LoggerFactory;
 
 /**
  * Class to handle file backend registration
@@ -168,6 +169,8 @@
$config['wanCache'] = ObjectCache::getMainWANInstance();
$config['mimeCallback'] = [ $this, 'guessMimeInternal' 
];
$config['statusWrapper'] = [ 'Status', 'wrap' ];
+   $config['logger'] = LoggerFactory::getInstance( 
'FileOperation' );
+   $config['profiler'] = Profiler::instance();
 
$this->backends[$name]['instance'] = new $class( 
$config );
}
diff --git a/includes/filebackend/FileBackendMultiWrite.php 
b/includes/filebackend/FileBackendMultiWrite.php
index c1cc7bb..2ef3016 100644
--- a/includes/filebackend/FileBackendMultiWrite.php
+++ b/includes/filebackend/FileBackendMultiWrite.php
@@ -121,7 +121,7 @@
unset( $config['readOnly'] ); // use proxy backend 
setting
unset( $config['fileJournal'] ); // use proxy backend 
journal
unset( $config['lockManager'] ); // lock under proxy 
backend
-   $config['wikiId'] = $this->wikiId; // use the proxy 
backend wiki ID
+   $config['wikiId'] = $this->domainId; // use the proxy 
backend wiki ID
if ( !empty( $config['isMultiMaster'] ) ) {
if ( $this->masterIndex >= 0 ) {
throw new FileBackendError( 'More than 
one master backend defined.' );
diff --git a/includes/filebackend/FileBackendStore.php 
b/includes/filebackend/FileBackendStore.php
index 4e25ce7..44966bb 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -116,7 +116,7 @@
 * @return StatusValue
 */
final public function createInternal( array $params ) {
-   $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . 
"-{$this->name}" );
+   $ps = $this->scopedProfileSection( __METHOD__ . 
"-{$this->name}" );
if ( strlen( $params['content'] ) > 
$this->maxFileSizeInternal() ) {
$status = $this->newStatus( 'backend-fail-maxsize',
$params['dst'], $this->maxFileSizeInternal() );
@@ -157,7 +157,7 @@
 * @return StatusValue
 */
final public function storeInternal( array $params ) {
-   $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . 
"-{$this->name}" );
+   $ps = $this->scopedProfileSection( __METHOD__ . 
"-{$this->name}" );
if ( filesize( $params['src'] ) > $this->maxFileSizeInternal() 
) {
$status = $this->newStatus( 'backend-fail-maxsize',
$params['dst'], $this->maxFileSizeInternal() );
@@ -199,7 +199,7 @@
 * @return StatusValue
 */
final public function copyInternal( array $params ) {
-   $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . 
"-{$this->name}" );
+   $ps = $this->scopedProfileSection( __METHOD__ . 
"-{$this->name}" );
$status = $this->doCopyInternal( $params );
$this->clearCache( [ $params['dst'] ] );
if ( !isset( $params['dstExists'] ) || $params['dstExists'] ) {
@@ -231,7 +231,7 @@
 * @return StatusValue
 */
final public function deleteInternal( array $params ) {
-   $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . 
"-{$this->name}" );
+   $ps = $this->scopedProfileSection( __METHOD__ . 
"-{$this->name}" );
$status = $this->doDeleteInternal( $params );
$this->clearCache( [ $params['src'] ] );
 

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: tox: display test coverage

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

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

Change subject: tox: display test coverage
..

tox: display test coverage

Change-Id: I74db473492b34905fc085228cc8b0f731d980df1
Signed-off-by: Loic Dachary 
---
M tox.ini
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/tox.ini b/tox.ini
index 55f3574..dd1efbb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,7 @@
 commands = env \
  {envbindir}/coverage run --source=FLOSSbot \
  {envbindir}/py.test -v {posargs:tests}
-# {envbindir}/coverage report --omit=*test*,*tox* --show-missing # 
--fail-under=100
+ {envbindir}/coverage report --omit=*test*,*tox* --show-missing # 
--fail-under=100
 
 [testenv:flake8]
 commands =

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: remove hardcoded properties

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

Change subject: remove hardcoded properties
..


remove hardcoded properties

Change-Id: I65fc7f71627bfdba61ef1aa1ac0225de8fd308c7
Signed-off-by: Loic Dachary 
---
M FLOSSbot/qa.py
M FLOSSbot/repository.py
2 files changed, 36 insertions(+), 29 deletions(-)

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



diff --git a/FLOSSbot/qa.py b/FLOSSbot/qa.py
index d893c6c..deb58a4 100644
--- a/FLOSSbot/qa.py
+++ b/FLOSSbot/qa.py
@@ -58,11 +58,14 @@
 
 def run(self):
 QUERY = """
-SELECT DISTINCT ?item WHERE {
-?item wdt:P1324 ?repo FILTER CONTAINS(str(?repo), "github.com").
-FILTER NOT EXISTS { ?item p:P2992 ?qa }
-}
-"""
+SELECT DISTINCT ?item WHERE {{
+?item wdt:{source_code_repository}
+   ?repo FILTER CONTAINS(str(?repo), "github.com").
+FILTER NOT EXISTS {{ ?item p:{software_quality_assurance} ?qa }}
+}}
+""".format(
+source_code_repository=self.P_source_code_repository,
+software_quality_assurance=self.P_software_quality_assurance)
 for item in pg.WikidataSPARQLPageGenerator(QUERY,
site=self.site,
result_type=list):
@@ -73,7 +76,8 @@
 item_dict = item.get()
 clm_dict = item_dict["claims"]
 headers = {'User-Agent': 'FLOSSbot'}
-for url in [claim.getTarget() for claim in clm_dict['P1324']]:
+for url in [claim.getTarget() for claim in
+clm_dict[self.P_source_code_repository]]:
 if 'github.com' not in url:
 continue
 path = os.path.normpath(urlparse(url).path)[1:]
diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 9cedd79..49ad37d 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -179,31 +179,34 @@
 def run_query(self):
 if self.args.filter == 'no-protocol':
 query = """
-SELECT DISTINCT ?item WHERE {
-  ?item p:P1324 ?repo.
-  ?repo ps:P1324 ?value.
-  OPTIONAL { ?repo pq:P2700 ?protocol } # try to get the protocol
+SELECT DISTINCT ?item WHERE {{
+  ?item p:{source_code_repository} ?repo.
+  ?repo ps:{source_code_repository} ?value.
+  OPTIONAL {{ ?repo pq:{protocol} ?protocol }} # get the protocol
   FILTER(!BOUND(?protocol)) # and only keep those with no protocol
-} ORDER BY ?item
-"""
+}} ORDER BY ?item
+""".format(source_code_repository=self.P_source_code_repository,
+   protocol=self.P_protocol)
 elif self.args.filter == 'no-preferred':
 query = """
 SELECT ?item (COUNT(?value) AS ?count) WHERE
-{
-  ?item p:P1324 [
- ps:P1324 ?value; wikibase:rank wikibase:NormalRank ].
-  MINUS { ?item p:P1324/wikibase:rank wikibase:PreferredRank. }
-}
+{{
+  ?item p:{source_code_repository} [
+ ps:{source_code_repository} ?value;
+ wikibase:rank wikibase:NormalRank ].
+  MINUS {{ ?item p:{source_code_repository}/wikibase:rank
+   wikibase:PreferredRank. }}
+}}
 GROUP BY ?item
 HAVING(?count > 1)
 ORDER BY ?item
-"""
+""".format(source_code_repository=self.P_source_code_repository)
 else:
 query = """
-SELECT DISTINCT ?item WHERE {
-  ?item wdt:P1324 ?url.
-} ORDER BY ?item
-"""
+SELECT DISTINCT ?item WHERE {{
+  ?item wdt:{source_code_repository} ?url.
+}} ORDER BY ?item
+""".format(source_code_repository=self.P_source_code_repository)
 query = query + " # " + str(time.time())
 log.debug(query)
 for item in pg.WikidataSPARQLPageGenerator(query,
@@ -219,15 +222,15 @@
 item_dict = item.get()
 clm_dict = item_dict["claims"]
 
-if len(clm_dict['P1324']) == 1:
+if len(clm_dict[self.P_source_code_repository]) == 1:
 return False
 
-if len(clm_dict['P1324']) != 2:
+if len(clm_dict[self.P_source_code_repository]) != 2:
 self.debug(item, "SKIP more than two URLs is too difficult to fix")
 return False
 
 http = []
-for claim in clm_dict['P1324']:
+for claim in clm_dict[self.P_source_code_repository]:
 if claim.getRank() == 'preferred':
 self.debug(item,
"SKIP because there already is a preferred URL")
@@ -251,10 +254,10 @@
 

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: remove hardcoded properties

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

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

Change subject: remove hardcoded properties
..

remove hardcoded properties

Change-Id: I65fc7f71627bfdba61ef1aa1ac0225de8fd308c7
Signed-off-by: Loic Dachary 
---
M FLOSSbot/qa.py
M FLOSSbot/repository.py
2 files changed, 36 insertions(+), 29 deletions(-)


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

diff --git a/FLOSSbot/qa.py b/FLOSSbot/qa.py
index d893c6c..deb58a4 100644
--- a/FLOSSbot/qa.py
+++ b/FLOSSbot/qa.py
@@ -58,11 +58,14 @@
 
 def run(self):
 QUERY = """
-SELECT DISTINCT ?item WHERE {
-?item wdt:P1324 ?repo FILTER CONTAINS(str(?repo), "github.com").
-FILTER NOT EXISTS { ?item p:P2992 ?qa }
-}
-"""
+SELECT DISTINCT ?item WHERE {{
+?item wdt:{source_code_repository}
+   ?repo FILTER CONTAINS(str(?repo), "github.com").
+FILTER NOT EXISTS {{ ?item p:{software_quality_assurance} ?qa }}
+}}
+""".format(
+source_code_repository=self.P_source_code_repository,
+software_quality_assurance=self.P_software_quality_assurance)
 for item in pg.WikidataSPARQLPageGenerator(QUERY,
site=self.site,
result_type=list):
@@ -73,7 +76,8 @@
 item_dict = item.get()
 clm_dict = item_dict["claims"]
 headers = {'User-Agent': 'FLOSSbot'}
-for url in [claim.getTarget() for claim in clm_dict['P1324']]:
+for url in [claim.getTarget() for claim in
+clm_dict[self.P_source_code_repository]]:
 if 'github.com' not in url:
 continue
 path = os.path.normpath(urlparse(url).path)[1:]
diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 9cedd79..49ad37d 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -179,31 +179,34 @@
 def run_query(self):
 if self.args.filter == 'no-protocol':
 query = """
-SELECT DISTINCT ?item WHERE {
-  ?item p:P1324 ?repo.
-  ?repo ps:P1324 ?value.
-  OPTIONAL { ?repo pq:P2700 ?protocol } # try to get the protocol
+SELECT DISTINCT ?item WHERE {{
+  ?item p:{source_code_repository} ?repo.
+  ?repo ps:{source_code_repository} ?value.
+  OPTIONAL {{ ?repo pq:{protocol} ?protocol }} # get the protocol
   FILTER(!BOUND(?protocol)) # and only keep those with no protocol
-} ORDER BY ?item
-"""
+}} ORDER BY ?item
+""".format(source_code_repository=self.P_source_code_repository,
+   protocol=self.P_protocol)
 elif self.args.filter == 'no-preferred':
 query = """
 SELECT ?item (COUNT(?value) AS ?count) WHERE
-{
-  ?item p:P1324 [
- ps:P1324 ?value; wikibase:rank wikibase:NormalRank ].
-  MINUS { ?item p:P1324/wikibase:rank wikibase:PreferredRank. }
-}
+{{
+  ?item p:{source_code_repository} [
+ ps:{source_code_repository} ?value;
+ wikibase:rank wikibase:NormalRank ].
+  MINUS {{ ?item p:{source_code_repository}/wikibase:rank
+   wikibase:PreferredRank. }}
+}}
 GROUP BY ?item
 HAVING(?count > 1)
 ORDER BY ?item
-"""
+""".format(source_code_repository=self.P_source_code_repository)
 else:
 query = """
-SELECT DISTINCT ?item WHERE {
-  ?item wdt:P1324 ?url.
-} ORDER BY ?item
-"""
+SELECT DISTINCT ?item WHERE {{
+  ?item wdt:{source_code_repository} ?url.
+}} ORDER BY ?item
+""".format(source_code_repository=self.P_source_code_repository)
 query = query + " # " + str(time.time())
 log.debug(query)
 for item in pg.WikidataSPARQLPageGenerator(query,
@@ -219,15 +222,15 @@
 item_dict = item.get()
 clm_dict = item_dict["claims"]
 
-if len(clm_dict['P1324']) == 1:
+if len(clm_dict[self.P_source_code_repository]) == 1:
 return False
 
-if len(clm_dict['P1324']) != 2:
+if len(clm_dict[self.P_source_code_repository]) != 2:
 self.debug(item, "SKIP more than two URLs is too difficult to fix")
 return False
 
 http = []
-for claim in clm_dict['P1324']:
+for claim in clm_dict[self.P_source_code_repository]:
 if claim.getRank() == 'preferred':
 self.debug(item,
"SKIP because there already is a 

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Stability and styling

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

Change subject: Stability and styling
..


Stability and styling

By generating the URLs with the #filepath parser function, the extension
works when the files are hosted at places other than the local repo.

Change-Id: I05ea06e05eaad48b0784d69771cc1bcbd12b648b
---
M HoverGallery.body.php
M HoverGallery.js
2 files changed, 17 insertions(+), 15 deletions(-)

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



diff --git a/HoverGallery.body.php b/HoverGallery.body.php
index c8a5513..d709c6b 100644
--- a/HoverGallery.body.php
+++ b/HoverGallery.body.php
@@ -31,9 +31,9 @@
$FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
foreach ( $FILENAMES as $filename ) {
$filename = strtok( $filename, '|' ); // Remove the 
options
-   $title = Title::newFromText( $filename, NS_FILE );
-   $file = wfLocalFile( $title );
-   $FILEURLS[] = $file->getFullUrl();
+   $filename = substr( $filename, ( $position = strpos( 
$filename, ':' ) ) === false ? 0 : $position + 1 ); // Remove the File prefix
+   $filepath = $parser->recursiveTagParse( '{{filepath:' . 
$filename . '|nowiki}}' ); // Get the filepath
+   $FILEURLS[] = $filepath;
}
 
$fileUrls = json_encode( $FILEURLS );
diff --git a/HoverGallery.js b/HoverGallery.js
index 58892cd..52e2d3a 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -10,10 +10,11 @@
 
onMouseEnter: function () {
// First show the loading icon
-   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/hovergallery/images/loading.gif',
+   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/Hovergallery/images/loading.gif',
loadingImg = $( '' ).addClass( 'hoverimage' 
).attr( 'src', loadingUrl );
$( 'body' ).append( loadingImg );
 
+   // Get the data from the gallery
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -21,18 +22,19 @@
 
// Determine which of the thumbs is it
var thumbs = $( 'img', gallery ),
-   thumbIndex = $.inArray( this, thumbs );
+   thumbIndex = $.inArray( this, thumbs ),
+   url = fileUrls[ thumbIndex ],
+   url = $( '' ).html( url ).text(); // Decode the 
HTML entities in the URL
 
-   // Get the corresponding URL and build the image
-   var url = fileUrls[ thumbIndex ],
-   image = new Image();
-   image.src = url;
-   image.onload = function () {
-   loadingImg.css({
-   'max-width': maxHoverWidth + 'px',
-   'max-height': maxHoverHeight + 'px'
-   }).attr( 'src', url );
-   };
+   // Replace the loading icon with the image
+   var image = new Image();
+   image.src = url;
+   image.onload = function () {
+   loadingImg.css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   }).attr( 'src', url );
+   };
},
 
onMouseLeave: function () {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I05ea06e05eaad48b0784d69771cc1bcbd12b648b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
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...Hovergallery[master]: Stability and styling

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

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

Change subject: Stability and styling
..

Stability and styling

By generating the URLs with the #filepath parser function, the extension
works when the files are hosted at places other than the local repo.

Change-Id: I05ea06e05eaad48b0784d69771cc1bcbd12b648b
---
M HoverGallery.body.php
M HoverGallery.js
2 files changed, 17 insertions(+), 15 deletions(-)


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

diff --git a/HoverGallery.body.php b/HoverGallery.body.php
index c8a5513..d709c6b 100644
--- a/HoverGallery.body.php
+++ b/HoverGallery.body.php
@@ -31,9 +31,9 @@
$FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
foreach ( $FILENAMES as $filename ) {
$filename = strtok( $filename, '|' ); // Remove the 
options
-   $title = Title::newFromText( $filename, NS_FILE );
-   $file = wfLocalFile( $title );
-   $FILEURLS[] = $file->getFullUrl();
+   $filename = substr( $filename, ( $position = strpos( 
$filename, ':' ) ) === false ? 0 : $position + 1 ); // Remove the File prefix
+   $filepath = $parser->recursiveTagParse( '{{filepath:' . 
$filename . '|nowiki}}' ); // Get the filepath
+   $FILEURLS[] = $filepath;
}
 
$fileUrls = json_encode( $FILEURLS );
diff --git a/HoverGallery.js b/HoverGallery.js
index 58892cd..52e2d3a 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -10,10 +10,11 @@
 
onMouseEnter: function () {
// First show the loading icon
-   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/hovergallery/images/loading.gif',
+   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/Hovergallery/images/loading.gif',
loadingImg = $( '' ).addClass( 'hoverimage' 
).attr( 'src', loadingUrl );
$( 'body' ).append( loadingImg );
 
+   // Get the data from the gallery
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -21,18 +22,19 @@
 
// Determine which of the thumbs is it
var thumbs = $( 'img', gallery ),
-   thumbIndex = $.inArray( this, thumbs );
+   thumbIndex = $.inArray( this, thumbs ),
+   url = fileUrls[ thumbIndex ],
+   url = $( '' ).html( url ).text(); // Decode the 
HTML entities in the URL
 
-   // Get the corresponding URL and build the image
-   var url = fileUrls[ thumbIndex ],
-   image = new Image();
-   image.src = url;
-   image.onload = function () {
-   loadingImg.css({
-   'max-width': maxHoverWidth + 'px',
-   'max-height': maxHoverHeight + 'px'
-   }).attr( 'src', url );
-   };
+   // Replace the loading icon with the image
+   var image = new Image();
+   image.src = url;
+   image.onload = function () {
+   loadingImg.css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   }).attr( 'src', url );
+   };
},
 
onMouseLeave: function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05ea06e05eaad48b0784d69771cc1bcbd12b648b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [IMPR] Make LogEntryFactory logtypes public

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

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

Change subject: [IMPR] Make LogEntryFactory logtypes public
..

[IMPR] Make LogEntryFactory logtypes public

- rename LogEntryFactory._logtypes to LogEntryFactory.logtypes
  in order to make them public
- add a _logtypes class method to deprecate the old class attribute
- use a new decorator 'classproperty' to get property access to the
  _logtypes method
- create a new classproperty class to realize the classproperty decorator
  and test it
- rename all old attributes to the new one

Change-Id: I5467a59beb93372a89426b6bfaaca4cd38e71e57
---
M pywikibot/logentries.py
M pywikibot/tools/__init__.py
M tests/logentry_tests.py
M tests/tools_tests.py
4 files changed, 68 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/49/311349/1

diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 05607b6..6df2123 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -14,7 +14,7 @@
 
 import pywikibot
 from pywikibot.exceptions import Error
-from pywikibot.tools import deprecated
+from pywikibot.tools import deprecated, classproperty
 
 if sys.version_info[0] > 2:
 basestring = (str, )
@@ -371,7 +371,7 @@
 Only available method is create()
 """
 
-_logtypes = {
+logtypes = {
 'block': BlockEntry,
 'protect': ProtectEntry,
 'rights': RightsEntry,
@@ -403,6 +403,12 @@
 logclass = LogEntryFactory._getEntryClass(logtype)
 self._creator = lambda data: logclass(data, self._site)
 
+@classproperty
+@deprecated('LogEntryFactory.logtypes')
+def _logtypes(cls):
+"""DEPRECATED LogEntryFactory class attribute of log types."""
+return cls.logtypes
+
 def create(self, logdata):
 """
 Instantiate the LogEntry object representing logdata.
@@ -423,7 +429,7 @@
 @rtype: class
 """
 try:
-return cls._logtypes[logtype]
+return cls.logtypes[logtype]
 except KeyError:
 return LogEntry
 
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index ffafbdf..78d3c5e 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -169,6 +169,36 @@
 return func
 
 
+class classproperty(object):
+
+"""
+Metaclass to accesss a class method as a property.
+
+This class may be used as a decorator:
+
+class Foo(object):
+
+_bar = 'baz'  # a class property
+
+@classproperty
+def bar(cls):  # a class property method
+return cls._bar
+
+>>> Foo._bar
+'baz'
+>>> Foo.bar
+'baz'
+"""
+
+def __init__(self, cls_method):
+"""Hold the class method."""
+self.method = cls_method
+
+def __get__(self, instance, owner):
+"""Get the attribute of the owner class by its method."""
+return self.method(owner)
+
+
 class UnicodeMixin(object):
 
 """Mixin class to add __str__ method in Python 2 or 3."""
diff --git a/tests/logentry_tests.py b/tests/logentry_tests.py
index 20d8935..48646b6 100644
--- a/tests/logentry_tests.py
+++ b/tests/logentry_tests.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8  -*-
 """Test logentries module."""
 #
-# (C) Pywikibot team, 2015
+# (C) Pywikibot team, 2015-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -68,7 +68,7 @@
 def _test_logevent(self, logtype):
 """Test a single logtype entry."""
 logentry = self._get_logentry(logtype)
-if logtype in LogEntryFactory._logtypes:
+if logtype in LogEntryFactory.logtypes:
 self.assertEqual(logentry._expectedType, logtype)
 else:
 self.assertIsNone(logentry._expectedType)
@@ -110,7 +110,7 @@
 return test_logevent
 
 # create test methods for the support logtype classes
-for logtype in LogEntryFactory._logtypes:
+for logtype in LogEntryFactory.logtypes:
 cls.add_method(dct, 'test_%sEntry' % logtype.title(),
test_method(logtype))
 
@@ -136,7 +136,7 @@
 # initialized yet.
 available_types = set(self.site._paraminfo.parameter(
 'query+logevents', 'type')['type'])
-for simple_type in available_types - set(LogEntryFactory._logtypes):
+for simple_type in available_types - set(LogEntryFactory.logtypes):
 if not simple_type:
 # paraminfo also reports an empty string as a type
 continue
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index c6525e9..194a30b 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -23,6 +23,7 @@
 mock = e
 
 from pywikibot import tools
+from pywikibot.tools import classproperty
 
 from tests import join_xml_data_path
 
@@ -724,6 +725,30 @@
 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Make ApiMain use isBot() to catch global bots in checkReadOn...

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

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

Change subject: Make ApiMain use isBot() to catch global bots in checkReadOnly()
..

Make ApiMain use isBot() to catch global bots in checkReadOnly()

Change-Id: I2090b1aad8a5858965e4ec261f8e88c37414e804
---
M includes/api/ApiMain.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 1f3c76a..ae3f3f2 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1299,7 +1299,7 @@
}
 
if ( $module->isWriteMode()
-   && in_array( 'bot', $this->getUser()->getGroups() )
+   && $this->getUser()->isBot()
&& wfGetLB()->getServerCount() > 1
) {
$this->checkBotReadOnly();

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: make cnx failures equivalent to 404

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

Change subject: repository: make cnx failures equivalent to 404
..


repository: make cnx failures equivalent to 404

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

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



diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 923cad0..9cedd79 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -369,8 +369,11 @@
 """.format(url=url))
 
 def verify_http(self, url):
-r = requests.head(url, allow_redirects=True)
-return r.status_code == requests.codes.ok
+try:
+r = requests.head(url, allow_redirects=True)
+return r.status_code == requests.codes.ok
+except:
+return False
 
 def verify_protocol(self, url, protocol, credentials):
 if protocol == self.Q_git:
@@ -458,32 +461,42 @@
 return "svn://svn.gna.org/svn/" + m.group(1)
 if re.match('https?://sourceforge.net/p/'
 '.*/(git|code|code-git)/ci/(default|master)/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('git clone (git://git.code.sf.net/p/.*/'
-   '(?:git|code(?:-git)?))', r.text)
-if len(u) == 1:
-return u[0]
-u = re.findall('hg clone (http://hg.code.sf.net/p/.*/code)',
-   r.text)
-if len(u) >= 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('git clone (git://git.code.sf.net/p/.*/'
+   '(?:git|code(?:-git)?))', r.text)
+if len(u) == 1:
+return u[0]
+u = re.findall('hg clone (http://hg.code.sf.net/p/.*/code)',
+   r.text)
+if len(u) >= 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 if re.match('https?://sourceforge.net/p/'
 '.*?/.*?/ci/(default|master)/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('hg clone (http://hg.code.sf.net/p/.*?) ', r.text)
-if len(u) >= 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('hg clone (http://hg.code.sf.net/p/.*?) ',
+   r.text)
+if len(u) >= 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 if re.match('https?://sourceforge.net/p/'
 '.*/(svn|code|code-0)/HEAD/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('svn checkout (svn://svn.code.sf.net.*/trunk)',
-   r.text)
-if len(u) == 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('svn checkout (svn://svn.code.sf.net.*/trunk)',
+   r.text)
+if len(u) == 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 return None

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move some FileBackend related classes to /libs

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

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

Change subject: Move some FileBackend related classes to /libs
..

Move some FileBackend related classes to /libs

Change-Id: I0c3a84c2ed8b869519f4d38475a77539c24a88a8
---
M autoload.php
M includes/filebackend/FileBackendGroup.php
R includes/libs/filebackend/FileBackend.php
A includes/libs/filebackend/FileBackendException.php
R includes/libs/filebackend/filejournal/FileJournal.php
A includes/libs/filebackend/filejournal/NullFileJournal.php
R includes/libs/lockmanager/LockManager.php
R includes/libs/lockmanager/QuorumLockManager.php
R includes/libs/lockmanager/ScopedLock.php
9 files changed, 88 insertions(+), 82 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index a07df96..7ef9381 100644
--- a/autoload.php
+++ b/autoload.php
@@ -454,10 +454,10 @@
'Field' => __DIR__ . '/includes/libs/rdbms/field/Field.php',
'File' => __DIR__ . '/includes/filerepo/file/File.php',
'FileAwareNodeVisitor' => __DIR__ . '/maintenance/findDeprecated.php',
-   'FileBackend' => __DIR__ . '/includes/filebackend/FileBackend.php',
+   'FileBackend' => __DIR__ . '/includes/libs/filebackend/FileBackend.php',
'FileBackendDBRepoWrapper' => __DIR__ . 
'/includes/filerepo/FileBackendDBRepoWrapper.php',
-   'FileBackendError' => __DIR__ . '/includes/filebackend/FileBackend.php',
-   'FileBackendException' => __DIR__ . 
'/includes/filebackend/FileBackend.php',
+   'FileBackendError' => __DIR__ . 
'/includes/libs/filebackend/FileBackendException.php',
+   'FileBackendException' => __DIR__ . 
'/includes/libs/filebackend/FileBackendException.php',
'FileBackendGroup' => __DIR__ . 
'/includes/filebackend/FileBackendGroup.php',
'FileBackendMultiWrite' => __DIR__ . 
'/includes/filebackend/FileBackendMultiWrite.php',
'FileBackendStore' => __DIR__ . 
'/includes/filebackend/FileBackendStore.php',
@@ -471,7 +471,7 @@
'FileDeleteForm' => __DIR__ . '/includes/FileDeleteForm.php',
'FileDependency' => __DIR__ . '/includes/cache/CacheDependency.php',
'FileDuplicateSearchPage' => __DIR__ . 
'/includes/specials/SpecialFileDuplicateSearch.php',
-   'FileJournal' => __DIR__ . 
'/includes/filebackend/filejournal/FileJournal.php',
+   'FileJournal' => __DIR__ . 
'/includes/libs/filebackend/filejournal/FileJournal.php',
'FileOp' => __DIR__ . '/includes/filebackend/FileOp.php',
'FileOpBatch' => __DIR__ . '/includes/filebackend/FileOpBatch.php',
'FileRepo' => __DIR__ . '/includes/filerepo/FileRepo.php',
@@ -747,7 +747,7 @@
'LocalSettingsGenerator' => __DIR__ . 
'/includes/installer/LocalSettingsGenerator.php',
'LocalisationCache' => __DIR__ . 
'/includes/cache/localisation/LocalisationCache.php',
'LocalisationCacheBulkLoad' => __DIR__ . 
'/includes/cache/localisation/LocalisationCacheBulkLoad.php',
-   'LockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/LockManager.php',
+   'LockManager' => __DIR__ . '/includes/libs/lockmanager/LockManager.php',
'LockManagerGroup' => __DIR__ . 
'/includes/filebackend/lockmanager/LockManagerGroup.php',
'LogEntry' => __DIR__ . '/includes/logging/LogEntry.php',
'LogEntryBase' => __DIR__ . '/includes/logging/LogEntry.php',
@@ -975,11 +975,11 @@
'NotRecursiveIterator' => __DIR__ . 
'/includes/utils/iterators/NotRecursiveIterator.php',
'NukeNS' => __DIR__ . '/maintenance/nukeNS.php',
'NukePage' => __DIR__ . '/maintenance/nukePage.php',
-   'NullFileJournal' => __DIR__ . 
'/includes/filebackend/filejournal/FileJournal.php',
+   'NullFileJournal' => __DIR__ . 
'/includes/libs/filebackend/filejournal/NullFileJournal.php',
'NullFileOp' => __DIR__ . '/includes/filebackend/FileOp.php',
'NullIndexField' => __DIR__ . '/includes/search/NullIndexField.php',
'NullJob' => __DIR__ . '/includes/jobqueue/jobs/NullJob.php',
-   'NullLockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/LockManager.php',
+   'NullLockManager' => __DIR__ . 
'/includes/libs/lockmanager/LockManager.php',
'NullRepo' => __DIR__ . '/includes/filerepo/NullRepo.php',
'NullStatsdDataFactory' => __DIR__ . 
'/includes/libs/stats/NullStatsdDataFactory.php',
'NumericUppercaseCollation' => __DIR__ . 
'/includes/collation/NumericUppercaseCollation.php',
@@ -1110,7 +1110,7 @@
'PurgeParserCache' => __DIR__ . '/maintenance/purgeParserCache.php',
'QueryPage' => __DIR__ . '/includes/specialpage/QueryPage.php',
'QuickTemplate' => __DIR__ . '/includes/skins/QuickTemplate.php',
-   'QuorumLockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/QuorumLockManager.php',
+   'QuorumLockManager' => __DIR__ . 

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: make cnx failures equivalent to 404

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

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

Change subject: repository: make cnx failures equivalent to 404
..

repository: make cnx failures equivalent to 404

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


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

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 923cad0..c474080 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -369,8 +369,11 @@
 """.format(url=url))
 
 def verify_http(self, url):
-r = requests.head(url, allow_redirects=True)
-return r.status_code == requests.codes.ok
+try:
+r = requests.head(url, allow_redirects=True)
+return r.status_code == requests.codes.ok
+except e:
+return False
 
 def verify_protocol(self, url, protocol, credentials):
 if protocol == self.Q_git:
@@ -458,32 +461,41 @@
 return "svn://svn.gna.org/svn/" + m.group(1)
 if re.match('https?://sourceforge.net/p/'
 '.*/(git|code|code-git)/ci/(default|master)/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('git clone (git://git.code.sf.net/p/.*/'
-   '(?:git|code(?:-git)?))', r.text)
-if len(u) == 1:
-return u[0]
-u = re.findall('hg clone (http://hg.code.sf.net/p/.*/code)',
-   r.text)
-if len(u) >= 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('git clone (git://git.code.sf.net/p/.*/'
+   '(?:git|code(?:-git)?))', r.text)
+if len(u) == 1:
+return u[0]
+u = re.findall('hg clone (http://hg.code.sf.net/p/.*/code)',
+   r.text)
+if len(u) >= 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 if re.match('https?://sourceforge.net/p/'
 '.*?/.*?/ci/(default|master)/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('hg clone (http://hg.code.sf.net/p/.*?) ', r.text)
-if len(u) >= 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('hg clone (http://hg.code.sf.net/p/.*?) ', 
r.text)
+if len(u) >= 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 if re.match('https?://sourceforge.net/p/'
 '.*/(svn|code|code-0)/HEAD/tree/', url):
-r = requests.get(url)
-if r.status_code != requests.codes.ok:
-return None
-u = re.findall('svn checkout (svn://svn.code.sf.net.*/trunk)',
-   r.text)
-if len(u) == 1:
-return u[0]
+try:
+r = requests.get(url)
+if r.status_code != requests.codes.ok:
+return None
+u = re.findall('svn checkout (svn://svn.code.sf.net.*/trunk)',
+   r.text)
+if len(u) == 1:
+return u[0]
+except requests.ConnectionError as e:
+pass
 return None

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

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

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


[MediaWiki-commits] [Gerrit] integration/docroot[master]: Update some libs

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

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

Change subject: Update some libs
..

Update some libs

Change-Id: I97f162cfe8a11773f5b01c404c352b31bd160de6
---
M shared/lib/bootstrap/css/bootstrap-theme.css
M shared/lib/bootstrap/css/bootstrap-theme.css.map
M shared/lib/bootstrap/css/bootstrap-theme.min.css
A shared/lib/bootstrap/css/bootstrap-theme.min.css.map
M shared/lib/bootstrap/css/bootstrap.css
M shared/lib/bootstrap/css/bootstrap.css.map
M shared/lib/bootstrap/css/bootstrap.min.css
A shared/lib/bootstrap/css/bootstrap.min.css.map
M shared/lib/bootstrap/fonts/glyphicons-halflings-regular.eot
M shared/lib/bootstrap/fonts/glyphicons-halflings-regular.svg
M shared/lib/bootstrap/fonts/glyphicons-halflings-regular.ttf
M shared/lib/bootstrap/fonts/glyphicons-halflings-regular.woff
A shared/lib/bootstrap/fonts/glyphicons-halflings-regular.woff2
M shared/lib/bootstrap/js/bootstrap.js
M shared/lib/bootstrap/js/bootstrap.min.js
A shared/lib/bootstrap/js/npm.js
16 files changed, 4,726 insertions(+), 3,015 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/docroot 
refs/changes/45/311345/1


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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: do not create directory for fossil

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

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

Change subject: repository: do not create directory for fossil
..

repository: do not create directory for fossil

Because it clone fails if the directory already exists.

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


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

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 90711d8..923cad0 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -352,8 +352,6 @@
 return util.sh_bool("""
 set -e
 rm -fr /tmp/tmpclone
-mkdir /tmp/tmpclone
-cd /tmp/tmpclone
 timeout 30 fossil clone {url} /tmp/tmpclone |
 grep -q -m 1 -e 'Round-trips'
 """.format(url=url))

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: do not create directory for fossil

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

Change subject: repository: do not create directory for fossil
..


repository: do not create directory for fossil

Because it clone fails if the directory already exists.

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

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



diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 90711d8..923cad0 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -352,8 +352,6 @@
 return util.sh_bool("""
 set -e
 rm -fr /tmp/tmpclone
-mkdir /tmp/tmpclone
-cd /tmp/tmpclone
 timeout 30 fossil clone {url} /tmp/tmpclone |
 grep -q -m 1 -e 'Round-trips'
 """.format(url=url))

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: bitbucket hosts git repositories

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

Change subject: repository: bitbucket hosts git repositories
..


repository: bitbucket hosts git repositories

Not mercurial repositories.

Change-Id: I223af8219fb8d0d99ed9421b880b9677ea568922
Signed-off-by: Loic Dachary 
---
M FLOSSbot/repository.py
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 45c32eb..90711d8 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -298,7 +298,7 @@
 if 'code.launchpad.net' in url:
 return self.Q_GNU_Bazaar
 if 'bitbucket.org' in url:
-return self.Q_Mercurial
+return self.Q_git
 if url.lower().startswith('http'):
 known = (
 'http://bxr.su/',

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: repository: bitbucket hosts git repositories

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

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

Change subject: repository: bitbucket hosts git repositories
..

repository: bitbucket hosts git repositories

Not mercurial repositories.

Change-Id: I223af8219fb8d0d99ed9421b880b9677ea568922
Signed-off-by: Loic Dachary 
---
M FLOSSbot/repository.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 45c32eb..90711d8 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -298,7 +298,7 @@
 if 'code.launchpad.net' in url:
 return self.Q_GNU_Bazaar
 if 'bitbucket.org' in url:
-return self.Q_Mercurial
+return self.Q_git
 if url.lower().startswith('http'):
 known = (
 'http://bxr.su/',

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: bot: rebase repository, qa on Bot

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

Change subject: bot: rebase repository,qa on Bot
..


bot: rebase repository,qa on Bot

Change-Id: I43ab7051470ec420779784eb81d33e562a57d014
Signed-off-by: Loic Dachary 
---
M FLOSSbot/main.py
M FLOSSbot/qa.py
M FLOSSbot/repository.py
M tests/test_main.py
M tests/test_repository.py
5 files changed, 132 insertions(+), 199 deletions(-)

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



diff --git a/FLOSSbot/main.py b/FLOSSbot/main.py
index d1227c8..8f3a970 100644
--- a/FLOSSbot/main.py
+++ b/FLOSSbot/main.py
@@ -48,11 +48,14 @@
 help='no side effect')
 
 self.parser.add_argument(
-'--language-code',
-default='wikidata',
-choices=['test', 'wikidata'],
-help='wikidata language code',
-)
+'--test',
+action='store_true', default=None,
+help='use test.wikidata.org instead of wikidata.org')
+
+self.parser.add_argument(
+'--user',
+default=None,
+help='wikidata user name')
 
 subparsers = self.parser.add_subparsers(
 title='subcommands',
diff --git a/FLOSSbot/qa.py b/FLOSSbot/qa.py
index 31fb29b..d893c6c 100644
--- a/FLOSSbot/qa.py
+++ b/FLOSSbot/qa.py
@@ -25,19 +25,12 @@
 from pywikibot import pagegenerators as pg
 
 from FLOSSbot import util
+from FLOSSbot import bot
 
 log = logging.getLogger(__name__)
 
-P_described_at_url = "P973"
-P_archive_url = "P1065"
-P_software_quality_assurance = "P2992"
-Q_continuous_integration = "Q965769"
 
-
-class QA(object):
-
-def __init__(self, args):
-self.args = args
+class QA(bot.Bot):
 
 @staticmethod
 def get_parser():
@@ -70,13 +63,12 @@
 FILTER NOT EXISTS { ?item p:P2992 ?qa }
 }
 """
-site = pywikibot.Site(self.args.language_code, "wikidata")
 for item in pg.WikidataSPARQLPageGenerator(QUERY,
-   site=site,
+   site=self.site,
result_type=list):
-self.fixup(site, item)
+self.fixup(item)
 
-def fixup(self, site, item):
+def fixup(self, item):
 log.debug(str(item))
 item_dict = item.get()
 clm_dict = item_dict["claims"]
@@ -104,18 +96,17 @@
 log.debug("SKIP: GET " + travis_ci + " not found")
 continue
 log.info("FOUND " + travis + " and " + travis_ci)
-continuous_integration = pywikibot.ItemPage(
-site, Q_continuous_integration, 0)
 
 software_quality_assurance = pywikibot.Claim(
-site, P_software_quality_assurance, 0)
-software_quality_assurance.setTarget(continuous_integration)
+self.site, self.P_software_quality_assurance, 0)
+software_quality_assurance.setTarget(self.Q_Continuous_integration)
 item.addClaim(software_quality_assurance)
 
-described_at_url = pywikibot.Claim(site, P_described_at_url, 0)
+described_at_url = pywikibot.Claim(self.site,
+   self.P_described_at_URL, 0)
 described_at_url.setTarget(travis)
 software_quality_assurance.addQualifier(described_at_url, bot=True)
 
-archive_url = pywikibot.Claim(site, P_archive_url, 0)
+archive_url = pywikibot.Claim(self.site, self.P_archive_URL, 0)
 archive_url.setTarget(travis_ci)
 software_quality_assurance.addQualifier(archive_url, bot=True)
diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 6c3ce4d..45c32eb 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -24,24 +24,17 @@
 import requests
 from pywikibot import pagegenerators as pg
 
-from FLOSSbot import util
+from FLOSSbot import bot, util
 
 log = logging.getLogger(__name__)
-
-P_username = "P554"
-P_protocol = "P2700"
-P_source_code_repository = "P1324"
 
 FLOSS_doc = ("https://www.wikidata.org/wiki/Wikidata:;
  "WikiProject_Informatics/FLOSS#source_code_repository")
 
 
-class Repository(object):
+class Repository(bot.Bot):
 
 cache = None
-
-def __init__(self, args):
-self.args = args
 
 @staticmethod
 def get_parser():
@@ -161,20 +154,6 @@
 def factory(argv):
 return Repository(Repository.get_parser().parse_args(argv))
 
-@staticmethod
-def setup_cache(site):
-if Repository.cache:
-return
-Repository.Q_git = pywikibot.ItemPage(site, "Q186055", 0)
-Repository.Q_svn = pywikibot.ItemPage(site, "Q46794", 0)
-Repository.Q_hg = pywikibot.ItemPage(site, "Q476543", 0)
-Repository.Q_fossil = pywikibot.ItemPage(site, "Q1439431", 0)
-

[MediaWiki-commits] [Gerrit] pywikibot...FLOSSbot[master]: bot: implement the Bot base class

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

Change subject: bot: implement the Bot base class
..


bot: implement the Bot base class

The Bot base class automatically fetches entities from attributes such
as

   self.P_protocol
   self.Q_git

If initialized with the test=True argument it works against
test.wikidata.org instead of wikidata.org. If an entity does not exist
in test.wikidata.org, a new one is created with the same label. In the
case of a property, it is created with the same datatype as the property
that has the same label in wikidata.

Change-Id: I0a1f0ddf858cbcd319be7fd6d11a012968be623f
Signed-off-by: Loic Dachary 
---
A FLOSSbot/bot.py
A tests/__init__.py
A tests/test_bot.py
A tests/wikidata.py
4 files changed, 225 insertions(+), 0 deletions(-)

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



diff --git a/FLOSSbot/bot.py b/FLOSSbot/bot.py
new file mode 100644
index 000..a58920f
--- /dev/null
+++ b/FLOSSbot/bot.py
@@ -0,0 +1,117 @@
+#
+# Copyright (C) 2016 Loic Dachary 
+#
+#This program is free software: you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation, either version 3 of the License, or
+#(at your option) any later version.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+#along with this program.  If not, see .
+#
+import logging
+
+import pywikibot
+
+log = logging.getLogger(__name__)
+
+
+class Bot(object):
+
+def __init__(self, args):
+self.args = args
+self.site = pywikibot.Site(
+code="wikidata" if not self.args.test else "test",
+fam="wikidata",
+user=self.args.user)
+if self.args.test:
+self.site.throttle.setDelays(writedelay=0)
+if self.args.test:
+self.wikidata_site = pywikibot.Site(code="wikidata",
+fam="wikidata")
+self.reset_cache()
+
+def reset_cache(self):
+self.entities = {
+'property': {},
+'item': {},
+}
+
+def lookup_entity(self, name, **kwargs):
+type = kwargs['type']
+found = self.entities[type].get(name)
+if found:
+return found
+found = self.search_entity(self.site, name, **kwargs)
+if found:
+if type == 'property':
+found = found['id']
+self.entities[type][name] = found
+return found
+
+def search_entity(self, site, name, **kwargs):
+found = None
+for p in site.search_entities(name, 'en', **kwargs):
+if p['label'] == name:
+if kwargs['type'] == 'property':
+found = p
+else:
+found = pywikibot.ItemPage(site, p['id'], 0)
+break
+return found
+
+lookup_item = lookup_entity
+
+def lookup_property(self, name):
+return self.lookup_entity(self.site, name, type='property')
+
+def create_entity(self, type, name):
+found = self.search_entity(self.wikidata_site, name, type=type)
+assert found, type + " " + name + " must exist wikidata"
+entity = {
+"labels": {
+"en": {
+"language": "en",
+"value": name,
+}
+},
+}
+if type == 'property':
+id = found['id']
+found = self.wikidata_site.loadcontent({'ids': id}, 'datatype')
+assert found, "datatype of " + id + " " + name + " is not found"
+entity['datatype'] = found[id]['datatype']
+log.debug("create " + type + " " + str(entity))
+self.site.editEntity({'new': type}, entity)
+
+def clear_entity_label(self, id):
+data = {
+"labels": {
+"en": {
+"language": "en",
+"value": "",
+}
+}
+}
+log.debug("clear " + id + " label")
+self.site.editEntity({'id': id}, data)
+self.reset_cache()
+
+def __getattribute__(self, name):
+if name.startswith('P_'):
+type = 'property'
+elif name.startswith('Q_'):
+type = 'item'
+else:
+return super(Bot, self).__getattribute__(name)
+label = " ".join(name.split('_')[1:])
+found = self.lookup_entity(label, type=type)
+if not found and self.args.test:
+

[MediaWiki-commits] [Gerrit] mediawiki...DeepSea[master]: Got rid of one unused variable + modernized the hook call

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

Change subject: Got rid of one unused variable + modernized the hook call
..


Got rid of one unused variable + modernized the hook call

Change-Id: I3b10da8f56d4733cc7a138aa39f492c93c9e2f81
---
M DeepSea.skin.php
1 file changed, 1 insertion(+), 4 deletions(-)

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



diff --git a/DeepSea.skin.php b/DeepSea.skin.php
index 48604d0..514e5f3 100644
--- a/DeepSea.skin.php
+++ b/DeepSea.skin.php
@@ -119,9 +119,6 @@
array_reverse( $this->data['personal_urls'] );
}
 
-   // Get rid of studs if not wanted
-   $studs = true;
-
// Output HTML Page
$this->html( 'headelement' );
 ?>
@@ -302,7 +299,7 @@
}
 
if ( $hook !== null ) {
-   wfRunHooks( $hook, array( &$this, true ) );
+   Hooks::run( $hook, array( &$this, true ) );
}
?>


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b10da8f56d4733cc7a138aa39f492c93c9e2f81
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/DeepSea
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix 
Gerrit-Reviewer: Jack Phoenix 

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


[MediaWiki-commits] [Gerrit] mediawiki...DeepSea[master]: Got rid of one unused variable + modernized the hook call

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

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

Change subject: Got rid of one unused variable + modernized the hook call
..

Got rid of one unused variable + modernized the hook call

Change-Id: I3b10da8f56d4733cc7a138aa39f492c93c9e2f81
---
M DeepSea.skin.php
1 file changed, 1 insertion(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/DeepSea 
refs/changes/42/311342/1

diff --git a/DeepSea.skin.php b/DeepSea.skin.php
index 48604d0..514e5f3 100644
--- a/DeepSea.skin.php
+++ b/DeepSea.skin.php
@@ -119,9 +119,6 @@
array_reverse( $this->data['personal_urls'] );
}
 
-   // Get rid of studs if not wanted
-   $studs = true;
-
// Output HTML Page
$this->html( 'headelement' );
 ?>
@@ -302,7 +299,7 @@
}
 
if ( $hook !== null ) {
-   wfRunHooks( $hook, array( &$this, true ) );
+   Hooks::run( $hook, array( &$this, true ) );
}
?>


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b10da8f56d4733cc7a138aa39f492c93c9e2f81
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/DeepSea
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix 

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


[MediaWiki-commits] [Gerrit] mediawiki...DeepSea[master]: Fix fatal on MW 1.27+

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

Change subject: Fix fatal on MW 1.27+
..


Fix fatal on MW 1.27+

Bug: T145979
Change-Id: Ib5ff05168b89a5577044f43c2eea16e96ed435bf
---
M DeepSea.skin.php
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/DeepSea.skin.php b/DeepSea.skin.php
index 338e422..48604d0 100644
--- a/DeepSea.skin.php
+++ b/DeepSea.skin.php
@@ -71,7 +71,7 @@
$nav = $this->data['content_navigation'];
 
if ( $wgVectorUseIconWatch ) {
-   $mode = $this->getSkin()->getTitle()->userIsWatching() 
? 'unwatch' : 'watch';
+   $mode = $this->getSkin()->getUser()->isWatched( 
$this->getSkin()->getTitle() ) ? 'unwatch' : 'watch';
if ( isset( $nav['actions'][$mode] ) ) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim( 'icon ' 
. $nav['views'][$mode]['class'], ' ' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5ff05168b89a5577044f43c2eea16e96ed435bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/DeepSea
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix 
Gerrit-Reviewer: Jack Phoenix 

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


[MediaWiki-commits] [Gerrit] mediawiki...DeepSea[master]: Fix fatal on MW 1.27+

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

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

Change subject: Fix fatal on MW 1.27+
..

Fix fatal on MW 1.27+

Bug: T145979
Change-Id: Ib5ff05168b89a5577044f43c2eea16e96ed435bf
---
M DeepSea.skin.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/DeepSea.skin.php b/DeepSea.skin.php
index 338e422..48604d0 100644
--- a/DeepSea.skin.php
+++ b/DeepSea.skin.php
@@ -71,7 +71,7 @@
$nav = $this->data['content_navigation'];
 
if ( $wgVectorUseIconWatch ) {
-   $mode = $this->getSkin()->getTitle()->userIsWatching() 
? 'unwatch' : 'watch';
+   $mode = $this->getSkin()->getUser()->isWatched( 
$this->getSkin()->getTitle() ) ? 'unwatch' : 'watch';
if ( isset( $nav['actions'][$mode] ) ) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim( 'icon ' 
. $nav['views'][$mode]['class'], ' ' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5ff05168b89a5577044f43c2eea16e96ed435bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/DeepSea
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix 

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


[MediaWiki-commits] [Gerrit] mediawiki/vagrant[master]: mediawiki: Expose /w/docs for multiwiki

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

Change subject: mediawiki: Expose /w/docs for multiwiki
..


mediawiki: Expose /w/docs for multiwiki

When using JSDuck (`npm run doc`) or Doxygen (mwdocgen.php),
one needs to access /w/docs/js/ or /w/docs/html/ to view it.

Right now it's required for the developer to have another web server
running outside of Vagrant with access to the mediawiki directory.

Test plan:
* Run `vagrant provision` in the vagrant directory on the host.
* Run `npm run doc` from the mediawiki directory.
* View http://localhost:8080/w/docs/js/

Change-Id: I552d72c25ac2257d9e48803d270dd814daa84f8e
---
M puppet/modules/mediawiki/manifests/multiwiki.pp
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/puppet/modules/mediawiki/manifests/multiwiki.pp 
b/puppet/modules/mediawiki/manifests/multiwiki.pp
index a48ee1f..22a4208 100644
--- a/puppet/modules/mediawiki/manifests/multiwiki.pp
+++ b/puppet/modules/mediawiki/manifests/multiwiki.pp
@@ -172,9 +172,9 @@
 content => template('mediawiki/docroot/w/RunJobs.php.erb'),
 }
 
-file { "${script_dir}/assets":
+file { "${script_dir}/docs":
 ensure => link,
-target => "${::mediawiki::dir}/assets",
+target => "${::mediawiki::dir}/docs",
 }
 
 file { "${script_dir}/extensions":

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I552d72c25ac2257d9e48803d270dd814daa84f8e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Krinkle 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: BryanDavis 
Gerrit-Reviewer: Dduvall 
Gerrit-Reviewer: Gilles 
Gerrit-Reviewer: Jforrester 
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] operations/puppet[production]: fix another possible netmapper-1.3+v4 FE crash

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

Change subject: fix another possible netmapper-1.3+v4 FE crash
..


fix another possible netmapper-1.3+v4 FE crash

Change-Id: Iddb35c4438e4a0efe4b394f2aae839fa0766eaf7
---
M modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
index 58a2e3b..738490e 100644
--- a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
@@ -167,7 +167,9 @@
 
// if it's an outside IP, use it to set XCIP (otherwise leave
// XCIP alone and it's still the proxy's IP)
-   if(<%= @std_ipcast %>.ip(req.http.maybe-xcip, "127.0.0.1") !~ 
wikimedia_nets) {
+   if(req.http.maybe-xcip && <%= @std_ipcast 
%>.ip(req.http.maybe-xcip, "127.0.0.1") !~ wikimedia_nets) {
+   // the check for empty/false maybe-xcip is to prevent
+   // the same netmapper-1.3 breakage as the 192.0.2.1 hack
set req.http.X-Client-IP = req.http.maybe-xcip;
}
 

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: fix another possible netmapper-1.3+v4 FE crash

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

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

Change subject: fix another possible netmapper-1.3+v4 FE crash
..

fix another possible netmapper-1.3+v4 FE crash

Change-Id: Iddb35c4438e4a0efe4b394f2aae839fa0766eaf7
---
M modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/38/311338/1

diff --git a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
index 58a2e3b..738490e 100644
--- a/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia-frontend.vcl.erb
@@ -167,7 +167,9 @@
 
// if it's an outside IP, use it to set XCIP (otherwise leave
// XCIP alone and it's still the proxy's IP)
-   if(<%= @std_ipcast %>.ip(req.http.maybe-xcip, "127.0.0.1") !~ 
wikimedia_nets) {
+   if(req.http.maybe-xcip && <%= @std_ipcast 
%>.ip(req.http.maybe-xcip, "127.0.0.1") !~ wikimedia_nets) {
+   // the check for empty/false maybe-xcip is to prevent
+   // the same netmapper-1.3 breakage as the 192.0.2.1 hack
set req.http.X-Client-IP = req.http.maybe-xcip;
}
 

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [bugfix] ItemPage.exists() should return True for redirects

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

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

Change subject: [bugfix] ItemPage.exists() should return True for redirects
..

[bugfix] ItemPage.exists() should return True for redirects

- If a ItemPage is a redirect to another ItemPage then its exits() method
  should return True and not raise an IsRedirectPage exception
- Test this behavior with and without get() operation because
  ItemPage.get() fills the _content instance variable

Bug: T145971
Change-Id: I8d42372f69eda864811f00d781a56374923abad8
---
M pywikibot/page.py
M tests/wikibase_tests.py
2 files changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/37/311337/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 79aefc3..4888c3c 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3456,7 +3456,7 @@
 """
 if not hasattr(self, '_content'):
 try:
-self.get()
+self.get(get_redirect=True)
 return True
 except pywikibot.NoPage:
 return False
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index f428475..1f6241b 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -646,6 +646,7 @@
 wikidata = self.get_repo()
 item = pywikibot.ItemPage(wikidata, 'Q1')
 self.assertFalse(item.isRedirectPage())
+self.assertTrue(item.exits())
 self.assertRaises(pywikibot.IsNotRedirectPage, item.getRedirectTarget)
 
 def test_redirect_item(self):
@@ -654,11 +655,22 @@
 item = pywikibot.ItemPage(wikidata, 'Q10008448')
 item.get(get_redirect=True)
 target = pywikibot.ItemPage(wikidata, 'Q8422626')
+# tests after get operation
 self.assertTrue(item.isRedirectPage())
+self.assertTrue(item.exists())
 self.assertEqual(item.getRedirectTarget(), target)
 self.assertIsInstance(item.getRedirectTarget(), pywikibot.ItemPage)
 self.assertRaises(pywikibot.IsRedirectPage, item.get)
 
+def test_redirect_item_without_get(self):
+"""Test redirect item without explicit get operation."""
+wikidata = self.get_repo()
+item = pywikibot.ItemPage(wikidata, 'Q10008448')
+self.assertTrue(item.exists())
+self.assertTrue(item.isRedirectPage())
+target = pywikibot.ItemPage(wikidata, 'Q8422626')
+self.assertEqual(item.getRedirectTarget(), target)
+
 
 class TestPropertyPage(WikidataTestCase):
 

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: two-hit-wonder experiment, hit/2+

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

Change subject: cache_upload: two-hit-wonder experiment, hit/2+
..


cache_upload: two-hit-wonder experiment, hit/2+

Bug: T144187
Change-Id: Ibe2fcfba9005f72295c179b63a3fe67f7048395d
---
M modules/varnish/templates/upload-frontend.inc.vcl.erb
1 file changed, 21 insertions(+), 0 deletions(-)

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



diff --git a/modules/varnish/templates/upload-frontend.inc.vcl.erb 
b/modules/varnish/templates/upload-frontend.inc.vcl.erb
index 2ced015..8e4e2c9 100644
--- a/modules/varnish/templates/upload-frontend.inc.vcl.erb
+++ b/modules/varnish/templates/upload-frontend.inc.vcl.erb
@@ -77,6 +77,27 @@
}
<%- end -%>
 
+   // Two-hit-wonder experiment: if the immediate backend does not indicate
+   // hit/2 or higher, deliver the object as normal but do not create a new
+   // cache entry of any kind.  We start caching in the frontend when an
+   // object is accessed for the 3rd time across all frontends in this DC.
+   // The ttl>3600 check is to ensure we don't apply this to any short-TTL
+   // edge cases we're not thinking of.
+   // We probably want to either back out this experiment later or improve
+   // on it, especially re: multiplying backend requests when warming a
+   // cold cache.
+   if (beresp.status == 200
+&& beresp.http.X-Cache-Int !~ " hit/([2-9]|[0-9]{2,})$"
+&& beresp.ttl > 3600s) {
+   set beresp.ttl = 0s;
+   <%- if @varnish_version4 -%>
+   set beresp.uncacheable = true;
+   return (deliver);
+   <%- else -%>
+   return (hit_for_pass);
+   <%- end -%>
+   }
+
// hit-for-pass objects >= 1MB size
if (std.integer(beresp.http.Content-Length, 1048576) >= 1048576 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.http.X-CDIS = "pass";

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe2fcfba9005f72295c179b63a3fe67f7048395d
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Ema 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: FE size limit 1MB

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

Change subject: cache_upload: FE size limit 1MB
..


cache_upload: FE size limit 1MB

512KB didn't offer notable improvement over 1MB, and 2MB seems to
have slightly dropped FE hitrate, so 1MB seems reasonably-optimal
for now.

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

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



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

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: FE size limit 1MB

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

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

Change subject: cache_upload: FE size limit 1MB
..

cache_upload: FE size limit 1MB

512KB didn't offer notable improvement over 1MB, and 2MB seems to
have slightly dropped FE hitrate, so 1MB seems reasonably-optimal
for now.

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


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/36/311336/1

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

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...ArticlePlaceholder[master]: Adjust the HTML output of the ArticlePlaceholder structure

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

Change subject: Adjust the HTML output of the ArticlePlaceholder structure
..


Adjust the HTML output of the ArticlePlaceholder structure

In order to make the placeholders are semantically well structured, removed 
unnecessary classes and div/p tag.

Bug: T144589
Change-Id: I802ba44dcac1c1cf775fadbd4ec2cd646a8ff74b
---
M includes/Lua/mw/ext/articlePlaceholder/statementRenderer.lua
M 
modules/ext.articleplaceholder.defaultDisplay/ext.articleplaceholder.defaultDisplay.css
2 files changed, 1 insertion(+), 10 deletions(-)

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



diff --git a/includes/Lua/mw/ext/articlePlaceholder/statementRenderer.lua 
b/includes/Lua/mw/ext/articlePlaceholder/statementRenderer.lua
index ee7c6ba..018245f 100644
--- a/includes/Lua/mw/ext/articlePlaceholder/statementRenderer.lua
+++ b/includes/Lua/mw/ext/articlePlaceholder/statementRenderer.lua
@@ -30,7 +30,7 @@
   end
 end
   end
-  return result .. '' .. mainsnak .. '' .. reference .. 
'' .. qualifier
+  return result .. '' .. mainsnak .. 
reference .. qualifier .. ''
 end
 
 -- Get a function which is bound to the given entityrenderer.
diff --git 
a/modules/ext.articleplaceholder.defaultDisplay/ext.articleplaceholder.defaultDisplay.css
 
b/modules/ext.articleplaceholder.defaultDisplay/ext.articleplaceholder.defaultDisplay.css
index 2205ecb..38dd701 100644
--- 
a/modules/ext.articleplaceholder.defaultDisplay/ext.articleplaceholder.defaultDisplay.css
+++ 
b/modules/ext.articleplaceholder.defaultDisplay/ext.articleplaceholder.defaultDisplay.css
@@ -59,15 +59,6 @@
   margin-top: 1.5em;
 }
 
-.articleplaceholder-identifierlist .articleplaceholder-value {
-  font-size: 100%;
-}
-
-.articleplaceholder-identifierlist .articleplaceholder-value {
-  font-size: 100%;
-  margin-left: 1.5em;
-}
-
 .articleplaceholder-qualifier {
   margin-left: 1em;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I802ba44dcac1c1cf775fadbd4ec2cd646a8ff74b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ArticlePlaceholder
Gerrit-Branch: master
Gerrit-Owner: Lucie Kaffee 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: Jackmcbarn 
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...Wikibase[master]: Change item to entity

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

Change subject: Change item to entity
..


Change item to entity

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

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



diff --git a/client/i18n/en.json b/client/i18n/en.json
index 1af2235..0e5f82f 100644
--- a/client/i18n/en.json
+++ b/client/i18n/en.json
@@ -93,7 +93,7 @@
"wikibase-pageswithbadges-submit": "Show pages",
"entityusage": "Entity Usage",
"entityusage-summary": "This page lists pages that use the given entity 
(e.g. Q42). The list is sorted by descending page ID, so that newer pages are 
listed first.",
-   "wikibase-entityusage-invalid-id": "$1 is not a valid item ID",
+   "wikibase-entityusage-invalid-id": "$1 is not a valid entity ID",
"wikibase-entityusage-legend": "List of pages that use a given entity",
"wikibase-entityusage-entity": "Entity:",
"wikibase-entityusage-submit": "Show pages",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4cddb3d5c1b43cce1b56b3cb5ccaaad52090a321
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: Ladsgroup 
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...Hovergallery[master]: Add loading icon

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

Change subject: Add loading icon
..


Add loading icon

When a user hover over an image, now a loading icon is show while
the full image loads.

Change-Id: I5432a768fb978ddd9105c6b47a1c2a2d2c359628
---
M HoverGallery.css
M HoverGallery.js
A images/loading.gif
3 files changed, 15 insertions(+), 7 deletions(-)

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



diff --git a/HoverGallery.css b/HoverGallery.css
index 002203a..1429040 100644
--- a/HoverGallery.css
+++ b/HoverGallery.css
@@ -1,4 +1,6 @@
 .hoverimage {
+   background: white;
+   padding: 1em;
pointer-events: none;
position: fixed;
top: 50%;
diff --git a/HoverGallery.js b/HoverGallery.js
index 421ac93..58892cd 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -9,6 +9,11 @@
},
 
onMouseEnter: function () {
+   // First show the loading icon
+   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/hovergallery/images/loading.gif',
+   loadingImg = $( '' ).addClass( 'hoverimage' 
).attr( 'src', loadingUrl );
+   $( 'body' ).append( loadingImg );
+
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -20,13 +25,14 @@
 
// Get the corresponding URL and build the image
var url = fileUrls[ thumbIndex ],
-   image = $( '' ).attr( 'src', url ).addClass( 
'hoverimage' ).css({
-   'max-width': maxHoverWidth + 'px',
-   'max-height': maxHoverHeight + 'px'
-   });
-
-   // Show the image
-   $( 'body' ).append( image );
+   image = new Image();
+   image.src = url;
+   image.onload = function () {
+   loadingImg.css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   }).attr( 'src', url );
+   };
},
 
onMouseLeave: function () {
diff --git a/images/loading.gif b/images/loading.gif
new file mode 100644
index 000..490e8f0
--- /dev/null
+++ b/images/loading.gif
Binary files differ

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5432a768fb978ddd9105c6b47a1c2a2d2c359628
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
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...Hovergallery[master]: Add loading icon

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

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

Change subject: Add loading icon
..

Add loading icon

When a user hover over an image, now a loading icon is show while
the full image loads.

Change-Id: I5432a768fb978ddd9105c6b47a1c2a2d2c359628
---
M HoverGallery.css
M HoverGallery.js
A images/loading.gif
3 files changed, 15 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/35/311335/1

diff --git a/HoverGallery.css b/HoverGallery.css
index 002203a..1429040 100644
--- a/HoverGallery.css
+++ b/HoverGallery.css
@@ -1,4 +1,6 @@
 .hoverimage {
+   background: white;
+   padding: 1em;
pointer-events: none;
position: fixed;
top: 50%;
diff --git a/HoverGallery.js b/HoverGallery.js
index 421ac93..58892cd 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -9,6 +9,11 @@
},
 
onMouseEnter: function () {
+   // First show the loading icon
+   var loadingUrl = mw.config.get( 'wgExtensionAssetsPath' ) + 
'/hovergallery/images/loading.gif',
+   loadingImg = $( '' ).addClass( 'hoverimage' 
).attr( 'src', loadingUrl );
+   $( 'body' ).append( loadingImg );
+
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -20,13 +25,14 @@
 
// Get the corresponding URL and build the image
var url = fileUrls[ thumbIndex ],
-   image = $( '' ).attr( 'src', url ).addClass( 
'hoverimage' ).css({
-   'max-width': maxHoverWidth + 'px',
-   'max-height': maxHoverHeight + 'px'
-   });
-
-   // Show the image
-   $( 'body' ).append( image );
+   image = new Image();
+   image.src = url;
+   image.onload = function () {
+   loadingImg.css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   }).attr( 'src', url );
+   };
},
 
onMouseLeave: function () {
diff --git a/images/loading.gif b/images/loading.gif
new file mode 100644
index 000..490e8f0
--- /dev/null
+++ b/images/loading.gif
Binary files differ

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5432a768fb978ddd9105c6b47a1c2a2d2c359628
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...Vector[master]: search.less: Use only one background-image for overlaid buttons

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

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

Change subject: search.less: Use only one background-image for overlaid buttons
..

search.less: Use only one background-image for overlaid buttons

Bug: T145928
Change-Id: If701930e469283c969e9a8a16574fa1a96cd502f
---
M components/search.less
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Vector 
refs/changes/34/311334/1

diff --git a/components/search.less b/components/search.less
index 320a389..148d37f 100644
--- a/components/search.less
+++ b/components/search.less
@@ -105,6 +105,9 @@
direction: ltr;
white-space: nowrap;
overflow: hidden;
+   }
+
+   #searchButton {
.background-image-svg('images/search-ltr.svg', 
'images/search-ltr.png');
background-position: center center;
background-repeat: no-repeat;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If701930e469283c969e9a8a16574fa1a96cd502f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Vector
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: htcppurger: quoting bugfix for host_regex

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

Change subject: htcppurger: quoting bugfix for host_regex
..


htcppurger: quoting bugfix for host_regex

Even with a simple string, apparently it's still possible to get
quoting wrong through the various layers :)

Change-Id: I537ebc0e25224c37a683fdc11ab7aa52511665e2
---
M modules/varnish/manifests/htcppurger.pp
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index a92fa51..7f647c5 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -41,7 +41,7 @@
 }
 
 if $host_regex != '' {
-$regex_arg = " -r '${host_regex}'"
+$regex_arg = " -r ${host_regex}"
 }
 else {
 $regex_arg = ''

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: htcppurger: quoting bugfix for host_regex

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

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

Change subject: htcppurger: quoting bugfix for host_regex
..

htcppurger: quoting bugfix for host_regex

Even with a simple string, apparently it's still possible to get
quoting wrong through the various layers :)

Change-Id: I537ebc0e25224c37a683fdc11ab7aa52511665e2
---
M modules/varnish/manifests/htcppurger.pp
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/33/311333/1

diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index a92fa51..7f647c5 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -41,7 +41,7 @@
 }
 
 if $host_regex != '' {
-$regex_arg = " -r '${host_regex}'"
+$regex_arg = " -r ${host_regex}"
 }
 else {
 $regex_arg = ''

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: vhtcpd host regex filter

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

Change subject: cache_upload: vhtcpd host regex filter
..


cache_upload: vhtcpd host regex filter

Only about 0.1% (or less) of the total multicast purge flow
actually applies to the upload caches.  The rest is the crazy mess
of redundant/template/backref-driven text purges.  Reducing the
rate of actual PURGE into varnishd may help a lot with various
problems in cache_upload for now, and vhtcpd is capable of
regex-filtering on the purged URL.

The full flow can still be seen in vhtcpd's inpkts_received and
inpkts_sane, but the reduce number from this fitering will be seen
in inpkts_enqueued and other stats further into the pipeline.

We never got around to this optimization before because the
perfect was the enemy of the good and it was hard to think through
and test the quoting for a proper, perfectly-matching regex with
several layers of interpolation and quoting between puppet and the
actual vhtcpd commandline.  However, using the literal simple
string 'upload' as a regex filter does the job fine in this case,
and is all we really need.

Change-Id: I605638d8e60c9c52ecc8368afc4a1705112f57d1
---
M modules/role/manifests/cache/upload.pp
M modules/varnish/manifests/htcppurger.pp
M modules/varnish/templates/vhtcpd-default.erb
3 files changed, 11 insertions(+), 2 deletions(-)

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



diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index ee8707a..826a269 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -9,7 +9,8 @@
 }
 
 class { 'varnish::htcppurger':
-mc_addrs => [ '239.128.0.112', '239.128.0.113' ],
+host_regex => 'upload',
+mc_addrs   => [ '239.128.0.112', '239.128.0.113' ],
 }
 
 class { 'lvs::realserver':
diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index 3a5dc0e..a92fa51 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -31,6 +31,7 @@
 
 class varnish::htcppurger(
 $mc_addrs,
+$host_regex = '',
 $varnishes = [ '127.0.0.1:3127', '127.0.0.1:3128' ],
 ) {
 Class[varnish::packages] -> Class[varnish::htcppurger]
@@ -39,6 +40,13 @@
 ensure => latest,
 }
 
+if $host_regex != '' {
+$regex_arg = " -r '${host_regex}'"
+}
+else {
+$regex_arg = ''
+}
+
 file { '/etc/default/vhtcpd':
 owner   => 'root',
 group   => 'root',
diff --git a/modules/varnish/templates/vhtcpd-default.erb 
b/modules/varnish/templates/vhtcpd-default.erb
index 1ada858..6b16ae7 100644
--- a/modules/varnish/templates/vhtcpd-default.erb
+++ b/modules/varnish/templates/vhtcpd-default.erb
@@ -1 +1 @@
-DAEMON_OPTS="-m <%= @mc_addrs.join(' -m ') -%> -c <%= @varnishes.join(' -c ') 
-%> -l 1024"
+DAEMON_OPTS="-m <%= @mc_addrs.join(' -m ') -%> -c <%= @varnishes.join(' -c ') 
-%><%= @regex_arg -%> -l 1024"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I605638d8e60c9c52ecc8368afc4a1705112f57d1
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Ema 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: vhtcpd host regex filter

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

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

Change subject: cache_upload: vhtcpd host regex filter
..

cache_upload: vhtcpd host regex filter

Only about 0.1% (or less) of the total multicast purge flow
actually applies to the upload caches.  The rest is the crazy mess
of redundant/template/backref-driven text purges.  Reducing the
rate of actual PURGE into varnishd may help a lot with various
problems in cache_upload for now, and vhtcpd is capable of
regex-filtering on the purged URL.

The full flow can still be seen in vhtcpd's inpkts_received and
inpkts_sane, but the reduce number from this fitering will be seen
in inpkts_enqueued and other stats further into the pipeline.

We never got around to this optimization before because the
perfect was the enemy of the good and it was hard to think through
and test the quoting for a proper, perfectly-matching regex with
several layers of interpolation and quoting between puppet and the
actual vhtcpd commandline.  However, using the literal simple
string 'upload' as a regex filter does the job fine in this case,
and is all we really need.

Change-Id: I605638d8e60c9c52ecc8368afc4a1705112f57d1
---
M modules/role/manifests/cache/upload.pp
M modules/varnish/manifests/htcppurger.pp
M modules/varnish/templates/vhtcpd-default.erb
3 files changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/32/311332/1

diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index ee8707a..826a269 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -9,7 +9,8 @@
 }
 
 class { 'varnish::htcppurger':
-mc_addrs => [ '239.128.0.112', '239.128.0.113' ],
+host_regex => 'upload',
+mc_addrs   => [ '239.128.0.112', '239.128.0.113' ],
 }
 
 class { 'lvs::realserver':
diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index 3a5dc0e..3873fe5 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -31,6 +31,7 @@
 
 class varnish::htcppurger(
 $mc_addrs,
+$host_regex = '',
 $varnishes = [ '127.0.0.1:3127', '127.0.0.1:3128' ],
 ) {
 Class[varnish::packages] -> Class[varnish::htcppurger]
@@ -39,6 +40,13 @@
 ensure => latest,
 }
 
+if $host_regex != '' {
+$regex_arg = " -r '${host_regex}'"
+}
+else {
+$regex_arg = '';
+}
+
 file { '/etc/default/vhtcpd':
 owner   => 'root',
 group   => 'root',
diff --git a/modules/varnish/templates/vhtcpd-default.erb 
b/modules/varnish/templates/vhtcpd-default.erb
index 1ada858..6b16ae7 100644
--- a/modules/varnish/templates/vhtcpd-default.erb
+++ b/modules/varnish/templates/vhtcpd-default.erb
@@ -1 +1 @@
-DAEMON_OPTS="-m <%= @mc_addrs.join(' -m ') -%> -c <%= @varnishes.join(' -c ') 
-%> -l 1024"
+DAEMON_OPTS="-m <%= @mc_addrs.join(' -m ') -%> -c <%= @varnishes.join(' -c ') 
-%><%= @regex_arg -%> -l 1024"

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Change item to entity

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

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

Change subject: Change item to entity
..

Change item to entity

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


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

diff --git a/client/i18n/en.json b/client/i18n/en.json
index 1af2235..0e5f82f 100644
--- a/client/i18n/en.json
+++ b/client/i18n/en.json
@@ -93,7 +93,7 @@
"wikibase-pageswithbadges-submit": "Show pages",
"entityusage": "Entity Usage",
"entityusage-summary": "This page lists pages that use the given entity 
(e.g. Q42). The list is sorted by descending page ID, so that newer pages are 
listed first.",
-   "wikibase-entityusage-invalid-id": "$1 is not a valid item ID",
+   "wikibase-entityusage-invalid-id": "$1 is not a valid entity ID",
"wikibase-entityusage-legend": "List of pages that use a given entity",
"wikibase-entityusage-entity": "Entity:",
"wikibase-entityusage-submit": "Show pages",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cddb3d5c1b43cce1b56b3cb5ccaaad52090a321
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Matěj Suchánek 

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: increase FE size limit to 2MB

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

Change subject: cache_upload: increase FE size limit to 2MB
..


cache_upload: increase FE size limit to 2MB

Part of ongoing experiments to find an approximately-optimal value
for maximizing FE hitrate.

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

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



diff --git a/modules/varnish/templates/upload-frontend.inc.vcl.erb 
b/modules/varnish/templates/upload-frontend.inc.vcl.erb
index a0ee370..e99764f 100644
--- a/modules/varnish/templates/upload-frontend.inc.vcl.erb
+++ b/modules/varnish/templates/upload-frontend.inc.vcl.erb
@@ -77,8 +77,8 @@
}
<%- end -%>
 
-   // hit-for-pass objects >= 512KB size
-   if (std.integer(beresp.http.Content-Length, 524288) >= 524288 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   // hit-for-pass objects >= 2MB size
+   if (std.integer(beresp.http.Content-Length, 2097152) >= 2097152 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.http.X-CDIS = "pass";
<%- if @varnish_version4 -%>
set beresp.uncacheable = true;

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: cache_upload: increase FE size limit to 2MB

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

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

Change subject: cache_upload: increase FE size limit to 2MB
..

cache_upload: increase FE size limit to 2MB

Part of ongoing experiments to find an approximately-optimal value
for maximizing FE hitrate.

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


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

diff --git a/modules/varnish/templates/upload-frontend.inc.vcl.erb 
b/modules/varnish/templates/upload-frontend.inc.vcl.erb
index a0ee370..e99764f 100644
--- a/modules/varnish/templates/upload-frontend.inc.vcl.erb
+++ b/modules/varnish/templates/upload-frontend.inc.vcl.erb
@@ -77,8 +77,8 @@
}
<%- end -%>
 
-   // hit-for-pass objects >= 512KB size
-   if (std.integer(beresp.http.Content-Length, 524288) >= 524288 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
+   // hit-for-pass objects >= 2MB size
+   if (std.integer(beresp.http.Content-Length, 2097152) >= 2097152 || 
beresp.http.Content-Length ~ "^[0-9]{9}") {
set beresp.http.X-CDIS = "pass";
<%- if @varnish_version4 -%>
set beresp.uncacheable = true;

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Correct error handling for exceptions in 'user' module

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

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

Change subject: Correct error handling for exceptions in 'user' module
..

Correct error handling for exceptions in 'user' module

Rearrange code so that the try...catch which is supposed to catch
exceptions when evalling code actually catches them. Evaluation of
'user' module was wrapped in `mw.loader.using( 'site' ).always( ... )`,
so it could be executed asynchronously, so try...catch never caught
exceptions from it; they bubbled up to all kinds of weird places and
broke things in confusing ways.

I think the same issue could occur for any module when waiting for
legacy modules to load ('wgResourceLoaderLegacyModules').

Bug: T145970
Change-Id: I91e7d0b4e50c786f7302e30a2b7ed43c3cd0da6c
---
M resources/src/mediawiki/mediawiki.js
1 file changed, 45 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/29/311329/1

diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 04807f4..89bb83b 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -1278,35 +1278,46 @@
registry[ module ].state = 'executing';
 
runScript = function () {
-   var script, markModuleReady, 
nestedAddScript, legacyWait,
+   var script, markModuleReady, 
nestedAddScript, legacyWait, implicitDependencies,
// Expand to include 
dependencies since we have to exclude both legacy modules
// and their dependencies from 
the legacyWait (to prevent a circular dependency).
legacyModules = resolve( 
mw.config.get( 'wgResourceLoaderLegacyModules', [] ) );
-   try {
-   script = registry[ module 
].script;
-   markModuleReady = function () {
-   registry[ module 
].state = 'ready';
-   handlePending( module );
-   };
-   nestedAddScript = function ( 
arr, callback, i ) {
-   // Recursively call 
queueModuleScript() in its own callback
-   // for each element of 
arr.
-   if ( i >= arr.length ) {
-   // We're at the 
end of the array
-   callback();
-   return;
-   }
 
-   queueModuleScript( arr[ 
i ], module ).always( function () {
-   
nestedAddScript( arr, callback, i + 1 );
-   } );
-   };
+   script = registry[ module ].script;
+   markModuleReady = function () {
+   registry[ module ].state = 
'ready';
+   handlePending( module );
+   };
+   nestedAddScript = function ( arr, 
callback, i ) {
+   // Recursively call 
queueModuleScript() in its own callback
+   // for each element of arr.
+   if ( i >= arr.length ) {
+   // We're at the end of 
the array
+   callback();
+   return;
+   }
 
-   legacyWait = ( $.inArray( 
module, legacyModules ) !== -1 )
-   ? $.Deferred().resolve()
-   : mw.loader.using( 
legacyModules );
+   queueModuleScript( arr[ i ], 
module ).always( function () {
+   nestedAddScript( arr, 
callback, i + 1 );
+   } );
+

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Move entity usage from basic to properties section in action...

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

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

Change subject: Move entity usage from basic to properties section in 
action=info
..

Move entity usage from basic to properties section in action=info

Change-Id: I28f0b0cf1bc0fd01ec938bd81db926148618ed3e
---
M client/includes/Hooks/InfoActionHookHandler.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/client/includes/Hooks/InfoActionHookHandler.php 
b/client/includes/Hooks/InfoActionHookHandler.php
index d5880ad..db662aa 100644
--- a/client/includes/Hooks/InfoActionHookHandler.php
+++ b/client/includes/Hooks/InfoActionHookHandler.php
@@ -70,7 +70,7 @@
}
 
if ( $usage ) {
-   $pageInfo['header-basic'][] = $this->formatEntityUsage( 
$context, $usage );
+   $pageInfo['header-properties'][] = 
$this->formatEntityUsage( $context, $usage );
}
 
return $pageInfo;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28f0b0cf1bc0fd01ec938bd81db926148618ed3e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup 

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


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Add WT namespace alias to NS_PROJECT in mywiktionary

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

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

Change subject: Add WT namespace alias to NS_PROJECT in mywiktionary
..

Add WT namespace alias to NS_PROJECT in mywiktionary

Bug: T140998
Change-Id: I5c68bf04cf9702e12e833d4de38d9434dd63eb30
---
M wmf-config/InitialiseSettings.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 127b806..b78f765 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -3392,6 +3392,10 @@
'+mywiki' => [
'WP' => NS_PROJECT, // T119807
],
+   '+mywiktionary' =>
+   [
+   'WT' => NS_PROJECT, // T140998
+   ],
'+mznwiki' => [
'وپ' => NS_PROJECT,
'Portal' => 100,

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: varnish-backend-restart: fix service invocation

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

Change subject: varnish-backend-restart: fix service invocation
..


varnish-backend-restart: fix service invocation

'service' is under /usr/sbin, which is not in cron's path

Change-Id: If413fcef0167cb49469acec13c6ec44ea80b3a06
---
M modules/varnish/files/varnish-backend-restart
1 file changed, 4 insertions(+), 4 deletions(-)

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



diff --git a/modules/varnish/files/varnish-backend-restart 
b/modules/varnish/files/varnish-backend-restart
index c3bf9e0..4a3f333 100644
--- a/modules/varnish/files/varnish-backend-restart
+++ b/modules/varnish/files/varnish-backend-restart
@@ -10,20 +10,20 @@
 sleep 15
 
 # Restart varnish and wipe storage
-service varnish stop
+/usr/sbin/service varnish stop
 rm -f /srv/sd*/varnish*
-service varnish start
+/usr/sbin/service varnish start
 
 sleep 5
 
 # Fix VSM files permissions and restart ganglia
 chmod 644 /var/lib/varnish/*/*.vsm
-service ganglia-monitor restart
+/usr/sbin/service ganglia-monitor restart
 
 sleep 5
 
 # Sometimes varnishkafka crashes after a varnish restart
-service varnishkafka-webrequest restart
+/usr/sbin/service varnishkafka-webrequest restart
 
 # Repool varnish-be and varnish-be-rand
 confctl --quiet select name=`hostname -f`,service='varnish-be' set/pooled=yes

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If413fcef0167cb49469acec13c6ec44ea80b3a06
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema 
Gerrit-Reviewer: BBlack 
Gerrit-Reviewer: Elukey 
Gerrit-Reviewer: Ema 
Gerrit-Reviewer: Giuseppe Lavagetto 
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]: varnish-backend-restart: fix service invocation

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

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

Change subject: varnish-backend-restart: fix service invocation
..

varnish-backend-restart: fix service invocation

'service' is under /usr/sbin, which is not in cron's path

Change-Id: If413fcef0167cb49469acec13c6ec44ea80b3a06
---
M modules/varnish/files/varnish-backend-restart
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/26/311326/1

diff --git a/modules/varnish/files/varnish-backend-restart 
b/modules/varnish/files/varnish-backend-restart
index c3bf9e0..4a3f333 100644
--- a/modules/varnish/files/varnish-backend-restart
+++ b/modules/varnish/files/varnish-backend-restart
@@ -10,20 +10,20 @@
 sleep 15
 
 # Restart varnish and wipe storage
-service varnish stop
+/usr/sbin/service varnish stop
 rm -f /srv/sd*/varnish*
-service varnish start
+/usr/sbin/service varnish start
 
 sleep 5
 
 # Fix VSM files permissions and restart ganglia
 chmod 644 /var/lib/varnish/*/*.vsm
-service ganglia-monitor restart
+/usr/sbin/service ganglia-monitor restart
 
 sleep 5
 
 # Sometimes varnishkafka crashes after a varnish restart
-service varnishkafka-webrequest restart
+/usr/sbin/service varnishkafka-webrequest restart
 
 # Repool varnish-be and varnish-be-rand
 confctl --quiet select name=`hostname -f`,service='varnish-be' set/pooled=yes

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

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

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


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

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

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

Change subject: New Wikidata Build - 2016-09-18T10:00:01+
..

New Wikidata Build - 2016-09-18T10:00:01+

Change-Id: Ib87314bf4a0e68598accad1dd4a74b99405d3e25
---
M composer.lock
A extensions/ArticlePlaceholder/i18n/nb.json
M extensions/ArticlePlaceholder/i18n/zh-hant.json
M extensions/Wikibase/client/i18n/ar.json
M extensions/Wikibase/client/i18n/de.json
M extensions/Wikibase/client/i18n/es.json
M extensions/Wikibase/client/i18n/gl.json
M extensions/Wikibase/client/i18n/he.json
M extensions/Wikibase/client/i18n/ko.json
M extensions/Wikibase/client/i18n/lb.json
M extensions/Wikibase/client/i18n/pl.json
M extensions/Wikibase/client/i18n/pt.json
M extensions/Wikibase/client/i18n/qqq.json
M extensions/Wikibase/client/i18n/ru.json
M extensions/Wikibase/client/i18n/tcy.json
M extensions/Wikibase/client/i18n/uk.json
M extensions/Wikibase/client/i18n/zh-hans.json
M extensions/Wikibase/client/includes/RecentChanges/RecentChangeFactory.php
M 
extensions/Wikibase/client/tests/phpunit/includes/RecentChanges/RecentChangeFactoryTest.php
M 
extensions/Wikibase/client/tests/phpunit/includes/Specials/SpecialEntityUsageTest.php
M extensions/Wikibase/lib/i18n/hu.json
M extensions/Wikibase/lib/i18n/nl.json
M extensions/Wikibase/repo/i18n/ar.json
M extensions/Wikibase/repo/i18n/hu.json
M extensions/Wikibase/repo/i18n/ru.json
M 
extensions/Wikibase/repo/includes/Notifications/JobQueueChangeNotificationSender.php
M 
extensions/Wikibase/repo/tests/phpunit/includes/Notifications/JobQueueChangeNotificationSenderTest.php
M 
extensions/Wikibase/view/resources/jquery/wikibase/toolbar/jquery.wikibase.edittoolbar.js
M extensions/Wikibase/view/resources/wikibase/view/resources.php
M vendor/composer/installed.json
30 files changed, 267 insertions(+), 74 deletions(-)


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

diff --git a/composer.lock b/composer.lock
index 1700cbe..ab7b3ca 100644
--- a/composer.lock
+++ b/composer.lock
@@ -788,12 +788,12 @@
 "source": {
 "type": "git",
 "url": 
"https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git;,
-"reference": "09d5e0ed480cfb90f2b144509938048d773c0f3a"
+"reference": "67036eee7ba19191f17cbe7cc70eedbdbdc6f83b"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/09d5e0ed480cfb90f2b144509938048d773c0f3a;,
-"reference": "09d5e0ed480cfb90f2b144509938048d773c0f3a",
+"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/67036eee7ba19191f17cbe7cc70eedbdbdc6f83b;,
+"reference": "67036eee7ba19191f17cbe7cc70eedbdbdc6f83b",
 "shasum": ""
 },
 "require-dev": {
@@ -818,7 +818,7 @@
 ],
 "description": "Provides a special page with Wikibase information 
about a certain topic, with invitation to create an article for the topic",
 "homepage": 
"https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder;,
-"time": "2016-09-05 10:32:45"
+"time": "2016-09-17 21:15:24"
 },
 {
 "name": "propertysuggester/property-suggester",
@@ -1574,12 +1574,12 @@
 "source": {
 "type": "git",
 "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git;,
-"reference": "3dcac6c817c4ff350345f78fb902b57bf49e2a45"
+"reference": "0b6b15dc8b824d97c72cda6a36c23281800a8ca6"
 },
 "dist": {
 "type": "zip",
-"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/3dcac6c817c4ff350345f78fb902b57bf49e2a45;,
-"reference": "3dcac6c817c4ff350345f78fb902b57bf49e2a45",
+"url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/0b6b15dc8b824d97c72cda6a36c23281800a8ca6;,
+"reference": "0b6b15dc8b824d97c72cda6a36c23281800a8ca6",
 "shasum": ""
 },
 "require": {
@@ -1653,7 +1653,7 @@
 "wikibaserepo",
 "wikidata"
 ],
-"time": "2016-09-16 18:30:22"
+"time": "2016-09-17 21:23:47"
 },
 {
 "name": "wikibase/wikimedia-badges",
diff --git a/extensions/ArticlePlaceholder/i18n/nb.json 
b/extensions/ArticlePlaceholder/i18n/nb.json
new file mode 100644
index 000..16fc2f3
--- /dev/null
+++ b/extensions/ArticlePlaceholder/i18n/nb.json
@@ -0,0 +1,24 @@
+{
+   "@metadata": [],
+   "createtopicpage": "Opprett side",
+  

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Extract subdomain when pasting full URL into siteselector

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

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

Change subject: Extract subdomain when pasting full URL into siteselector
..

Extract subdomain when pasting full URL into siteselector

(Alternative to I62578bdfac821ec1030dde4bfca4fbf25c488da8, see below)

This is a trivial first step towards the idea to allow pasting full
Wikipedia URLs into the sitelinks editor. This patch does have a
single effect: Before, nothing was found when a user tried to paste a
URL. Now, it finds the site (but not the page).

This has been adopted from I62578bdfac821ec1030dde4bfca4fbf25c488da8
by Marius Hoch, so that it matches the pasted URL with the site URL,
instead of trying to match the pasted URL with the site id.

Bug: T144310
Change-Id: Ifb5b3b2f2cbef186f7349c5c65964ee430fe626d
---
M .jscsrc
M .jshintrc
M lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js
M lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js
4 files changed, 29 insertions(+), 5 deletions(-)


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

diff --git a/.jscsrc b/.jscsrc
index 179fec4..4a6edcf 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,5 +1,5 @@
 {
-   // 
https://github.com/jscs-dev/node-jscs/blob/master/presets/wikimedia.json
+   // 
https://github.com/wikimedia/jscs-preset-wikimedia/blob/master/presets/wikimedia.json
"preset": "wikimedia",
 
// 
@@ -10,6 +10,7 @@
"disallowDanglingUnderscores": null,
"requireSpacesInsideBrackets": null,
"requireVarDeclFirst": null,
+   "requireCamelCaseOrUpperCaseIdentifiers": { "allExcept": [ "zh_min_nan" 
] },
"jsDoc": {
// what we don't yet follow is commented out
"checkAnnotations": {
diff --git a/.jshintrc b/.jshintrc
index 720300f..055265d 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,5 +1,5 @@
 {
-   "camelcase": true,
+   "camelcase": false, // conflicts with JSCS' disallowQuotedKeysInObjects
"curly": true,
"eqeqeq": true,
"immed": true,
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js
index 6325663..55ee20a 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.siteselector.js
@@ -215,6 +215,14 @@
return self._considerSuggestion( site );
} );
 
+   if ( suggestedSites.length === 0 ) {
+   var removePrefix = /^(\w*:)?(\/\/)?/;
+   var siteId = this._term.replace( removePrefix, 
'' ).replace( /\..*/, '' );
+   suggestedSites = $.grep( source, function( site 
) {
+   return site.getApi().replace( 
removePrefix, '' ).indexOf( siteId ) === 0;
+   } );
+   }
+
return deferred.resolve( suggestedSites, term 
).promise();
},
 
diff --git 
a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js 
b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js
index 32248fa..c688127 100644
--- a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js
+++ b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.siteselector.tests.js
@@ -45,6 +45,15 @@
languageCode: 'frr',
id: 'frrwiki',
group: 'foo'
+   },
+   {
+   apiUrl: 'http://zh-min-nan.wikipedia.org/w/api.php',
+   name: 'Chinese',
+   pageUrl: 'http://zh-min-nan.wikipedia.org/wiki/$1',
+   shortName: 'Chinese',
+   languageCode: 'zh-min-nan',
+   id: 'zh_min_nan',
+   group: 'dummy'
}
];
 
@@ -96,13 +105,13 @@
}
} ) );
 
-   QUnit.test( 'getSelectedSite()', 23, function( assert ) {
+   QUnit.test( 'getSelectedSite()', 36, function( assert ) {
var $siteSelector = newTestSiteSelector(),
siteSelector = $siteSelector.data( 'siteselector' );
 
/**
 * Key: Expected site id / Value: Input string.
-* @type {Object}
+* @type {Object[]}
 */
var testStrings = [
{ enwiki: 'en' },
@@ -111,7 +120,13 @@
{ dewiki: 'deutsch' },
{ nowiki: 'no' }, // Prefer language code.
{ enwiki: 'enwiki' },
-   { frrwiki: 'nord' }
+   { frrwiki: 'nord' },
+

[MediaWiki-commits] [Gerrit] translatewiki[master]: [CookieWarning] Add new key to ignore

2016-09-18 Thread Raimond Spekking (Code Review)
Raimond Spekking has submitted this change and it was merged.

Change subject: [CookieWarning] Add new key to ignore
..


[CookieWarning] Add new key to ignore

Change-Id: If1a5713aa37ffe6456431282f329d8e03cd3915a
---
M groups/MediaWiki/mediawiki-extensions.txt
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Raimond Spekking: Verified; Looks good to me, approved



diff --git a/groups/MediaWiki/mediawiki-extensions.txt 
b/groups/MediaWiki/mediawiki-extensions.txt
index 15b680d..31c1f4b 100644
--- a/groups/MediaWiki/mediawiki-extensions.txt
+++ b/groups/MediaWiki/mediawiki-extensions.txt
@@ -765,6 +765,7 @@
 
 Cookie Warning
 descmsg = cookiewarning-desc
+ignored = cookiewarning-more-link
 
 Copy To Clipboard
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If1a5713aa37ffe6456431282f329d8e03cd3915a
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Raimond Spekking 
Gerrit-Reviewer: Raimond Spekking 

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


[MediaWiki-commits] [Gerrit] translatewiki[master]: [CookieWarning] Add new key to ignore

2016-09-18 Thread Raimond Spekking (Code Review)
Raimond Spekking has uploaded a new change for review.

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

Change subject: [CookieWarning] Add new key to ignore
..

[CookieWarning] Add new key to ignore

Change-Id: If1a5713aa37ffe6456431282f329d8e03cd3915a
---
M groups/MediaWiki/mediawiki-extensions.txt
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/translatewiki 
refs/changes/23/311323/1

diff --git a/groups/MediaWiki/mediawiki-extensions.txt 
b/groups/MediaWiki/mediawiki-extensions.txt
index 15b680d..31c1f4b 100644
--- a/groups/MediaWiki/mediawiki-extensions.txt
+++ b/groups/MediaWiki/mediawiki-extensions.txt
@@ -765,6 +765,7 @@
 
 Cookie Warning
 descmsg = cookiewarning-desc
+ignored = cookiewarning-more-link
 
 Copy To Clipboard
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1a5713aa37ffe6456431282f329d8e03cd3915a
Gerrit-PatchSet: 1
Gerrit-Project: translatewiki
Gerrit-Branch: master
Gerrit-Owner: Raimond Spekking 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Move DatabaseSqlite to /libs/rdbms

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

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

Change subject: Move DatabaseSqlite to /libs/rdbms
..

Move DatabaseSqlite to /libs/rdbms

Change-Id: I332ee968ab4e56841224304c7fd8e7f0b09c67cd
---
M autoload.php
R includes/libs/rdbms/database/DatabaseSqlite.php
2 files changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/22/311322/1

diff --git a/autoload.php b/autoload.php
index ff7d488..5c132fe 100644
--- a/autoload.php
+++ b/autoload.php
@@ -328,7 +328,7 @@
'DatabaseMysqli' => __DIR__ . 
'/includes/libs/rdbms/database/DatabaseMysqli.php',
'DatabaseOracle' => __DIR__ . '/includes/db/DatabaseOracle.php',
'DatabasePostgres' => __DIR__ . '/includes/db/DatabasePostgres.php',
-   'DatabaseSqlite' => __DIR__ . '/includes/db/DatabaseSqlite.php',
+   'DatabaseSqlite' => __DIR__ . 
'/includes/libs/rdbms/database/DatabaseSqlite.php',
'DatabaseUpdater' => __DIR__ . 
'/includes/installer/DatabaseUpdater.php',
'DateFormats' => __DIR__ . '/maintenance/language/date-formats.php',
'DateFormatter' => __DIR__ . '/includes/parser/DateFormatter.php',
diff --git a/includes/db/DatabaseSqlite.php 
b/includes/libs/rdbms/database/DatabaseSqlite.php
similarity index 100%
rename from includes/db/DatabaseSqlite.php
rename to includes/libs/rdbms/database/DatabaseSqlite.php

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Inject "srvCache" and local DB connections into LockManagerDB

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

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

Change subject: Inject "srvCache" and local DB connections into LockManagerDB
..

Inject "srvCache" and local DB connections into LockManagerDB

* Also simplified the srvCache variable usage to be unconditional.
* The wfRandomString() call has also been replaced.

Change-Id: I17e83b17ec549906ee200bbe9eb2f0b151423e26
---
M includes/DefaultSettings.php
M includes/filebackend/lockmanager/DBLockManager.php
M includes/filebackend/lockmanager/LockManagerGroup.php
3 files changed, 50 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/21/311321/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 135c3e5..be858c2 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -644,6 +644,10 @@
  * See LockManager::__construct() for more details.
  * Additional parameters are specific to the lock manager class used.
  * These settings should be global to all wikis.
+ *
+ * When using DBLockManager, the 'dbsByBucket' map can reference 
'localDBMaster' as
+ * a peer database in each bucket. This will result in an extra connection to 
the domain
+ * that the LockManager services, which must also be a valid wiki ID.
  */
 $wgLockManagers = [];
 
diff --git a/includes/filebackend/lockmanager/DBLockManager.php 
b/includes/filebackend/lockmanager/DBLockManager.php
index 4667dde..c36ff48 100644
--- a/includes/filebackend/lockmanager/DBLockManager.php
+++ b/includes/filebackend/lockmanager/DBLockManager.php
@@ -36,7 +36,7 @@
  * @since 1.19
  */
 abstract class DBLockManager extends QuorumLockManager {
-   /** @var array[] Map of DB names to server config */
+   /** @var array[]|IDatabase[] Map of (DB names => server config or 
IDatabase) */
protected $dbServers; // (DB name => server config array)
/** @var BagOStuff */
protected $statusCache;
@@ -63,19 +63,15 @@
 * - flags   : DB flags (see DatabaseBase)
 *   - dbsByBucket : Array of 1-16 consecutive integer keys, starting 
from 0,
 *   each having an odd-numbered list of DB names 
(peers) as values.
-*   Any DB named 'localDBMaster' will automatically 
use the DB master
-*   settings for this wiki (without the need for a 
dbServers entry).
-*   Only use 'localDBMaster' if the domain is a valid 
wiki ID.
 *   - lockExpiry  : Lock timeout (seconds) for dropped connections. 
[optional]
 *   This tells the DB server how long to wait before 
assuming
 *   connection failure and releasing all the locks for 
a session.
+*   - srvCache: A BagOStuff instance using APC or the like.
 */
public function __construct( array $config ) {
parent::__construct( $config );
 
-   $this->dbServers = isset( $config['dbServers'] )
-   ? $config['dbServers']
-   : []; // likely just using 'localDBMaster'
+   $this->dbServers = $config['dbServers'];
// Sanitize srvsByBucket config to prevent PHP errors
$this->srvsByBucket = array_filter( $config['dbsByBucket'], 
'is_array' );
$this->srvsByBucket = array_values( $this->srvsByBucket ); // 
consecutive
@@ -90,19 +86,25 @@
? 60 // pick a safe-ish number to match DB timeout 
default
: $this->lockExpiry; // cover worst case
 
-   foreach ( $this->srvsByBucket as $bucket ) {
-   if ( count( $bucket ) > 1 ) { // multiple peers
-   // Tracks peers that couldn't be queried 
recently to avoid lengthy
-   // connection timeouts. This is useless if each 
bucket has one peer.
-   $this->statusCache = 
ObjectCache::getLocalServerInstance();
-   break;
-   }
-   }
+   // Tracks peers that couldn't be queried recently to avoid 
lengthy
+   // connection timeouts. This is useless if each bucket has one 
peer.
+   $this->statusCache = isset( $config['srvCache'] )
+   ? $config['srvCache']
+   : new HashBagOStuff();
 
-   $this->session = wfRandomString( 31 );
+   $random = [];
+   for ( $i = 1; $i <= 5; ++$i ) {
+   $random[] = mt_rand( 0, 0xFFF );
+   }
+   $this->session = substr( md5( implode( '-', $random ) ), 0, 31 
);
}
 
-   // @todo change this code to work in one batch
+   /**
+* @TODO change this code to work in one batch
+