[MediaWiki-commits] [Gerrit] mediawiki/core[master]: WebStart.php: Update the file's doc comment

2017-02-26 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/340060 )

Change subject: WebStart.php: Update the file's doc comment
..

WebStart.php: Update the file's doc comment

The doc comment did not reflect the removal of MW_NO_SETUP in
edc9edbc769b570c, or the fact that Setup.php no longer loads
AutoLoader.php or GlobalFunctions.php.

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


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

diff --git a/includes/WebStart.php b/includes/WebStart.php
index 861e532..2f0db39 100644
--- a/includes/WebStart.php
+++ b/includes/WebStart.php
@@ -1,12 +1,11 @@
 https://gerrit.wikimedia.org/r/340060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: ApiQueryBase::addWhereFld: Don't count uncountable values

2017-02-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338301 )

Change subject: ApiQueryBase::addWhereFld: Don't count uncountable values
..

ApiQueryBase::addWhereFld: Don't count uncountable values

In PHP 7.2, count() will generate a warning if its argument is
not an array or countable object.

https://wiki.php.net/rfc/counting_non_countables

addWhereFld() "[uses] count() to its full documented capabilities to
simultaneously test for null, empty array or empty countable object"
since r42536 (c4dd73000a734ddf). Thus, in PHP 7.2, a warning would
occur in the common case in which a scalar value is provided.

Avoid the warnings by checking, in the obvious way, whether the
value is null or an empty array, as there is no apparent reason
to check for countable objects containing zero items.

Change-Id: I562ec00cbebcaa803855e033cd07806bbcc16af0
---
M includes/api/ApiQueryBase.php
1 file changed, 1 insertion(+), 3 deletions(-)


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

diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index 2d21865..c907187 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -261,9 +261,7 @@
 * @param string|string[] $value Value; ignored if null or empty array;
 */
protected function addWhereFld( $field, $value ) {
-   // Use count() to its full documented capabilities to 
simultaneously
-   // test for null, empty array or empty countable object
-   if ( count( $value ) ) {
+   if ( $value !== null && $value !== [] ) {
$this->where[$field] = $value;
}
}

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

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

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


[MediaWiki-commits] [Gerrit] operations/puppet[production]: gerrit: Fix CSS selector for diff font size override

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

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

Change subject: gerrit: Fix CSS selector for diff font size override
..

gerrit: Fix CSS selector for diff font size override

Because Gerrit's CSS sets a font size of `small` for `table td`
elements, overriding it on the containing table element has no
effect. Overriding the font size on the child div element (the
element on which the `monospace` font family is set) does work.

Bug: T141286
Change-Id: I138c0817bd5bb475a5e5dc7a5d71611039bc17fa
---
M modules/gerrit/files/etc/GerritSite.css
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/11/315511/1

diff --git a/modules/gerrit/files/etc/GerritSite.css 
b/modules/gerrit/files/etc/GerritSite.css
index 9f8de49..82a34c8 100644
--- a/modules/gerrit/files/etc/GerritSite.css
+++ b/modules/gerrit/files/etc/GerritSite.css
@@ -144,7 +144,7 @@
  * https://phabricator.wikimedia.org/T42941
  * Gerrit diff font isn't big enough, either
  */
-.com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-table {
+.com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-table 
.CodeMirror {
font-size: 9pt !important;
 }
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Remove patch-pl-tl-il-unique.sql

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

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

Change subject: Remove patch-pl-tl-il-unique.sql
..

Remove patch-pl-tl-il-unique.sql

In 1.24 (b8c038f6784ef082), this update from 1.15 (see T18645,
640a6d311e91ccdc) was undone in tables.sql. However, it was not
removed from MysqlUpdater, so update.php would still make the
indices UNIQUE, even when run on a new MediaWiki installation.

In its place, added patch-pl-tl-il-nonunique.sql, which recreates
the indices to match the current definitions from tables.sql.

Bug: T78513
Change-Id: Ic82ca06c8e7051bcd1e0a2a3d5d251e297a9142f
---
M includes/installer/MysqlUpdater.php
A maintenance/archives/patch-pl-tl-il-nonunique.sql
D maintenance/archives/patch-pl-tl-il-unique.sql
3 files changed, 19 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/306895/1

diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index 6989969..65af086 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -155,7 +155,6 @@
[ 'addField', 'ipblocks', 'ipb_allow_usertalk', 
'patch-ipb_allow_usertalk.sql' ],
 
// 1.15
-   [ 'doUniquePlTlIl' ],
[ 'addTable', 'change_tag', 'patch-change_tag.sql' ],
[ 'addTable', 'tag_summary', 'patch-tag_summary.sql' ],
[ 'addTable', 'valid_tag', 'patch-valid_tag.sql' ],
@@ -287,7 +286,8 @@
// 1.28
[ 'addIndex', 'recentchanges', 
'rc_name_type_patrolled_timestamp',

'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
-   [ 'doRevisionPageRevIndexNonUnique' ]
+   [ 'doRevisionPageRevIndexNonUnique' ],
+   [ 'doNonUniquePlTlIl' ],
];
}
 
@@ -974,24 +974,24 @@
return true;
}
 
-   protected function doUniquePlTlIl() {
+   protected function doNonUniquePlTlIl() {
$info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' );
-   if ( is_array( $info ) && !$info[0]->Non_unique ) {
-   $this->output( "...pl_namespace, tl_namespace, il_to 
indices are already UNIQUE.\n" );
+   if ( is_array( $info ) && $info[0]->Non_unique ) {
+   $this->output( "...pl_namespace, tl_namespace, il_to 
indices are already non-UNIQUE.\n" );
 
return true;
}
if ( $this->skipSchema ) {
$this->output( "...skipping schema change (making 
pl_namespace, tl_namespace " .
-   "and il_to indices UNIQUE).\n" );
+   "and il_to indices non-UNIQUE).\n" );
 
return false;
}
 
return $this->applyPatch(
-   'patch-pl-tl-il-unique.sql',
+   'patch-pl-tl-il-nonunique.sql',
false,
-   'Making pl_namespace, tl_namespace and il_to indices 
UNIQUE'
+   'Making pl_namespace, tl_namespace and il_to indices 
non-UNIQUE'
);
}
 
diff --git a/maintenance/archives/patch-pl-tl-il-nonunique.sql 
b/maintenance/archives/patch-pl-tl-il-nonunique.sql
new file mode 100644
index 000..8e1715b
--- /dev/null
+++ b/maintenance/archives/patch-pl-tl-il-nonunique.sql
@@ -0,0 +1,11 @@
+-- Make reorderings of UNIQUE indices non-UNIQUE
+-- Since 1.24, these indices have been non-UNIQUE in tables.sql.
+-- However, an earlier update from 1.15 that made the indices
+-- UNIQUE was not removed until 1.28 (T78513).
+
+DROP INDEX /*i*/pl_namespace ON /*_*/pagelinks;
+CREATE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, 
pl_from);
+DROP INDEX /*i*/tl_namespace ON /*_*/templatelinks;
+CREATE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, 
tl_from);
+DROP INDEX /*i*/il_to ON /*_*/imagelinks;
+CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to, il_from);
diff --git a/maintenance/archives/patch-pl-tl-il-unique.sql 
b/maintenance/archives/patch-pl-tl-il-unique.sql
deleted file mode 100644
index a356670..000
--- a/maintenance/archives/patch-pl-tl-il-unique.sql
+++ /dev/null
@@ -1,11 +0,0 @@
---
--- patch-pl-tl-il-unique-index.sql
---
--- Make reorderings of UNIQUE indices UNIQUE as well
-
-DROP INDEX /*i*/pl_namespace ON /*_*/pagelinks;
-CREATE UNIQUE INDEX /*i*/pl_namespace ON /*_*/pagelinks (pl_namespace, 
pl_title, pl_from);
-DROP INDEX /*i*/tl_namespace ON /*_*/templatelinks;
-CREATE UNIQUE INDEX /*i*/tl_namespace ON /*_*/templatelinks (tl_namespace, 
tl_title, tl_from);
-DROP INDEX /*i*/il_to ON /*_*/imagelinks;
-CREATE UNIQUE 

[MediaWiki-commits] [Gerrit] mediawiki...AzharAuth[master]: Don't unwrap database query result

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

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

Change subject: Don't unwrap database query result
..

Don't unwrap database query result

The code assumed that $res->result is a mysqli_result, instead of
calling the wrapper method numRows(). All it was doing, however,
was retrieving the first row, for which selectRow() can be used.

While at it, I also changed the queries to return most columns from
the user table, not just the ID, and made use of User::newFromRow()
rather than directly assigning to User object properties.

Change-Id: I3ca89e69ead65f54062ed9058a684fb6badee149
---
M AzharAuth.class.php
1 file changed, 11 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AzharAuth 
refs/changes/76/306876/1

diff --git a/AzharAuth.class.php b/AzharAuth.class.php
index 00df261..869457b 100644
--- a/AzharAuth.class.php
+++ b/AzharAuth.class.php
@@ -248,23 +248,19 @@
$dbr = wfGetDB( DB_SLAVE );
 
// Gets user by azhar.remoteUserId property
-$res = $dbr->select(
-   'user_properties',
-   'up_user',
+   $row = $dbr->selectRow(
+   array( 'user_properties', 'user' ),
+   User::selectFields(),
array(
'up_property' => 'azhar.remoteUserId',
'up_value' => $document->localUserId
),
-   __METHOD__
+   __METHOD__,
+   array(),
+   array( 'user' => array( 'INNER JOIN', 'up_user = 
user_id' ) )
);
-   if ( $res->result->num_rows > 0 ) {
-   foreach ( $res as $row ) {
-   break;
-   }
-   $user = new User();
-   $user->mId = $row->up_user;
-   $user->loadFromId();
-   return $user;
+   if ( $row ) {
+   return User::newFromRow( $row );
}
 
// Search by name
@@ -306,24 +302,15 @@
 */
private static function searchUser ( $property, $value ) {
$dbr = wfGetDB( DB_SLAVE );
-   $res = $dbr->select(
+   $row = $dbr->selectRow(
'user',
-   'user_id',
+   User::selectFields(),
array(
$property => $value
),
__METHOD__
);
-   if ( $res->result->num_rows == 0 ) {
-   return null;
-   }
-   foreach ( $res as $row ) {
-   break;
-   }
-   $user = new User();
-   $user->mId = $row->user_id;
-   $user->loadFromId();
-   return $user;
+   return $row ? User::newFromRow( $row ) : null;
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ca89e69ead65f54062ed9058a684fb6badee149
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AzharAuth
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Disuse and remove $wgRequestTime

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

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

Change subject: Disuse and remove $wgRequestTime
..

Disuse and remove $wgRequestTime

* In wfDebug(), used $_SERVER['REQUEST_TIME_FLOAT'] instead.
* In ApiFormatBase and MWDebug, used WebRequest::getElapsedTime() instead.
* Moved wfReportTime() into Skin, so it has access to the WebRequest object
  from the context and can also use that method. This is one way to avoid
  reintroducing T24852. (Any existing caller in an extension or skin will
  use the Skin object from the main context.)
* In WebStart.php, Maintenance.php, and rebuildFileCache.php, removed
  assignments to $wgRequestTime. I found no extensions that read its value.
* Fixed a bug I found in rebuildFileCache.php while testing this change.

Change-Id: I1b647da2862f815029caa533b592ec8a05b33806
---
M RELEASE-NOTES-1.28
M includes/GlobalFunctions.php
M includes/WebStart.php
M includes/api/ApiFormatBase.php
M includes/debug/MWDebug.php
M includes/skins/Skin.php
M includes/skins/SkinTemplate.php
M maintenance/Maintenance.php
M maintenance/rebuildFileCache.php
9 files changed, 36 insertions(+), 27 deletions(-)


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

diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28
index eb9bc17..e2c13a9 100644
--- a/RELEASE-NOTES-1.28
+++ b/RELEASE-NOTES-1.28
@@ -105,6 +105,8 @@
 * DifferenceEngine::generateDiffBody() was removed (deprecated since 1.21).
 * UploadBase::stashFileGetKey() and UploadBase::stashSession() were deprecated.
   Use ...->stashFile()->getFileKey() instead.
+* $wgRequestTime was removed (deprecated since 1.25). Use
+  $_SERVER['REQUEST_TIME_FLOAT'] or WebRequest::getElapsedTime() instead.
 
 == Compatibility ==
 
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 7117f4c..6430a20 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -996,7 +996,7 @@
  */
 function wfDebug( $text, $dest = 'all', array $context = [] ) {
global $wgDebugRawPage, $wgDebugLogPrefix;
-   global $wgDebugTimestamps, $wgRequestTime;
+   global $wgDebugTimestamps;
 
if ( !$wgDebugRawPage && wfIsDebugRawPage() ) {
return;
@@ -1007,7 +1007,7 @@
if ( $wgDebugTimestamps ) {
$context['seconds_elapsed'] = sprintf(
'%6.4f',
-   microtime( true ) - $wgRequestTime
+   microtime( true ) - $_SERVER['REQUEST_TIME_FLOAT']
);
$context['memory_used'] = sprintf(
'%5.1fM',
@@ -1481,17 +1481,12 @@
  * If $wgShowHostnames is true, the script will also set 'wgHostname' to the
  * hostname of the server handling the request.
  *
- * @return string
+ * @deprecated since 1.28; use Skin::getReportTime()
+ * @return WrappedString\WrappedString
  */
 function wfReportTime() {
-   global $wgRequestTime, $wgShowHostnames;
-
-   $responseTime = round( ( microtime( true ) - $wgRequestTime ) * 1000 );
-   $reportVars = [ 'wgBackendResponseTime' => $responseTime ];
-   if ( $wgShowHostnames ) {
-   $reportVars['wgHostname'] = wfHostname();
-   }
-   return Skin::makeVariablesScript( $reportVars );
+   wfDeprecated( __FUNCTION__, '1.28' );
+   return RequestContext::getMain()->getSkin()->getReportTime();
 }
 
 /**
diff --git a/includes/WebStart.php b/includes/WebStart.php
index d063ce3..b424245 100644
--- a/includes/WebStart.php
+++ b/includes/WebStart.php
@@ -35,13 +35,6 @@
 # points and when $wgOut gets disabled or overridden.
 header( 'X-Content-Type-Options: nosniff' );
 
-/**
- * @var float Request start time as fractional seconds since epoch
- * @deprecated since 1.25; use $_SERVER['REQUEST_TIME_FLOAT'] or
- *   WebRequest::getElapsedTime() instead.
- */
-$wgRequestTime = $_SERVER['REQUEST_TIME_FLOAT'];
-
 unset( $IP );
 
 # Valid web server entry point, enable includes.
diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php
index c826bba..6941538 100644
--- a/includes/api/ApiFormatBase.php
+++ b/includes/api/ApiFormatBase.php
@@ -222,7 +222,7 @@
 
if ( $this->getIsWrappedHtml() ) {
// This is a special output mode mainly 
intended for ApiSandbox use
-   $time = microtime( true ) - 
$this->getConfig()->get( 'RequestTime' );
+   $time = 
$this->getMain()->getRequest()->getElapsedTime();
$json = FormatJson::encode(
[
'html' => $out->getHTML(),
diff --git a/includes/debug/MWDebug.php b/includes/debug/MWDebug.php
index d90ef8a..6ddae65 100644
--- a/includes/debug/MWDebug.php
+++ b/includes/debug/MWDebug.php
@@ -531,7 +531,7 @@
   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: syncFileBackend.php: ellapsed => elapsed

2016-07-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: syncFileBackend.php: ellapsed => elapsed
..

syncFileBackend.php: ellapsed => elapsed

As in c099155a17d26f03 for copyFileBackend.php.

Change-Id: Ifbc0673ee092f782de654eeca636d3b1ec061ae7
---
M maintenance/syncFileBackend.php
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/maintenance/syncFileBackend.php b/maintenance/syncFileBackend.php
index 4a74322..82149a6 100644
--- a/maintenance/syncFileBackend.php
+++ b/maintenance/syncFileBackend.php
@@ -268,9 +268,9 @@
sleep( 10 ); // wait and retry copy again
$status = $dst->doQuickOperations( $ops, [ 
'bypassReadOnly' => 1 ] );
}
-   $ellapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
+   $elapsed_ms = floor( ( microtime( true ) - $t_start ) * 1000 );
if ( $status->isOK() && $this->getOption( 'verbose' ) ) {
-   $this->output( "Synchronized these file(s) 
[{$ellapsed_ms}ms]:\n" .
+   $this->output( "Synchronized these file(s) 
[{$elapsed_ms}ms]:\n" .
implode( "\n", $dPaths ) . "\n" );
}
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: SectionProfiler: Remove $profileOutCallback

2016-07-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: SectionProfiler: Remove $profileOutCallback
..

SectionProfiler: Remove $profileOutCallback

Unused since 626aede99bf83733.

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


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

diff --git a/includes/profiler/SectionProfiler.php 
b/includes/profiler/SectionProfiler.php
index 04ec841..65ac6e6 100644
--- a/includes/profiler/SectionProfiler.php
+++ b/includes/profiler/SectionProfiler.php
@@ -46,8 +46,6 @@
protected $collateOnly = true;
/** @var array Cache of a standard broken collation entry */
protected $errorEntry;
-   /** @var callable Cache of a profile out callback */
-   protected $profileOutCallback;
 
/**
 * @param array $params
@@ -55,9 +53,6 @@
public function __construct( array $params = [] ) {
$this->errorEntry = $this->getErrorEntry();
$this->collateOnly = empty( $params['trace'] );
-   $this->profileOutCallback = function ( $profiler, $section ) {
-   $profiler->profileOutInternal( $section );
-   };
}
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] LocalRepo::checkRedirect(): Fix use of __METHOD__ in closure - change (mediawiki/core)

2016-07-22 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: LocalRepo::checkRedirect(): Fix use of __METHOD__ in closure
..

LocalRepo::checkRedirect(): Fix use of __METHOD__ in closure

Change-Id: Ic8b4d2d54f1986fe4b52bc595221c9384389379b
---
M includes/filerepo/LocalRepo.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/300513/1

diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php
index eaec151..dede086 100644
--- a/includes/filerepo/LocalRepo.php
+++ b/includes/filerepo/LocalRepo.php
@@ -199,12 +199,12 @@
$expiry = 86400; // has invalidation, 1 day
}
 
-   $that = $this;
+   $method = __METHOD__;
$redirDbKey = 
ObjectCache::getMainWANInstance()->getWithSetCallback(
$memcKey,
$expiry,
-   function ( $oldValue, &$ttl, array &$setOpts ) use ( 
$that, $title ) {
-   $dbr = $that->getSlaveDB(); // possibly remote 
DB
+   function ( $oldValue, &$ttl, array &$setOpts ) use ( 
$method, $title ) {
+   $dbr = $this->getSlaveDB(); // possibly remote 
DB
 
$setOpts += Database::getCacheSetOptions( $dbr 
);
 
@@ -217,7 +217,7 @@
'page_title' => 
$title->getDBkey(),
'rd_from = page_id'
],
-   __METHOD__
+   $method
);
} else {
$row = false;

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

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

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


[MediaWiki-commits] [Gerrit] DumpStringOutput: Rename getOutput() to __toString() - change (mediawiki/core)

2016-07-14 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: DumpStringOutput: Rename getOutput() to __toString()
..

DumpStringOutput: Rename getOutput() to __toString()

Though getOutput() is what first came to mind, I do not particularly
like the name, partly because it is used in many, many places as a
method that returns an OutputPage object.

* Renamed the method to __toString(). This is appropriate because
  each instance, at any given time, corresponds to a single string
  value (and exceptions cannot occur during this conversion).
* Removed unnecessary variables from ApiQuery and ExportTest. In
  these and most other cases, it should no longer be necessary to
  call getOutput() explicitly.

Change-Id: Icf202743d1f332f8981338f42eb6e3e5a04abdf1
---
M includes/api/ApiQuery.php
M includes/export/DumpStringOutput.php
M tests/phpunit/includes/ExportTest.php
3 files changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/298944/1

diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php
index 1e91256..5eb86ab 100644
--- a/includes/api/ApiQuery.php
+++ b/includes/api/ApiQuery.php
@@ -450,7 +450,6 @@
$exporter->pageByTitle( $title );
}
$exporter->closeStream();
-   $exportxml = $sink->getOutput();
 
// Don't check the size of exported stuff
// It's not continuable, so it would cause more
@@ -458,10 +457,10 @@
if ( $this->mParams['exportnowrap'] ) {
$result->reset();
// Raw formatter will handle this
-   $result->addValue( null, 'text', $exportxml, 
ApiResult::NO_SIZE_CHECK );
+   $result->addValue( null, 'text', $sink, 
ApiResult::NO_SIZE_CHECK );
$result->addValue( null, 'mime', 'text/xml', 
ApiResult::NO_SIZE_CHECK );
} else {
-   $result->addValue( 'query', 'export', $exportxml, 
ApiResult::NO_SIZE_CHECK );
+   $result->addValue( 'query', 'export', $sink, 
ApiResult::NO_SIZE_CHECK );
$result->addValue( 'query', 
ApiResult::META_BC_SUBELEMENTS, [ 'export' ] );
}
}
diff --git a/includes/export/DumpStringOutput.php 
b/includes/export/DumpStringOutput.php
index 5168225..837a62d 100644
--- a/includes/export/DumpStringOutput.php
+++ b/includes/export/DumpStringOutput.php
@@ -39,7 +39,7 @@
 *
 * @return string
 */
-   public function getOutput() {
+   public function __toString() {
return $this->output;
}
 }
diff --git a/tests/phpunit/includes/ExportTest.php 
b/tests/phpunit/includes/ExportTest.php
index c077081..a5d3570 100644
--- a/tests/phpunit/includes/ExportTest.php
+++ b/tests/phpunit/includes/ExportTest.php
@@ -35,10 +35,9 @@
$exporter->openStream();
$exporter->pageByTitle( $title );
$exporter->closeStream();
-   $xmlString = $sink->getOutput();
 
// This throws error if invalid xml output
-   $xmlObject = simplexml_load_string( $xmlString );
+   $xmlObject = simplexml_load_string( $sink );
 
/**
 * Check namespaces match xml

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

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

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


[MediaWiki-commits] [Gerrit] Run generateLocalAutoload.php - change (mediawiki/core)

2016-07-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Run generateLocalAutoload.php
..

Run generateLocalAutoload.php

Follows-up ae0bae92afe0307d.

Change-Id: I5f7decd6a5279e941a7e1406dca77bbe37a1f3cb
---
M autoload.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/autoload.php b/autoload.php
index 8e214ce..8ff7771 100644
--- a/autoload.php
+++ b/autoload.php
@@ -21,6 +21,7 @@
'ApiAuthManagerHelper' => __DIR__ . 
'/includes/api/ApiAuthManagerHelper.php',
'ApiBase' => __DIR__ . '/includes/api/ApiBase.php',
'ApiBlock' => __DIR__ . '/includes/api/ApiBlock.php',
+   'ApiCSPReport' => __DIR__ . '/includes/api/ApiCSPReport.php',
'ApiChangeAuthenticationData' => __DIR__ . 
'/includes/api/ApiChangeAuthenticationData.php',
'ApiCheckToken' => __DIR__ . '/includes/api/ApiCheckToken.php',
'ApiClearHasMsg' => __DIR__ . '/includes/api/ApiClearHasMsg.php',
@@ -28,7 +29,6 @@
'ApiComparePages' => __DIR__ . '/includes/api/ApiComparePages.php',
'ApiContinuationManager' => __DIR__ . 
'/includes/api/ApiContinuationManager.php',
'ApiCreateAccount' => __DIR__ . '/includes/api/ApiCreateAccount.php',
-   'ApiCSPReport' => __DIR__ . '/includes/api/ApiCSPReport.php',
'ApiDelete' => __DIR__ . '/includes/api/ApiDelete.php',
'ApiDisabled' => __DIR__ . '/includes/api/ApiDisabled.php',
'ApiEditPage' => __DIR__ . '/includes/api/ApiEditPage.php',

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

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

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


[MediaWiki-commits] [Gerrit] ApiQuery: Don't mess with PHP output buffering - change (mediawiki/core)

2016-07-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: ApiQuery: Don't mess with PHP output buffering
..

ApiQuery: Don't mess with PHP output buffering

Specifically, it is not necessary to use output buffering functions
to capture XML generated by the export code because it is already
possible to set the "output sink" object to be used.

* Created a DumpStringOutput class, which appends all output to a
  string property rather than printing output immediately.
* Used that class, instead of ob_start() and ob_get_clean(), in
  ApiQuery and ExportTest.

Change-Id: I238f5d5ec7fd442c845b25cb59ef81ac3285099f
---
M autoload.php
M includes/api/ApiQuery.php
A includes/export/DumpStringOutput.php
M tests/phpunit/includes/ExportTest.php
4 files changed, 52 insertions(+), 7 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index 8e214ce..57da6a0 100644
--- a/autoload.php
+++ b/autoload.php
@@ -389,6 +389,7 @@
'DumpPipeOutput' => __DIR__ . '/includes/export/DumpPipeOutput.php',
'DumpRenderer' => __DIR__ . '/maintenance/renderDump.php',
'DumpRev' => __DIR__ . '/maintenance/storage/dumpRev.php',
+   'DumpStringOutput' => __DIR__ . '/includes/export/DumpStringOutput.php',
'DuplicateJob' => __DIR__ . '/includes/jobqueue/jobs/DuplicateJob.php',
'EditAction' => __DIR__ . '/includes/actions/EditAction.php',
'EditCLI' => __DIR__ . '/maintenance/edit.php',
diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php
index ed4d373..1e91256 100644
--- a/includes/api/ApiQuery.php
+++ b/includes/api/ApiQuery.php
@@ -443,16 +443,14 @@
}
 
$exporter = new WikiExporter( $this->getDB() );
-   // WikiExporter writes to stdout, so catch its
-   // output with an ob
-   ob_start();
+   $sink = new DumpStringOutput;
+   $exporter->setOutputSink( $sink );
$exporter->openStream();
foreach ( $exportTitles as $title ) {
$exporter->pageByTitle( $title );
}
$exporter->closeStream();
-   $exportxml = ob_get_contents();
-   ob_end_clean();
+   $exportxml = $sink->getOutput();
 
// Don't check the size of exported stuff
// It's not continuable, so it would cause more
diff --git a/includes/export/DumpStringOutput.php 
b/includes/export/DumpStringOutput.php
new file mode 100644
index 000..5168225
--- /dev/null
+++ b/includes/export/DumpStringOutput.php
@@ -0,0 +1,45 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup Dump
+ * @since 1.28
+ */
+class DumpStringOutput extends DumpOutput {
+   private $output = '';
+
+   /**
+* @param string $string
+*/
+   function write( $string ) {
+   $this->output .= $string;
+   }
+
+   /**
+* Get the string containing the output.
+*
+* @return string
+*/
+   public function getOutput() {
+   return $this->output;
+   }
+}
diff --git a/tests/phpunit/includes/ExportTest.php 
b/tests/phpunit/includes/ExportTest.php
index a2bb97a..c077081 100644
--- a/tests/phpunit/includes/ExportTest.php
+++ b/tests/phpunit/includes/ExportTest.php
@@ -30,11 +30,12 @@
 
$title = Title::newFromText( $pageTitle );
 
-   ob_start();
+   $sink = new DumpStringOutput;
+   $exporter->setOutputSink( $sink );
$exporter->openStream();
$exporter->pageByTitle( $title );
$exporter->closeStream();
-   $xmlString = ob_get_clean();
+   $xmlString = $sink->getOutput();
 
// This throws error if invalid xml output
$xmlObject = simplexml_load_string( $xmlString );

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

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

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


[MediaWiki-commits] [Gerrit] Fix handling of error messages from the 'SpecialPasswordRese... - change (mediawiki/core)

2016-06-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Fix handling of error messages from the 
'SpecialPasswordResetOnSubmit' hook
..

Fix handling of error messages from the 'SpecialPasswordResetOnSubmit' hook

$error might be an array of key + values, but wfMessage() treats that as
an array of alternative message keys instead so the values are lost.
Message::newFromSpecifier(), on the other hand, does exactly what we
want.

Change-Id: I25765869f6888ac793c2af9caaa9bbdf2224d51a
(cherry picked from commit b6487447463de476ad1b8bc0eff3d4972c9d44b8)
---
M includes/user/PasswordReset.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/includes/user/PasswordReset.php b/includes/user/PasswordReset.php
index 60144bb..bc87cd0 100644
--- a/includes/user/PasswordReset.php
+++ b/includes/user/PasswordReset.php
@@ -153,7 +153,7 @@
'Capture' => $displayPassword ? '1' : null,
];
if ( !Hooks::run( 'SpecialPasswordResetOnSubmit', [ &$users, 
$data, &$error ] ) ) {
-   return StatusValue::newFatal( wfMessage( $error ) );
+   return StatusValue::newFatal( 
Message::newFromSpecifier( $error ) );
}
 
if ( !$users ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25765869f6888ac793c2af9caaa9bbdf2224d51a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_27
Gerrit-Owner: PleaseStand 
Gerrit-Reviewer: Anomie 

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


[MediaWiki-commits] [Gerrit] RELEASE-NOTES: Don't imply that HHVM 3.1 is supported - change (mediawiki/core)

2016-06-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: RELEASE-NOTES: Don't imply that HHVM 3.1 is supported
..

RELEASE-NOTES: Don't imply that HHVM 3.1 is supported

HHVM 3.1 is no longer supported by Facebook, not packaged by any Linux
distribution I know of, and MediaWiki is not routinely tested with it
(e.g. neither Wikimedia Jenkins nor Travis CI runs automated tests
using HHVM 3.1).

The Compatibility section already has a note that "There is experimental
support for HHVM 3.6.5 or later." So instead just refer to that section.
(HHVM 3.6 is also no longer supported by Facebook or still used by
Wikimedia, as far as I know, though that's a separate matter.)

Change-Id: I62352f0edc6b9f95acaaef4cb717990e52db1146
---
M RELEASE-NOTES-1.27
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index c13be51..6c93676 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -6,8 +6,8 @@
 production.
 
 === PHP version requirement ===
-As of 1.27, MediaWiki now requires PHP 5.5.9 or higher. This corresponds with
-HHVM 3.1. Additionally, the following PHP extensions are required:
+As of 1.27, MediaWiki now requires PHP 5.5.9 or higher (see Compatibility
+section). Additionally, the following PHP extensions are required:
 * ctype
 * iconv
 * json

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

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

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


[MediaWiki-commits] [Gerrit] Remove "jshint evil:true" where not required - change (mediawiki/core)

2016-06-14 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove "jshint evil:true" where not required
..

Remove "jshint evil:true" where not required

* resources/src/startup.js: No more document.write() since
  d7905627fdc3b210.
* tests/qunit/data/testrunner.js: No more document.write()
  since 05f6edc903f81993, and the TestSwarm agent loading
  code was removed entirely in 0e9f24a169fdb9b9.

Change-Id: Iac61874e3ca04e1cad0d0fb2b7cebdc9fd4b237a
---
M resources/src/startup.js
M tests/qunit/data/testrunner.js
2 files changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/294423/1

diff --git a/resources/src/startup.js b/resources/src/startup.js
index 312e745..62ee94e 100644
--- a/resources/src/startup.js
+++ b/resources/src/startup.js
@@ -3,7 +3,7 @@
  *
  * This file is where we decide whether to initialise the modern run-time.
  */
-/*jshint unused: false, evil: true */
+/*jshint unused: false */
 /*globals mw, RLQ: true, NORLQ: true, $VARS, $CODE, performance */
 
 var mediaWikiLoadStart = ( new Date() ).getTime(),
diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js
index 1091d09..79f37dc 100644
--- a/tests/qunit/data/testrunner.js
+++ b/tests/qunit/data/testrunner.js
@@ -1,5 +1,4 @@
 /*global CompletenessTest, sinon */
-/*jshint evil: true */
 ( function ( $, mw, QUnit ) {
'use strict';
 

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

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

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


[MediaWiki-commits] [Gerrit] Maintenance: Use __DIR__ instead of dirname( __FILE__ ) - change (mediawiki/core)

2016-06-14 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Maintenance: Use __DIR__ instead of dirname( __FILE__ )
..

Maintenance: Use __DIR__ instead of dirname( __FILE__ )

dirname( __FILE__ ) was used because it worked in PHP 5.2, allowing
the version check to function correctly. However, Maintenance.php
now uses the short array syntax, which is a parse error before 5.4:

> Parse error: syntax error, unexpected '[' in maintenance/Maintenance.php
> on line 66

Change-Id: I3373a02c684bb6cbde83d7bedc204818f3394602
---
M maintenance/Maintenance.php
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/294413/1

diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index a08297a..27d8161 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -21,10 +21,8 @@
  */
 
 // Bail on old versions of PHP, or if composer has not been run yet to install
-// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
-// @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
-require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
-// @codingStandardsIgnoreEnd
+// dependencies.
+require_once __DIR__ . '/../includes/PHPVersionCheck.php';
 wfEntryPointCheck( 'cli' );
 
 /**

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

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

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


[MediaWiki-commits] [Gerrit] update.php: Don't check for mbstring extension - change (mediawiki/core)

2016-06-14 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: update.php: Don't check for mbstring extension
..

update.php: Don't check for mbstring extension

This check is redundant to the one in PHPVersionCheck.php.

Change-Id: I32ab259939ca7e93ad6d08f2c04406ad8a973b5d
---
M maintenance/update.php
1 file changed, 0 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/08/294408/1

diff --git a/maintenance/update.php b/maintenance/update.php
index 0103189..b96e7eb 100755
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -82,13 +82,6 @@
"ABORTING (see 
https://bugs.php.net/bug.php?id=45996).\n",
true );
}
-
-   if ( !function_exists( 'mb_strlen' ) ) {
-   $this->error(
-   "MediaWiki now requires the mbstring PHP 
extension, your system doesn't have it.\n"
-   . "ABORTING.\n",
-   true );
-   }
}
 
function execute() {

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

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

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


[MediaWiki-commits] [Gerrit] FormatMetadata: Use binary integer literals instead of bindec() - change (mediawiki/core)

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

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

Change subject: FormatMetadata: Use binary integer literals instead of bindec()
..

FormatMetadata: Use binary integer literals instead of bindec()

We can do this now that we have dropped support for PHP 5.3.

Change-Id: I1e78249e244105496e976bf01e35f4067410b2f0
---
M includes/media/FormatMetadata.php
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/294242/1

diff --git a/includes/media/FormatMetadata.php 
b/includes/media/FormatMetadata.php
index 5fbdcc7..78b0296 100644
--- a/includes/media/FormatMetadata.php
+++ b/includes/media/FormatMetadata.php
@@ -418,12 +418,12 @@
 
case 'Flash':
$flashDecode = [
-   'fired' => $val & 
bindec( '0001' ),
-   'return' => ( $val & 
bindec( '0110' ) ) >> 1,
-   'mode' => ( $val & 
bindec( '00011000' ) ) >> 3,
-   'function' => ( $val & 
bindec( '0010' ) ) >> 5,
-   'redeye' => ( $val & 
bindec( '0100' ) ) >> 6,
-   // 'reserved' => ( $val 
& bindec( '1000' ) ) >> 7,
+   'fired' => $val & 
0b0001,
+   'return' => ( $val & 
0b0110 ) >> 1,
+   'mode' => ( $val & 
0b00011000 ) >> 3,
+   'function' => ( $val & 
0b0010 ) >> 5,
+   'redeye' => ( $val & 
0b0100 ) >> 6,
+   // 'reserved' => ( $val 
& 0b1000 ) >> 7,
];
$flashMsgs = [];
# We do not need to handle 
unknown values since all are used.

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

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

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


[MediaWiki-commits] [Gerrit] IcuCollation: Remove null terminator from sort key if present - change (mediawiki/core)

2016-06-11 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: IcuCollation: Remove null terminator from sort key if present
..

IcuCollation: Remove null terminator from sort key if present

In PHP 5.3.15 and 5.4.5, there was a change to Collation::getSortKey().
Now, its return value now does not end with a null byte. A corresponding
change to HHVM was not made until May 2016. Thus, sort keys depended not
just on ICU library version but also on PHP/HHVM version (or PECL intl
version), which is undesirable.

* In getSortKey() and getPrimarySortKey(), trim off any null terminator.
* In the return value of fetchFirstLetterData(), use trimmed keys rather
  than untrimmed keys. Because each trimmed key sorts immediately above
  the corresponding untrimmed key, this should be fine; getFirstLetter()
  should still work as expected.
* Bump FIRST_LETTER_VERSION accordingly. Though the sort key format may
  mean this is not strictly necessary, it is implementation-defined,
  aside from the restriction that only the terminator is a null byte.
* As sort keys will change on some Wikimedia sites, add a migration flag
  to allow scheduling the necessary database updates separately from
  the next MediaWiki update.

Bug: T137642
Change-Id: I241e15985d4f81e2a9c2420dc7301c16e7788512
---
M RELEASE-NOTES-1.27
M includes/DefaultSettings.php
M includes/collation/IcuCollation.php
3 files changed, 50 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/293910/1

diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index c13be51..c7b006c 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -141,6 +141,10 @@
those via the web UI. Use UserLoggedIn if you need to do something on all
logins.
 ** $wgRequirePasswordforEmailChange is removed.
+* (T137642) If $wgCategoryCollation is set to a value other than "uppercase"
+  or "identity", and your site ran a PHP version older than 5.3.15 or 5.4.5,
+  or any version of HHVM, you should run maintenance/updateCollation.php
+  (with the --force option) after upgrading.
 
 === New features in 1.27 ===
 * $wgDataCenterUpdateStickTTL was also added. This decides how long a user
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 2607797..16c804c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -7328,6 +7328,27 @@
  */
 $wgCategoryCollation = 'uppercase';
 
+/**
+ * If the wiki uses a UCA collation, whether to append a null byte to each
+ * sort key.
+ *
+ * Because of a bug, some old versions of PHP's intl extension (including
+ * some versions of HHVM) return the sort key's null terminator as the
+ * last character of the string. Until 1.27, MediaWiki did not strip off
+ * that null byte, which made the sort key not merely dependent on ICU
+ * version, but also on PHP extension version. This has changed.
+ *
+ * This setting is a migration flag, intended for use on large wiki farms,
+ * to allow administrators to schedule the necessary database updates
+ * independently of each other and of MediaWiki updates. It will be
+ * removed in the next MediaWiki version.
+ *
+ * @deprecated since 1.27
+ * @since 1.27
+ * @see https://phabricator.wikimedia.org/T137642
+ */
+$wgAppendNullToUcaSortKeys = false;
+
 /** @} */ # End categories }
 
 /*//**
diff --git a/includes/collation/IcuCollation.php 
b/includes/collation/IcuCollation.php
index 27f917b..bfaf960 100644
--- a/includes/collation/IcuCollation.php
+++ b/includes/collation/IcuCollation.php
@@ -22,7 +22,7 @@
  * @since 1.16.3
  */
 class IcuCollation extends Collation {
-   const FIRST_LETTER_VERSION = 2;
+   const FIRST_LETTER_VERSION = 3;
 
/** @var Collator */
private $primaryCollator;
@@ -193,11 +193,27 @@
}
 
public function getSortKey( $string ) {
-   return $this->mainCollator->getSortKey( $string );
+   global $wgAppendNullToUcaSortKeys;
+
+   // Remove the null terminator byte if one is present
+   // https://github.com/facebook/hhvm/issues/7106
+   $sortKey = rtrim( $this->mainCollator->getSortKey( $string ), 
"\0" );
+   if ( $wgAppendNullToUcaSortKeys ) {
+   $sortKey .= "\0";
+   }
+   return $sortKey;
}
 
public function getPrimarySortKey( $string ) {
-   return $this->primaryCollator->getSortKey( $string );
+   global $wgAppendNullToUcaSortKeys;
+
+   // Remove the null terminator byte if one is present
+   // https://github.com/facebook/hhvm/issues/7106
+   $sortKey = rtrim( $this->primaryCollator->getSortKey( $string 
), "\0" );
+   if ( $wgAppendNullToUcaSortKeys ) {
+  

[MediaWiki-commits] [Gerrit] Remove checks formerly for MySQL server version - change (mediawiki/core)

2016-05-23 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove checks formerly for MySQL server version
..

Remove checks formerly for MySQL server version

Originally:
* In initEditCount.php, --background was the default when at least
  one slave DB is configured or when the MySQL version was older
  than 4.1. Otherwise, --quick would be assumed.
* In fixBug20757.php, slightly different SQL would be used
  depending on whether MySQL 4.0 or 4.1 was in use. The script
  did not, and still does not, support non-MySQL DB types.

Now:
* In initEditCount.php, --background is the default not only when
  there is a configured slave DB, but also when the deprecated
  mysql PHP extension is used (through DatabaseMysql) instead of
  the newer mysqli extension.
* In fixBug20757.php, $lowerLeft is defined when MySQL is in use,
  yet left undefined for other (unsupported) DB types.

Both checks are unnecessary and can be removed.

Follows-up b74f88967bf090af.

Change-Id: I7f32aed4473e5ea39dc40449ddc0af5f9a10df16
---
M maintenance/initEditCount.php
M maintenance/storage/fixBug20757.php
2 files changed, 5 insertions(+), 10 deletions(-)


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

diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php
index c219b9b..50a4018 100644
--- a/maintenance/initEditCount.php
+++ b/maintenance/initEditCount.php
@@ -32,8 +32,7 @@
avoids locking tables or lagging slaves with large updates;
calculates counts on a slave if possible.
 
-Background mode will be automatically used if the server is MySQL 4.0
-(which does not support subqueries) or if multiple servers are listed
+Background mode will be automatically used if multiple servers are listed
 in the load balancer, usually indicating a replication environment.' );
$this->addDescription( 'Batch-recalculate user_editcount fields 
from the revision table' );
}
@@ -46,13 +45,12 @@
$dbver = $dbw->getServerVersion();
 
// Autodetect mode...
-   $backgroundMode = wfGetLB()->getServerCount() > 1 ||
-   ( $dbw instanceof DatabaseMysql );
-
if ( $this->hasOption( 'background' ) ) {
$backgroundMode = true;
} elseif ( $this->hasOption( 'quick' ) ) {
$backgroundMode = false;
+   } else {
+   $backgroundMode = wfGetLB()->getServerCount() > 1;
}
 
if ( $backgroundMode ) {
@@ -96,7 +94,6 @@
wfWaitForSlaves();
}
} else {
-   // Subselect should work on modern MySQLs etc
$this->output( "Using single-query mode...\n" );
$sql = "UPDATE $user SET user_editcount=(SELECT 
COUNT(*) FROM $revision WHERE rev_user=user_id)";
$dbw->query( $sql );
diff --git a/maintenance/storage/fixBug20757.php 
b/maintenance/storage/fixBug20757.php
index 0ea52ca..94335cf 100644
--- a/maintenance/storage/fixBug20757.php
+++ b/maintenance/storage/fixBug20757.php
@@ -57,10 +57,8 @@
 
$totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, 
__METHOD__ );
 
-   if ( $dbr->getType() == 'mysql' ) {
-   // In MySQL 4.1+, the binary field old_text has a 
non-working LOWER() function
-   $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING 
latin1))';
-   }
+   // In MySQL 4.1+, the binary field old_text has a non-working 
LOWER() function
+   $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))';
 
while ( true ) {
print "ID: $startId / $totalRevs\r";

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

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

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


[MediaWiki-commits] [Gerrit] SpaceyParenthesisSniff: Don't remove last argument or array ... - change (mediawiki...codesniffer)

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

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

Change subject: SpaceyParenthesisSniff: Don't remove last argument or array 
element
..

SpaceyParenthesisSniff: Don't remove last argument or array element

Since ed6dc365286a1c4c, to allow fixing errors involving multiple existing
spaces, the token immediately preceding the closing parenthesis or bracket
is replaced with a single space. This is incorrect (and damages code) when
that token is not whitespace, so make it conditional on token type.

Though I don't know the specifics, the sniff's code appears to account for
at least some cases of multiple consecutive whitespace tokens. Further
adjustment may be necessary to handle those cases entirely correctly.

Bug: T134857
Change-Id: I3dca4c37e178760a326d771c213850dead4b2bd9
---
M MediaWiki/Sniffs/WhiteSpace/SpaceyParenthesisSniff.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer 
refs/changes/43/288043/1

diff --git a/MediaWiki/Sniffs/WhiteSpace/SpaceyParenthesisSniff.php 
b/MediaWiki/Sniffs/WhiteSpace/SpaceyParenthesisSniff.php
index eafb60a..7e2ab83 100644
--- a/MediaWiki/Sniffs/WhiteSpace/SpaceyParenthesisSniff.php
+++ b/MediaWiki/Sniffs/WhiteSpace/SpaceyParenthesisSniff.php
@@ -155,7 +155,11 @@
'SingleSpaceBeforeCloseParenthesis'
);
if ( $fix === true ) {
-   $phpcsFile->fixer->replaceToken( $stackPtr - 1, ' ' );
+   if ( $previousToken['code'] === T_WHITESPACE ) {
+   $phpcsFile->fixer->replaceToken( $stackPtr - 1, 
' ' );
+   } else {
+   $phpcsFile->fixer->addContentBefore( $stackPtr, 
' ' );
+   }
}
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dca4c37e178760a326d771c213850dead4b2bd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Fix mbstring check in update.php - change (mediawiki/core)

2016-04-07 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Fix mbstring check in update.php
..

Fix mbstring check in update.php

Maintenance::error() will not cause the script to exit unless the
$die argument, when cast as an integer, is greater than 0. Since
the default value is 0, specify a different one, as in the other
calls from within the same function.

Follows-up 943563062f0a6995.

Change-Id: I3af72b1cd87c63d7f57436866633e86c272e904f
---
M maintenance/update.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/maintenance/update.php b/maintenance/update.php
index e487449..775fa7b 100755
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -87,7 +87,8 @@
if ( !function_exists( 'mb_strlen' ) ) {
$this->error(
"MediaWiki now requires the mbstring PHP 
extension, your system doesn't have it.\n"
-   . "ABORTING.\n" );
+   . "ABORTING.\n",
+   true );
}
}
 

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

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

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


[MediaWiki-commits] [Gerrit] Clean up after "Kill mbstring fallbacks" - change (mediawiki/core)

2016-04-07 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Clean up after "Kill mbstring fallbacks"
..

Clean up after "Kill mbstring fallbacks"

* Removed fallback code from Language, the associated data file
  (Utf8Case.ser), and the code to generate that data file.
* Removed comment in LanguageFi that "mb_substr has a compatibility
  function in GlobalFunctions.php".
* Removed check for mbstring in bench_utf8_title_check.php.
* In the tests for StringUtils::isUtf8():
  * Removed separate test for the non-mbstring code path.
  * Removed mentions of mbstring from function names and assertion
messages, since mb_check_encoding() is now always used.
* Also updated the comment in StringUtils::isUtf8() referring to
  PHP 5.3, which is no longer supported in MediaWiki, to indicate
  that the same issue also exists in old versions of HHVM. (If
  we don't have to support 3.4 or older, then the function could
  be deprecated and removed if desired.)

Follows-up 943563062f0a6995.

Change-Id: I55e5cd534b849c6ea06a7fadacbbf34a12d87ebe
---
M autoload.php
M includes/libs/StringUtils.php
M languages/Language.php
M languages/classes/LanguageFi.php
M maintenance/benchmarks/bench_utf8_title_check.php
D maintenance/language/generateUtf8Case.php
M serialized/Makefile
D serialized/Utf8Case.ser
M tests/phpunit/includes/libs/StringUtilsTest.php
9 files changed, 34 insertions(+), 292 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/52/282152/1

diff --git a/autoload.php b/autoload.php
index 7667035..e757491 100644
--- a/autoload.php
+++ b/autoload.php
@@ -489,7 +489,6 @@
'GenerateNormalizerDataAr' => __DIR__ . 
'/maintenance/language/generateNormalizerDataAr.php',
'GenerateNormalizerDataMl' => __DIR__ . 
'/maintenance/language/generateNormalizerDataMl.php',
'GenerateSitemap' => __DIR__ . '/maintenance/generateSitemap.php',
-   'GenerateUtf8Case' => __DIR__ . 
'/maintenance/language/generateUtf8Case.php',
'GenericArrayObject' => __DIR__ . 
'/includes/libs/GenericArrayObject.php',
'GetConfiguration' => __DIR__ . '/maintenance/getConfiguration.php',
'GetLagTimes' => __DIR__ . '/maintenance/getLagTimes.php',
diff --git a/includes/libs/StringUtils.php b/includes/libs/StringUtils.php
index 2af3868..6b10c09 100644
--- a/includes/libs/StringUtils.php
+++ b/includes/libs/StringUtils.php
@@ -41,8 +41,10 @@
static function isUtf8( $value ) {
$value = (string)$value;
 
-   // Before PHP 5.4, values above U+10 are incorrectly 
allowed, so we have to
-   // check for them separately.
+   // HHVM 3.4 and older come with an outdated version of libmbfl 
that
+   // incorrectly allows values above U+10, so we have to check
+   // for them separately. (This issue also exists in PHP 5.3 and
+   // older, which are no longer supported.)
static $newPHP;
if ( $newPHP === null ) {
$newPHP = !mb_check_encoding( "\xf4\x90\x80\x80", 
'UTF-8' );
diff --git a/languages/Language.php b/languages/Language.php
index f13f9d6..80aacb5 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -30,9 +30,7 @@
exit( 1 );
 }
 
-if ( function_exists( 'mb_strtoupper' ) ) {
-   mb_internal_encoding( 'UTF-8' );
-}
+mb_internal_encoding( 'UTF-8' );
 
 use CLDRPluralRuleParser\Evaluator;
 
@@ -2592,7 +2590,7 @@
return $text;
}
 
-   // callback functions for uc(), lc(), ucwords(), ucwordbreaks()
+   // callback functions for ucwords(), ucwordbreaks()
 
/**
 * @param array $matches
@@ -2614,35 +2612,8 @@
 * @param array $matches
 * @return string
 */
-   function ucCallback( $matches ) {
-   list( $wikiUpperChars ) = self::getCaseMaps();
-   return strtr( $matches[1], $wikiUpperChars );
-   }
-
-   /**
-* @param array $matches
-* @return string
-*/
-   function lcCallback( $matches ) {
-   list( , $wikiLowerChars ) = self::getCaseMaps();
-   return strtr( $matches[1], $wikiLowerChars );
-   }
-
-   /**
-* @param array $matches
-* @return string
-*/
function ucwordsCallbackMB( $matches ) {
return mb_strtoupper( $matches[0] );
-   }
-
-   /**
-* @param array $matches
-* @return string
-*/
-   function ucwordsCallbackWiki( $matches ) {
-   list( $wikiUpperChars ) = self::getCaseMaps();
-   return strtr( $matches[0], $wikiUpperChars );
}
 
/**
@@ -2673,27 +2644,14 @@
 * @return string
 */
function uc( $str, $first = false ) {
-   if ( function_exists( 'mb_strtoupper' ) 

[MediaWiki-commits] [Gerrit] Run generateLocalAutoload.php - change (mediawiki/core)

2016-04-03 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Run generateLocalAutoload.php
..

Run generateLocalAutoload.php

Change-Id: I618f831f5c33d0163b873dd0494cc37799450001
---
M autoload.php
1 file changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index fd4f873..0056920 100644
--- a/autoload.php
+++ b/autoload.php
@@ -719,8 +719,7 @@
'LocalRepo' => __DIR__ . '/includes/filerepo/LocalRepo.php',
'LocalSettingsGenerator' => __DIR__ . 
'/includes/installer/LocalSettingsGenerator.php',
'LocalisationCache' => __DIR__ . 
'/includes/cache/localisation/LocalisationCache.php',
-   'LocalisationCacheBulkLoad' => __DIR__ .
-   '/includes/cache/localisation/LocalisationCacheBulkLoad.php',
+   'LocalisationCacheBulkLoad' => __DIR__ . 
'/includes/cache/localisation/LocalisationCacheBulkLoad.php',
'LockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/LockManager.php',
'LockManagerGroup' => __DIR__ . 
'/includes/filebackend/lockmanager/LockManagerGroup.php',
'LogEntry' => __DIR__ . '/includes/logging/LogEntry.php',
@@ -780,7 +779,6 @@
'MediaWikiSite' => __DIR__ . '/includes/site/MediaWikiSite.php',
'MediaWikiTitleCodec' => __DIR__ . 
'/includes/title/MediaWikiTitleCodec.php',
'MediaWikiVersionFetcher' => __DIR__ . 
'/includes/MediaWikiVersionFetcher.php',
-   'MediaWiki\\MediaWikiServices' => __DIR__ . 
'/includes/MediaWikiServices.php',
'MediaWiki\\Languages\\Data\\Names' => __DIR__ . 
'/languages/data/Names.php',
'MediaWiki\\Languages\\Data\\ZhConversion' => __DIR__ . 
'/languages/data/ZhConversion.php',
'MediaWiki\\Logger\\LegacyLogger' => __DIR__ . 
'/includes/debug/logger/LegacyLogger.php',
@@ -797,6 +795,7 @@
'MediaWiki\\Logger\\Monolog\\WikiProcessor' => __DIR__ . 
'/includes/debug/logger/monolog/WikiProcessor.php',
'MediaWiki\\Logger\\NullSpi' => __DIR__ . 
'/includes/debug/logger/NullSpi.php',
'MediaWiki\\Logger\\Spi' => __DIR__ . '/includes/debug/logger/Spi.php',
+   'MediaWiki\\MediaWikiServices' => __DIR__ . 
'/includes/MediaWikiServices.php',
'MediaWiki\\Services\\ServiceContainer' => __DIR__ . 
'/includes/Services/ServiceContainer.php',
'MediaWiki\\Session\\BotPasswordSessionProvider' => __DIR__ . 
'/includes/session/BotPasswordSessionProvider.php',
'MediaWiki\\Session\\CookieSessionProvider' => __DIR__ . 
'/includes/session/CookieSessionProvider.php',
@@ -1269,8 +1268,8 @@
'SquidPurgeClientPool' => __DIR__ . 
'/includes/clientpool/SquidPurgeClientPool.php',
'SquidUpdate' => __DIR__ . '/includes/deferred/CdnCacheUpdate.php',
'SrConverter' => __DIR__ . '/languages/classes/LanguageSr.php',
-   'StatsdAwareInterface' => __DIR__ . 
'/includes/libs/stats/StatsdAwareInterface.php',
'StatsOutput' => __DIR__ . '/maintenance/language/StatOutputs.php',
+   'StatsdAwareInterface' => __DIR__ . 
'/includes/libs/stats/StatsdAwareInterface.php',
'Status' => __DIR__ . '/includes/Status.php',
'StatusValue' => __DIR__ . '/includes/libs/StatusValue.php',
'StorageTypeStats' => __DIR__ . 
'/maintenance/storage/storageTypeStats.php',

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

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

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


[MediaWiki-commits] [Gerrit] Revert "Split ClassCollector class into own file" - change (mediawiki/core)

2016-04-03 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Revert "Split ClassCollector class into own file"
..

Revert "Split ClassCollector class into own file"

The AutoloadGenerator class is instantiated in the script
maintenance/generateLocalAutoload.php and its equivalents in
several extensions, none of which use MediaWiki's AutoLoader,
so you get a "Fatal error: Class 'ClassCollector' not found".

This reverts commit a379bebd03099ee056a5ae7466f0699423064ede.

Change-Id: Ia6a7a1cb8a593ac86ecffdb690064e0b8ad68b47
---
M autoload.php
M includes/utils/AutoloadGenerator.php
D includes/utils/ClassCollector.php
3 files changed, 115 insertions(+), 116 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index 67a235f..fd4f873 100644
--- a/autoload.php
+++ b/autoload.php
@@ -230,7 +230,7 @@
'CheckSyntax' => __DIR__ . '/maintenance/checkSyntax.php',
'CheckUsernames' => __DIR__ . '/maintenance/checkUsernames.php',
'ChronologyProtector' => __DIR__ . 
'/includes/db/ChronologyProtector.php',
-   'ClassCollector' => __DIR__ . '/includes/utils/ClassCollector.php',
+   'ClassCollector' => __DIR__ . '/includes/utils/AutoloadGenerator.php',
'CleanupAncientTables' => __DIR__ . 
'/maintenance/cleanupAncientTables.php',
'CleanupBlocks' => __DIR__ . '/maintenance/cleanupBlocks.php',
'CleanupPreferences' => __DIR__ . '/maintenance/cleanupPreferences.php',
diff --git a/includes/utils/AutoloadGenerator.php 
b/includes/utils/AutoloadGenerator.php
index 4101879..916e2f8 100644
--- a/includes/utils/AutoloadGenerator.php
+++ b/includes/utils/AutoloadGenerator.php
@@ -250,3 +250,117 @@
return str_replace( '\\', '/', $path );
}
 }
+
+/**
+ * Reads PHP code and returns the FQCN of every class defined within it.
+ */
+class ClassCollector {
+
+   /**
+* @var string Current namespace
+*/
+   protected $namespace = '';
+
+   /**
+* @var array List of FQCN detected in this pass
+*/
+   protected $classes;
+
+   /**
+* @var array Token from token_get_all() that started an expect sequence
+*/
+   protected $startToken;
+
+   /**
+* @var array List of tokens that are members of the current expect 
sequence
+*/
+   protected $tokens;
+
+   /**
+* @var string $code PHP code (including namespace = '';
+   $this->classes = [];
+   $this->startToken = null;
+   $this->tokens = [];
+
+   foreach ( token_get_all( $code ) as $token ) {
+   if ( $this->startToken === null ) {
+   $this->tryBeginExpect( $token );
+   } else {
+   $this->tryEndExpect( $token );
+   }
+   }
+
+   return $this->classes;
+   }
+
+   /**
+* Determine if $token begins the next expect sequence.
+*
+* @param array $token
+*/
+   protected function tryBeginExpect( $token ) {
+   if ( is_string( $token ) ) {
+   return;
+   }
+   switch ( $token[0] ) {
+   case T_NAMESPACE:
+   case T_CLASS:
+   case T_INTERFACE:
+   case T_TRAIT:
+   case T_DOUBLE_COLON:
+   $this->startToken = $token;
+   }
+   }
+
+   /**
+* Accepts the next token in an expect sequence
+*
+* @param array
+*/
+   protected function tryEndExpect( $token ) {
+   switch ( $this->startToken[0] ) {
+   case T_DOUBLE_COLON:
+   // Skip over T_CLASS after T_DOUBLE_COLON because this 
is something like
+   // "self::static" which accesses the class name. It 
doens't define a new class.
+   $this->startToken = null;
+   break;
+   case T_NAMESPACE:
+   if ( $token === ';' || $token === '{' ) {
+   $this->namespace = $this->implodeTokens() . 
'\\';
+   } else {
+   $this->tokens[] = $token;
+   }
+   break;
+
+   case T_CLASS:
+   case T_INTERFACE:
+   case T_TRAIT:
+   $this->tokens[] = $token;
+   if ( is_array( $token ) && $token[0] === T_STRING ) {
+   $this->classes[] = $this->namespace . 
$this->implodeTokens();
+   }
+   }
+   }
+
+   /**
+* Returns the string representation of the tokens within the
+* 

[MediaWiki-commits] [Gerrit] Replace create_function() with a closure - change (mediawiki/core)

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

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

Change subject: Replace create_function() with a closure
..

Replace create_function() with a closure

As in rEFLW266da0fb89ec4ae57f1f0cf1e973ad2ab8a5ace2.

Change-Id: I0f6a38761cf1fa2956dad0f44fa023e1a8855df4
---
M maintenance/dumpBackup.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/276640/1

diff --git a/maintenance/dumpBackup.php b/maintenance/dumpBackup.php
index 1904325..1824092 100644
--- a/maintenance/dumpBackup.php
+++ b/maintenance/dumpBackup.php
@@ -102,7 +102,7 @@
$this->fatalError( "Unable to open file 
{$filename}\n" );
}
$pages = array_map( 'trim', $pages );
-   $this->pages = array_filter( $pages, create_function( 
'$x', 'return $x !== "";' ) );
+   $this->pages = array_filter( $pages, function ( $x ) { 
return $x !== ''; } );
}
 
if ( $this->hasOption( 'start' ) ) {

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

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

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


[MediaWiki-commits] [Gerrit] Clean up XCFHandler::getImageSize() - change (mediawiki/core)

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

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

Change subject: Clean up XCFHandler::getImageSize()
..

Clean up XCFHandler::getImageSize()

No change in behavior:

* Moved setting of array elements into the initializer.
* Replaced sprintf() with variable interpolation.
* Removed a pointless assertion.

Change-Id: Ie77d26c80d592911b33bc544f831c4d34cc47d0e
---
M includes/media/XCF.php
1 file changed, 9 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/276470/1

diff --git a/includes/media/XCF.php b/includes/media/XCF.php
index f8fa252..526b45e 100644
--- a/includes/media/XCF.php
+++ b/includes/media/XCF.php
@@ -68,21 +68,15 @@
 
# Forge a return array containing metadata information just 
like getimagesize()
# See PHP documentation at: http://www.php.net/getimagesize
-   $metadata = [];
-   $metadata[0] = $header['width'];
-   $metadata[1] = $header['height'];
-   $metadata[2] = null; # IMAGETYPE constant, none exist for XCF.
-   $metadata[3] = sprintf(
-   'height="%s" width="%s"', $header['height'], 
$header['width']
-   );
-   $metadata['mime'] = 'image/x-xcf';
-   $metadata['channels'] = null;
-   $metadata['bits'] = 8; # Always 8-bits per color
-
-   assert( '7 == count($metadata); ' .
-   '# return array must contains 7 elements just like 
getimagesize() return' );
-
-   return $metadata;
+   return [
+   0 => $header['width'],
+   1 => $header['height'],
+   2 => null, # IMAGETYPE constant, none exist for XCF.
+   3 => "height=\"{$header['height']}\" 
width=\"{$header['width']}\"",
+   'mime' => 'image/x-xcf',
+   'channels' => null,
+   'bits' => 8, # Always 8-bits per color
+   ];
}
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] MovePage: When changing cl_type, update category counts - change (mediawiki/core)

2016-03-02 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: MovePage: When changing cl_type, update category counts
..

MovePage: When changing cl_type, update category counts

As part of this, I added getCategoryLinkType() methods to both
MWNamespace and Title, and used the new Title method in a few
places, to avoid code duplication.

Follows-up e0ff770adee0695b.

Change-Id: Ia45a53ede8f580ffa57aae3b4fe4ebf26377d5f1
---
M includes/MWNamespace.php
M includes/MovePage.php
M includes/Title.php
M includes/deferred/LinksUpdate.php
M maintenance/updateCollation.php
5 files changed, 55 insertions(+), 21 deletions(-)


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

diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php
index 61e34ee..fc00792 100644
--- a/includes/MWNamespace.php
+++ b/includes/MWNamespace.php
@@ -509,4 +509,26 @@
 
return $usableLevels;
}
+
+   /**
+* Returns the link type to be used for categories.
+*
+* This determines which section of a category page titles
+* in the namespace will appear within.
+*
+* @since 1.27
+* @param int $index Namespace index
+* @return string One of 'subcat', 'file', 'page'
+*/
+   public static function getCategoryLinkType( $index ) {
+   self::isMethodValidFor( $index, __METHOD__ );
+
+   if ( $index == NS_CATEGORY ) {
+   return 'subcat';
+   } elseif ( $index == NS_FILE ) {
+   return 'file';
+   } else {
+   return 'page';
+   }
+   }
 }
diff --git a/includes/MovePage.php b/includes/MovePage.php
index afa4e1c..dbfd357 100644
--- a/includes/MovePage.php
+++ b/includes/MovePage.php
@@ -267,13 +267,8 @@
[ 'cl_from' => $pageid ],
__METHOD__
);
-   if ( $this->newTitle->getNamespace() == NS_CATEGORY ) {
-   $type = 'subcat';
-   } elseif ( $this->newTitle->getNamespace() == NS_FILE ) {
-   $type = 'file';
-   } else {
-   $type = 'page';
-   }
+   $type = $this->newTitle->getCategoryLinkType();
+   $catTitles = [];
foreach ( $prefixes as $prefixRow ) {
$prefix = $prefixRow->cl_sortkey_prefix;
$catTo = $prefixRow->cl_to;
@@ -289,6 +284,22 @@
'cl_to' => $catTo ],
__METHOD__
);
+
+   $catTitles[] = $catTo;
+   }
+
+   // Also update the category counts if necessary to reflect
+   // a change in the cl_type value for this page.
+   $oldType = $this->oldTitle->getCategoryLinkType();
+   if ( $catTitles && $type !== $oldType ) {
+   $set = [];
+   if ( $oldType !== 'page' ) {
+   $set[] = "cat_{$oldType}s = cat_{$oldType}s - 
1";
+   }
+   if ( $type !== 'page' ) {
+   $set[] = "cat_{$type}s = cat_{$type}s + 1";
+   }
+   $dbw->update( 'category', $set, [ 'cat_title' => 
$catTitles ], __METHOD__ );
}
 
$redirid = $this->oldTitle->getArticleID();
diff --git a/includes/Title.php b/includes/Title.php
index c0ec97f..15dd7b6 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -4590,6 +4590,19 @@
}
 
/**
+* Returns the link type to be used for categories.
+*
+* This determines which section of a category page this title
+* will appear within.
+*
+* @since 1.27
+* @return string One of 'subcat', 'file', 'page'
+*/
+   public function getCategoryLinkType() {
+   return MWNamespace::getCategoryLinkType( $this->mNamespace );
+   }
+
+   /**
 * Returns the raw sort key to be used for categories, with the 
specified
 * prefix.  This will be fed to Collation::getSortKey() to get a
 * binary sortkey that can be used for actual sorting.
diff --git a/includes/deferred/LinksUpdate.php 
b/includes/deferred/LinksUpdate.php
index 4215ed0..f783846 100644
--- a/includes/deferred/LinksUpdate.php
+++ b/includes/deferred/LinksUpdate.php
@@ -451,13 +451,7 @@
$nt = Title::makeTitleSafe( NS_CATEGORY, $name );
$wgContLang->findVariantLink( $name, $nt, true );
 
-   if ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
-   $type = 'subcat';
- 

[MediaWiki-commits] [Gerrit] Use hex2bin() instead of pack() - change (mediawiki/core)

2016-02-19 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Use hex2bin() instead of pack()
..

Use hex2bin() instead of pack()

This function was added in PHP 5.4.0 and can be used now that MediaWiki
only works with PHP 5.5.9 or higher.

Also fixed a bug in ApiQueryCategoryMembers::validateHexSortkey() that
allowed a single line feed at the end of the string to pass.

Change-Id: I5b577e7dcc5fb6a06ab550429aae657dbcc79083
---
M includes/api/ApiQueryCategoryMembers.php
M tests/phpunit/includes/utils/MWCryptHKDFTest.php
M tests/phpunit/includes/utils/MWCryptHashTest.php
3 files changed, 10 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/271944/1

diff --git a/includes/api/ApiQueryCategoryMembers.php 
b/includes/api/ApiQueryCategoryMembers.php
index ef455b4..0f59ea6 100644
--- a/includes/api/ApiQueryCategoryMembers.php
+++ b/includes/api/ApiQueryCategoryMembers.php
@@ -53,7 +53,7 @@
 */
private function validateHexSortkey( $hexSortkey ) {
// A hex sortkey has an unbound number of 2 letter pairs
-   return preg_match( '/^(?:[a-fA-F0-9]{2})*$/', $hexSortkey );
+   return strlen( $hexSortkey ) & 1 == 0 && ctype_xdigit( 
$hexSortkey );
}
 
/**
@@ -138,8 +138,7 @@
 
// Add a WHERE clause for sortkey and from
$this->dieContinueUsageIf( 
!$this->validateHexSortkey( $cont[1] ) );
-   // pack( "H*", $foo ) is used to convert hex 
back to binary
-   $escSortkey = $this->getDB()->addQuotes( pack( 
'H*', $cont[1] ) );
+   $escSortkey = $this->getDB()->addQuotes( 
hex2bin( $cont[1] ) );
$from = intval( $cont[2] );
$op = $dir == 'newer' ? '>' : '<';
// $contWhere is used further down
@@ -156,7 +155,7 @@
if ( !$this->validateHexSortkey( 
$params['starthexsortkey'] ) ) {
$this->dieUsage( 'The 
starthexsortkey provided is not valid', 'bad_starthexsortkey' );
}
-   $startsortkey = pack( 'H*', 
$params['starthexsortkey'] );
+   $startsortkey = hex2bin( 
$params['starthexsortkey'] );
} else {
$startsortkey = $params['startsortkey'];
}
@@ -166,7 +165,7 @@
if ( !$this->validateHexSortkey( 
$params['endhexsortkey'] ) ) {
$this->dieUsage( 'The 
endhexsortkey provided is not valid', 'bad_endhexsortkey' );
}
-   $endsortkey = pack( 'H*', 
$params['endhexsortkey'] );
+   $endsortkey = hex2bin( 
$params['endhexsortkey'] );
} else {
$endsortkey = $params['endsortkey'];
}
diff --git a/tests/phpunit/includes/utils/MWCryptHKDFTest.php 
b/tests/phpunit/includes/utils/MWCryptHKDFTest.php
index 5dc0498..17442b8 100644
--- a/tests/phpunit/includes/utils/MWCryptHKDFTest.php
+++ b/tests/phpunit/includes/utils/MWCryptHKDFTest.php
@@ -28,10 +28,10 @@
 * @dataProvider providerRfc5869
 */
public function testRfc5869( $hash, $ikm, $salt, $info, $L, $prk, $okm 
) {
-   $ikm = pack( 'H*', $ikm );
-   $salt = pack( 'H*', $salt );
-   $info = pack( 'H*', $info );
-   $okm = pack( 'H*', $okm );
+   $ikm = hex2bin( $ikm );
+   $salt = hex2bin( $salt );
+   $info = hex2bin( $info );
+   $okm = hex2bin( $okm );
$result = MWCryptHKDF::HKDF( $hash, $ikm, $salt, $info, $L );
$this->assertEquals( $okm, $result );
}
diff --git a/tests/phpunit/includes/utils/MWCryptHashTest.php 
b/tests/phpunit/includes/utils/MWCryptHashTest.php
index ad54e2f..4c85c3d 100644
--- a/tests/phpunit/includes/utils/MWCryptHashTest.php
+++ b/tests/phpunit/includes/utils/MWCryptHashTest.php
@@ -26,7 +26,7 @@
// @codingStandardsIgnoreEnd
 
$this->assertEquals(
-   pack( 'H*', $hash ),
+   hex2bin( $hash ),
MWCryptHash::hash( $data ),
'Raw hash'
);
@@ -49,7 +49,7 @@
// @codingStandardsIgnoreEnd
 
$this->assertEquals(
-   pack( 'H*', $hash ),
+   

[MediaWiki-commits] [Gerrit] Optimize and compress the tries as nodes are added - change (IPSet)

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

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

Change subject: Optimize and compress the tries as nodes are added
..

Optimize and compress the tries as nodes are added

When adding a prefix, only uncompressed branch nodes and terminal nodes
were used. Only after all prefixes were added would recursive subnet
merging and depth compression happen. These extra passes can be avoided
by changing addCidr() in three main ways:

* Adjacent subnets (e.g. 192.0.2.0/25 and 192.0.2.128/25) can be
  checked while descending through the trie. The highest node having
  only adjacent subnets below it can be set to true (match-success).
* A compressed branch node can be added instead of eight uncompressed
  branch nodes whenever match-failure (false) is encountered, the
  first bit starts a byte, and at least seven more bits follow.
* This does mean compressed branch nodes must be handled properly when
  other prefixes are added. Fortunately, this is not too difficult.
  Whenever a compressed branch node is encountered, it can be checked
  against the value of the current byte, and if the bytes do not match
  (or the prefix is too short), the node can be replaced with eight
  uncompressed branch nodes.

This can yield a small speedup (e.g. ~30% for the tests) and avoids
problems with xdebug's default recursion depth limit of 100 (or 256
in version 2.3 and newer), without having to mess with ini_set().

Bug: T126495
Change-Id: I176d4b13faacb93f52d9541c3924080d85a30032
---
M src/IPSet.php
M tests/IPSetTest.php
2 files changed, 49 insertions(+), 109 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/IPSet refs/changes/01/270301/1

diff --git a/src/IPSet.php b/src/IPSet.php
index 249d84e..d8a417f 100644
--- a/src/IPSet.php
+++ b/src/IPSet.php
@@ -80,11 +80,11 @@
  * a net loss in my test scenarios due to additional match complexity)
  */
 class IPSet {
-   /** @var array $root4 The root of the IPv4 matching tree */
-   private $root4 = array( false, false );
+   /** @var array|bool $root4 The root of the IPv4 matching tree */
+   private $root4 = false;
 
-   /** @var array $root6 The root of the IPv6 matching tree */
-   private $root6 = array( false, false );
+   /** @var array|bool $root6 The root of the IPv6 matching tree */
+   private $root6 = false;
 
/**
 * Instantiate the object from an array of CIDR specs
@@ -98,11 +98,6 @@
foreach ( $cfg as $cidr ) {
$this->addCidr( $cidr );
}
-
-   self::recOptimize( $this->root4 );
-   self::recCompress( $this->root4, 0, 24 );
-   self::recOptimize( $this->root6 );
-   self::recCompress( $this->root6, 0, 120 );
}
 
/**
@@ -140,29 +135,56 @@
}
$rawOrd = array_map( 'ord', str_split( $raw ) );
 
-   // special-case: zero mask overwrites the whole tree with a 
pair of terminal successes
-   if ( $mask == 0 ) {
-   $node = array( true, true );
-   return;
-   }
-
// iterate the bits of the address while walking the tree 
structure for inserts
+   // at the end, $snode will point to the highest node that could 
only lead to a
+   // successful match (and thus can be set to true)
+   $snode =& $node;
$curBit = 0;
while ( 1 ) {
-   $maskShift = 7 - ( $curBit & 7 );
-   $node =& $node[( $rawOrd[$curBit >> 3] & ( 1 << 
$maskShift ) ) >> $maskShift];
-   ++$curBit;
if ( $node === true ) {
// already added a larger supernet, no need to 
go deeper
return;
} elseif ( $curBit == $mask ) {
// this may wipe out deeper subnets from earlier
-   $node = true;
+   $snode = true;
return;
} elseif ( $node === false ) {
// create new subarray to go deeper
-   $node = array( false, false );
+   if ( !( $curBit & 7 ) && $curBit <= $mask - 8 ) 
{
+   $node = array( 'comp' => 
$rawOrd[$curBit >> 3], 'next' => false );
+   } else {
+   $node = array( false, false );
+   }
}
+
+   if ( isset( $node['comp'] ) ) {
+   $comp = $node['comp'];
+   if ( $rawOrd[$curBit >> 3] == $comp && $curBit 
<= $mask - 8 ) {
+  

[MediaWiki-commits] [Gerrit] RELEASE-NOTES: Remove register_globals "Security reminder" - change (mediawiki/core)

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

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

Change subject: RELEASE-NOTES: Remove register_globals "Security reminder"
..

RELEASE-NOTES: Remove register_globals "Security reminder"

The feature no longer exists starting in PHP 5.4.0, and MediaWiki
now only supports PHP 5.5.9 or newer.

I did not remove the mention in UPGRADE because that refers to an
very old version of MediaWiki that needs a very old PHP version.

Change-Id: I0788d83943f4d08100177c430269eeb16e6f842e
---
M RELEASE-NOTES-1.27
1 file changed, 0 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/270451/1

diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index 6e2ca15..3a83b36 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -1,6 +1,3 @@
-Security reminder: If you have PHP's register_globals option set, you must
-turn it off. MediaWiki will not work with it enabled.
-
 == MediaWiki 1.27 ==
 
 THIS IS NOT A RELEASE YET

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

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

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


[MediaWiki-commits] [Gerrit] FormatJson: Remove PHP 5.3 compatibility code - change (mediawiki/core)

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

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

Change subject: FormatJson: Remove PHP 5.3 compatibility code
..

FormatJson: Remove PHP 5.3 compatibility code

MediaWiki now only works with PHP versions that are new enough
to have the encoding options required by encode54(). So fold
that into encode() and remove encode53() and prettyPrint().

Change-Id: I6b22daf8fa01ef608efbde9c6aecdbb5ce03e2b9
---
M includes/json/FormatJson.php
1 file changed, 38 insertions(+), 138 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/270444/1

diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php
index f85ee92..285f1ec 100644
--- a/includes/json/FormatJson.php
+++ b/includes/json/FormatJson.php
@@ -129,11 +129,46 @@
$pretty = $pretty ? '' : false;
}
 
-   if ( defined( 'JSON_UNESCAPED_UNICODE' ) ) {
-   return self::encode54( $value, $pretty, $escaping );
+   static $bug66021;
+   if ( $pretty !== false && $bug66021 === null ) {
+   $bug66021 = json_encode( array(), JSON_PRETTY_PRINT ) 
!== '[]';
}
 
-   return self::encode53( $value, $pretty, $escaping );
+   // PHP escapes '/' to prevent breaking out of inline script 
blocks using '',
+   // which is hardly useful when '<' and '>' are escaped (and 
inadequate), and such
+   // escaping negatively impacts the human readability of URLs 
and similar strings.
+   $options = JSON_UNESCAPED_SLASHES;
+   $options |= $pretty !== false ? JSON_PRETTY_PRINT : 0;
+   $options |= ( $escaping & self::UTF8_OK ) ? 
JSON_UNESCAPED_UNICODE : 0;
+   $options |= ( $escaping & self::XMLMETA_OK ) ? 0 : ( 
JSON_HEX_TAG | JSON_HEX_AMP );
+   $json = json_encode( $value, $options );
+   if ( $json === false ) {
+   return false;
+   }
+
+   if ( $pretty !== false ) {
+   // Workaround for 

+   if ( $bug66021 ) {
+   $json = preg_replace( self::WS_CLEANUP_REGEX, 
'', $json );
+   }
+   if ( $pretty !== '' ) {
+   // Change the four-space indent to a tab indent
+   $json = str_replace( "\n", "\n\t", $json );
+   while ( strpos( $json, "\t" ) !== false ) {
+   $json = str_replace( "\t", "\t\t", 
$json );
+   }
+
+   if ( $pretty !== "\t" ) {
+   // Change the tab indent to the 
provided indent
+   $json = str_replace( "\t", $pretty, 
$json );
+   }
+   }
+   }
+   if ( $escaping & self::UTF8_OK ) {
+   $json = str_replace( self::$badChars, 
self::$badCharsEscaped, $json );
+   }
+
+   return $json;
}
 
/**
@@ -224,141 +259,6 @@
break;
}
return Status::newFatal( $msg );
-   }
-
-   /**
-* JSON encoder wrapper for PHP >= 5.4, which supports useful encoding 
options.
-*
-* @param mixed $value
-* @param string|bool $pretty
-* @param int $escaping
-* @return string|false
-*/
-   private static function encode54( $value, $pretty, $escaping ) {
-   static $bug66021;
-   if ( $pretty !== false && $bug66021 === null ) {
-   $bug66021 = json_encode( array(), JSON_PRETTY_PRINT ) 
!== '[]';
-   }
-
-   // PHP escapes '/' to prevent breaking out of inline script 
blocks using '',
-   // which is hardly useful when '<' and '>' are escaped (and 
inadequate), and such
-   // escaping negatively impacts the human readability of URLs 
and similar strings.
-   $options = JSON_UNESCAPED_SLASHES;
-   $options |= $pretty !== false ? JSON_PRETTY_PRINT : 0;
-   $options |= ( $escaping & self::UTF8_OK ) ? 
JSON_UNESCAPED_UNICODE : 0;
-   $options |= ( $escaping & self::XMLMETA_OK ) ? 0 : ( 
JSON_HEX_TAG | JSON_HEX_AMP );
-   $json = json_encode( $value, $options );
-   if ( $json === false ) {
-   return false;
-   }
-
-   if ( $pretty !== false ) {
-   // Workaround for 

-   if ( $bug66021 ) {
-

[MediaWiki-commits] [Gerrit] Remove references to safe_mode INI setting - change (mediawiki/core)

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

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

Change subject: Remove references to safe_mode INI setting
..

Remove references to safe_mode INI setting

The feature no longer exists starting in PHP 5.4.0, and MediaWiki
now only supports PHP 5.5.9 or newer.

Change-Id: I3f2d1b564c50f0a28ec1ec0abd7d1b242e26953b
---
M INSTALL
M includes/DefaultSettings.php
M includes/GlobalFunctions.php
M includes/HttpFunctions.php
M includes/installer/Installer.php
M includes/installer/LocalSettingsGenerator.php
M includes/installer/i18n/en.json
M includes/installer/i18n/qqq.json
M includes/mail/UserMailer.php
9 files changed, 16 insertions(+), 57 deletions(-)


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

diff --git a/INSTALL b/INSTALL
index 4651a0c..0e8eb92 100644
--- a/INSTALL
+++ b/INSTALL
@@ -18,8 +18,7 @@
 work on Windows as well.
 
 If your PHP is configured as a CGI plug-in rather than an Apache module you may
-experience problems, as this configuration is not well tested. safe_mode is 
also
-not tested and unlikely to work.
+experience problems, as this configuration is not well tested.
 
 Support for rendering mathematical formulas requires installing the Math 
extension,
 see https://www.mediawiki.org/wiki/Extension:Math
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index a6733d7..e3c7713 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1555,7 +1555,6 @@
 
 /**
  * Additional email parameters, will be passed as the last argument to mail() 
call.
- * If using safe_mode this has no effect
  */
 $wgAdditionalMailParams = null;
 
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 4844531..a1ea936 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2366,16 +2366,13 @@
 /**
  * Check if wfShellExec() is effectively disabled via php.ini config
  *
- * @return bool|string False or one of (safemode,disabled)
+ * @return bool|string False or 'disabled'
  * @since 1.22
  */
 function wfShellExecDisabled() {
static $disabled = null;
if ( is_null( $disabled ) ) {
-   if ( wfIniGetBool( 'safe_mode' ) ) {
-   wfDebug( "wfShellExec can't run in safe_mode, PHP's 
exec functions are too broken.\n" );
-   $disabled = 'safemode';
-   } elseif ( !function_exists( 'proc_open' ) ) {
+   if ( !function_exists( 'proc_open' ) ) {
wfDebug( "proc_open() is disabled\n" );
$disabled = 'disabled';
} else {
@@ -2416,9 +2413,7 @@
$disabled = wfShellExecDisabled();
if ( $disabled ) {
$retval = 1;
-   return $disabled == 'safemode' ?
-   'Unable to run external programs in safe mode.' :
-   'Unable to run external programs, proc_open() is 
disabled.';
+   return 'Unable to run external programs, proc_open() is 
disabled.';
}
 
$includeStderr = isset( $options['duplicateStderr'] ) && 
$options['duplicateStderr'];
@@ -2659,10 +2654,8 @@
}
$done = true;
global $wgShellLocale;
-   if ( !wfIniGetBool( 'safe_mode' ) ) {
-   putenv( "LC_CTYPE=$wgShellLocale" );
-   setlocale( LC_CTYPE, $wgShellLocale );
-   }
+   putenv( "LC_CTYPE=$wgShellLocale" );
+   setlocale( LC_CTYPE, $wgShellLocale );
 }
 
 /**
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 5ede04f..032710c 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -818,7 +818,7 @@
MediaWiki\suppressWarnings();
if ( !curl_setopt( $curlHandle, CURLOPT_FOLLOWLOCATION, 
true ) ) {
wfDebug( __METHOD__ . ": Couldn't set 
CURLOPT_FOLLOWLOCATION. " .
-   "Probably safe_mode or open_basedir is 
set.\n" );
+   "Probably open_basedir is set.\n" );
// Continue the processing. If it were in 
curl_setopt_array,
// processing would have halted on its entry
}
@@ -863,8 +863,8 @@
}
 
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
-   if ( strval( ini_get( 'open_basedir' ) ) !== '' || 
wfIniGetBool( 'safe_mode' ) ) {
-   wfDebug( "Cannot follow redirects in safe 
mode\n" );
+   if ( strval( ini_get( 'open_basedir' ) ) !== '' ) {
+   wfDebug( "Cannot follow redirects when 
open_basedir is set\n" );
return false;
}
}
diff --git 

[MediaWiki-commits] [Gerrit] Revert "wfShellExec: Work around PHP 5.3 stream_select() issue" - change (mediawiki/core)

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

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

Change subject: Revert "wfShellExec: Work around PHP 5.3 stream_select() issue"
..

Revert "wfShellExec: Work around PHP 5.3 stream_select() issue"

No longer needed, MediaWiki no longer supports PHP 5.3.

This reverts commit 8bd6f698ccb990c9a9d37f495b8b5b7620832018.

Change-Id: I2edd25c4ce00eb324f7f6e04b2034ad28f7c6964
---
M includes/GlobalFunctions.php
1 file changed, 1 insertion(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/52/270452/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 4844531..f21f9ad 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2517,14 +2517,6 @@
$eintr = defined( 'SOCKET_EINTR' ) ? SOCKET_EINTR : 4;
$eintrMessage = "stream_select(): unable to select [$eintr]";
 
-   // Build a table mapping resource IDs to pipe FDs to work around a
-   // PHP 5.3 issue in which stream_select() does not preserve array keys
-   // .
-   $fds = array();
-   foreach ( $pipes as $fd => $pipe ) {
-   $fds[(int)$pipe] = $fd;
-   }
-
$running = true;
$timeout = null;
$numReadyPipes = 0;
@@ -2557,9 +2549,8 @@
break;
}
}
-   foreach ( $readyPipes as $pipe ) {
+   foreach ( $readyPipes as $fd => $pipe ) {
$block = fread( $pipe, 65536 );
-   $fd = $fds[(int)$pipe];
if ( $block === '' ) {
// End of file
fclose( $pipes[$fd] );

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

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

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


[MediaWiki-commits] [Gerrit] InlineDiffFormatter: Use writeOutput() when available - change (mediawiki...MobileFrontend)

2016-01-27 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: InlineDiffFormatter: Use writeOutput() when available
..

InlineDiffFormatter: Use writeOutput() when available

For compatibility with core change Idf2a6c59.

Change-Id: I81dd01cbb9ce11b87115fb1fed511027aee436a1
---
M includes/diff/InlineDiffFormatter.php
1 file changed, 23 insertions(+), 9 deletions(-)


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

diff --git a/includes/diff/InlineDiffFormatter.php 
b/includes/diff/InlineDiffFormatter.php
index 2b3c583..2ad9ccf 100644
--- a/includes/diff/InlineDiffFormatter.php
+++ b/includes/diff/InlineDiffFormatter.php
@@ -28,9 +28,9 @@
 */
function added( $lines ) {
foreach ( $lines as $line ) {
-   echo ''
+   $this->writeOutput( ''
. $this->lineOrNbsp( htmlspecialchars( $line ) )
-   . "\n";
+   . "\n" );
}
}
 
@@ -41,9 +41,9 @@
 */
function deleted( $lines ) {
foreach ( $lines as $line ) {
-   echo ''
+   $this->writeOutput( ''
. $this->lineOrNbsp( htmlspecialchars( $line ) )
-   . "\n";
+   . "\n" );
}
}
 
@@ -55,8 +55,8 @@
 */
function context( $lines ) {
foreach ( $lines as $line ) {
-   echo "" .
-   "{$this->contextLine( htmlspecialchars( $line ) 
)}\n";
+   $this->writeOutput( "" .
+   "{$this->contextLine( htmlspecialchars( $line ) 
)}\n" );
}
}
 
@@ -95,14 +95,14 @@
 * @param string[] $closing New content to compare with
 */
function changed( $orig, $closing ) {
-   echo '';
+   $this->writeOutput( '' );
$diff = new WordLevelDiff( $orig, $closing );
$edits = $this->inlineWordDiff( $diff );
 
# WordLevelDiff returns already HTML-escaped output.
-   echo implode( '', $edits );
+   $this->writeOutput( implode( '', $edits ) );
 
-   echo "\n";
+   $this->writeOutput( "\n" );
}
 
/**
@@ -130,4 +130,18 @@
 
return $lines;
}
+
+   /**
+* Writes a string to the output buffer.
+*
+* @param string $text
+*/
+   protected function writeOutput( $text ) {
+   if ( is_callable( 'parent::writeOutput' ) ) {
+   parent::writeOutput( $text );
+   } else {
+   // Pre-Idf2a6c59 version of MediaWiki
+   echo $text;
+   }
+   }
 }

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

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

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


[MediaWiki-commits] [Gerrit] TableDiffFormatter: Don't repeatedly call array_shift() - change (mediawiki/core)

2016-01-27 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: TableDiffFormatter: Don't repeatedly call array_shift()
..

TableDiffFormatter: Don't repeatedly call array_shift()

This also fixes a bug that could cause deleted lines to appear as if
they were replaced with blank lines rather than removed entirely.

Change-Id: I99dc2862b130c02aed311f93236eb6b2dc50a0fb
---
M includes/diff/TableDiffFormatter.php
1 file changed, 17 insertions(+), 10 deletions(-)


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

diff --git a/includes/diff/TableDiffFormatter.php 
b/includes/diff/TableDiffFormatter.php
index f1826ed..6dad66f 100644
--- a/includes/diff/TableDiffFormatter.php
+++ b/includes/diff/TableDiffFormatter.php
@@ -204,16 +204,23 @@
# Notice that WordLevelDiff returns HTML-escaped output.
# Hence, we will be calling addedLine/deletedLine without 
HTML-escaping.
 
-   $line = array_shift( $del );
-   while ( $line ) {
-   $aline = array_shift( $add );
-   $this->writeOutput( '' . $this->deletedLine( $line 
) .
-   $this->addedLine( $aline ) . "\n" );
-   $line = array_shift( $del );
-   }
-   foreach ( $add as $line ) { # If any leftovers
-   $this->writeOutput( '' . $this->emptyLine() .
-   $this->addedLine( $line ) . "\n" );
+   $ndel = count( $del );
+   $nadd = count( $add );
+   $n = max( $ndel, $nadd );
+   for ( $i = 0; $i < $n; $i++ ) {
+   if ( $i < $ndel ) {
+   $delLine = $this->deletedLine( $del[$i] );
+   } else {
+   $delLine = $this->emptyLine();
+   }
+
+   if ( $i < $nadd ) {
+   $addLine = $this->addedLine( $add[$i] );
+   } else {
+   $addLine = $this->emptyLine();
+   }
+
+   $this->writeOutput( "{$delLine}{$addLine}\n" );
}
}
 

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

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

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


[MediaWiki-commits] [Gerrit] Remove code to hide the site notice from search engines - change (mediawiki...DismissableSiteNotice)

2015-12-30 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove code to hide the site notice from search engines
..

Remove code to hide the site notice from search engines

While it might work for Bing, document.write() does not seem to be
enough to hide text from Google, as evident in this results page
(listing various pages from frr.wikipedia.org):

https://www.google.com/search?q=%22Wees+so+gud+an+melde+di+uun%2C+do+komst+d%C3%BC+%C3%BC%C3%BCb+di+leetst+stant.%22

On the other hand, core commit d861c6593a55 has broken this code.
Now, the mediawiki.legacy.wikibits module, once it loads, replaces
document.write with its own code, which can cause the site notice
to end up at the bottom of the page (just after #content, the last
child of the body element at the time the script is executed)
instead of in its proper place (inside #siteNotice, which
contains the script element).

Bug: T11209
Bug: T108811
Change-Id: I8052f01519f22558630489f97fc0ce126bf76dac
---
M DismissableSiteNotice.hooks.php
1 file changed, 0 insertions(+), 6 deletions(-)


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

diff --git a/DismissableSiteNotice.hooks.php b/DismissableSiteNotice.hooks.php
index d5b5c91..73aac4c 100644
--- a/DismissableSiteNotice.hooks.php
+++ b/DismissableSiteNotice.hooks.php
@@ -37,12 +37,6 @@
);
}
 
-   if ( $skin->getUser()->isAnon() ) {
-   // Hide the sitenotice from search engines (see bug 
T11209 comment 4)
-   // XXX: Does this actually work?
-   $notice = Html::inlineScript( Xml::encodeJsCall( 
'document.write', array( $notice ) ) );
-   }
-
return true;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8052f01519f22558630489f97fc0ce126bf76dac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DismissableSiteNotice
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] RELEASE-NOTES-1.27: Bugzilla is dead, long live Phabricator! - change (mediawiki/core)

2015-11-20 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: RELEASE-NOTES-1.27: Bugzilla is dead, long live Phabricator!
..

RELEASE-NOTES-1.27: Bugzilla is dead, long live Phabricator!

As in 173617003560c8cf (which changed RELEASE-NOTES-1.26).

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


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

diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index 6798e25..6bb1e0a 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -119,7 +119,7 @@
 
 MediaWiki supports over 350 languages. Many localisations are updated
 regularly. Below only new and removed languages are listed, as well as
-changes to languages because of Bugzilla reports.
+changes to languages because of Phabricator reports.
 
 * (T113688) Change default numerals from Gurmukhi to Arabic for Punjabi locale.
 

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

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

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


[MediaWiki-commits] [Gerrit] updateCollation.php: Switch back to using cl_from index for now - change (mediawiki/core)

2015-11-19 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: updateCollation.php: Switch back to using cl_from index for now
..

updateCollation.php: Switch back to using cl_from index for now

Using the cl_sortkey index instead (to reduce disruption to a live
site), as currently implemented, seems to have two serious problems:

* MySQL / MariaDB filesorts all rows that "sort above the given row
  [the last row of the previous batch]", not just a single category
  at a time until the row limit is reached.
* The current approach to pagination is broken in that it does not
  work with ENUM columns such as cl_type, causing 'file' rows to be
  skipped, or rows of any type to be repeated. See T119173.

This reverts part of commit a43f751cf6b6849e.

Bug: T58041
Change-Id: I619564e85b2122f249bdacc45d547b9ce1b3beb5
---
M maintenance/updateCollation.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/74/254374/1

diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php
index 5cf8afa..a0bd77c 100644
--- a/maintenance/updateCollation.php
+++ b/maintenance/updateCollation.php
@@ -86,7 +86,7 @@
 
$options = array(
'LIMIT' => self::BATCH_SIZE,
-   'ORDER BY' => 'cl_to, cl_type, cl_from',
+   'ORDER BY' => 'cl_from, cl_to',
'STRAIGHT_JOIN',
);
 
@@ -132,7 +132,7 @@
$res = $dbw->select(
array( 'categorylinks', 'page' ),
array( 'cl_from', 'cl_to', 'cl_sortkey_prefix', 
'cl_collation',
-   'cl_sortkey', 'cl_type', 
'page_namespace', 'page_title'
+   'cl_sortkey', 'page_namespace', 
'page_title'
),
array_merge( $collationConds, $batchConds, 
array( 'cl_from = page_id' ) ),
__METHOD__,
@@ -216,13 +216,13 @@
 
/**
 * Return an SQL expression selecting rows which sort above the given 
row,
-* assuming an ordering of cl_to, cl_type, cl_from
+* assuming an ordering of cl_from, cl_to
 * @param stdClass $row
 * @param DatabaseBase $dbw
 * @return string
 */
function getBatchCondition( $row, $dbw ) {
-   $fields = array( 'cl_to', 'cl_type', 'cl_from' );
+   $fields = array( 'cl_from', 'cl_to' );
$first = true;
$cond = false;
$prefix = false;

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

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

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


[MediaWiki-commits] [Gerrit] Add script to fix incorrect cl_type values - change (mediawiki/core)

2015-11-11 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Add script to fix incorrect cl_type values
..

Add script to fix incorrect cl_type values

This will allow cleaning up after T71740 (cl_type not being updated upon
cross-namespace page move) without having to run updateCollation.php. It
should take only about five minutes to run on English Wikipedia (based
on testing with a database dump from October 2015).

The reason I bothered to write this script despite the "low number of
affected pages" is that I am thinking of changing MediaWiki to base
category counts on cl_type rather than directly on page_namespace,
so an incorrect cl_type value would result in inaccurate counts.

Some bits (i.e. the chunking code) have been taken from refreshLinks.php.

Bug: T74661
Change-Id: I25724b4f330bc6201c8adc38d688e9d82fd69409
---
M autoload.php
A maintenance/fixClType.php
2 files changed, 184 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/252644/1

diff --git a/autoload.php b/autoload.php
index 15f1b10..7e958a3 100644
--- a/autoload.php
+++ b/autoload.php
@@ -448,6 +448,7 @@
'FindMissingFiles' => __DIR__ . '/maintenance/findMissingFiles.php',
'FindOrphanedFiles' => __DIR__ . '/maintenance/findOrphanedFiles.php',
'FixBug20757' => __DIR__ . '/maintenance/storage/fixBug20757.php',
+   'FixClType' => __DIR__ . '/maintenance/fixClType.php',
'FixDoubleRedirects' => __DIR__ . '/maintenance/fixDoubleRedirects.php',
'FixExtLinksProtocolRelative' => __DIR__ . 
'/maintenance/fixExtLinksProtocolRelative.php',
'FixTimestamps' => __DIR__ . '/maintenance/fixTimestamps.php',
diff --git a/maintenance/fixClType.php b/maintenance/fixClType.php
new file mode 100644
index 000..70f03c4
--- /dev/null
+++ b/maintenance/fixClType.php
@@ -0,0 +1,183 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance
+ */
+
+require_once __DIR__ . '/Maintenance.php';
+
+/**
+ * Maintenance script to fix incorrect cl_type values without having to run
+ * updateCollation.php.
+ *
+ * @since 1.27
+ * @ingroup Maintenance
+ */
+class FixClType extends Maintenance {
+   public function __construct() {
+   parent::__construct();
+   $this->mDescription = 'Fix incorrect cl_type values without 
having to run ' .
+   'updateCollation.php';
+   $this->addOption( 'start', 'First page ID to check', false, 
true );
+   $this->addOption( 'end', 'Last page ID to check', false, true );
+   $this->addOption( 'chunk-size', 'Maximum number of existent IDs 
to check per query, ' .
+   'default 10', false, true );
+   $this->setBatchSize( 100 );
+   }
+
+   public function execute() {
+   $dbr = $this->getDB( DB_SLAVE );
+   $start = (int)$this->getOption( 'start' ) ?: null;
+   $end = (int)$this->getOption( 'end' ) ?: null;
+   $chunkSize = (int)$this->getOption( 'chunk-size', 10 );
+   do {
+   // Find the start of the next chunk.
+   $nextStart = $dbr->selectField(
+   'page',
+   'page_id',
+   self::intervalCond( $dbr, 'page_id', $start, 
$end ),
+   __METHOD__,
+   array( 'ORDER BY' => 'page_id', 'OFFSET' => 
$chunkSize )
+   );
+
+   if ( $nextStart !== false ) {
+   // To find the end of the current chunk, 
subtract one.
+   $chunkEnd = $nextStart - 1;
+   } else {
+   // This is the last chunk. Check all page_ids 
up to $end.
+   $chunkEnd = $end;
+   }
+
+   $fmtStart = $start !== null ? "[$start" : '(-INF';
+   $fmtChunkEnd = $chunkEnd !== null ? "$chunkEnd]" : 
'INF)';
+   $this->output( "Checking interval $fmtStart, 
$fmtChunkEnd\n" );
+   $this->checkInterval( $start, $chunkEnd );
+
+   $start = $nextStart;
+
+   } while ( $nextStart !== false );
+   }
+
+   /**
+* Check a range of page IDs in the categorylinks table.
+*
+* @param string|int|null $start Page_id to start from
+* @param string|int|null $end Page_id to stop at
+*/
+   private function checkInterval( $start, $end ) {
+   $dbr = $this->getDB( DB_SLAVE );
+   do {
+   $res = $dbr->select(
+   array( 'page', 'categorylinks' ),
+   

[MediaWiki-commits] [Gerrit] Update description of LinkCache::forUpdate() - change (mediawiki/core)

2015-10-30 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Update description of LinkCache::forUpdate()
..

Update description of LinkCache::forUpdate()

The $mForUpdate flag no longer causes the FOR UPDATE option to be added.
This was at first only true for some values of $wgAntiLockFlags (since
r9248 / ba8a00bcb833), though since 12757b50f8da (when the setting was
removed), is always the case.

The added text is based on the description for $wgAntiLockFlags.

Change-Id: I02a3e2df37ec40c7e36ae6210c8263f13d9e3e5b
---
M includes/cache/LinkCache.php
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php
index 3db84a6..3397a02 100644
--- a/includes/cache/LinkCache.php
+++ b/includes/cache/LinkCache.php
@@ -88,7 +88,11 @@
}
 
/**
-* General accessor to get/set whether SELECT FOR UPDATE should be used
+* General accessor to get/set whether the master DB should be used
+*
+* This used to also set the FOR UPDATE option (in order to avoid link
+* table inconsistency), which was later removed for performance on
+* wikis with a high edit rate.
 *
 * @param bool $update
 * @return bool

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

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

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


[MediaWiki-commits] [Gerrit] Preprocessor: Use correct cache prefix for the subclass - change (mediawiki/core)

2015-10-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Preprocessor: Use correct cache prefix for the subclass
..

Preprocessor: Use correct cache prefix for the subclass

Follows-up 1559be9f7aef, which caused "Preprocessor" to be used as the
cache prefix for all subclasses, by using late static binding to access
the constant. Though use of that feature has been discouraged[1], this
change is a straightforward bug fix, and any improvements can be made
separately.

[1]: 
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Late_static_binding

Change-Id: Ib25e1908a6373f6675659a0906e12d4a38af014c
---
M includes/parser/Preprocessor.php
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/08/248808/1

diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php
index 30eab19..b1e49b2 100644
--- a/includes/parser/Preprocessor.php
+++ b/includes/parser/Preprocessor.php
@@ -46,9 +46,11 @@
}
 
$key = wfMemcKey(
-   defined( 'self::CACHE_PREFIX' ) ? self::CACHE_PREFIX : 
__CLASS__,
+   // TODO: Once we require PHP 5.5, use static::class 
instead of
+   // get_called_class() or get_class( $this ).
+   defined( 'static::CACHE_PREFIX' ) ? 
static::CACHE_PREFIX : get_called_class(),
md5( $text ), $flags );
-   $value = sprintf( "%08d", self::CACHE_VERSION ) . $tree;
+   $value = sprintf( "%08d", static::CACHE_VERSION ) . $tree;
 
$cache = ObjectCache::getInstance( $config->get( 
'MainCacheType' ) );
$cache->set( $key, $value, 86400 );
@@ -77,7 +79,9 @@
$cache = ObjectCache::getInstance( $config->get( 
'MainCacheType' ) );
 
$key = wfMemcKey(
-   defined( 'self::CACHE_PREFIX' ) ? self::CACHE_PREFIX : 
__CLASS__,
+   // TODO: Once we require PHP 5.5, use static::class 
instead of
+   // get_called_class() or get_class( $this ).
+   defined( 'static::CACHE_PREFIX' ) ? 
static::CACHE_PREFIX : get_called_class(),
md5( $text ), $flags );
 
$value = $cache->get( $key );
@@ -86,7 +90,7 @@
}
 
$version = intval( substr( $value, 0, 8 ) );
-   if ( $version !== self::CACHE_VERSION ) {
+   if ( $version !== static::CACHE_VERSION ) {
return false;
}
 

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

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

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


[MediaWiki-commits] [Gerrit] Database::__construct(): Don't set $mTrxAtomicLevels to an S... - change (mediawiki/core)

2015-10-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Database::__construct(): Don't set $mTrxAtomicLevels to an 
SplStack
..

Database::__construct(): Don't set $mTrxAtomicLevels to an SplStack

Follows-up db0b9ef2649c and 01ef30fcc495.

Change-Id: I06188c746fb885819aa93e0e3caf3dc2bac7ae72
---
M includes/db/Database.php
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 2f135a4..57c28bb 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -607,7 +607,6 @@
function __construct( array $params ) {
global $wgDBprefix, $wgDBmwschema, $wgCommandLineMode;
 
-   $this->mTrxAtomicLevels = new SplStack;
$this->srvCache = ObjectCache::newAccelerator( 'hash' );
 
$server = $params['host'];

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

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

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


[MediaWiki-commits] [Gerrit] Avoid creating lots and lots of cat_id gaps - change (mediawiki/core)

2015-10-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Avoid creating lots and lots of cat_id gaps
..

Avoid creating lots and lots of cat_id gaps

Currently, INSERT...ON DUPLICATE KEY UPDATE is used to update the page
counts in the category table. However, MySQL 5.1.22 and newer, by default,
increment the counter for cat_id before checking for duplicate key errors.
This creates many gaps in the cat_id sequence.

To avoid this, check for existing category rows, and instead UPDATE any
that were found. It is hoped that the extra queries will not significantly
harm performance.

Change-Id: Ic2ab9ff14f04a0c7ea90a5b6756cade0c78e2885
---
M includes/Category.php
M includes/page/WikiPage.php
2 files changed, 73 insertions(+), 38 deletions(-)


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

diff --git a/includes/Category.php b/includes/Category.php
index c3e8a4e..1b05f33 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -304,11 +304,11 @@
return false;
}
 
-   # Note, we must use names for this, since categorylinks does.
-   if ( $this->mName === null ) {
-   if ( !$this->initialize() ) {
-   return false;
-   }
+   # If we have just a category name, find out whether there is an
+   # existing row. Or if we have just an ID, get the name, because
+   # that's what categorylinks uses.
+   if ( !$this->initialize() ) {
+   return false;
}
 
$dbw = wfGetDB( DB_MASTER );
@@ -327,25 +327,38 @@
array( 'LOCK IN SHARE MODE' )
);
 
-   # TODO: This will cause lots and lots of gaps on MySQL unless
-   # innodb_autoinc_lock_mode is 0 (and also on some non-MySQL
-   # DBMSes) if you run populateCategory.php repeatedly.
-   $dbw->upsert(
-   'category',
-   array(
-   'cat_title' => $this->mName,
-   'cat_pages' => $result->pages,
-   'cat_subcats' => $result->subcats,
-   'cat_files' => $result->files
-   ),
-   array( 'cat_title' ),
-   array(
-   'cat_pages' => $result->pages,
-   'cat_subcats' => $result->subcats,
-   'cat_files' => $result->files
-   ),
-   __METHOD__
-   );
+   if ( $this->mId ) {
+   # The category row already exists, so do a plain UPDATE 
instead
+   # of INSERT...ON DUPLICATE KEY UPDATE to avoid creating 
a gap
+   # in the cat_id sequence. The row may or may not be 
"affected".
+   $dbw->update(
+   'category',
+   array(
+   'cat_pages' => $result->pages,
+   'cat_subcats' => $result->subcats,
+   'cat_files' => $result->files
+   ),
+   array( 'cat_title' => $this->mName ),
+   __METHOD__
+   );
+   } else {
+   $dbw->upsert(
+   'category',
+   array(
+   'cat_title' => $this->mName,
+   'cat_pages' => $result->pages,
+   'cat_subcats' => $result->subcats,
+   'cat_files' => $result->files
+   ),
+   array( 'cat_title' ),
+   array(
+   'cat_pages' => $result->pages,
+   'cat_subcats' => $result->subcats,
+   'cat_files' => $result->files
+   ),
+   __METHOD__
+   );
+   }
 
$dbw->endAtomic( __METHOD__ );
 
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 3f6a4db..3ec3e89 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -3395,22 +3395,44 @@
}
 
if ( count( $added ) ) {
-   $insertRows = array();
-   foreach ( 

[MediaWiki-commits] [Gerrit] TopFansByStat: Remove use of strencode() - change (mediawiki...SocialProfile)

2015-10-09 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: TopFansByStat: Remove use of strencode()
..

TopFansByStat: Remove use of strencode()

All valid column names should consist of characters that do not need
to be escaped, so validate the provided column name using a regex,
though there probably should be an explicit whitelist.

Change-Id: I3b17aaf075c9018a8102aeac8b45117f22ed8737
---
M UserStats/TopFansByStat.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/18/244818/1

diff --git a/UserStats/TopFansByStat.php b/UserStats/TopFansByStat.php
index ab7db80..1614669 100644
--- a/UserStats/TopFansByStat.php
+++ b/UserStats/TopFansByStat.php
@@ -37,11 +37,13 @@
 
$dbr = wfGetDB( DB_SLAVE );
 
-   $statistic = $dbr->strencode( trim( $request->getVal( 'stat' ) 
) );
+   $statistic = trim( $request->getVal( 'stat' ) );
$column = "stats_{$statistic}";
 
// Error if the query string value does not match our stat 
column
-   if ( !$dbr->fieldExists( 'user_stats', $column ) ) {
+   if ( !preg_match( '/^stats_[0-9a-z_]{1,58}$/D', $column ) ||
+   !$dbr->fieldExists( 'user_stats', $column )
+   ) {
$out->setPageTitle( $this->msg( 
'top-fans-bad-field-title' )->plain() );
$out->addHTML( $this->msg( 'top-fans-bad-field-message' 
)->plain() );
return false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b17aaf075c9018a8102aeac8b45117f22ed8737
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] LocalisationCache::recache(): Use array_fill_keys() - change (mediawiki/core)

2015-10-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: LocalisationCache::recache(): Use array_fill_keys()
..

LocalisationCache::recache(): Use array_fill_keys()

LocalisationCache was added in 1.16, so in order to retain PHP 5.1
compatibility, array_fill_keys() was avoided. In 1.17, support for
PHP 5.1 was dropped, so we can use that function now.

Change-Id: I435705639f1a470324a4ba46153351aadc0d40e2
---
M includes/cache/LocalisationCache.php
1 file changed, 2 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/244510/1

diff --git a/includes/cache/LocalisationCache.php 
b/includes/cache/LocalisationCache.php
index f5b2350..fa5e288 100644
--- a/includes/cache/LocalisationCache.php
+++ b/includes/cache/LocalisationCache.php
@@ -816,9 +816,7 @@
$this->recachedLangs[$code] = true;
 
# Initial values
-   $initialData = array_combine(
-   self::$allKeys,
-   array_fill( 0, count( self::$allKeys ), null ) );
+   $initialData = array_fill_keys( self::$allKeys, null );
$coreData = $initialData;
$deps = array();
 
@@ -856,9 +854,7 @@
$messageDirs = $this->getMessagesDirs();
 
# Load non-JSON localisation data for extensions
-   $extensionData = array_combine(
-   $codeSequence,
-   array_fill( 0, count( $codeSequence ), $initialData ) );
+   $extensionData = array_fill_keys( $codeSequence, $initialData );
foreach ( $wgExtensionMessagesFiles as $extension => $fileName 
) {
if ( isset( $messageDirs[$extension] ) ) {
# This extension has JSON message data; skip 
the PHP shim

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

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

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


[MediaWiki-commits] [Gerrit] DiffFormatter: Don't mess with PHP output buffering - change (mediawiki/core)

2015-10-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: DiffFormatter: Don't mess with PHP output buffering
..

DiffFormatter: Don't mess with PHP output buffering

This is a line-by-line conversion to append to a string property rather
than print into a PHP output buffer. The changes to the base class break
subclasses, though I don't see any in the MediaWiki extensions hosted on
gerrit.wikimedia.org.

Change-Id: Idf2a6c593b81a152edec923d4db6272ca1f3f545
---
M includes/diff/DiffFormatter.php
M includes/diff/TableDiffFormatter.php
M includes/diff/UnifiedDiffFormatter.php
3 files changed, 16 insertions(+), 13 deletions(-)


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

diff --git a/includes/diff/DiffFormatter.php b/includes/diff/DiffFormatter.php
index 33ca931..7ddca67 100644
--- a/includes/diff/DiffFormatter.php
+++ b/includes/diff/DiffFormatter.php
@@ -49,6 +49,9 @@
 */
protected $trailingContextLines = 0;
 
+   /** @var string Holds the output while it is built. */
+   protected $result = '';
+
/**
 * Format a diff.
 *
@@ -146,15 +149,15 @@
}
 
protected function startDiff() {
-   ob_start();
+   $this->result = '';
}
 
/**
 * @return string
 */
protected function endDiff() {
-   $val = ob_get_contents();
-   ob_end_clean();
+   $val = $this->result;
+   $this->result = '';
 
return $val;
}
@@ -185,7 +188,7 @@
 * @param string $header
 */
protected function startBlock( $header ) {
-   echo $header . "\n";
+   $this->result .= $header . "\n";
}
 
/**
@@ -203,7 +206,7 @@
 */
protected function lines( $lines, $prefix = ' ' ) {
foreach ( $lines as $line ) {
-   echo "$prefix $line\n";
+   $this->result .= "$prefix $line\n";
}
}
 
@@ -236,7 +239,7 @@
 */
protected function changed( $orig, $closing ) {
$this->deleted( $orig );
-   echo "---\n";
+   $this->result .= "---\n";
$this->added( $closing );
}
 
diff --git a/includes/diff/TableDiffFormatter.php 
b/includes/diff/TableDiffFormatter.php
index 4737f08..7da5382 100644
--- a/includes/diff/TableDiffFormatter.php
+++ b/includes/diff/TableDiffFormatter.php
@@ -80,7 +80,7 @@
 * @param string $header
 */
protected function startBlock( $header ) {
-   echo $header;
+   $this->result .= $header;
}
 
protected function endBlock() {
@@ -157,7 +157,7 @@
 */
protected function added( $lines ) {
foreach ( $lines as $line ) {
-   echo '' . $this->emptyLine() .
+   $this->result .= '' . $this->emptyLine() .
$this->addedLine( '' .
htmlspecialchars( $line ) . '' ) 
. "\n";
}
@@ -170,7 +170,7 @@
 */
protected function deleted( $lines ) {
foreach ( $lines as $line ) {
-   echo '' . $this->deletedLine( '' .
+   $this->result .= '' . $this->deletedLine( '' .
htmlspecialchars( $line ) . '' ) .
$this->emptyLine() . "\n";
}
@@ -183,7 +183,7 @@
 */
protected function context( $lines ) {
foreach ( $lines as $line ) {
-   echo '' .
+   $this->result .= '' .
$this->contextLine( htmlspecialchars( $line ) ) 
.
$this->contextLine( htmlspecialchars( $line ) ) 
. "\n";
}
@@ -206,11 +206,11 @@
 
while ( $line = array_shift( $del ) ) {
$aline = array_shift( $add );
-   echo '' . $this->deletedLine( $line ) .
+   $this->result .= '' . $this->deletedLine( $line ) .
$this->addedLine( $aline ) . "\n";
}
foreach ( $add as $line ) { # If any leftovers
-   echo '' . $this->emptyLine() .
+   $this->result .= '' . $this->emptyLine() .
$this->addedLine( $line ) . "\n";
}
}
diff --git a/includes/diff/UnifiedDiffFormatter.php 
b/includes/diff/UnifiedDiffFormatter.php
index 5f3ad3d..033471a 100644
--- a/includes/diff/UnifiedDiffFormatter.php
+++ b/includes/diff/UnifiedDiffFormatter.php
@@ -42,7 +42,7 @@
 */
protected function lines( 

[MediaWiki-commits] [Gerrit] Change 1.26 to 1.27, mostly in doc comments - change (mediawiki/core)

2015-10-06 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Change 1.26 to 1.27, mostly in doc comments
..

Change 1.26 to 1.27, mostly in doc comments

Using the following command line, I have found doc comments (and
a wfDeprecated() call) mentioning "1.26" when they should mention
"1.27" instead, which I have fixed manually:

git diff -M REL1_26 | grep --color=always -C 10 -iP \
'^\+.*\D1\.26(\D|$)' | aha > oldver.html

Follows-up these commits:
* 047b60b96d8218eec5122dbca38e367773267d4b
* 169b7b98b5c43db55acfc7e31b089300c0026c80
* 21206c8fbe90cbc16ea75863783caedb26bd6eb1
* 25a44aa3e4fa511d326b373af71762eb7375db7a
* 2fb2a3f14b34d4b81de2ca1aec07efc5659f9e90
* 3f1e9fa268cdc9850dd1df2b271dbd814d957488 [1]
* 8c84af70b656678dea7845eee6acbfe7ced6d6f9
* c0cb80beac069254edf9f77b7ce149af6568be23
* d04a92a5517d656447d73001e51a8cfb9b130d07
* d3b85592ead7fc1348c20c565fd21375da5417de

[1] Release notes moved in I195dd1cf.

Because a release note stating that the UserRights hook is deprecated
was added in 37062a0c0d0b (before the branch cut), this commit does not
change the Hooks::run call that had been changed in 21206c8fbe90.

Change-Id: I5a427f003e7e3b4559fe377bcdfdca466a570708
---
M includes/api/ApiImport.php
M includes/changes/CategoryMembershipChange.php
M includes/changes/RecentChange.php
M includes/db/loadbalancer/LoadMonitor.php
M includes/deferred/DataUpdate.php
M includes/deferred/DeferredUpdates.php
M includes/jobqueue/jobs/DeleteLinksJob.php
M includes/resourceloader/ResourceLoader.php
M includes/resourceloader/ResourceLoaderEditToolbarModule.php
M includes/resourceloader/ResourceLoaderFileModule.php
M includes/resourceloader/ResourceLoaderModule.php
11 files changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/244117/1

diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php
index a6aae4b..f0ca6fe 100644
--- a/includes/api/ApiImport.php
+++ b/includes/api/ApiImport.php
@@ -97,7 +97,7 @@
 * source.
 *
 * @return array
-* @since 1.26
+* @since 1.27
 */
public function getAllowedImportSources() {
$importSources = $this->getConfig()->get( 'ImportSources' );
diff --git a/includes/changes/CategoryMembershipChange.php 
b/includes/changes/CategoryMembershipChange.php
index a12a1d8..9e73ebe 100644
--- a/includes/changes/CategoryMembershipChange.php
+++ b/includes/changes/CategoryMembershipChange.php
@@ -20,7 +20,7 @@
  * @file
  * @author Kai Nissen
  * @author Adam Shorland
- * @since 1.26
+ * @since 1.27
  */
 
 use Wikimedia\Assert\Assert;
diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index 2ccc24b..07d1487 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -760,7 +760,7 @@
 * Constructs a RecentChange object for the given categorization
 * This does not call save() on the object and thus does not write to 
the db
 *
-* @since 1.26
+* @since 1.27
 *
 * @param string $timestamp Timestamp of the recent change to occur
 * @param Title $categoryTitle Title of the category a page is being 
added to or removed from
diff --git a/includes/db/loadbalancer/LoadMonitor.php 
b/includes/db/loadbalancer/LoadMonitor.php
index 438e4fc..d5cd017 100644
--- a/includes/db/loadbalancer/LoadMonitor.php
+++ b/includes/db/loadbalancer/LoadMonitor.php
@@ -56,7 +56,7 @@
 
/**
 * Clear any process and persistent cache of lag times
-* @since 1.26
+* @since 1.27
 */
public function clearCaches();
 }
diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php
index 4a61b2a..cb57140 100644
--- a/includes/deferred/DataUpdate.php
+++ b/includes/deferred/DataUpdate.php
@@ -127,7 +127,7 @@
 *
 * @param DataUpdate[] $updates A list of DataUpdate instances
 * @return DataUpdate[]
-* @since 1.26
+* @since 1.27
 */
protected static function enqueueUpdates( array $updates ) {
$remaining = array();
@@ -151,7 +151,7 @@
  * Such updates must be representable using IJobSpecification, so that
  * they can be serialized into jobs and enqueued for later execution
  *
- * @since 1.26
+ * @since 1.27
  */
 interface EnqueueableDataUpdate {
/**
diff --git a/includes/deferred/DeferredUpdates.php 
b/includes/deferred/DeferredUpdates.php
index 7d02a7a..cdd1fff 100644
--- a/includes/deferred/DeferredUpdates.php
+++ b/includes/deferred/DeferredUpdates.php
@@ -136,7 +136,7 @@
/**
 * @note This method is intended for testing purposes
 * @param bool $value Whether to *always* defer updates, even in CLI 
mode
-* @since 1.26
+* @since 1.27
 */
public static 

[MediaWiki-commits] [Gerrit] Move release notes from 1.26 to 1.27, and minor fixes - change (mediawiki/core)

2015-10-06 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Move release notes from 1.26 to 1.27, and minor fixes
..

Move release notes from 1.26 to 1.27, and minor fixes

In general, I moved all notes not present in the REL1_26 branch. However,
in the "External libraries" section, I instead changed the list of libraries
to reflect the current states of resources/lib and composer.json. (I assumed
oojs/oojs-ui refers to the PHP library, not the JS libraries.)

Also, for consistency with the other sections, I renamed "External libraries"
to "External library updates in 1.2X" and promoted it to heading level 3.
I made some minor formatting changes as well, though some JS libraries are
still missing from the list.

Change-Id: I195dd1cf1aca1112945dc630e2bb7d8584bb4bb2
---
M RELEASE-NOTES-1.26
M RELEASE-NOTES-1.27
2 files changed, 44 insertions(+), 34 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index efca318..1079556 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -41,10 +41,6 @@
 * The UserRights hook is deprecated in favor of the new UserGroupsChanged hook.
 * AuthPlugin::initUser() and AuthPlugin::updateUser() should no longer replace
   the passed User object.
-* $wgBlockAllowsUTEdit is now set to true by default. This allows
-  blocked users to edit their talk pages unless explicitly disabled
-  when they are being blocked.
-* CLDRPluralRule* classes have been replaced with 
wikimedia/cldr-plural-rule-parser.
 
 === New features in 1.26 ===
 * (T51506) Now action=info gives estimates of actual watchers for a page.
@@ -74,9 +70,6 @@
 * Caches that need purging ability now use the WANObjectCache interface.
   This corresponds to a new $wgMainWANCache setting, which defaults to using
   the $wgMainCacheType settings.
-* Added MWTimestamp::getTimezoneString() which returns the localized timezone
-  string, if available. To localize this string, see the comments of
-  $wgLocaltimezone in includes/DefaultSettings.php.
 * Callers needing fast light-weight data stores use $wgMainStash to select
   the store type from $wgObjectCaches. The default is the local database.
 * Interface message overrides in the MediaWiki namespace will now be cached in
@@ -95,29 +88,30 @@
   suggestion, results for suggestion will be shown. Can be disabled by setting
   $wgSearchRunSuggestedQuery to false.
 
-== External libraries ==
-=== Upgraded external libraries ===
+
+=== External library updates in 1.26 ===
+ Upgraded external libraries 
 * Updated es5-shim from v4.0.0 to v4.1.5.
 * Updated json2 from revision 2014-02-04 to 2015-05-03.
 * Updated Sinon.JS from 1.10.3 to 1.15.4.
 * Updated jQuery Client from v1.0.0 to v2.0.0.
 * Updated QUnit from v1.17.1 to v1.18.0.
-* Updated liuggio/statsd-php-client from v1.0.12 to v1.0.16
-* Updated oojs/oojs-ui from v0.9.8 to v0.12.9.
-* Updated wikimedia/utfnormal from v1.0.2 to v1.0.3
+* Updated liuggio/statsd-php-client from v1.0.12 to v1.0.16.
+* Updated oojs/oojs-ui from v0.11.3 to v0.12.8.1.
+* Updated wikimedia/cdb from v1.0.1 to v1.3.0.
+* Updated wikimedia/utfnormal from v1.0.2 to v1.0.3.
 * Updated wikimedia/composer-merge-plugin from v1.0.0 to v1.2.1.
 * Updated zordius/lightncandy from v0.18 to v0.21.
 
-=== New external libraries ===
-* Added composer/semver v0.1.0.
+ New external libraries 
+* Added composer/semver v1.0.0.
 * Added mediawiki/at-ease v1.1.0.
 * Added wikimedia/assert v0.2.2.
-* Added wikimedia/cldr-plural-rule-parser v1.0.0
 * Added wikimedia/ip-set v1.0.1.
 * Added wikimedia/wrappedstring v2.0.0.
 
-=== Removed and replaced external libraries ===
-* Replaced leafo/lessphp v0.5.0 with oyejorge/less.php: v1.7.0.8
+ Removed and replaced external libraries 
+* Replaced leafo/lessphp v0.5.0 with oyejorge/less.php v1.7.0.9.
 
 === Bug fixes in 1.26 ===
 * (T53283) load.php sometimes sends 304 response without full headers
@@ -151,7 +145,6 @@
 * API responses to GET requests may now include ETag and Last-Modified headers,
   and will honor corresponding If-None-Match and If-Modified-Since on such
   requests.
-* (T47988) The protect log event details now use new-style formatting.
 
 === Action API internal changes in 1.26 ===
 * New metadata item ApiResult::META_KVP_MERGE to allow for merging the KVP key
@@ -172,8 +165,6 @@
 ** dty (डोटेली/Doteli), thanks to translators जनक राज भट्ट, बिप्लब आनन्द,
मेश सिंह बोहरा, and राम प्रसाद जोशी
 ** luz (لئری دوٙمینی / Southern Luri)
-** olo (Livvinкarjala / Livvi-Karelian), thanks to translators Denö, Hiloin 
Natoi,
-   Ilja.mos, and Mashoi7
 
 === Other changes in 1.26 ===
 * ChangeTags::tagDescription() will return false if the interface message
@@ -227,21 +218,9 @@
 * Watchlist tokens, SpecialResetTokens, and User::getTokenFromOption()
   are deprecated. 

[MediaWiki-commits] [Gerrit] Turn $wgSearchRunSuggestedQueryPercent into $wgSearchRunSugg... - change (mediawiki/core)

2015-10-06 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Turn $wgSearchRunSuggestedQueryPercent into 
$wgSearchRunSuggestedQuery
..

Turn $wgSearchRunSuggestedQueryPercent into $wgSearchRunSuggestedQuery

Deciding how to behave randomly is useful for testing, yet misleading
for general usage. Now that testing is over, make it a boolean switch.

Change-Id: I3e4d02aa57c853c20152c9071c444e09da57fb35
(cherry picked from commit ba5bea7a713c38f62bfb7c7ca2050648e26732e8)
---
M RELEASE-NOTES-1.26
M includes/DefaultSettings.php
M includes/specials/SpecialSearch.php
3 files changed, 8 insertions(+), 9 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 47c751e..d18aaee 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -84,6 +84,9 @@
   page. During the deprecation period, the styles will only be loaded on pages
   which contain 'mw-ui-button' in their HTML. Starting in 1.28, the styles will
   only be loaded if explicitly required.
+* If search returns zero results and current search engine has a "did you mean"
+  suggestion, results for suggestion will be shown. Can be disabled by setting
+  $wgSearchRunSuggestedQuery to false.
 
  External libraries 
 * Update es5-shim from v4.0.0 to v4.1.5.
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 37429b9..d6a52d7 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -7704,14 +7704,13 @@
 );
 
 /**
- * Controls the percentage of zero-result search queries with suggestions that
- * run the suggestion automatically. Must be a number between 0 and 1.  This
- * can be lowered to reduce query volume at the expense of result quality.
+ * Controls whether zero-result search queries with suggestions should display 
results for
+ * these suggestions.
  *
- * @var float
+ * @var bool
  * @since 1.26
  */
-$wgSearchRunSuggestedQueryPercent = 1;
+$wgSearchRunSuggestedQuery = true;
 
 /**
  * For really cool vim folding this needs to be at the end:
diff --git a/includes/specials/SpecialSearch.php 
b/includes/specials/SpecialSearch.php
index fd0745f..f50fb73 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -415,10 +415,7 @@
return false;
}
 
-   // Generate a random number between 0 and 1. If the
-   // number is less than the desired percentages run it.
-   $rand = rand( 0, getrandmax() ) / getrandmax();
-   return $this->getConfig()->get( 
'SearchRunSuggestedQueryPercent' ) > $rand;
+   return $this->getConfig()->get( 'SearchRunSuggestedQuery' );
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e4d02aa57c853c20152c9071c444e09da57fb35
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_26
Gerrit-Owner: PleaseStand 
Gerrit-Reviewer: MaxSem 

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


[MediaWiki-commits] [Gerrit] dumpBackup.php: Remove --force-normal option - change (mediawiki/core)

2015-09-29 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: dumpBackup.php: Remove --force-normal option
..

dumpBackup.php: Remove --force-normal option

The code handling this option, added in r14151 / 64cbfd80b576, used to call
dl() to allow use of the utfnormal library's custom PHP extension even if
it is not enabled in php.ini. That part was removed in 1.22 (d0c8ba037cf6).

And as pointed out by Ariel Glenn[1], the utfnormal library later dropped
support for that PHP extension in 6c61fd7c7843 (in favor of intl, which had
already been supported since 1.17 (r69626 / f08147c313f5)), so there is now
no reason whatsoever to check for utf8_normalize(). The option will now be
treated like any other unrecognized option and will be silently ignored.

[1]: https://phabricator.wikimedia.org/T94277#1680209

Change-Id: I467bf609fda6e923fd2d654400d8e1b6c3714d96
---
M RELEASE-NOTES-1.26
M maintenance/backup.inc
2 files changed, 2 insertions(+), 6 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index efca318..8282cc1 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -242,6 +242,8 @@
   ResourceLoaderContext instance is deprecated.
 * ResourceLoader::getLessCompiler() now takes an optional parameter of
   additional LESS variables to set for the compiler.
+* Removed --force-normal option of dumpBackup.php, as it no longer served
+  any useful purpose since 1.22.
 
 == Compatibility ==
 
diff --git a/maintenance/backup.inc b/maintenance/backup.inc
index 6e1ddb4..93010ae 100644
--- a/maintenance/backup.inc
+++ b/maintenance/backup.inc
@@ -174,12 +174,6 @@
case "server":
$this->server = $val;
break;
-   case "force-normal":
-   if ( !function_exists( 
'utf8_normalize' ) ) {
-   $this->fatalError( 
"UTF-8 normalization extension not loaded. " .
-   "Install or 
remove --force-normal parameter to use slower code." );
-   }
-   break;
default:
$this->processOption( $opt, 
$val, $param );
}

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

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

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


[MediaWiki-commits] [Gerrit] QueryPage::fetchFromCache: Remove redundant $db->resultObjec... - change (mediawiki/core)

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

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

Change subject: QueryPage::fetchFromCache: Remove redundant $db->resultObject() 
call
..

QueryPage::fetchFromCache: Remove redundant $db->resultObject() call

Apparently missed in 3daf61814db3

Change-Id: I1dd15e0cfb79c4221b079d6f08b3de5db5b9b1a4
---
M includes/specialpage/QueryPage.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/241270/1

diff --git a/includes/specialpage/QueryPage.php 
b/includes/specialpage/QueryPage.php
index 3c8b742..48fed38 100644
--- a/includes/specialpage/QueryPage.php
+++ b/includes/specialpage/QueryPage.php
@@ -457,7 +457,7 @@
array( 'qc_type' => $this->getName() ),
__METHOD__, $options
);
-   return $dbr->resultObject( $res );
+   return $res;
}
 
public function getCachedTimestamp() {

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

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

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


[MediaWiki-commits] [Gerrit] Remove redundant $db->resultObject() call - change (mediawiki...Maps)

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

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

Change subject: Remove redundant $db->resultObject() call
..

Remove redundant $db->resultObject() call

As in rMW3daf61814db326f8

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Maps 
refs/changes/77/241277/1

diff --git a/includes/Maps_LayerGroup.php b/includes/Maps_LayerGroup.php
index b8f8cd6..3f4538b 100644
--- a/includes/Maps_LayerGroup.php
+++ b/includes/Maps_LayerGroup.php
@@ -249,6 +249,6 @@
$conditions,
__METHOD__
);
-   return $db->resultObject( $res );
+   return $res;
}
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic90bd0ad97d2c5660f1491c0fa17fc84291a5100
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Maps
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Remove redundant $db->resultObject() call - change (mediawiki...Disambiguator)

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

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

Change subject: Remove redundant $db->resultObject() call
..

Remove redundant $db->resultObject() call

From SpecialDisambiguationPageLinks::fetchFromCache(), as in
core commit aa13d7935db2 (removing the redundant call from the
overridden method of the parent class)

Change-Id: Ibef942fdf39044df045981e6bb9f6ff4640b
---
M specials/SpecialDisambiguationPageLinks.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/specials/SpecialDisambiguationPageLinks.php 
b/specials/SpecialDisambiguationPageLinks.php
index 40d0ae9..09d5c11 100644
--- a/specials/SpecialDisambiguationPageLinks.php
+++ b/specials/SpecialDisambiguationPageLinks.php
@@ -199,7 +199,7 @@
__METHOD__,
$options
);
-   return $dbr->resultObject( $res );
+   return $res;
}
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibef942fdf39044df045981e6bb9f6ff4640b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Disambiguator
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Remove redundant $db->resultObject() call - change (mediawiki...Video)

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

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

Change subject: Remove redundant $db->resultObject() call
..

Remove redundant $db->resultObject() call

As in core commit 3daf61814db3

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


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

diff --git a/VideoPageArchive.php b/VideoPageArchive.php
index c4d2ed4..fd07616 100644
--- a/VideoPageArchive.php
+++ b/VideoPageArchive.php
@@ -26,8 +26,7 @@
__METHOD__,
array( 'ORDER BY' => 'ov_timestamp DESC' )
);
-   $ret = $dbr->resultObject( $res );
-   return $ret;
+   return $res;
}
 
/**
@@ -113,4 +112,4 @@
 
return array( '', '', '' );
}
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id71914cdd0d94f52fcce2aafaa2fd55382d5d93d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Video
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Remove redundant $db->resultObject() calls - change (mediawiki...Oversight)

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

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

Change subject: Remove redundant $db->resultObject() calls
..

Remove redundant $db->resultObject() calls

As in core commit 3daf61814db3

Change-Id: I63071e65868b429b9f097a476dd903eba458dcbf
---
M HideRevision_body.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Oversight 
refs/changes/76/241276/1

diff --git a/HideRevision_body.php b/HideRevision_body.php
index 0f93439..8cbda7a 100644
--- a/HideRevision_body.php
+++ b/HideRevision_body.php
@@ -155,7 +155,7 @@
),
__METHOD__ );
 
-   return $this->makeList( $dbr->resultObject( $result ) );
+   return $this->makeList( $result );
}
 
/**
@@ -219,7 +219,7 @@
),
__METHOD__ );
 
-   return $this->makeList( $dbr->resultObject( $result ) );
+   return $this->makeList( $result );
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63071e65868b429b9f097a476dd903eba458dcbf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Oversight
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Database: Remove resultObject() from the public interface - change (mediawiki/core)

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

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

Change subject: Database: Remove resultObject() from the public interface
..

Database: Remove resultObject() from the public interface

It has not been necessary to call this method outside the Database classes
since 1.11.

This is a breaking change and should not be merged before the following
changes to extensions:

* Disambiguator: Ibef942fd
* Maps: Ic90bd0ad
* OAI: Idbbe08d6
* Oversight: I63071e65
* Video: Id71914cd

Change-Id: Idfe7cd6f516f0aca850878282c47e7914accc6d8
---
M RELEASE-NOTES-1.26
M includes/db/DBConnRef.php
M includes/db/Database.php
M includes/db/DatabaseMssql.php
M includes/db/IDatabase.php
5 files changed, 8 insertions(+), 27 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index aab1b42..7f738e1 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -220,6 +220,8 @@
   'Project:Oversight' to 'Project:Suppress'.
 * (T84937) Free external links ("autolinked" urls) will now be terminated
   by  and HTML entity encodings of , <, and >.
+* DatabaseBase::resultObject() is now protected (use outside Database classes
+  not necessary since 1.11).
 
 == Compatibility ==
 
diff --git a/includes/db/DBConnRef.php b/includes/db/DBConnRef.php
index b4f3f79..ffada49 100644
--- a/includes/db/DBConnRef.php
+++ b/includes/db/DBConnRef.php
@@ -449,10 +449,6 @@
return $this->__call( __FUNCTION__, func_get_args() );
}
 
-   public function resultObject( $result ) {
-   return $this->__call( __FUNCTION__, func_get_args() );
-   }
-
public function ping() {
return $this->__call( __FUNCTION__, func_get_args() );
}
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 1e54f55..dbe86dc 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -3766,14 +3766,13 @@
 * Once upon a time, DatabaseBase::query() returned a bare MySQL result
 * resource, and it was necessary to call this function to convert it to
 * a wrapper. Nowadays, raw database objects are never exposed to 
external
-* callers, so this is unnecessary in external code. For compatibility 
with
-* old code, ResultWrapper objects are passed through unaltered.
+* callers, so this is unnecessary in external code.
 *
-* @param bool|ResultWrapper|resource $result
+* @param bool|ResultWrapper|resource|object $result
 * @return bool|ResultWrapper
 */
-   public function resultObject( $result ) {
-   if ( empty( $result ) ) {
+   protected function resultObject( $result ) {
+   if ( !$result ) {
return false;
} elseif ( $result instanceof ResultWrapper ) {
return $result;
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index 85f1b96..354afc5 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -145,8 +145,8 @@
 * @param bool|MssqlResultWrapper|resource $result
 * @return bool|MssqlResultWrapper
 */
-   public function resultObject( $result ) {
-   if ( empty( $result ) ) {
+   protected function resultObject( $result ) {
+   if ( !$result ) {
return false;
} elseif ( $result instanceof MssqlResultWrapper ) {
return $result;
diff --git a/includes/db/IDatabase.php b/includes/db/IDatabase.php
index 49d0514..95608c6 100644
--- a/includes/db/IDatabase.php
+++ b/includes/db/IDatabase.php
@@ -1348,22 +1348,6 @@
public function timestampOrNull( $ts = null );
 
/**
-* Take the result from a query, and wrap it in a ResultWrapper if
-* necessary. Boolean values are passed through as is, to indicate 
success
-* of write queries or failure.
-*
-* Once upon a time, DatabaseBase::query() returned a bare MySQL result
-* resource, and it was necessary to call this function to convert it to
-* a wrapper. Nowadays, raw database objects are never exposed to 
external
-* callers, so this is unnecessary in external code. For compatibility 
with
-* old code, ResultWrapper objects are passed through unaltered.
-*
-* @param bool|ResultWrapper|resource $result
-* @return bool|ResultWrapper
-*/
-   public function resultObject( $result );
-
-   /**
 * Ping the server and try to reconnect if it there is no connection
 *
 * @return bool Success or failure

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

Gerrit-MessageType: newchange

[MediaWiki-commits] [Gerrit] Remove redundant $db->resultObject() call - change (mediawiki...OAI)

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

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

Change subject: Remove redundant $db->resultObject() call
..

Remove redundant $db->resultObject() call

As in core commit 3daf61814db3

Change-Id: Idbbe08d67b9d8391fb0a844a21b4c480a9da25b0
---
M OAIRepo_body.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAI 
refs/changes/79/241279/1

diff --git a/OAIRepo_body.php b/OAIRepo_body.php
index 6ae8c95..9b05715 100644
--- a/OAIRepo_body.php
+++ b/OAIRepo_body.php
@@ -814,7 +814,7 @@
__METHOD__
);
 
-   return $this->_db->resultObject( $res );
+   return $res;
}
 
function identifyInfo() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbbe08d67b9d8391fb0a844a21b4c480a9da25b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAI
Gerrit-Branch: master
Gerrit-Owner: PleaseStand 

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


[MediaWiki-commits] [Gerrit] Installer: Fix collapsing of field help text - change (mediawiki/core)

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

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

Change subject: Installer: Fix collapsing of field help text
..

Installer: Fix collapsing of field help text

Follows-up 1e06a9f02f9a.

Change-Id: I23030f48ce89abc460ac9e7ed3c148893ffb24ef
---
M mw-config/config.js
1 file changed, 5 insertions(+), 5 deletions(-)


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

diff --git a/mw-config/config.js b/mw-config/config.js
index d2dc213..fb637f7 100644
--- a/mw-config/config.js
+++ b/mw-config/config.js
@@ -14,15 +14,15 @@
}
 
// Set up the help system
-   $( '.mw-help-field-data' )
+   $( '.config-help-field-data' )
.hide()
-   .closest( '.mw-help-field-container' )
-   .find( '.mw-help-field-hint' )
+   .closest( '.config-help-field-container' )
+   .find( '.config-help-field-hint' )
.show()
.click( function () {
$( this )
-   .closest( 
'.mw-help-field-container' )
-   .find( 
'.mw-help-field-data' )
+   .closest( 
'.config-help-field-container' )
+   .find( 
'.config-help-field-data' )

.slideToggle( 'fast' );
} );
 

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

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

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


[MediaWiki-commits] [Gerrit] User::incEditCountImmediate(): Add explicit IS NOT NULL check - change (mediawiki/core)

2015-09-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: User::incEditCountImmediate(): Add explicit IS NOT NULL check
..

User::incEditCountImmediate(): Add explicit IS NOT NULL check

Within the UPDATE query, if user_editcount IS NULL, user_editcount+1 will
also be NULL, and the change becomes a no-op. So in MySQL, the number of
affected rows would be zero, which is the number of rows that actually
changed.

However, other DBMSs (e.g. PostgreSQL, SQLite) do count no-op changes,
meaning the code would not initialize user_editcount if it were NULL.
Explicitly checking for NULL should ensure consistent behavior across
database types.

Also, if the CLIENT_FOUND_ROWS flag is set when connecting to MySQL, the
server returns "Rows matched:" instead of "Changed:" as the affected row
count. This change would be necessary if MediaWiki, like Drupal, is
changed to use that flag .

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


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

diff --git a/includes/User.php b/includes/User.php
index d57dfaa..19ccc6d 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -4842,7 +4842,7 @@
$dbw->update(
'user',
array( 'user_editcount=user_editcount+1' ),
-   array( 'user_id' => $this->getId() ),
+   array( 'user_id' => $this->getId(), 'user_editcount IS 
NOT NULL' ),
__METHOD__
);
// Lazy initialization check...

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

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

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


[MediaWiki-commits] [Gerrit] Remove unused private property LinkCache::$mClassVer - change (mediawiki/core)

2015-09-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove unused private property LinkCache::$mClassVer
..

Remove unused private property LinkCache::$mClassVer

This was added in r2084 / c280ef342b64 for a "persistent link cache"
feature, which became obsolete in 1.4 and was removed in 1.5.

https://www.mediawiki.org/wiki/Manual:$wgEnablePersistentLC

Follows-up r9276 / cb45389b9c4d.

Change-Id: I2f27d6acc1a1f9a9382a47d56921f570107a7be9
---
M includes/cache/LinkCache.php
1 file changed, 0 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/241017/1

diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php
index 56c9256..3db84a6 100644
--- a/includes/cache/LinkCache.php
+++ b/includes/cache/LinkCache.php
@@ -27,10 +27,6 @@
  * @ingroup Cache
  */
 class LinkCache {
-   // Increment $mClassVer whenever old serialized versions of this class
-   // becomes incompatible with the new version.
-   private $mClassVer = 5;
-
/**
 * @var MapCacheLRU
 */

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

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

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


[MediaWiki-commits] [Gerrit] DatabaseBase::deadlockLoop(): Remove unused variables - change (mediawiki/core)

2015-09-19 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: DatabaseBase::deadlockLoop(): Remove unused variables
..

DatabaseBase::deadlockLoop(): Remove unused variables

Follows-up 419221e4a71b.

Change-Id: Ia0d50e40600ca2cd7b90441b66340d3c290be85f
---
M includes/db/Database.php
1 file changed, 0 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/33/239533/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 4ceebaf..1e54f55 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -3226,9 +3226,6 @@
$retVal = call_user_func_array( $function, 
$args );
break;
} catch ( DBQueryError $e ) {
-   $error = $this->lastError();
-   $errno = $this->lastErrno();
-   $sql = $this->lastQuery();
if ( $this->wasDeadlock() ) {
// Retry after a randomized delay
usleep( mt_rand( 
self::DEADLOCK_DELAY_MIN, self::DEADLOCK_DELAY_MAX ) );

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

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

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


[MediaWiki-commits] [Gerrit] Database: Remove unused errorCount() method - change (mediawiki/core)

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

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

Change subject: Database: Remove unused errorCount() method
..

Database: Remove unused errorCount() method

Change-Id: Ie26a5f5ef7dc5619d9db38d3eb6b7af3e6592aff
---
M RELEASE-NOTES-1.26
M includes/db/Database.php
M includes/db/DatabaseOracle.php
3 files changed, 1 insertion(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/239324/1

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 4463c78..13239de 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -187,6 +187,7 @@
 * Watchlist tokens, SpecialResetTokens, and User::getTokenFromOption()
   are deprecated. Applications using those can work via the OAuth
   extension instead. New tokens types should not be added.
+* DatabaseBase::errorCount() was removed (unused).
 
 == Compatibility ==
 
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 4d1b1c0..4ceebaf 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -58,7 +58,6 @@
protected $mSchema;
protected $mFlags;
protected $mForeign;
-   protected $mErrorCount = 0;
protected $mLBInfo = array();
protected $mDefaultBigSelects = null;
protected $mSchemaVars = false;
@@ -257,15 +256,6 @@
 */
public function trxTimestamp() {
return $this->mTrxLevel ? $this->mTrxTimestamp : null;
-   }
-
-   /**
-* Get/set the number of errors logged. Only useful when errors are 
ignored
-* @param int $count The count to set, or omitted to leave it unchanged.
-* @return int The error count
-*/
-   public function errorCount( $count = null ) {
-   return wfSetVar( $this->mErrorCount, $count );
}
 
/**
@@ -,8 +1101,6 @@
 * @throws DBQueryError
 */
public function reportQueryError( $error, $errno, $sql, $fname, 
$tempIgnore = false ) {
-   ++$this->mErrorCount;
-
if ( $this->ignoreErrors() || $tempIgnore ) {
wfDebug( "SQL ERROR (ignored): $error\n" );
} else {
diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php
index 081174a..87c3164 100644
--- a/includes/db/DatabaseOracle.php
+++ b/includes/db/DatabaseOracle.php
@@ -971,20 +971,6 @@
return $valuedata;
}
 
-   function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = 
false ) {
-   # Ignore errors during error handling to avoid infinite
-   # recursion
-   $ignore = $this->ignoreErrors( true );
-   ++$this->mErrorCount;
-
-   if ( $ignore || $tempIgnore ) {
-   wfDebug( "SQL ERROR (ignored): $error\n" );
-   $this->ignoreErrors( $ignore );
-   } else {
-   throw new DBQueryError( $this, $error, $errno, $sql, 
$fname );
-   }
-   }
-
/**
 * @return string Wikitext of a link to the server software's web site
 */

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

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

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


[MediaWiki-commits] [Gerrit] [WIP] Database: Avoid internal use of ignoreErrors() - change (mediawiki/core)

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

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

Change subject: [WIP] Database: Avoid internal use of ignoreErrors()
..

[WIP] Database: Avoid internal use of ignoreErrors()

* Use $tempIgnore in DatabaseBase::tableExists() instead of ignoreErrors().
  This does not preclude removing the parameter in the future provided that
  another way to suppress the error logging (using wfLogDBError()) becomes
  available.
* DatabasePostgres::reportQueryError(), when calling rollback(), appears
  to use ignoreErrors() as a recursion guard (since 419221e4a71b). However,
  rollback() is called regardless of whether errors are ignored. Replaced
  this with a boolean property set within doRollback(), which already sets
  $tempIgnore.
* ignoreErrors(), now unused, will be removed in a separate change set.

Change-Id: Iee768abf996ece213146ab8f64a15a2b407a2e5e
---
M includes/db/Database.php
M includes/db/DatabasePostgres.php
2 files changed, 24 insertions(+), 8 deletions(-)


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

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 4ceebaf..ee49476 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1841,11 +1841,7 @@
 */
public function tableExists( $table, $fname = __METHOD__ ) {
$table = $this->tableName( $table );
-   $old = $this->ignoreErrors( true );
-   $res = $this->query( "SELECT 1 FROM $table LIMIT 1", $fname );
-   $this->ignoreErrors( $old );
-
-   return (bool)$res;
+   return (bool)$this->query( "SELECT 1 FROM $table LIMIT 1", 
$fname, true );
}
 
/**
diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 56a5b2c..8fa0f15 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -313,6 +313,9 @@
/** @var string */
private $mCoreSchema;
 
+   /** @var bool */
+   private $mDoingRollback = false;
+
function getType() {
return 'postgres';
}
@@ -531,14 +534,31 @@
}
}
/* Transaction stays in the ERROR state until rolled back */
-   if ( $this->mTrxLevel ) {
-   $ignore = $this->ignoreErrors( true );
+   if ( $this->mTrxLevel && !$this->mDoingRollback ) {
$this->rollback( __METHOD__ );
-   $this->ignoreErrors( $ignore );
}
parent::reportQueryError( $error, $errno, $sql, $fname, false );
}
 
+   /**
+* Issues the ROLLBACK command to the database server.
+*
+* @see DatabaseBase::rollback()
+* @param string $fname
+*/
+   protected function doRollback( $fname ) {
+   $this->mDoingRollback = true;
+
+   try {
+   parent::doRollback( $fname );
+   } catch ( Exception $e ) {
+   $this->mDoingRollback = false;
+   throw $e;
+   }
+
+   $this->mDoingRollback = false;
+   }
+
function queryIgnore( $sql, $fname = __METHOD__ ) {
return $this->query( $sql, $fname, true );
}

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

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

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


[MediaWiki-commits] [Gerrit] Category::refreshCounts(): Save new counts using upsert() - change (mediawiki/core)

2015-08-28 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Category::refreshCounts(): Save new counts using upsert()
..

Category::refreshCounts(): Save new counts using upsert()

Addresses TODO comment. upsert() is also what WikiPage currently
uses (since ff85f8bfcc88) to update the category table.

Change-Id: I71c6dafd4223d79a0153fa8ce7cb0ee1354c0ec6
---
M includes/Category.php
1 file changed, 11 insertions(+), 19 deletions(-)


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

diff --git a/includes/Category.php b/includes/Category.php
index 3a21e25..54009c8 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -314,22 +314,6 @@
$dbw = wfGetDB( DB_MASTER );
$dbw-startAtomic( __METHOD__ );
 
-   # Insert the row if it doesn't exist yet (e.g., this is being 
run via
-   # update.php from a pre-1.16 schema).  TODO: This will cause 
lots and
-   # lots of gaps on some non-MySQL DBMSes if you run 
populateCategory.php
-   # repeatedly.  Plus it's an extra query that's unneeded almost 
all the
-   # time.  This should be rewritten somehow, probably.
-   $seqVal = $dbw-nextSequenceValue( 'category_cat_id_seq' );
-   $dbw-insert(
-   'category',
-   array(
-   'cat_id' = $seqVal,
-   'cat_title' = $this-mName
-   ),
-   __METHOD__,
-   'IGNORE'
-   );
-
$cond1 = $dbw-conditional( array( 'page_namespace' = 
NS_CATEGORY ), 1, 'NULL' );
$cond2 = $dbw-conditional( array( 'page_namespace' = NS_FILE 
), 1, 'NULL' );
$result = $dbw-selectRow(
@@ -342,16 +326,24 @@
__METHOD__,
array( 'LOCK IN SHARE MODE' )
);
-   $ret = $dbw-update(
+
+   $dbw-upsert(
'category',
+   array(
+   'cat_title' = $this-mName,
+   'cat_pages' = $result-pages,
+   'cat_subcats' = $result-subcats,
+   'cat_files' = $result-files
+   ),
+   array( 'cat_title' ),
array(
'cat_pages' = $result-pages,
'cat_subcats' = $result-subcats,
'cat_files' = $result-files
),
-   array( 'cat_title' = $this-mName ),
__METHOD__
);
+
$dbw-endAtomic( __METHOD__ );
 
# Now we should update our local counts.
@@ -359,6 +351,6 @@
$this-mSubcats = $result-subcats;
$this-mFiles = $result-files;
 
-   return $ret;
+   return true;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71c6dafd4223d79a0153fa8ce7cb0ee1354c0ec6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] deleteEqualMessages.php: Avoid Transaction already in progr... - change (mediawiki/core)

2015-08-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: deleteEqualMessages.php: Avoid Transaction already in 
progress warning
..

deleteEqualMessages.php: Avoid Transaction already in progress warning

Set the $commit parameter of WikiPage::doDeleteArticle() to true so
the transaction it starts is explicitly committed. Also fixed similar
bugs in two other maintenance scripts.

Follows-up 02f17b579060.

Bug: T110189
Change-Id: Ifde98066e25cb616f23c8998f9461ebf7a2073d6
---
M maintenance/deleteBatch.php
M maintenance/deleteDefaultMessages.php
M maintenance/deleteEqualMessages.php
3 files changed, 6 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/09/233909/1

diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php
index 93507b3..216d718 100644
--- a/maintenance/deleteBatch.php
+++ b/maintenance/deleteBatch.php
@@ -106,8 +106,7 @@
}
$page = WikiPage::factory( $title );
$error = '';
-   $success = $page-doDeleteArticle( $reason, false, 0, 
false, $error, $user );
-   $dbw-commit( __METHOD__ );
+   $success = $page-doDeleteArticle( $reason, false, 0, 
true, $error, $user );
if ( $success ) {
$this-output(  Deleted!\n );
} else {
diff --git a/maintenance/deleteDefaultMessages.php 
b/maintenance/deleteDefaultMessages.php
index 5aeeb8e..a1c0f61 100644
--- a/maintenance/deleteDefaultMessages.php
+++ b/maintenance/deleteDefaultMessages.php
@@ -76,10 +76,9 @@
$dbw-ping();
$title = Title::makeTitle( $row-page_namespace, 
$row-page_title );
$page = WikiPage::factory( $title );
-   $dbw-begin( __METHOD__ );
$error = ''; // Passed by ref
-   $page-doDeleteArticle( 'No longer required', false, 0, 
false, $error, $user );
-   $dbw-commit( __METHOD__ );
+   // FIXME: Deletion failures should be reported, not 
silently ignored.
+   $page-doDeleteArticle( 'No longer required', false, 0, 
true, $error, $user );
}
 
$this-output( done!\n, 'msg' );
diff --git a/maintenance/deleteEqualMessages.php 
b/maintenance/deleteEqualMessages.php
index dbe9698..73e65dc 100644
--- a/maintenance/deleteEqualMessages.php
+++ b/maintenance/deleteEqualMessages.php
@@ -182,14 +182,15 @@
$this-output( \n* [[$title]] );
$page = WikiPage::factory( $title );
$error = ''; // Passed by ref
-   $page-doDeleteArticle( 'No longer required', false, 0, 
false, $error, $user );
+   // FIXME: Deletion failures should be reported, not 
silently ignored.
+   $page-doDeleteArticle( 'No longer required', false, 0, 
true, $error, $user );
if ( $result['hasTalk']  $doDeleteTalk ) {
$title = Title::makeTitle( NS_MEDIAWIKI_TALK, 
$result['title'] );
$this-output( \n* [[$title]] );
$page = WikiPage::factory( $title );
$error = ''; // Passed by ref
$page-doDeleteArticle( 'Orphaned talk page of 
no longer required message',
-   false, 0, false, $error, $user );
+   false, 0, true, $error, $user );
}
}
$this-output( \n\ndone!\n );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifde98066e25cb616f23c8998f9461ebf7a2073d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Fix typo in UploadFromUrlJob::initializeSessionData() - change (mediawiki/core)

2015-08-25 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Fix typo in UploadFromUrlJob::initializeSessionData()
..

Fix typo in UploadFromUrlJob::initializeSessionData()

Behavior would change under PHP7, though neither the current behavior
nor the new behavior seem correct. Did not test, as the feature has
been broken anyway since r81612 / e942dc69fcc6.

https://github.com/facebook/hhvm/issues/5523#issuecomment-133132721

Change-Id: Iac1177fee05b6c721abe54b6a96c1652445a5c90
---
M includes/jobqueue/jobs/UploadFromUrlJob.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/08/233908/1

diff --git a/includes/jobqueue/jobs/UploadFromUrlJob.php 
b/includes/jobqueue/jobs/UploadFromUrlJob.php
index a15d51e..ade4810 100644
--- a/includes/jobqueue/jobs/UploadFromUrlJob.php
+++ b/includes/jobqueue/jobs/UploadFromUrlJob.php
@@ -166,11 +166,11 @@
}
 
/**
-* Initialize the session data. Sets the intial result to queued.
+* Initialize the session data. Sets the initial result to queued.
 */
public function initializeSessionData() {
$session = self::getSessionData( $this-params['sessionKey'] );
-   $$session['result'] = 'Queued';
+   $session['result'] = 'Queued';
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac1177fee05b6c721abe54b6a96c1652445a5c90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove maintenance script fixSlaveDesync.php - change (mediawiki/core)

2015-08-19 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove maintenance script fixSlaveDesync.php
..

Remove maintenance script fixSlaveDesync.php

Though this script was run on Wikimedia sites years ago (see T8399), there
are enough reasons to doubt it will be run again:

* There is a hardcoded maximum page_id value, which would have to be
  changed or removed before reuse.
* It scans the entire page table in a single SELECT query and stores all
  values of page_id and page_latest in a PHP array, which might not be
  feasible on a large wiki.
* It writes directly to slaves. In contrast, the manual page for
  pt-table-sync (from Percona Toolkit) says in general, [...] it always
  makes the changes on the replication master, never the replication slave
  directly. This is in general the only safe way to bring a replica back
  in sync [...].
* It only works on the page/revision/text tables. In contrast, pt-table-sync
  can work on any table having a primary key.
* It does try to detect whether revisions are missing on the master (instead
  of on the slave). However, this won't work because of a bug introduced in
  r91243 / bb1df74f8715 (it actually queries the master twice and puts the
  second result set in $slaveIDs).

Change-Id: I85c98821af308abf7dde8068d7cbca17d06b1362
---
M RELEASE-NOTES-1.26
M autoload.php
D maintenance/fixSlaveDesync.php
3 files changed, 1 insertion(+), 247 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 1b468a1..19e3eaa 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -154,6 +154,7 @@
 * BREAKING CHANGE: mediawiki.legacy.ajax has been removed, following
   a lengthy deprecation period.
 * The ScopedPHPTimeout class was removed.
+* Removed maintenance script fixSlaveDesync.php.
 
 == Compatibility ==
 
diff --git a/autoload.php b/autoload.php
index b67fb8f..48e0b88 100644
--- a/autoload.php
+++ b/autoload.php
@@ -448,7 +448,6 @@
'FixBug20757' = __DIR__ . '/maintenance/storage/fixBug20757.php',
'FixDoubleRedirects' = __DIR__ . '/maintenance/fixDoubleRedirects.php',
'FixExtLinksProtocolRelative' = __DIR__ . 
'/maintenance/fixExtLinksProtocolRelative.php',
-   'FixSlaveDesync' = __DIR__ . '/maintenance/fixSlaveDesync.php',
'FixTimestamps' = __DIR__ . '/maintenance/fixTimestamps.php',
'FixUserRegistration' = __DIR__ . 
'/maintenance/fixUserRegistration.php',
'ForeignAPIFile' = __DIR__ . 
'/includes/filerepo/file/ForeignAPIFile.php',
diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php
deleted file mode 100644
index a5418ce..000
--- a/maintenance/fixSlaveDesync.php
+++ /dev/null
@@ -1,246 +0,0 @@
-?php
-/**
- * Fix erroneous page_latest values due to slave desynchronisation.
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance
- */
-
-require_once __DIR__ . '/Maintenance.php';
-
-/**
- * Maintenance script that fixes erroneous page_latest values
- * due to slave desynchronisation.
- *
- * @ingroup Maintenance
- */
-class FixSlaveDesync extends Maintenance {
-   /** @var array */
-   private $slaveIndexes;
-
-   public function __construct() {
-   parent::__construct();
-   $this-mDescription = ;
-   }
-
-   public function getDbType() {
-   return Maintenance::DB_ADMIN;
-   }
-
-   public function execute() {
-   $this-slaveIndexes = array();
-   $serverCount = wfGetLB()-getServerCount();
-   for ( $i = 1; $i  $serverCount; $i++ ) {
-   if ( wfGetLB()-isNonZeroLoad( $i ) ) {
-   $this-slaveIndexes[] = $i;
-   }
-   }
-
-   if ( $this-hasArg() ) {
-   $this-desyncFixPage( $this-getArg() );
-   } else {
-   $corrupt = $this-findPageLatestCorruption();
-   foreach ( $corrupt as $id = $dummy ) {
-   $this-desyncFixPage( $id );
- 

[MediaWiki-commits] [Gerrit] Cleanup after extraction of utfnormal library - change (mediawiki/core)

2015-08-17 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Cleanup after extraction of utfnormal library
..

Cleanup after extraction of utfnormal library

* Delete includes/compat/normal/.gitignore, which excluded files
  now located in various directories within the utfnormal repo.
* Remove For NFC see includes/compat/normal comments from
  maintenance/language, replacing them with a note that This
  data file is used after normalizing to NFC.

Change-Id: I0ac990ec1a547b4c454ed738ce1dfffce0f53ba4
---
D includes/compat/normal/.gitignore
M maintenance/language/generateNormalizerDataAr.php
M maintenance/language/generateNormalizerDataMl.php
3 files changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/91/231991/1

diff --git a/includes/compat/normal/.gitignore 
b/includes/compat/normal/.gitignore
deleted file mode 100644
index 5af0afa..000
--- a/includes/compat/normal/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/CompositionExclusions.txt
-/DerivedNormalizationProps.txt
-/NormalizationCorrections.txt
-/NormalizationTest.txt
-/UnicodeData.txt
-/testdata
diff --git a/maintenance/language/generateNormalizerDataAr.php 
b/maintenance/language/generateNormalizerDataAr.php
index d029bf7..52ed81f 100644
--- a/maintenance/language/generateNormalizerDataAr.php
+++ b/maintenance/language/generateNormalizerDataAr.php
@@ -25,7 +25,8 @@
 
 /**
  * Generates the normalizer data file for Arabic.
- * For NFC see includes/compat/normal.
+ *
+ * This data file is used after normalizing to NFC.
  *
  * @ingroup MaintenanceLanguage
  */
diff --git a/maintenance/language/generateNormalizerDataMl.php 
b/maintenance/language/generateNormalizerDataMl.php
index 770a98c..cb6ae69 100644
--- a/maintenance/language/generateNormalizerDataMl.php
+++ b/maintenance/language/generateNormalizerDataMl.php
@@ -25,7 +25,8 @@
 
 /**
  * Generates the normalizer data file for Malayalam.
- * For NFC see includes/compat/normal.
+ *
+ * This data file is used after normalizing to NFC.
  *
  * @ingroup MaintenanceLanguage
  */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ac990ec1a547b4c454ed738ce1dfffce0f53ba4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] refreshLinks.php: Fix deletion of link entries from nonexist... - change (mediawiki/core)

2015-07-31 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: refreshLinks.php: Fix deletion of link entries from nonexistent 
pages
..

refreshLinks.php: Fix deletion of link entries from nonexistent pages

After checking a chunk of one of the links tables, the script failed
to restore the original chunk start when checking the next table.

Follows-up a1e005155921.

Bug: T107632
Change-Id: I21678bc3c83946f2e62afe3fdc69c7e84678ceeb
---
M maintenance/refreshLinks.php
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/228417/1

diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index 5d311ad..f6c721f 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -327,13 +327,14 @@
 
foreach ( $linksTables as $table = $field ) {
$this-output( $table: 0 );
+   $tableStart = $start;
$counter = 0;
do {
$ids = $dbr-selectFieldValues(
$table,
$field,
array(
-   self::intervalCond( $dbr, 
$field, $start, $end ),
+   self::intervalCond( $dbr, 
$field, $tableStart, $end ),
$field NOT IN 
({$dbr-selectSQLText( 'page', 'page_id' )}),
),
__METHOD__,
@@ -346,10 +347,10 @@
wfWaitForSlaves();
$dbw-delete( $table, array( $field = 
$ids ), __METHOD__ );
$this-output( , $counter );
-   $start = $ids[$numIds - 1] + 1;
+   $tableStart = $ids[$numIds - 1] + 1;
}
 
-   } while ( $numIds = $batchSize  ( $end === null || 
$start = $end ) );
+   } while ( $numIds = $batchSize  ( $end === null || 
$tableStart = $end ) );
 
$this-output(  deleted.\n );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I21678bc3c83946f2e62afe3fdc69c7e84678ceeb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] SpecialAllPages: Fix a few subtle Previous page link bugs - change (mediawiki/core)

2015-07-03 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: SpecialAllPages: Fix a few subtle Previous page link bugs
..

SpecialAllPages: Fix a few subtle Previous page link bugs

* When finding the start of the previous page, exclude redirects if
  Hide redirects is checked. Otherwise, if some of the previous 345
  wiki pages were redirects, an equal number of results would be
  repeated when going back.
* Don't select unnecessary rows beyond the start of the previous page.
  At the same time, fix a bug that could cause results close to the
  beginning to be skipped when going back.
* When finding the start of the first page, don't omit ORDER BY for
  MySQL and SQLite.
* Don't suppress the link when the unprefixed title is 0 or similar
  or is numerically equal to the from parameter value.

Change-Id: I2cc6958b894afa824a5345871b5a27b01f9fcc73
---
M includes/specials/SpecialAllPages.php
1 file changed, 15 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/222715/1

diff --git a/includes/specials/SpecialAllPages.php 
b/includes/specials/SpecialAllPages.php
index 74b1f7b..c8e218c 100644
--- a/includes/specials/SpecialAllPages.php
+++ b/includes/specials/SpecialAllPages.php
@@ -25,6 +25,7 @@
  * Implements Special:Allpages
  *
  * @ingroup SpecialPage
+ * @todo Rewrite using IndexPager
  */
 class SpecialAllPages extends IncludableSpecialPage {
 
@@ -33,7 +34,7 @@
 *
 * @var int $maxPerPage
 */
-   protected $maxPerPage = 345;
+   protected $maxPerPage = 10;
 
/**
 * Determines, which message describes the input field 'nsfrom'.
@@ -191,15 +192,13 @@
list( , $toKey, $to ) = $toList;
 
$dbr = wfGetDB( DB_SLAVE );
-   $conds = array(
-   'page_namespace' = $namespace,
-   'page_title = ' . $dbr-addQuotes( $fromKey )
-   );
-
+   $filterConds = array( 'page_namespace' = $namespace );
if ( $hideredirects ) {
-   $conds['page_is_redirect'] = 0;
+   $filterConds['page_is_redirect'] = 0;
}
 
+   $conds = $filterConds;
+   $conds[] = 'page_title = ' . $dbr-addQuotes( $fromKey 
);
if ( $toKey !==  ) {
$conds[] = 'page_title = ' . $dbr-addQuotes( 
$toKey );
}
@@ -245,37 +244,22 @@
// First chunk; no previous link.
$prevTitle = null;
} else {
-   # Get the last title from previous chunk
+   # Get the first title from previous chunk
$dbr = wfGetDB( DB_SLAVE );
$res_prev = $dbr-select(
'page',
'page_title',
-   array( 'page_namespace' = $namespace, 
'page_title  ' . $dbr-addQuotes( $from ) ),
+   array_merge( $filterConds, array( 'page_title  
' . $dbr-addQuotes( $from ) ) ),
__METHOD__,
-   array( 'ORDER BY' = 'page_title DESC',
-   'LIMIT' = $this-maxPerPage, 'OFFSET' 
= ( $this-maxPerPage - 1 )
-   )
+   array( 'ORDER BY' = 'page_title DESC', 'LIMIT' 
= $this-maxPerPage )
);
 
-   # Get first title of previous complete chunk
-   if ( $dbr-numrows( $res_prev ) = $this-maxPerPage ) {
-   $pt = $dbr-fetchObject( $res_prev );
+   if ( $res_prev-numRows()  0 ) {
+   $res_prev-seek( $res_prev-numRows() - 1 );
+   $pt = $res_prev-fetchObject();
$prevTitle = Title::makeTitle( $namespace, 
$pt-page_title );
} else {
-   # The previous chunk is not complete, need to 
link to the very first title
-   # available in the database
-   $options = array( 'LIMIT' = 1 );
-   if ( !$dbr-implicitOrderby() ) {
-   $options['ORDER BY'] = 'page_title';
-   }
-   $reallyFirstPage_title = $dbr-selectField( 
'page', 'page_title',
-   array( 'page_namespace' = $namespace 
), __METHOD__, $options );
-   # Show the previous link if it s not the 

[MediaWiki-commits] [Gerrit] api/i18n: Fix a couple typos - change (mediawiki/core)

2015-06-09 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: api/i18n: Fix a couple typos
..

api/i18n: Fix a couple typos

Change-Id: I5990bd9e92b0ffb592ec7c3eb80280a2d3e2f19f
---
M includes/api/i18n/en.json
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/46/216946/1

diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json
index f576f45..1a412dd 100644
--- a/includes/api/i18n/en.json
+++ b/includes/api/i18n/en.json
@@ -207,7 +207,7 @@
apihelp-import-param-templates: For interwiki imports: import all 
included templates as well.,
apihelp-import-param-namespace: Import to this namespace. Cannot be 
used together with var$1rootpage/var.,
apihelp-import-param-rootpage: Import as subpage of this page. 
Cannot be used together with var$1namespace/var.,
-   apihelp-import-example-import: Import [[meta:Help:Parserfunctions]] 
to namespace 100 with full history.,
+   apihelp-import-example-import: Import [[meta:Help:ParserFunctions]] 
to namespace 100 with full history.,
 
apihelp-login-description: Log in and get authentication 
cookies.\n\nIn the event of a successful log-in, the needed cookies will be 
included in the HTTP response headers. In the event of a failed log-in, further 
attempts may be throttled to limit automated password guessing attacks.,
apihelp-login-param-name: User name.,
@@ -909,7 +909,7 @@
apihelp-query+search-param-backend: Which search backend to use, if 
not the default.,
apihelp-query+search-example-simple: Search for kbdmeaning/kbd.,
apihelp-query+search-example-text: Search texts for 
kbdmeaning/kbd.,
-   apihelp-query+search-example-generator: Ger page info about the 
pages returned for a search for kbdmeaning/kbd.,
+   apihelp-query+search-example-generator: Get page info about the 
pages returned for a search for kbdmeaning/kbd.,
 
apihelp-query+siteinfo-description: Return general information about 
the site.,
apihelp-query+siteinfo-param-prop: Which information to 
get:\n;general:Overall system information.\n;namespaces:List of registered 
namespaces and their canonical names.\n;namespacealiases:List of registered 
namespace aliases.\n;specialpagealiases:List of special page 
aliases.\n;magicwords:List of magic words and their 
aliases.\n;statistics:Returns site statistics.\n;interwikimap:Returns interwiki 
map (optionally filtered, optionally localised by using 
var$1inlanguagecode/var).\n;dbrepllag:Returns database server with the 
highest replication lag.\n;usergroups:Returns user groups and the associated 
permissions.\n;libraries:Returns libraries installed on the 
wiki.\n;extensions:Returns extensions installed on the 
wiki.\n;fileextensions:Returns list of file extensions allowed to be 
uploaded.\n;rightsinfo:Returns wiki rights (license) information if 
available.\n;restrictions:Returns information on available restriction 
(protection) types.\n;languages:Returns a list of languages MediaWiki supports 
(optionally localised by using var$1inlanguagecode/var).\n;skins:Returns a 
list of all enabled skins (optionally localised by using 
var$1inlanguagecode/var, otherwise in the content 
language).\n;extensiontags:Returns a list of parser extension 
tags.\n;functionhooks:Returns a list of parser function 
hooks.\n;showhooks:Returns a list of all subscribed hooks (contents of 
var[[mw:Manual:$wgHooks|$wgHooks]]/var).\n;variables:Returns a list of 
variable IDs.\n;protocols:Returns a list of protocols that are allowed in 
external links.\n;defaultoptions:Returns the default values for user 
preferences.,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5990bd9e92b0ffb592ec7c3eb80280a2d3e2f19f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove maintenance script deleteImageMemcached.php - change (mediawiki/core)

2015-05-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove maintenance script deleteImageMemcached.php
..

Remove maintenance script deleteImageMemcached.php

This script is broken; it deletes an object cache key that 1.11
(r22850 / ed4303922f4e) and newer no longer use. The most similar
working script is probably refreshImageMetadata.php --force.

Change-Id: Icf2223dc87861e02f20422492d40994f5302ad15
---
M RELEASE-NOTES-1.26
M autoload.php
D maintenance/deleteImageMemcached.php
3 files changed, 1 insertion(+), 90 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 3d6651f..61e04b8 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -55,6 +55,7 @@
 * mediaWiki.confirmCloseWindow now returns an object of functions, instead of
 one function. The callback can't be called directly any more. The callback 
function
 is replaced with confirmCloseWindow.release().
+* Removed maintenance script deleteImageMemcached.php.
 
 == Compatibility ==
 
diff --git a/autoload.php b/autoload.php
index c81c4bb..bdc0d93 100644
--- a/autoload.php
+++ b/autoload.php
@@ -318,7 +318,6 @@
'DeleteDefaultMessages' = __DIR__ . 
'/maintenance/deleteDefaultMessages.php',
'DeleteEqualMessages' = __DIR__ . 
'/maintenance/deleteEqualMessages.php',
'DeleteFileOp' = __DIR__ . '/includes/filebackend/FileOp.php',
-   'DeleteImageCache' = __DIR__ . '/maintenance/deleteImageMemcached.php',
'DeleteLogFormatter' = __DIR__ . 
'/includes/logging/DeleteLogFormatter.php',
'DeleteOldRevisions' = __DIR__ . '/maintenance/deleteOldRevisions.php',
'DeleteOrphanedRevisions' = __DIR__ . 
'/maintenance/deleteOrphanedRevisions.php',
diff --git a/maintenance/deleteImageMemcached.php 
b/maintenance/deleteImageMemcached.php
deleted file mode 100644
index 4799e5e..000
--- a/maintenance/deleteImageMemcached.php
+++ /dev/null
@@ -1,89 +0,0 @@
-?php
-/**
- * Delete image information from the object cache.
- *
- * Usage example:
- * php deleteImageMemcached.php --until 2005-09-05 00:00:00 --sleep 0
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance
- */
-
-require_once __DIR__ . '/Maintenance.php';
-
-/**
- * Maintenance script that deletes image information from the object cache.
- *
- * @ingroup Maintenance
- */
-class DeleteImageCache extends Maintenance {
-   public function __construct() {
-   parent::__construct();
-   $this-mDescription = Delete image information from the cache;
-   $this-addOption( 'sleep', 'How many seconds to sleep between 
deletions', true, true );
-   $this-addOption( 'until', 'Timestamp to delete all entries 
prior to', true, true );
-   }
-
-   public function execute() {
-   global $wgMemc;
-
-   $until = preg_replace( /[^\d]/, '', $this-getOption( 'until' 
) );
-   $sleep = (int)$this-getOption( 'sleep' ) * 1000; // 
milliseconds
-
-   ini_set( 'display_errors', false );
-
-   $dbr = wfGetDB( DB_SLAVE );
-
-   $res = $dbr-select( 'image',
-   array( 'img_name' ),
-   array( img_timestamp  {$until} ),
-   __METHOD__
-   );
-
-   $i = 0;
-   $total = $this-getImageCount();
-
-   foreach ( $res as $row ) {
-   if ( $i % $this-report == 0 ) {
-   $this-output( sprintf(
-   %s: %13s done (%s)\n,
-   wfWikiID(),
-   $i/$total,
-   wfPercent( $i / $total * 100 )
-   ) );
-   }
-   $md5 = md5( $row-img_name );
-   $wgMemc-delete( wfMemcKey( 'Image', $md5 ) );
-
-   if ( $sleep != 0 ) {
-   usleep( $sleep );
-   }
-
-  

[MediaWiki-commits] [Gerrit] [WIP] Combine deleteArchived{Files, Revisions}.inc into the .... - change (mediawiki/core)

2015-05-16 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: [WIP] Combine deleteArchived{Files,Revisions}.inc into the .php 
scripts
..

[WIP] Combine deleteArchived{Files,Revisions}.inc into the .php scripts

Some of deleteArchivedFiles.php and deleteArchivedRevisions.php were
split off to deleteArchivedFiles.inc and deleteArchivedRevisions.inc
respectively in r62948 (04b2413aacfd) for use in tests.

The tests no longer use those methods, so I moved them back and inlined
them into execute(). I also did some minor cleanup -- changing direct
calls to tableName() and query() to use query builder functions and
clarifying/fixing some of the logic that was in deleteArchivedFiles.inc.

Change-Id: Ica49dcac18a9c702cffe02e562c6dff48d2d2784
---
M autoload.php
D maintenance/deleteArchivedFiles.inc
M maintenance/deleteArchivedFiles.php
D maintenance/deleteArchivedRevisions.inc
M maintenance/deleteArchivedRevisions.php
5 files changed, 86 insertions(+), 168 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index c81c4bb..274c87e 100644
--- a/autoload.php
+++ b/autoload.php
@@ -311,9 +311,7 @@
'DeferredUpdates' = __DIR__ . '/includes/deferred/DeferredUpdates.php',
'DeleteAction' = __DIR__ . '/includes/actions/DeleteAction.php',
'DeleteArchivedFiles' = __DIR__ . 
'/maintenance/deleteArchivedFiles.php',
-   'DeleteArchivedFilesImplementation' = __DIR__ . 
'/maintenance/deleteArchivedFiles.inc',
'DeleteArchivedRevisions' = __DIR__ . 
'/maintenance/deleteArchivedRevisions.php',
-   'DeleteArchivedRevisionsImplementation' = __DIR__ . 
'/maintenance/deleteArchivedRevisions.inc',
'DeleteBatch' = __DIR__ . '/maintenance/deleteBatch.php',
'DeleteDefaultMessages' = __DIR__ . 
'/maintenance/deleteDefaultMessages.php',
'DeleteEqualMessages' = __DIR__ . 
'/maintenance/deleteEqualMessages.php',
diff --git a/maintenance/deleteArchivedFiles.inc 
b/maintenance/deleteArchivedFiles.inc
deleted file mode 100644
index 0c0b34a..000
--- a/maintenance/deleteArchivedFiles.inc
+++ /dev/null
@@ -1,84 +0,0 @@
-?php
-/**
- * Core functions for deleteArchivedFiles.php
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance
- */
-
-/**
- * Core functions for deleteArchivedFiles.php
- *
- * @ingroup Maintenance
- */
-class DeleteArchivedFilesImplementation {
-   public static function doDelete( $output, $force ) {
-   # Data should come off the master, wrapped in a transaction
-   $dbw = wfGetDB( DB_MASTER );
-   $dbw-begin( __METHOD__ );
-   $tbl_arch = $dbw-tableName( 'filearchive' );
-   $repo = RepoGroup::singleton()-getLocalRepo();
-   # Get active revisions from the filearchive table
-   $output-handleOutput( Searching for and deleting archived 
files...\n );
-   $res = $dbw-query( SELECT 
fa_id,fa_storage_group,fa_storage_key,fa_sha1 FROM $tbl_arch );
-   $count = 0;
-   foreach ( $res as $row ) {
-   $key = $row-fa_storage_key;
-   if ( !strlen( $key ) ) {
-   $output-handleOutput( Entry with ID 
{$row-fa_id} has empty key, skipping\n );
-   continue;
-   }
-   $group = $row-fa_storage_group;
-   $id = $row-fa_id;
-   $path = $repo-getZonePath( 'deleted' ) . '/' . 
$repo-getDeletedHashPath( $key ) . $key;
-   if ( isset( $row-fa_sha1 ) ) {
-   $sha1 = $row-fa_sha1;
-   } else {
-   // old row, populate from key
-   $sha1 = LocalRepo::getHashFromKey( $key );
-   }
-   // Check if the file is used anywhere...
-   $inuse = $dbw-selectField(
-   'oldimage',
-   '1',
-   

[MediaWiki-commits] [Gerrit] Make PPFrame::RECOVER_COMMENTS actually work - change (mediawiki/core)

2015-05-13 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Make PPFrame::RECOVER_COMMENTS actually work
..

Make PPFrame::RECOVER_COMMENTS actually work

Because of a missing condition, it generally only had an effect
on output type Parser::OT_WIKI (during a pre-save transform).

Bug: T98841
Change-Id: I1e47696434fe87475f9902e6bfb8990566456e2f
---
M RELEASE-NOTES-1.26
M includes/parser/Preprocessor_DOM.php
M includes/parser/Preprocessor_Hash.php
M tests/parser/parserTests.txt
4 files changed, 10 insertions(+), 4 deletions(-)


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

diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 3d6651f..050a557 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -20,6 +20,8 @@
 
 === Bug fixes in 1.26 ===
 * (bug 51283) load.php sometimes sends 304 response without full headers
+* (T98841) {{msgnw:}} will correctly recover the original code of comments
+  even when it is not substituted as part of a pre-save transform.
 
 === Action API changes in 1.26 ===
 * API action=querylist=tags: The displayname can now be boolean false if the
diff --git a/includes/parser/Preprocessor_DOM.php 
b/includes/parser/Preprocessor_DOM.php
index 0351f2a..bbf7aa1 100644
--- a/includes/parser/Preprocessor_DOM.php
+++ b/includes/parser/Preprocessor_DOM.php
@@ -1195,15 +1195,16 @@
} elseif ( $contextNode-nodeName == 'comment' 
) {
# HTML-style comment
# Remove it in HTML, pre+remove and 
STRIP_COMMENTS modes
-   if ( $this-parser-ot['html']
+   # Not in RECOVER_COMMENTS mode 
(extractSections, msgnw) though.
+   if ( ( $this-parser-ot['html']
|| ( $this-parser-ot['pre'] 
 $this-parser-mOptions-getRemoveComments() )
|| ( $flags  
PPFrame::STRIP_COMMENTS )
+   )  !( $flags  
PPFrame::RECOVER_COMMENTS )
) {
$out .= '';
} elseif ( $this-parser-ot['wiki']  
!( $flags  PPFrame::RECOVER_COMMENTS ) ) {
# Add a strip marker in PST 
mode so that pstPass2() can
# run some old-fashioned 
regexes on the result.
-   # Not in RECOVER_COMMENTS mode 
(extractSections) though.
$out .= 
$this-parser-insertStripItem( $contextNode-textContent );
} else {
# Recover the literal comment 
in RECOVER_COMMENTS and pre+no-remove
diff --git a/includes/parser/Preprocessor_Hash.php 
b/includes/parser/Preprocessor_Hash.php
index af91ad4..26b524d 100644
--- a/includes/parser/Preprocessor_Hash.php
+++ b/includes/parser/Preprocessor_Hash.php
@@ -1118,15 +1118,16 @@
} elseif ( $contextNode-name == 'comment' ) {
# HTML-style comment
# Remove it in HTML, pre+remove and 
STRIP_COMMENTS modes
-   if ( $this-parser-ot['html']
+   # Not in RECOVER_COMMENTS mode 
(extractSections, msgnw) though.
+   if ( ( $this-parser-ot['html']
|| ( $this-parser-ot['pre'] 
 $this-parser-mOptions-getRemoveComments() )
|| ( $flags  
PPFrame::STRIP_COMMENTS )
+   )  !( $flags  
PPFrame::RECOVER_COMMENTS )
) {
$out .= '';
} elseif ( $this-parser-ot['wiki']  
!( $flags  PPFrame::RECOVER_COMMENTS ) ) {
# Add a strip marker in PST 
mode so that pstPass2() can
# run some old-fashioned 
regexes on the result.
-   # Not in RECOVER_COMMENTS mode 
(extractSections) though.
$out .= 
$this-parser-insertStripItem( $contextNode-firstChild-value );
} else {
# Recover the literal comment 
in RECOVER_COMMENTS and pre+no-remove
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 

[MediaWiki-commits] [Gerrit] wfBaseConvert(): Avoid PHP warning when converting zero - change (mediawiki/core)

2015-05-13 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: wfBaseConvert(): Avoid PHP warning when converting zero
..

wfBaseConvert(): Avoid PHP warning when converting zero

The warning occurs when gmp_init() tries to convert the empty string
that came from ltrim(). This is causing tests to fail under HHVM 3.6.1.

Follows-up 5957856c46c3.

Bug: T98882
Change-Id: Ica86c91d7897db979e09d7cfc82fb3a20b95d4ce
---
M includes/GlobalFunctions.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 6eaeb25..8b3b959 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -3353,7 +3353,7 @@
// Removing leading zeros works around broken base detection 
code in
// some PHP versions (see 
https://bugs.php.net/bug.php?id=50175 and
// https://bugs.php.net/bug.php?id=55398).
-   $result = gmp_strval( gmp_init( ltrim( $input, '0' ), 
$sourceBase ), $destBase );
+   $result = gmp_strval( gmp_init( ltrim( $input, '0' ) ?: '0', 
$sourceBase ), $destBase );
} elseif ( extension_loaded( 'bcmath' )  ( $engine == 'auto' || 
$engine == 'bcmath' ) ) {
$decimal = '0';
foreach ( str_split( strtolower( $input ) ) as $char ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica86c91d7897db979e09d7cfc82fb3a20b95d4ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Move some global statements to top of function - change (mediawiki/core)

2015-04-30 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Move some global statements to top of function
..

Move some global statements to top of function

These were flagged by mediawiki/tools/code-utils/check-vars.php
because they were located inside a switch statement, or inside an
if statement and used outside the statement. All other warnings
from that script are bogus, mostly because the script has no
support for PHP 5.3 namespaces.

Change-Id: If93bae4434b5c28845125095f6a22d6788a76efc
---
M includes/logging/LogFormatter.php
M includes/logging/LogPager.php
2 files changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/includes/logging/LogFormatter.php 
b/includes/logging/LogFormatter.php
index 9c2fdd3..119492b 100644
--- a/includes/logging/LogFormatter.php
+++ b/includes/logging/LogFormatter.php
@@ -193,6 +193,8 @@
 * @return string Text
 */
public function getIRCActionText() {
+   global $wgContLang;
+
$this-plaintext = true;
$this-irctext = true;
 
@@ -338,7 +340,6 @@
case 'block':
switch ( $entry-getSubtype() ) {
case 'block':
-   global $wgContLang;
// Keep compatibility with 
extensions by checking for
// new key 
(5::duration/6::flags) or old key (0/optional 1)
if ( $entry-isLegacy() ) {
@@ -358,7 +359,6 @@
-rawParams( $target 
)-inContentLanguage()-escaped();
break;
case 'reblock':
-   global $wgContLang;
$duration = 
$wgContLang-translateBlockExpiry( $parameters['5::duration'] );
$flags = 
BlockLogFormatter::formatBlockFlags( $parameters['6::flags'], $wgContLang );
$text = wfMessage( 
'reblock-logentry' )
diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php
index bf489ab..c4ce7b3 100644
--- a/includes/logging/LogPager.php
+++ b/includes/logging/LogPager.php
@@ -192,7 +192,7 @@
 * @return void
 */
private function limitTitle( $page, $pattern ) {
-   global $wgMiserMode;
+   global $wgMiserMode, $wgUserrightsInterwikiDelimiter;
 
if ( $page instanceof Title ) {
$title = $page;
@@ -209,7 +209,6 @@
 
$doUserRightsLogLike = false;
if ( $this-types == array( 'rights' ) ) {
-   global $wgUserrightsInterwikiDelimiter;
$parts = explode( $wgUserrightsInterwikiDelimiter, 
$title-getDBKey() );
if ( count( $parts ) == 2 ) {
list( $name, $database ) = array_map( 'trim', 
$parts );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If93bae4434b5c28845125095f6a22d6788a76efc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] generateJsonI18n.php: Remove features that should no longer ... - change (mediawiki/core)

2015-04-30 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: generateJsonI18n.php: Remove features that should no longer be 
needed
..

generateJsonI18n.php: Remove features that should no longer be needed

* Removed --langcode, which was for converting core messages files.
* Do not generate backward compatibility shims. MediaWiki 1.19 will
  enter end-of-life status in May 2015.
* Print a special error message for shims, which is different from
  the one that used to refer to --langcode.
* Removed extra newlines from error messages.

Change-Id: Ic8498fbdd7c2bd6e30ddbd96da85b2b8b23d706b
---
M maintenance/generateJsonI18n.php
1 file changed, 21 insertions(+), 113 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/207917/1

diff --git a/maintenance/generateJsonI18n.php b/maintenance/generateJsonI18n.php
index 22d9940..b9c07fb 100644
--- a/maintenance/generateJsonI18n.php
+++ b/maintenance/generateJsonI18n.php
@@ -39,11 +39,8 @@
 
$this-addArg( 'phpfile', 'PHP file defining a $messages 
array', false );
$this-addArg( 'jsondir', 'Directory to write JSON files to', 
false );
-   $this-addOption( 'langcode', 'Language code; only needed for 
converting core i18n files',
-   false, true );
$this-addOption( 'extension', 'Perform default conversion on 
an extension',
false, true );
-   $this-addOption( 'shim-only', 'Only create or update the 
backward-compatibility shim' );
$this-addOption( 'supplementary', 'Find supplementary i18n 
files in subdirs and convert those',
false, false );
}
@@ -58,13 +55,13 @@
 
if ( $extension ) {
if ( $phpfile ) {
-   $this-error( The phpfile is already 
specified, conflicts with --extension.\n, 1 );
+   $this-error( The phpfile is already 
specified, conflicts with --extension., 1 );
}
$phpfile = 
$IP/extensions/$extension/$extension.i18n.php;
}
 
if ( !$phpfile ) {
-   $this-error( I'm here for an argument!\n );
+   $this-error( I'm here for an argument! );
$this-maybeHelp( true );
// dies.
}
@@ -104,47 +101,32 @@
$this-output( Creating directory $jsondir.\n );
$success = mkdir( $jsondir );
if ( !$success ) {
-   $this-error( Could not create directory 
$jsondir\n, 1 );
+   $this-error( Could not create directory 
$jsondir, 1 );
}
}
 
-   if ( $this-hasOption( 'shim-only' ) ) {
-   $this-shimOnly( $phpfile, $jsondir );
-
-   return;
-   }
-
-   if ( $jsondir === null ) {
-   $this-error( 'Argument [jsondir] is required unless 
--shim-only is specified.' );
-   $this-maybeHelp( true );
-   }
-
if ( !is_readable( $phpfile ) ) {
-   $this-error( Error reading $phpfile\n, 1 );
+   $this-error( Error reading $phpfile, 1 );
}
include $phpfile;
$phpfileContents = file_get_contents( $phpfile );
 
if ( !isset( $messages ) ) {
-   $this-error( PHP file $phpfile does not define 
\$messages array\n, 1 );
+   $this-error( PHP file $phpfile does not define 
\$messages array, 1 );
}
 
-   $extensionStyle = true;
+   if ( !$messages ) {
+   $this-error( PHP file $phpfile contains an empty 
\$messages array.  .
+   Maybe it was already converted?, 1 );
+   }
+
if ( !isset( $messages['en'] ) || !is_array( $messages['en'] ) 
) {
-   if ( !$this-hasOption( 'langcode' ) ) {
-   $this-error( PHP file $phpfile does not set 
language codes, --langcode  .
-   is required.\n, 1 );
-   }
-   $extensionStyle = false;
-   $langcode = $this-getOption( 'langcode' );
-   $messages = array( $langcode = $messages );
-   } elseif ( $this-hasOption( 'langcode' ) ) {
-   $this-output( Warning: --langcode option set but will 
not be used.\n );
+   $this-error( PHP file $phpfile does not set language 
codes, 1 );
}
 
foreach ( 

[MediaWiki-commits] [Gerrit] convertExtensionToRegistration.php: Ignore i18n shims - change (mediawiki/core)

2015-04-30 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: convertExtensionToRegistration.php: Ignore i18n shims
..

convertExtensionToRegistration.php: Ignore i18n shims

Bug: T91350
Change-Id: I18b35db14a13f58909bce83fec11bf9e8f10672d
---
M maintenance/convertExtensionToRegistration.php
1 file changed, 17 insertions(+), 2 deletions(-)


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

diff --git a/maintenance/convertExtensionToRegistration.php 
b/maintenance/convertExtensionToRegistration.php
index 2fb3697..78b4e8c 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -6,7 +6,7 @@
 
protected $custom = array(
'MessagesDirs' = 'handleMessagesDirs',
-   'ExtensionMessagesFiles' = 'removeAbsolutePath',
+   'ExtensionMessagesFiles' = 'handleExtensionMessagesFiles',
'AutoloadClasses' = 'removeAbsolutePath',
'ExtensionCredits' = 'handleCredits',
'ResourceModules' = 'handleResourceModules',
@@ -79,7 +79,7 @@
}
$realName = substr( $name, 2 ); // Strip 'wg'
if ( isset( $this-custom[$realName] ) ) {
-   call_user_func_array( array( $this, 
$this-custom[$realName] ), array( $realName, $value ) );
+   call_user_func_array( array( $this, 
$this-custom[$realName] ), array( $realName, $value, $vars ) );
} elseif ( in_array( $realName, $globalSettings ) ) {
$this-json[$realName] = $value;
} elseif ( strpos( $name, 'wg' ) === 0 ) {
@@ -123,6 +123,21 @@
}
}
 
+   protected function handleExtensionMessagesFiles( $realName, $value, 
$vars ) {
+   foreach ( $value as $key = $file ) {
+   $strippedFile = $this-stripPath( $file, $this-dir );
+   if ( isset( $vars['wgMessagesDirs'][$key] ) ) {
+   $this-output(
+   Note: Ignoring PHP shim $strippedFile. 
 .
+   If your extension no longer supports 
versions of MediaWiki  .
+   older than 1.23.0, you can safely 
delete it.\n
+   );
+   } else {
+   $this-json[$realName][$key] = $strippedFile;
+   }
+   }
+   }
+
private function stripPath( $val, $dir ) {
if ( $val === $dir ) {
$val = '';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18b35db14a13f58909bce83fec11bf9e8f10672d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Change case of class names to match declarations - change (mediawiki/core)

2015-04-29 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Change case of class names to match declarations
..

Change case of class names to match declarations

Found by running a script that uses PHP's tokenizer extension to
extract class declarations and uses, then compare them:

* AllMessagesTablePager
* SVGReader
* XML

Change-Id: I960aa05b2127722ecc5ae8b165549f9e1077d3c1
---
M includes/media/SVG.php
M includes/site/SiteExporter.php
M includes/specials/SpecialAllMessages.php
3 files changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/31/207431/1

diff --git a/includes/media/SVG.php b/includes/media/SVG.php
index b505280..c2f85e8 100644
--- a/includes/media/SVG.php
+++ b/includes/media/SVG.php
@@ -95,7 +95,7 @@
$metadata = $this-unpackMetadata( $metadata );
if ( isset( $metadata['translations'] ) ) {
foreach ( $metadata['translations'] as $lang = 
$langType ) {
-   if ( $langType === 
SvgReader::LANG_FULL_MATCH ) {
+   if ( $langType === 
SVGReader::LANG_FULL_MATCH ) {
$langList[] = $lang;
}
}
diff --git a/includes/site/SiteExporter.php b/includes/site/SiteExporter.php
index 62f6ca3..169c0d8 100644
--- a/includes/site/SiteExporter.php
+++ b/includes/site/SiteExporter.php
@@ -57,13 +57,13 @@
'xmlns' = 'http://www.mediawiki.org/xml/sitelist-1.0/',
);
 
-   fwrite( $this-sink, XML::openElement( 'sites', $attributes ) . 
\n );
+   fwrite( $this-sink, Xml::openElement( 'sites', $attributes ) . 
\n );
 
foreach ( $sites as $site ) {
$this-exportSite( $site );
}
 
-   fwrite( $this-sink, XML::closeElement( 'sites' ) . \n );
+   fwrite( $this-sink, Xml::closeElement( 'sites' ) . \n );
fflush( $this-sink );
}
 
@@ -79,36 +79,36 @@
$siteAttr = null;
}
 
-   fwrite( $this-sink, \t . XML::openElement( 'site', $siteAttr 
) . \n );
+   fwrite( $this-sink, \t . Xml::openElement( 'site', $siteAttr 
) . \n );
 
-   fwrite( $this-sink, \t\t . XML::element( 'globalid', null, 
$site-getGlobalId() ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 'globalid', null, 
$site-getGlobalId() ) . \n );
 
if ( $site-getGroup() !== Site::GROUP_NONE ) {
-   fwrite( $this-sink, \t\t . XML::element( 'group', 
null, $site-getGroup() ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 'group', 
null, $site-getGroup() ) . \n );
}
 
if ( $site-getSource() !== Site::SOURCE_LOCAL ) {
-   fwrite( $this-sink, \t\t . XML::element( 'source', 
null, $site-getSource() ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 'source', 
null, $site-getSource() ) . \n );
}
 
if ( $site-shouldForward() ) {
-   fwrite( $this-sink, \t\t . XML::element( 'forward', 
null, '' ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 'forward', 
null, '' ) . \n );
}
 
foreach ( $site-getAllPaths() as $type = $path ) {
-   fwrite( $this-sink, \t\t . XML::element( 'path', 
array( 'type' = $type ), $path ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 'path', 
array( 'type' = $type ), $path ) . \n );
}
 
foreach ( $site-getLocalIds() as $type = $ids ) {
foreach ( $ids as $id ) {
-   fwrite( $this-sink, \t\t . XML::element( 
'localid', array( 'type' = $type ), $id ) . \n );
+   fwrite( $this-sink, \t\t . Xml::element( 
'localid', array( 'type' = $type ), $id ) . \n );
}
}
 
//@todo: export data
//@todo: export config
 
-   fwrite( $this-sink, \t . XML::closeElement( 'site' ) . \n 
);
+   fwrite( $this-sink, \t . Xml::closeElement( 'site' ) . \n 
);
}
 
 }
diff --git a/includes/specials/SpecialAllMessages.php 
b/includes/specials/SpecialAllMessages.php
index 5211e30..91eade1 100644
--- a/includes/specials/SpecialAllMessages.php
+++ b/includes/specials/SpecialAllMessages.php
@@ -29,7 +29,7 @@
  */
 class SpecialAllMessages extends SpecialPage {
/**
-* @var AllmessagesTablePager
+* @var AllMessagesTablePager
 */
protected $table;
 
@@ 

[MediaWiki-commits] [Gerrit] Add script that checks for incorrectly capitalized class names - change (mediawiki...code-utils)

2015-04-29 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Add script that checks for incorrectly capitalized class names
..

Add script that checks for incorrectly capitalized class names

find-class-case-mismatches.php, written by me in September 2013, checks
every non-dynamic use of a class from a certain directory against a
class map generated from the classes in a certain (other) directory.

Change-Id: Id2564ed7b8fe28ab8c7a49ed4950f31d22b0a4d3
---
A find-class-case-mismatches.php
1 file changed, 257 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/code-utils 
refs/changes/20/207720/1

diff --git a/find-class-case-mismatches.php b/find-class-case-mismatches.php
new file mode 100755
index 000..27119c1
--- /dev/null
+++ b/find-class-case-mismatches.php
@@ -0,0 +1,257 @@
+#!/usr/bin/env php
+?php
+/**
+ * Scan a PHP codebase for incorrectly capitalized class names.
+ *
+ * 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 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @author Kevin Israel
+ * @todo Test and/or fix namespace support
+ * @todo Add support for PHP 5.4 traits
+ * @file
+ */
+
+// Debugging code, not currently in use
+function tokenDump( $token ) {
+   if ( is_array( $token ) ) {
+   printf( %6d: %-40s%s\n, $token[2], token_name( $token[0] ), 
$token[1] );
+   } else {
+   echo str_repeat( ' ', 38 ) . $token . \n;
+   }
+}
+
+class TokenScanner {
+   protected $tokens;
+   protected $token = null;
+   protected $i = 0;
+
+   public function __construct( $tokens ) {
+   $this-tokens = $tokens;
+   }
+
+   protected function accept( $expected ) {
+   if ( !is_array( $expected ) ) {
+   $expected = array( $expected );
+   }
+
+   $this-nextToken();
+   $got = is_array( $this-token ) ? $this-token[0] : 
$this-token;
+   if ( in_array( $got, $expected, true ) ) {
+   return true;
+   }
+
+   $this-i -= 2;
+   $this-nextToken();
+   return false;
+   }
+
+   protected function nextToken() {
+   if ( $this-i = count( $this-tokens ) ) {
+   $this-token = null;
+   } else {
+   $this-token = $this-tokens[$this-i++];
+   }
+   return $this-token;
+   }
+
+   public function getDeclaredClasses() {
+   $classes = array();
+   $namespace = '\\';
+   while ( $this-nextToken() ) {
+   switch ( $this-token[0] ) {
+   case T_NAMESPACE:
+   $namespace = 
$this-parseNamespaceDeclaration();
+   break;
+   case T_CLASS:
+   case T_INTERFACE:
+   if ( !$this-accept( T_STRING ) ) {
+   break;
+   }
+   $classes[] = $namespace . 
$this-token[1];
+   break;
+   }
+   }
+   return $classes;
+   }
+
+   public function getUsedClasses() {
+   $classes = array();
+   $namespace = '\\';
+   $aliases = array();
+   while ( $this-nextToken() ) {
+   switch ( $this-token[0] ) {
+   case T_NAMESPACE:
+   $namespace = 
$this-parseNamespaceDeclaration();
+   break;
+   case T_USE:
+   $full = '\\';
+   $this-accept( T_NS_SEPARATOR );
+   while ( $this-accept( array( T_STRING, 
T_NS_SEPARATOR ) ) ) {
+   $full .= $this-token[1];
+   }
+
+ 

[MediaWiki-commits] [Gerrit] Allow setting the anonnotice to the empty string - change (mediawiki/core)

2015-03-31 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Allow setting the anonnotice to the empty string
..

Allow setting the anonnotice to the empty string

This supersedes hacks such as setting the anonnotice to p/p or
span/span to hide the normal sitenotice for logged-out users. These
are problematic for the DismissableSiteNotice extension, which will show
a close link even when there is no actual sitenotice visible on the page.

Bug: T94536
Change-Id: I11b8b883d480d0e07d8b395dd92360cb15de7c5b
---
M RELEASE-NOTES-1.25
M includes/skins/Skin.php
2 files changed, 7 insertions(+), 4 deletions(-)


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

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 0bf7a80..f6d9cb1 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -119,6 +119,8 @@
   proper, published library, which is now tagged as v1.0.0.
 * A new message (defaulting to blank), 'editnotice-notext', can be shown to 
users
   when they are editing if no edit notices apply to the page being edited.
+* (T94536) You can now disable the sitenotice for logged-out users by blanking
+  MediaWiki:Anonnotice.
 
  External libraries 
 * MediaWiki now requires certain external libraries to be installed. In the 
past
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 48bce67..d45eac7 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -1472,7 +1472,8 @@
 * Get a cached notice
 *
 * @param string $name Message name, or 'default' for $wgSiteNotice
-* @return string HTML fragment
+* @return string|bool HTML fragment, or false to indicate that the 
caller
+*   should fall back to the next notice in its sequence
 */
private function getCachedNotice( $name ) {
global $wgRenderHashAppend, $parserMemc, $wgContLang;
@@ -1489,7 +1490,7 @@
} else {
$msg = $this-msg( $name )-inContentLanguage();
if ( $msg-isDisabled() ) {
-   return false;
+   return $msg-exists()  $msg-isBlank() ? '' : 
false;
}
$notice = $msg-plain();
}
@@ -1549,13 +1550,13 @@
$siteNotice = $this-getCachedNotice( 
'sitenotice' );
} else {
$anonNotice = $this-getCachedNotice( 
'anonnotice' );
-   if ( !$anonNotice ) {
+   if ( $anonNotice === false ) {
$siteNotice = $this-getCachedNotice( 
'sitenotice' );
} else {
$siteNotice = $anonNotice;
}
}
-   if ( !$siteNotice ) {
+   if ( $siteNotice === false ) {
$siteNotice = $this-getCachedNotice( 'default' 
);
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11b8b883d480d0e07d8b395dd92360cb15de7c5b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Fix ORDER BY in fixUserRegistration.php - change (mediawiki/core)

2015-03-29 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Fix ORDER BY in fixUserRegistration.php
..

Fix ORDER BY in fixUserRegistration.php

Non-boolean options for select() must be provided as key-value pairs. If
provided as numbered elements, they will not end up in the generated query.

Follows-up ea406e42cd41.

Change-Id: I0364618b6a805c353cdc19a60f157df33519d87a
---
M maintenance/fixUserRegistration.php
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/maintenance/fixUserRegistration.php 
b/maintenance/fixUserRegistration.php
index 43f4b6c..40e0915 100644
--- a/maintenance/fixUserRegistration.php
+++ b/maintenance/fixUserRegistration.php
@@ -46,13 +46,13 @@
'user',
'user_id',
array(
-   'user_id ' . $dbw-addQuotes( $lastId 
),
+   'user_id  ' . $dbw-addQuotes( $lastId 
),
'user_registration IS NULL'
),
__METHOD__,
array(
'LIMIT' = $this-mBatchSize,
-   'ORDER BY user_id ASC',
+   'ORDER BY' = 'user_id',
)
);
foreach ( $res as $row ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0364618b6a805c353cdc19a60f157df33519d87a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] refreshLinks.php: Limit rows scanned per query in deleteLink... - change (mediawiki/core)

2015-03-26 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: refreshLinks.php: Limit rows scanned per query in 
deleteLinksFromNonexistent()
..

refreshLinks.php: Limit rows scanned per query in deleteLinksFromNonexistent()

This also makes the -e and [start] options apply to --dfn-only, making it
possible to restart the script other than at the beginning if necessary.

Bug: T38195
Change-Id: I828b522039290b5700faa89fb8ad4075e50332e7
---
M RELEASE-NOTES-1.25
M maintenance/refreshLinks.php
2 files changed, 103 insertions(+), 31 deletions(-)


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

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 01ab739..6462767 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -411,6 +411,9 @@
   this.
 * Removed class DBObject. (unused since 1.10)
 * wfDiff() is deprecated.
+* The -m (maximum replication lag) option of refreshLinks.php was removed.
+  It had no effect since MediaWiki 1.18 and should be removed from any cron
+  jobs or similar scripts you may have set up.
 
 == Compatibility ==
 
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index b2f7497..e39a37c 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -36,42 +36,51 @@
$this-addOption( 'new-only', 'Only affect articles with just a 
single edit' );
$this-addOption( 'redirects-only', 'Only fix redirects, not 
all links' );
$this-addOption( 'old-redirects-only', 'Only fix redirects 
with no redirect table entry' );
-   $this-addOption( 'm', 'Maximum replication lag', false, true );
$this-addOption( 'e', 'Last page id to refresh', false, true );
+   $this-addOption( 'dfn-chunk-size', 'Maximum number of existent 
IDs to check per ' .
+   'query, default 10', false, true );
$this-addArg( 'start', 'Page_id to start from, default 1', 
false );
$this-setBatchSize( 100 );
}
 
public function execute() {
-   $max = $this-getOption( 'm', 0 );
+   // Note that there is a difference between not specifying the 
start
+   // and end IDs and using the minimum and maximum values from 
the page
+   // table. In the latter case, deleteLinksFromNonexistent() will 
not
+   // delete entries for nonexistent IDs that fall outside the 
range.
+   $start = (int)$this-getArg( 0 ) ?: null;
+   $end = (int)$this-getOption( 'e' ) ?: null;
+   $dfnChunkSize = (int)$this-getOption( 'dfn-chunk-size', 10 
);
if ( !$this-hasOption( 'dfn-only' ) ) {
-   $start = $this-getArg( 0, 1 );
$new = $this-getOption( 'new-only', false );
-   $end = $this-getOption( 'e', 0 );
$redir = $this-getOption( 'redirects-only', false );
$oldRedir = $this-getOption( 'old-redirects-only', 
false );
-   $this-doRefreshLinks( $start, $new, $max, $end, 
$redir, $oldRedir );
+   $this-doRefreshLinks( $start, $new, $end, $redir, 
$oldRedir );
+   $this-deleteLinksFromNonexistent( null, null, 
$this-mBatchSize, $dfnChunkSize );
+   } else {
+   $this-deleteLinksFromNonexistent( $start, $end, 
$this-mBatchSize, $dfnChunkSize );
}
-   $this-deleteLinksFromNonexistent( $max, $this-mBatchSize );
}
 
/**
 * Do the actual link refreshing.
-* @param int $start Page_id to start from
+* @param int|null $start Page_id to start from
 * @param bool $newOnly Only do pages with 1 edit
-* @param int $maxLag Max DB replication lag
-* @param int $end Page_id to stop at
+* @param int|null $end Page_id to stop at
 * @param bool $redirectsOnly Only fix redirects
 * @param bool $oldRedirectsOnly Only fix redirects without redirect 
entries
 */
-   private function doRefreshLinks( $start, $newOnly = false, $maxLag = 
false,
-   $end = 0, $redirectsOnly = false, $oldRedirectsOnly = false
+   private function doRefreshLinks( $start, $newOnly = false,
+   $end = null, $redirectsOnly = false, $oldRedirectsOnly = false
) {
global $wgParser, $wgUseTidy;
 
$reportingInterval = 100;
$dbr = wfGetDB( DB_SLAVE );
-   $start = intval( $start );
+
+   if ( $start === null ) {
+   $start = 1;
+   }
 
// Give extensions a chance to optimize settings
wfRunHooks( 'MaintenanceRefreshLinksInit', array( $this ) );
@@ -89,14 +98,9 @@

[MediaWiki-commits] [Gerrit] Remove unused class DBObject - change (mediawiki/core)

2015-03-23 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove unused class DBObject
..

Remove unused class DBObject

This was left over from a previous attempt at Oracle support,
which was removed in 1.10 (r19196 / ccf91e827a48).

Change-Id: I5f9b82fffc0b4f84286b697be8d504020fe22547
---
M RELEASE-NOTES-1.25
M autoload.php
M includes/db/DatabaseUtility.php
3 files changed, 1 insertion(+), 24 deletions(-)


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

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 00ce6b1..d5868b6 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -409,6 +409,7 @@
 * EditPage::attemptSave has been modified not to call handleStatus itself and
   instead just returns the Status object. Extension calling it should be aware 
of
   this.
+* Removed class DBObject. (unused since 1.10)
 
 == Compatibility ==
 
diff --git a/autoload.php b/autoload.php
index eacf431..892a1f7 100644
--- a/autoload.php
+++ b/autoload.php
@@ -276,7 +276,6 @@
'DBFileJournal' = __DIR__ . 
'/includes/filebackend/filejournal/DBFileJournal.php',
'DBLockManager' = __DIR__ . 
'/includes/filebackend/lockmanager/DBLockManager.php',
'DBMasterPos' = __DIR__ . '/includes/db/DatabaseUtility.php',
-   'DBObject' = __DIR__ . '/includes/db/DatabaseUtility.php',
'DBQueryError' = __DIR__ . '/includes/db/DatabaseError.php',
'DBSiteStore' = __DIR__ . '/includes/site/DBSiteStore.php',
'DBUnexpectedError' = __DIR__ . '/includes/db/DatabaseError.php',
diff --git a/includes/db/DatabaseUtility.php b/includes/db/DatabaseUtility.php
index 4e5ed08..9a520ff 100644
--- a/includes/db/DatabaseUtility.php
+++ b/includes/db/DatabaseUtility.php
@@ -22,29 +22,6 @@
  */
 
 /**
- * Utility class.
- * @ingroup Database
- */
-class DBObject {
-   public $mData;
-
-   function __construct( $data ) {
-   $this-mData = $data;
-   }
-
-   /**
-* @return bool
-*/
-   function isLOB() {
-   return false;
-   }
-
-   function data() {
-   return $this-mData;
-   }
-}
-
-/**
  * Utility class
  * @ingroup Database
  *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f9b82fffc0b4f84286b697be8d504020fe22547
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] RELEASE-NOTES: Increase minimum MySQL version to 5.0.3 - change (mediawiki/core)

2015-03-23 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: RELEASE-NOTES: Increase minimum MySQL version to 5.0.3
..

RELEASE-NOTES: Increase minimum MySQL version to 5.0.3

Follows-up 5d9b67e09ed1.

Also updated the list of supported database servers in INSTALL
to match the list from RELEASE-NOTES-1.25.

Change-Id: I6881b1163455d834b058f4b4a7839a6aea44cdab
---
M INSTALL
M RELEASE-NOTES-1.25
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/199173/1

diff --git a/INSTALL b/INSTALL
index 70d8d53..2054a57 100644
--- a/INSTALL
+++ b/INSTALL
@@ -8,10 +8,11 @@
 Required software:
 * Web server with PHP 5.3.3 or higher.
 * A SQL server, the following types are supported
-** MySQL 5.0.2 or higher
+** MySQL 5.0.3 or higher
 ** PostgreSQL 8.3 or higher
 ** SQLite 3.3.7 or higher
 ** Oracle 9.0.1 or higher
+** Microsoft SQL Server 2005 (9.00.1399)
 
 MediaWiki is developed and tested mainly on Unix/Linux platforms, but should
 work on Windows as well.
diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 00ce6b1..a8d99ff 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -421,7 +421,7 @@
 
 The supported versions are:
 
-* MySQL 5.0.2 or later
+* MySQL 5.0.3 or later
 * PostgreSQL 8.3 or later
 * SQLite 3.3.7 or later
 * Oracle 9.0.1 or later

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6881b1163455d834b058f4b4a7839a6aea44cdab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] [WIP] Optionally log warnings generated by MySQL - change (mediawiki/core)

2015-03-22 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: [WIP] Optionally log warnings generated by MySQL
..

[WIP] Optionally log warnings generated by MySQL

There have been multiple cases in which strings are silently truncated
when they are stored in the database. When fields are binary fields,
this can result in ill-formed UTF-8. Under MySQL's strict mode, enabled
by default in recent versions[1], an error would occur. However, strict
mode is not enabled in WMF production. MediaWiki even turns it off by
default!

Fortunately, MySQL generates a warning even when strict mode is disabled.
In fact, it even does for some other cases as well. If we log these
warnings, we can discover and fix the bugs that cause them, without
breaking the site by immediately enabling strict mode.

This change adds an option to log warnings generated by successful queries
to a new log group DBWarnings. This is done only when using the mysqli
extension; the original mysql extension was designed for MySQL 3 and thus
lacks a sane way to determine whether a particular query generated any
warnings.

For some queries (e.g. INSERT IGNORE in MariaDB), certain warnings are
expected and are thus not logged. The list of error codes to avoid logging
is configurable.

[1]: In MySQL 5.6+, the sample my.cnf file specifies a sql_mode containing
STRICT_TRANS_TABLES; in 5.7.5+, the default sql_mode contains that option.

Change-Id: I3314c6ac0bcf4beb19fb95c3a2ca61d5d46b44ae
---
M includes/DefaultSettings.php
M includes/db/DatabaseMysqli.php
2 files changed, 54 insertions(+), 2 deletions(-)


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

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 1df809e..4b0fb99 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1931,6 +1931,22 @@
  */
 $wgDBWindowsAuthentication = false;
 
+/**
+ * Set to true to log warnings reported by the database, for successful
+ * queries only, to the DBWarnings log group.
+ *
+ * Currently only works for MySQL connections using the mysqli PHP extension.
+ */
+$wgDBLogWarnings = false;
+
+/**
+ * List of MySQL error codes to ignore when logging warnings
+ * (see $wgDBLogWarnings).
+ */
+$wgDBIgnoredMysqlWarnings = array(
+   1062, // ER_DUP_ENTRY, see note in 
https://mariadb.com/kb/en/mariadb/ignore/
+);
+
 /**@}*/ # End of DB settings }
 
 ///**
diff --git a/includes/db/DatabaseMysqli.php b/includes/db/DatabaseMysqli.php
index ad12e19..30fe645 100644
--- a/includes/db/DatabaseMysqli.php
+++ b/includes/db/DatabaseMysqli.php
@@ -30,14 +30,46 @@
  */
 class DatabaseMysqli extends DatabaseMysqlBase {
/**
+* @var int
+*/
+   protected $affectedRows = 0;
+
+   /**
 * @param string $sql
 * @return resource
 */
protected function doQuery( $sql ) {
-   if ( $this-bufferResults() ) {
+   $bufferResults = $this-bufferResults();
+   if ( $bufferResults ) {
$ret = $this-mConn-query( $sql );
} else {
$ret = $this-mConn-query( $sql, MYSQLI_USE_RESULT );
+   }
+
+   // Get the number of affected rows now; if we end up performing
+   // a SHOW WARNINGS query, that number would otherwise be lost.
+   $this-affectedRows = $this-mConn-affected_rows;
+
+   global $wgDBLogWarnings, $wgDBIgnoredMysqlWarnings;
+   if ( $wgDBLogWarnings ) {
+   // If the query succeeded yet generated one or more 
warnings, log
+   // any that we are configured to log. We don't do this 
for unbuffered
+   // queries; there aren't many of them, and we would 
have to defer
+   // SHOW WARNINGS until the result set has been freed.
+   if ( $ret  $this-mConn-warning_count  ( 
$bufferResults || $ret === true ) ) {
+   $messagesToLog = array();
+   $warnRet = $this-mConn-query( 'SHOW WARNINGS' 
);
+   while ( $warnRet  ( $warning = 
$warnRet-fetch_row() ) ) {
+   list( $level, $code, $message ) = 
$warning;
+   if ( $level !== 'Note'  !in_array( 
$code, $wgDBIgnoredMysqlWarnings ) ) {
+   $messagesToLog[] = $level 
(Code $code): $message;
+   }
+   }
+
+   if ( $messagesToLog ) {
+   wfDebugLog( 'DBWarnings', $sql\n . 
implode( \n, $messagesToLog ) );
+   }
+ 

[MediaWiki-commits] [Gerrit] Remove --max-slave-lag options and remnants from maintenance... - change (mediawiki/core)

2015-03-03 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove --max-slave-lag options and remnants from maintenance 
scripts
..

Remove --max-slave-lag options and remnants from maintenance scripts

Change-Id: Id01fb9a82bcfe1af8cbce23a9aec7eccaa0f6b21
---
M maintenance/cleanupRemovedModules.php
M maintenance/cleanupTable.inc
M maintenance/populateCategory.php
M maintenance/rebuildImages.php
M maintenance/refreshLinks.php
M maintenance/updateCollation.php
M maintenance/waitForSlave.php
7 files changed, 10 insertions(+), 41 deletions(-)


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

diff --git a/maintenance/cleanupRemovedModules.php 
b/maintenance/cleanupRemovedModules.php
index e1d0ed6..a4e66ca 100644
--- a/maintenance/cleanupRemovedModules.php
+++ b/maintenance/cleanupRemovedModules.php
@@ -36,13 +36,6 @@
parent::__construct();
$this-mDescription = 'Remove cache entries for removed 
ResourceLoader modules from the database';
$this-addOption( 'batchsize', 'Delete rows in batches of this 
size. Default: 500', false, true );
-   $this-addOption(
-   'max-slave-lag',
-   'If the slave lag exceeds this many seconds, wait until 
it drops below this value. '
-   . 'Default: 5',
-   false,
-   true
-   );
}
 
public function execute() {
@@ -51,7 +44,6 @@
$moduleNames = $rl-getModuleNames();
$moduleList = implode( ', ', array_map( array( $dbw, 
'addQuotes' ), $moduleNames ) );
$limit = max( 1, intval( $this-getOption( 'batchsize', 500 ) ) 
);
-   $maxlag = intval( $this-getOption( 'max-slave-lag', 5 ) );
 
$this-output( Cleaning up module_deps table...\n );
$i = 1;
@@ -63,7 +55,7 @@
$numRows = $dbw-affectedRows();
$this-output( Batch $i: $numRows rows\n );
$i++;
-   wfWaitForSlaves( $maxlag );
+   wfWaitForSlaves();
} while ( $numRows  0 );
$this-output( done\n );
 
@@ -77,7 +69,7 @@
$numRows = $dbw-affectedRows();
$this-output( Batch $i: $numRows rows\n );
$i++;
-   wfWaitForSlaves( $maxlag );
+   wfWaitForSlaves();
} while ( $numRows  0 );
$this-output( done\n );
 
@@ -90,7 +82,7 @@
$numRows = $dbw-affectedRows();
$this-output( Batch $i: $numRows rows\n );
$i++;
-   wfWaitForSlaves( $maxlag );
+   wfWaitForSlaves();
} while ( $numRows  0 );
$this-output( done\n );
}
diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc
index cbd1be6..f6259e9 100644
--- a/maintenance/cleanupTable.inc
+++ b/maintenance/cleanupTable.inc
@@ -37,7 +37,6 @@
);
 
protected $dryrun = false;
-   protected $maxLag = 10; # if slaves are lagged more than 10 secs, wait
public $batchSize = 100;
public $reportInterval = 100;
 
diff --git a/maintenance/populateCategory.php b/maintenance/populateCategory.php
index ab0ca1e..66553bc 100644
--- a/maintenance/populateCategory.php
+++ b/maintenance/populateCategory.php
@@ -58,12 +58,6 @@
true
);
$this-addOption(
-   'max-slave-lag',
-   'If slave lag exceeds this many seconds, wait until it 
drops before continuing. Default: 10',
-   false,
-   true
-   );
-   $this-addOption(
'throttle',
'Wait this many milliseconds after each category. 
Default: 0',
false,
@@ -74,13 +68,9 @@
 
public function execute() {
$begin = $this-getOption( 'begin', '' );
-   $maxSlaveLag = $this-getOption( 'max-slave-lag', 10 );
$throttle = $this-getOption( 'throttle', 0 );
$force = $this-getOption( 'force', false );
-   $this-doPopulateCategory( $begin, $maxSlaveLag, $throttle, 
$force );
-   }
 
-   private function doPopulateCategory( $begin, $maxlag, $throttle, $force 
) {
$dbw = wfGetDB( DB_MASTER );
 
if ( !$force ) {
diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php
index 5a14967..8e39978 100644
--- a/maintenance/rebuildImages.php
+++ b/maintenance/rebuildImages.php
@@ -59,7 +59,6 @@
 
public function execute() {
 

[MediaWiki-commits] [Gerrit] update.php: Remove max seconds of lag from wfWaitForSlaves()... - change (mediawiki/core)

2015-03-03 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: update.php: Remove max seconds of lag from wfWaitForSlaves() 
call
..

update.php: Remove max seconds of lag from wfWaitForSlaves() call

Follows-up r97526 (a11a1edafa4d).

Change-Id: Ie208810f2531924f37fb1b21fe2b9637f0476782
---
M maintenance/update.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/194183/1

diff --git a/maintenance/update.php b/maintenance/update.php
index 182a2c4..9381e7f 100755
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -126,7 +126,7 @@
 
$this-output( MediaWiki {$wgVersion} Updater\n\n );
 
-   wfWaitForSlaves( 5 ); // let's not kill databases, shall we? ;) 
--tor
+   wfWaitForSlaves();
 
if ( !$this-hasOption( 'skip-compat-checks' ) ) {
$this-compatChecks();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie208810f2531924f37fb1b21fe2b9637f0476782
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove rel=archives from HTML output - change (mediawiki/core)

2015-03-01 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove rel=archives from HTML output
..

Remove rel=archives from HTML output

That link type was removed from HTML5 in 2011. It is not recognized
by the W3C Markup Validator.

https://html5.org/r/5925
https://www.w3.org/Bugs/Public/show_bug.cgi?id=11486

Change-Id: I61ddd7ee3df41bfb62423d0498217d31e7952902
---
M RELEASE-NOTES-1.25
M includes/page/Article.php
M includes/skins/SkinTemplate.php
3 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/70/193670/1

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 45e669a..cc984f5 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -164,6 +164,8 @@
   (instead of returning incorrect results) even when the page ID is known.
 * (T74070) Duplicate search for archived files on file upload now omits the 
extension.
   This requires the fa_sha1 field being populated.
+* Removed rel=archives from the View history link, as it did not pass
+  HTML validation.
 
 === Action API changes in 1.25 ===
 * (T67403) XML tag highlighting is now only performed for formats
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 817b4b6..cc87a10 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1634,7 +1634,7 @@
$context-msg( 'historywarning' )-numParams( 
$revisions )-parse() .
$context-msg( 'word-separator' )-escaped() . 
Linker::linkKnown( $title,
$context-msg( 'history' )-escaped(),
-   array( 'rel' = 'archives' ),
+   array(),
array( 'action' = 'history' ) ) .
'/strong'
);
diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index 98a1b03..b0390e9 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -948,7 +948,6 @@
'text' = wfMessageFallback( 
$skname-view-history, 'history_short' )
-setContext( 
$this-getContext() )-text(),
'href' = $title-getLocalURL( 
'action=history' ),
-   'rel' = 'archives',
);
 
if ( $title-quickUserCan( 'delete', 
$user ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61ddd7ee3df41bfb62423d0498217d31e7952902
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] EditPage: Remove remnants of pre-1.16 live preview - change (mediawiki/core)

2015-03-01 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: EditPage: Remove remnants of pre-1.16 live preview
..

EditPage: Remove remnants of pre-1.16 live preview

Change-Id: I6cd0c56f7e934ce43f9bd101bfb5d4ca3d7bdbad
---
M includes/EditPage.php
1 file changed, 1 insertion(+), 41 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/71/193671/1

diff --git a/includes/EditPage.php b/includes/EditPage.php
index a8a17cf..0b0939a 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -377,9 +377,6 @@
/** @var bool */
protected $edit;
 
-   /** @var bool */
-   public $live;
-
/**
 * @param Article $article
 */
@@ -477,11 +474,6 @@
 
$this-importFormData( $wgRequest );
$this-firsttime = false;
-
-   if ( $this-live ) {
-   $this-livePreview();
-   return;
-   }
 
if ( wfReadOnly()  $this-save ) {
// Force preview
@@ -801,8 +793,7 @@
wfDebug( POST DATA:  . var_export( $_POST, 
true ) . \n );
$this-preview = true;
} else {
-   /* Fallback for live preview */
-   $this-preview = $request-getCheck( 
'wpPreview' ) || $request-getCheck( 'wpLivePreview' );
+   $this-preview = $request-getCheck( 
'wpPreview' );
$this-diff = $request-getCheck( 'wpDiff' );
 
// Remember whether a save was requested, so we 
can indicate
@@ -915,7 +906,6 @@
 *   allowed.
 */
 
-   $this-live = $request-getCheck( 'live' );
$this-editintro = $request-getText( 'editintro',
// Custom edit intro for new sections
$this-section === 'new' ? 
'MediaWiki:addsection-editintro' : '' );
@@ -3807,36 +3797,6 @@
 
Hooks::run( 'EditPageBeforeEditButtons', array( $this, 
$buttons, $tabindex ) );
return $buttons;
-   }
-
-   /**
-* Output preview text only. This can be sucked into the edit page
-* via JavaScript, and saves the server time rendering the skin as
-* well as theoretically being more robust on the client (doesn't
-* disturb the edit box's undo history, won't eat your text on
-* failure, etc).
-*
-* @todo This doesn't include category or interlanguage links.
-*   Would need to enhance it a bit, smaybe wrap them in XML
-*   or something.../s that might also require more skin
-*   initialization, so check whether that's a problem.
-*/
-   function livePreview() {
-   global $wgOut;
-   $wgOut-disable();
-   header( 'Content-type: text/xml; charset=utf-8' );
-   header( 'Cache-control: no-cache' );
-
-   $previewText = $this-getPreviewText();
-   #$categories = $skin-getCategoryLinks();
-
-   $s =
-   '?xml version=1.0 encoding=UTF-8 ?' . \n .
-   Xml::tags( 'livepreview', null,
-   Xml::element( 'preview', null, $previewText )
-   #.  Xml::element( 'category', null, 
$categories )
-   );
-   echo $s;
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cd0c56f7e934ce43f9bd101bfb5d4ca3d7bdbad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] refreshLinks.php: Tweak exit condition in deleteLinksFromNon... - change (mediawiki/core)

2015-02-28 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: refreshLinks.php: Tweak exit condition in 
deleteLinksFromNonexistent()
..

refreshLinks.php: Tweak exit condition in deleteLinksFromNonexistent()

Instead of exiting the do...while loop only once a query returns zero
rows, exit whenever fewer rows than the batch size are returned. This
could save quite a bit of time when the highest nonexistent page_id
found is a relatively low one.

Follows-up 40e300b8273d.

Bug: T44180
Change-Id: I14d2d48c2405fcc0bd05a3181ba6293caef5298c
---
M maintenance/refreshLinks.php
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/64/193564/1

diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index 7c85a1c..b2f7497 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -284,7 +284,7 @@
$this-output( 0.. );
 
do {
-   $list = $dbr-selectFieldValues(
+   $ids = $dbr-selectFieldValues(
$table,
$field,
array(
@@ -295,15 +295,16 @@
array( 'DISTINCT', 'ORDER BY' = 
$field, 'LIMIT' = $batchSize )
);
 
-   if ( $list ) {
-   $counter += count( $list );
+   $numIds = count( $ids );
+   if ( $numIds ) {
+   $counter += $numIds;
wfWaitForSlaves();
-   $dbw-delete( $table, array( $field = 
$list ), __METHOD__ );
+   $dbw-delete( $table, array( $field = 
$ids ), __METHOD__ );
$this-output( $counter . .. );
-   $start = $list[count( $list ) - 1] + 1;
+   $start = $ids[$numIds - 1] + 1;
}
 
-   } while ( $list );
+   } while ( $numIds = $batchSize );
 
$this-output( \n );
wfWaitForSlaves();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14d2d48c2405fcc0bd05a3181ba6293caef5298c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] refreshLinks.php: Get IDs in batches in deleteLinksFromNonex... - change (mediawiki/core)

2015-02-26 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: refreshLinks.php: Get IDs in batches in 
deleteLinksFromNonexistent()
..

refreshLinks.php: Get IDs in batches in deleteLinksFromNonexistent()

... instead of making an unbuffered query, which is discouraged in the
doc comment for DatabaseBase::bufferResults().

Also used NOT IN for the antijoin instead of LEFT JOIN...IS NULL; when
combined with DISTINCT, the latter causes MySQL to use a temporary
table rather than an appropriate index, according to EXPLAIN. (Using
GROUP BY instead of DISTINCT also avoids this problem. I don't know why.)

Bug: T44180
Change-Id: Idca85fac7dd7879f9fbef2712b6aa83343099e02
---
M maintenance/refreshLinks.php
1 file changed, 21 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/193182/2

diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
index 0c2f722..7c85a1c 100644
--- a/maintenance/refreshLinks.php
+++ b/maintenance/refreshLinks.php
@@ -262,10 +262,7 @@
wfWaitForSlaves();
 
$dbw = wfGetDB( DB_MASTER );
-
-   $lb = wfGetLBFactory()-newMainLB();
-   $dbr = $lb-getConnection( DB_SLAVE );
-   $dbr-bufferResults( false );
+   $dbr = wfGetDB( DB_SLAVE );
 
$linksTables = array( // table name = page_id field
'pagelinks' = 'pl_from',
@@ -282,38 +279,35 @@
foreach ( $linksTables as $table = $field ) {
$this-output( Retrieving illegal entries from 
$table...  );
 
-   // SELECT DISTINCT( $field ) FROM $table LEFT JOIN page 
ON $field=page_id WHERE page_id IS NULL;
-   $results = $dbr-select(
-   array( $table, 'page' ),
-   $field,
-   array( 'page_id' = null ),
-   __METHOD__,
-   'DISTINCT',
-   array( 'page' = array( 'LEFT JOIN', 
$field=page_id ) )
-   );
-
+   $start = 0;
$counter = 0;
-   $list = array();
$this-output( 0.. );
-   foreach ( $results as $row ) {
-   $counter++;
-   $list[] = $row-$field;
-   if ( ( $counter % $batchSize ) == 0 ) {
+
+   do {
+   $list = $dbr-selectFieldValues(
+   $table,
+   $field,
+   array(
+   $field = {$dbr-addQuotes( 
$start )},
+   $field NOT IN 
({$dbr-selectSQLText( 'page', 'page_id' )}),
+   ),
+   __METHOD__,
+   array( 'DISTINCT', 'ORDER BY' = 
$field, 'LIMIT' = $batchSize )
+   );
+
+   if ( $list ) {
+   $counter += count( $list );
wfWaitForSlaves();
$dbw-delete( $table, array( $field = 
$list ), __METHOD__ );
-
$this-output( $counter . .. );
-   $list = array();
+   $start = $list[count( $list ) - 1] + 1;
}
-   }
-   $this-output( $counter );
-   if ( count( $list )  0 ) {
-   $dbw-delete( $table, array( $field = $list ), 
__METHOD__ );
-   }
+
+   } while ( $list );
+
$this-output( \n );
wfWaitForSlaves();
}
-   $lb-closeAll();
}
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idca85fac7dd7879f9fbef2712b6aa83343099e02
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com
Gerrit-Reviewer: jenkins-bot 

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


[MediaWiki-commits] [Gerrit] DatabaseBase: Document behavior of nulls in array conditions - change (mediawiki/core)

2015-02-21 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: DatabaseBase: Document behavior of nulls in array conditions
..

DatabaseBase: Document behavior of nulls in array conditions

Follows-up 26235c73376b.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/192173/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 8ce7f3f..0a2e221 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1638,9 +1638,10 @@
 * - If the value of such an array element is a scalar (such as a
 *   string), it will be treated as data and thus quoted 
appropriately.
 *   If it is null, an IS NULL clause will be added.
-* - If the value is an array, an IN(...) clause will be 
constructed,
-*   such that the field name may match any of the elements in the
-*   array. The elements of the array will be quoted.
+* - If the value is an array, an IN (...) clause will be 
constructed
+*   from its non-null elements, and an IS NULL clause will be added
+*   if null is present, such that the field may match any of the
+*   elements in the array. The non-null elements will be quoted.
 *
 * Note that expressions are often DBMS-dependent in their syntax.
 * DBMS-independent wrappers are provided for constructing several 
types of

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id008557e53a8c27f49e87cb2120298ce6478b6df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove maintenance script dumpSisterSites.php - change (mediawiki/core)

2015-02-20 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove maintenance script dumpSisterSites.php
..

Remove maintenance script dumpSisterSites.php

This script would perhaps better belong in the SisterSites extension, as noted
on the extension's MW.org description page. However, that extension was never
actually developed to a usable state (first commit was r16390, no substantial
changes since) or imported into Git, so apparently the feature (or at least
its implementation) is of only limited, possibly historical interest.

Change-Id: Ia4c3b0316815f06b7e82f013edfd1798ed07d9a3
---
M RELEASE-NOTES-1.25
M autoload.php
D maintenance/dumpSisterSites.php
3 files changed, 1 insertion(+), 63 deletions(-)


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

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index df13daa..cdef220 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -362,6 +362,7 @@
   The alphabet of the prior string returned was A-Za-z0-9 and now it is 0-9A-F
 * (T87504) Avoid serving SVG background-images in CSS for Opera 12, which
   renders them incorrectly when combined with border-radius or background-size.
+* Removed maintenance script dumpSisterSites.php.
 
 == Compatibility ==
 
diff --git a/autoload.php b/autoload.php
index 4131c71..a115e75 100644
--- a/autoload.php
+++ b/autoload.php
@@ -354,7 +354,6 @@
'DumpPipeOutput' = __DIR__ . '/includes/Export.php',
'DumpRenderer' = __DIR__ . '/maintenance/renderDump.php',
'DumpRev' = __DIR__ . '/maintenance/storage/dumpRev.php',
-   'DumpSisterSites' = __DIR__ . '/maintenance/dumpSisterSites.php',
'DuplicateJob' = __DIR__ . '/includes/jobqueue/jobs/DuplicateJob.php',
'EditAction' = __DIR__ . '/includes/actions/EditAction.php',
'EditCLI' = __DIR__ . '/maintenance/edit.php',
diff --git a/maintenance/dumpSisterSites.php b/maintenance/dumpSisterSites.php
deleted file mode 100644
index 784dc7a..000
--- a/maintenance/dumpSisterSites.php
+++ /dev/null
@@ -1,62 +0,0 @@
-?php
-/**
- * Quickie page name dump script for SisterSites usage.
- * http://www.eekim.com/cgi-bin/wiki.pl?SisterSites
- *
- * Copyright © 2006 Brion Vibber br...@pobox.com
- * https://www.mediawiki.org/
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Maintenance
- */
-
-require_once __DIR__ . '/Maintenance.php';
-
-/**
- * Maintenance script that generates a page name dump for SisterSites usage.
- *
- * @ingroup Maintenance
- */
-class DumpSisterSites extends Maintenance {
-   public function __construct() {
-   parent::__construct();
-   $this-mDescription = Quickie page name dump script for 
SisterSites usage;
-   }
-
-   public function execute() {
-   $dbr = wfGetDB( DB_SLAVE );
-   $dbr-bufferResults( false );
-   $result = $dbr-select( 'page',
-   array( 'page_namespace', 'page_title' ),
-   array(
-   'page_namespace' = NS_MAIN,
-   'page_is_redirect' = 0,
-   ),
-   __METHOD__ );
-
-   foreach ( $result as $row ) {
-   $title = Title::makeTitle( $row-page_namespace, 
$row-page_title );
-   $url = $title-getFullURL();
-   $text = $title-getPrefixedText();
-   $this-output( $url $text\n );
-   }
-   }
-}
-
-$maintClass = DumpSisterSites;
-require_once RUN_MAINTENANCE_IF_MAIN;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4c3b0316815f06b7e82f013edfd1798ed07d9a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Fixes for sort-gitmodules script - change (mediawiki/extensions)

2015-02-09 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Fixes for sort-gitmodules script
..

Fixes for sort-gitmodules script

* Use U+0007 BELL as a delimiter instead of U+20AC EURO SIGN, as according to
  https://www.gnu.org/software/coreutils/manual/html_node/tr-invocation.html,
  Currently tr fully supports only single-byte characters. This caused the
  primary issue evident in 5776dde57c43, which had to be reverted.
* Force C locale for consistent sort order independent of developer
  workstation and user configuration.

Change-Id: Ic4ce9ef9d5d179bfb98f0301e7a3d8e3e8463020
---
M sort-gitmodules
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/sort-gitmodules b/sort-gitmodules
index 4a41546..b422373 100755
--- a/sort-gitmodules
+++ b/sort-gitmodules
@@ -1,6 +1,7 @@
 #!/bin/bash
+export LC_ALL=C
 TMP_FILE=`mktemp -t mwextmodsortX`
-paste -s -d €€€\n .gitmodules|sort|tr € \n  $TMP_FILE
+paste -s -d $'\a\a\a\n' .gitmodules|sort|tr \a \n  $TMP_FILE
 mv $TMP_FILE .gitmodules
 rm -f $TMP_FILE
 echo Sorted .gitmodules. Review output and commit.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4ce9ef9d5d179bfb98f0301e7a3d8e3e8463020
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove commented-out calls to DatabaseBase::strencode() - change (mediawiki...PictureGame)

2015-02-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove commented-out calls to DatabaseBase::strencode()
..

Remove commented-out calls to DatabaseBase::strencode()

Change-Id: Icb52e5d18bd56dbed378afec09eb1e836c2f6f91
---
M PictureGameHome.body.php
1 file changed, 1 insertion(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PictureGame 
refs/changes/11/189311/1

diff --git a/PictureGameHome.body.php b/PictureGameHome.body.php
index e3e2c1c..f16eaf8 100644
--- a/PictureGameHome.body.php
+++ b/PictureGameHome.body.php
@@ -1121,10 +1121,6 @@
__METHOD__,
array( 'LIMIT' = 1 )
);
-   /*$sql = SELECT * FROM picturegame_images 
WHERE picturegame_images.id NOT IN
-   (SELECT picid FROM picturegame_votes 
WHERE picturegame_votes.username=' . $dbr-strencode( $user-getName() ) . ')
-   AND flag   . 
PICTUREGAME_FLAG_FLAGGED .  AND img1  '' AND img2  '' LIMIT 1;;
-   $res = $dbr-query( $sql, __METHOD__ );*/
$row = $dbr-fetchObject( $res );
$imgID = isset( $row-id ) ? $row-id : 0;
}
@@ -1187,10 +1183,6 @@
__METHOD__,
array( 'LIMIT' = 1 )
);
-   /*$sql = SELECT * FROM picturegame_images 
WHERE picturegame_images.id  {$imgID} AND picturegame_images.id NOT IN
-   (SELECT picid FROM 
picturegame_votes WHERE picturegame_votes.username=' . $dbr-strencode( 
$user-getName() ) . ')
-   AND flag !=  . 
PICTUREGAME_FLAG_FLAGGED .  AND img1  '' AND img2  '' LIMIT 1;;
-   $nextres = $dbr-query( $sql, __METHOD__ );*/
$nextrow = $dbr-fetchObject( $nextres );
$next_id = ( isset( $nextrow-id ) ? 
$nextrow-id : 0 );
}
@@ -1762,13 +1754,6 @@
$canSkip = true;
}
}
-   /*$sql = SELECT COUNT(*) AS mycount FROM picturegame_images 
WHERE picturegame_images.id NOT IN
-   (SELECT picid FROM picturegame_votes WHERE 
picturegame_votes.username=' . $dbr-strencode( $wgUser-getName() ) . ')
-   AND flag !=  . PICTUREGAME_FLAG_FLAGGED .  AND img1 
 '' AND img2  '' LIMIT 1;;
-   $res = $dbr-query( $sql, __METHOD__ );
-   $row = $dbr-fetchObject( $res );
-
-   $canSkip = ( $row-mycount != 0 ? true : false );*/
 
// used for the key
$now = time();
@@ -1849,4 +1834,4 @@
 
$out-addHTML( $output );
}
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb52e5d18bd56dbed378afec09eb1e836c2f6f91
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PictureGame
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove use of DatabaseBase::strencode() - change (mediawiki...LinkSuggest)

2015-02-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove use of DatabaseBase::strencode()
..

Remove use of DatabaseBase::strencode()

Change-Id: I53059836f16db465c51359f47c71547d03b77869
---
M LinkSuggest.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LinkSuggest 
refs/changes/12/189312/1

diff --git a/LinkSuggest.php b/LinkSuggest.php
index 2238239..ed38769 100644
--- a/LinkSuggest.php
+++ b/LinkSuggest.php
@@ -170,7 +170,7 @@
$results = array();
 
$dbr = wfGetDB( DB_SLAVE );
-   $query = $dbr-strencode( mb_strtolower( $query ) );
+   $query = mb_strtolower( $query );
 
$res = $dbr-select(
array( 'querycache', 'page' ),
@@ -180,7 +180,7 @@
'qc_namespace = page_namespace',
'page_is_redirect = 0',
'qc_type' = 'Mostlinked',
-   LOWER(qc_title) LIKE '{$query}%',
+   'LOWER(qc_title)' . $dbr-buildLike( $query, 
$dbr-anyString() ),
'qc_namespace' = $namespaces
),
__METHOD__,
@@ -195,7 +195,7 @@
'page',
array( 'page_namespace', 'page_title' ),
array(
-   LOWER(page_title) LIKE '{$query}%',
+   'LOWER(page_title)' . $dbr-buildLike( $query, 
$dbr-anyString() ),
'page_is_redirect' = 0,
'page_namespace' = $namespaces
),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53059836f16db465c51359f47c71547d03b77869
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LinkSuggest
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove use of DatabaseBase::strencode() - change (mediawiki...PollNY)

2015-02-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove use of DatabaseBase::strencode()
..

Remove use of DatabaseBase::strencode()

Change-Id: Ia3eecce64080ddbc026595ee649980ee2687ad2d
---
M PollClass.php
M SpecialViewPoll.php
2 files changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/PollClass.php b/PollClass.php
index c29ae1a..6489dd1 100644
--- a/PollClass.php
+++ b/PollClass.php
@@ -283,7 +283,7 @@
$randstr = wfRandom();
$sql = SELECT poll_page_id FROM {$dbr-tableName( 
'poll_question' )} {$use_index}
INNER JOIN {$dbr-tableName( 'page' )} ON 
page_id=poll_page_id WHERE poll_id NOT IN
-   (SELECT pv_poll_id FROM {$dbr-tableName( 
'poll_user_vote' )} WHERE pv_user_name = ' . $dbr-strencode( $user_name ) . 
')
+   (SELECT pv_poll_id FROM {$dbr-tableName( 
'poll_user_vote' )} WHERE pv_user_name = {$dbr-addQuotes( $user_name )})
AND poll_status=1 AND poll_random$randstr 
ORDER BY poll_random LIMIT 0,1;
$res = $dbr-query( $sql, __METHOD__ );
$row = $dbr-fetchObject( $res );
@@ -291,7 +291,7 @@
if( !$row ) {
$sql = SELECT poll_page_id FROM {$dbr-tableName( 
'poll_question' )} {$use_index}
INNER JOIN {$dbr-tableName( 'page' )} ON 
page_id=poll_page_id WHERE poll_id NOT IN
-   (SELECT pv_poll_id FROM 
{$dbr-tableName( 'poll_user_vote' )} WHERE pv_user_name = ' . 
$dbr-strencode( $user_name ) . ')
+   (SELECT pv_poll_id FROM 
{$dbr-tableName( 'poll_user_vote' )} WHERE pv_user_name = {$dbr-addQuotes( 
$user_name )})
AND poll_status=1 AND 
poll_random$randstr ORDER BY poll_random LIMIT 0,1;
wfDebugLog( 'PollNY', $sql );
$res = $dbr-query( $sql, __METHOD__ );
@@ -424,4 +424,4 @@
return $timeStr;
}
 
-}
\ No newline at end of file
+}
diff --git a/SpecialViewPoll.php b/SpecialViewPoll.php
index 94b6d9a..d172dee 100644
--- a/SpecialViewPoll.php
+++ b/SpecialViewPoll.php
@@ -72,7 +72,7 @@
$user = $request-getVal( 'user' );
$userLink = array();
if ( $user ) {
-   $where['poll_user_name'] = $dbr-strencode( $user );
+   $where['poll_user_name'] = $user;
$userLink['user'] = $user;
}
 
@@ -122,7 +122,7 @@
$res_total = $dbr-select(
'poll_question',
'COUNT(*) AS total_polls',
-   ( ( $user ) ? array( 'poll_user_name' = 
$dbr-strencode( $user ) ) : array() ),
+   ( ( $user ) ? array( 'poll_user_name' = $user ) : 
array() ),
__METHOD__
);
$row_total = $dbr-fetchObject( $res_total );
@@ -244,4 +244,4 @@
 
$out-addHTML( $output );
}
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3eecce64080ddbc026595ee649980ee2687ad2d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PollNY
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


[MediaWiki-commits] [Gerrit] Remove use of DatabaseBase::strencode() - change (mediawiki...Video)

2015-02-08 Thread PleaseStand (Code Review)
PleaseStand has uploaded a new change for review.

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

Change subject: Remove use of DatabaseBase::strencode()
..

Remove use of DatabaseBase::strencode()

Change-Id: Idbc74cde1954036ce396662410930094904f3c5d
---
M SpecialNewVideos.php
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Video 
refs/changes/10/189310/1

diff --git a/SpecialNewVideos.php b/SpecialNewVideos.php
index 8d7dc07..2216c33 100644
--- a/SpecialNewVideos.php
+++ b/SpecialNewVideos.php
@@ -106,10 +106,8 @@
if ( $wpIlMatch != '' ) {
$nt = Title::newFromUrl( $wpIlMatch );
if ( $nt ) {
-   $m = $dbr-strencode( strtolower( 
$nt-getDBkey() ) );
-   $m = str_replace( '%', \\%, $m );
-   $m = str_replace( '_', \\_, $m );
-   $where[] = LCASE(video_name) LIKE '%{$m}%';
+   $where[] = 'LCASE(video_name)' . 
$dbr-buildLike(
+   $dbr-anyString(), strtolower( 
$nt-getDBkey() ), $dbr-anyString() );
$searchpar['wpIlMatch'] = $wpIlMatch;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbc74cde1954036ce396662410930094904f3c5d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Video
Gerrit-Branch: master
Gerrit-Owner: PleaseStand pleasest...@live.com

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


  1   2   3   4   >