[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] jenkins testing

2018-01-20 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405405 )

Change subject: [DNM] jenkins testing
..

[DNM] jenkins testing

Change-Id: Id7992f3a01da92e9e8772dfbca118df8b354251f
---
M includes/shell/FirejailCommand.php
M tests/phpunit/MediaWikiCoversValidator.php
M tests/phpunit/includes/EditPageTest.php
3 files changed, 3 insertions(+), 35 deletions(-)


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

diff --git a/includes/shell/FirejailCommand.php 
b/includes/shell/FirejailCommand.php
index a71b376..ae7a8ba 100644
--- a/includes/shell/FirejailCommand.php
+++ b/includes/shell/FirejailCommand.php
@@ -142,7 +142,7 @@
}
 
if ( $this->hasRestriction( Shell::PRIVATE_DEV ) ) {
-   $cmd[] = '--private-dev';
+   //$cmd[] = '--private-dev';
}
 
if ( $this->hasRestriction( Shell::NO_NETWORK ) ) {
diff --git a/tests/phpunit/MediaWikiCoversValidator.php 
b/tests/phpunit/MediaWikiCoversValidator.php
index a79a139..d3719a4 100644
--- a/tests/phpunit/MediaWikiCoversValidator.php
+++ b/tests/phpunit/MediaWikiCoversValidator.php
@@ -30,6 +30,8 @@
/**
 * Test that all methods in this class that begin
 * with "test" have valid covers tags.
+*
+* @coversNothing
 */
public function testValidCovers() {
$methods = get_class_methods( $this );
diff --git a/tests/phpunit/includes/EditPageTest.php 
b/tests/phpunit/includes/EditPageTest.php
index 65c5d65..e04fda7 100644
--- a/tests/phpunit/includes/EditPageTest.php
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -41,40 +41,6 @@
parent::tearDown();
}
 
-   /**
-* @dataProvider provideExtractSectionTitle
-* @covers EditPage::extractSectionTitle
-*/
-   public function testExtractSectionTitle( $section, $title ) {
-   $extracted = EditPage::extractSectionTitle( $section );
-   $this->assertEquals( $title, $extracted );
-   }
-
-   public static function provideExtractSectionTitle() {
-   return [
-   [
-   "== Test ==\n\nJust a test section.",
-   "Test"
-   ],
-   [
-   "An initial section, no header.",
-   false
-   ],
-   [
-   "An initial section with a fake heder 
(T34617)\n\n== Test == ??\nwtf",
-   false
-   ],
-   [
-   "== Section ==\nfollowed by a fake == 
Non-section == ??\nn",
-   "Section"
-   ],
-   [
-   "== Section== \t\r\n followed by whitespace 
(T37051)",
-   'Section',
-   ],
-   ];
-   }
-
protected function forceRevisionDate( WikiPage $page, $timestamp ) {
$dbw = wfGetDB( DB_MASTER );
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Bump PHP version requirement to 7.0.0+

2018-01-18 Thread Jforrester (Code Review)
Jforrester has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405216 )

Change subject: [DNM] Bump PHP version requirement to 7.0.0+
..

[DNM] Bump PHP version requirement to 7.0.0+

Intended to be merged into master before the branch of REL1_31, pending the
upgrade and clean-up of Wikimedia production to make this possible.

Bug: T172165
Change-Id: I740f32ac859d9bb3787fdf8414f82ae6f410492f
---
M INSTALL
M RELEASE-NOTES-1.31
M composer.json
M includes/GlobalFunctions.php
M includes/PHPVersionCheck.php
M includes/libs/CSSMin.php
6 files changed, 6 insertions(+), 74 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/405216/1

diff --git a/INSTALL b/INSTALL
index 1a59f0b..5c6669e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@
 "in-place", as long as you have the necessary prerequisites available.
 
 Required software:
-* Web server with PHP 5.5.9 or higher.
+* Web server with PHP 7.0.0 or HHVM 3.18.5 or higher.
 * A SQL server, the following types are supported
 ** MySQL 5.5.8 or higher
 ** PostgreSQL 8.3 or higher
diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index a50159c..422f7e9 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -179,8 +179,8 @@
   default driver for MySQL has been 'mysqli' since MediaWiki 1.22.
 
 == Compatibility ==
-MediaWiki 1.31 requires PHP 5.5.9 or later. Although HHVM 3.18.5 or later is 
supported,
-it is generally advised to use PHP 5.5.9 or later for long term support.
+MediaWiki 1.31 requires PHP 7.0.0 or later. Although HHVM 3.18.5 or later is 
supported,
+it is generally advised to use PHP 7.0.0 or later for long term support.
 
 MySQL/MariaDB is the recommended DBMS. PostgreSQL or SQLite can also be used,
 but support for them is somewhat less mature. There is experimental support for
diff --git a/composer.json b/composer.json
index 4ae1f00..4d8982e 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
"mediawiki/at-ease": "1.1.0",
"oojs/oojs-ui": "0.25.1",
"oyejorge/less.php": "1.7.0.14",
-   "php": ">=5.5.9",
+   "php": ">=7.0.0",
"psr/log": "1.0.2",
"wikimedia/assert": "0.2.2",
"wikimedia/base-convert": "1.0.1",
diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index b181628..a365e6c 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -32,75 +32,6 @@
 use Wikimedia\ScopedCallback;
 use Wikimedia\Rdbms\DBReplicationWaitError;
 
-// Hide compatibility functions from Doxygen
-/// @cond
-/**
- * Compatibility functions
- *
- * We support PHP 5.5.9 and up.
- * Re-implementations of newer functions or functions in non-standard
- * PHP extensions may be included here.
- */
-
-// hash_equals function only exists in PHP >= 5.6.0
-// https://secure.php.net/hash_equals
-if ( !function_exists( 'hash_equals' ) ) {
-   /**
-* Check whether a user-provided string is equal to a fixed-length 
secret string
-* without revealing bytes of the secret string through timing 
differences.
-*
-* The usual way to compare strings (PHP's === operator or the 
underlying memcmp()
-* function in C) is to compare corresponding bytes and stop at the 
first difference,
-* which would take longer for a partial match than for a complete 
mismatch. This
-* is not secure when one of the strings (e.g. an HMAC or token) must 
remain secret
-* and the other may come from an attacker. Statistical analysis of 
timing measurements
-* over many requests may allow the attacker to guess the string's 
bytes one at a time
-* (and check his guesses) even if the timing differences are extremely 
small.
-*
-* When making such a security-sensitive comparison, it is essential 
that the sequence
-* in which instructions are executed and memory locations are accessed 
not depend on
-* the secret string's value. HOWEVER, for simplicity, we do not 
attempt to minimize
-* the inevitable leakage of the string's length. That is generally 
known anyway as
-* a chararacteristic of the hash function used to compute the secret 
value.
-*
-* Longer explanation: http://www.emerose.com/timing-attacks-explained
-*
-* @codeCoverageIgnore
-* @param string $known_string Fixed-length secret string to compare 
against
-* @param string $user_string User-provided string
-* @return bool True if the strings are the same, false otherwise
-*/
-   function hash_equals( $known_string, $user_string ) {
-   // Strict type checking as in PHP's native implementation
-   if ( !is_string( $known_string ) ) {
-   trigger_error( 'hash_equals(): Expected known_string to 
be a string, ' .
-

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM WIP MCR switch from wikiId to DatabaseDomain

2018-01-03 Thread Addshore (Code Review)
Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401746 )

Change subject: DNM WIP MCR switch from wikiId to DatabaseDomain
..

DNM WIP MCR switch from wikiId to DatabaseDomain

Exploration...

Still to fix would be:
 - BlobStoreFactory
 - Tests
 - Passing wikiid / dbDomain to ExternalStore in SqlBlogStore
 - Anything else...

Bug: T183914
Change-Id: I6a98684af1d747e18849c262b2f4ca6da5a0afb7
---
M includes/Storage/MutableRevisionRecord.php
M includes/Storage/RevisionArchiveRecord.php
M includes/Storage/RevisionRecord.php
M includes/Storage/RevisionStore.php
M includes/Storage/RevisionStoreRecord.php
M includes/Storage/SqlBlobStore.php
M includes/libs/rdbms/database/DBConnRef.php
M includes/libs/rdbms/database/Database.php
M includes/libs/rdbms/database/IDatabase.php
M tests/phpunit/includes/Storage/RevisionStoreDbTest.php
M tests/phpunit/includes/Storage/RevisionStoreRecordTest.php
11 files changed, 94 insertions(+), 72 deletions(-)


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

diff --git a/includes/Storage/MutableRevisionRecord.php 
b/includes/Storage/MutableRevisionRecord.php
index a259ae0..0da7577 100644
--- a/includes/Storage/MutableRevisionRecord.php
+++ b/includes/Storage/MutableRevisionRecord.php
@@ -29,6 +29,7 @@
 use MWException;
 use Title;
 use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\DatabaseDomain;
 
 /**
  * Mutable RevisionRecord implementation, for building new revision entries 
programmatically.
@@ -58,7 +59,7 @@
) {
// TODO: ideally, we wouldn't need a Title here
$title = Title::newFromLinkTarget( 
$parent->getPageAsLinkTarget() );
-   $rev = new MutableRevisionRecord( $title, $parent->getWikiId() 
);
+   $rev = new MutableRevisionRecord( $title, 
$parent->getDbDomain() );
 
$rev->setComment( $comment );
$rev->setUser( $user );
@@ -80,15 +81,15 @@
 * in RevisionStore instead.
 *
 * @param Title $title The title of the page this Revision is 
associated with.
-* @param bool|string $wikiId the wiki ID of the site this Revision 
belongs to,
-*or false for the local site.
+* @param DatabaseDomain|null $dbDomain the wiki DatabaseDomain of the 
site this Revision belongs to,
+*or null for the local site.
 *
 * @throws MWException
 */
-   function __construct( Title $title, $wikiId = false ) {
+   function __construct( Title $title, DatabaseDomain $dbDomain = null ) {
$slots = new MutableRevisionSlots();
 
-   parent::__construct( $title, $slots, $wikiId );
+   parent::__construct( $title, $slots, $dbDomain );
 
$this->mSlots = $slots; // redundant, but nice for static 
analysis
}
diff --git a/includes/Storage/RevisionArchiveRecord.php 
b/includes/Storage/RevisionArchiveRecord.php
index 419cb95..b15b32e 100644
--- a/includes/Storage/RevisionArchiveRecord.php
+++ b/includes/Storage/RevisionArchiveRecord.php
@@ -27,6 +27,7 @@
 use Title;
 use User;
 use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\DatabaseDomain;
 
 /**
  * A RevisionRecord representing a revision of a deleted page persisted in the 
archive table.
@@ -53,8 +54,8 @@
 * @param object $row An archive table row. Use 
RevisionStore::getArchiveQueryInfo() to build
 *a query that yields the required fields.
 * @param RevisionSlots $slots The slots of this revision.
-* @param bool|string $wikiId the wiki ID of the site this Revision 
belongs to,
-*or false for the local site.
+* @param DatabaseDomain|null $dbDomain the wiki DatabaseDomain of the 
site this Revision belongs to,
+*or null for the local site.
 */
function __construct(
Title $title,
@@ -62,9 +63,9 @@
CommentStoreComment $comment,
$row,
RevisionSlots $slots,
-   $wikiId = false
+   DatabaseDomain $dbDomain = null
) {
-   parent::__construct( $title, $slots, $wikiId );
+   parent::__construct( $title, $slots, $dbDomain );
Assert::parameterType( 'object', $row, '$row' );
 
$this->mArchiveId = intval( $row->ar_id );
diff --git a/includes/Storage/RevisionRecord.php 
b/includes/Storage/RevisionRecord.php
index f490f9b..783e709 100644
--- a/includes/Storage/RevisionRecord.php
+++ b/includes/Storage/RevisionRecord.php
@@ -31,7 +31,7 @@
 use MWException;
 use Title;
 use User;
-use Wikimedia\Assert\Assert;
+use Wikimedia\Rdbms\DatabaseDomain;
 
 /**
  * Page revision base class.
@@ -56,8 +56,8 @@
const FOR_THIS_USER = 2;
const RAW = 3;
 
-   /** @var string Wiki ID; false means the current wiki */
-   protected 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Test tests...

2017-12-29 Thread Reedy (Code Review)
Reedy has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400983 )

Change subject: [DNM] Test tests...
..

[DNM] Test tests...

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/400983/1

diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index a496b02..53dbd47 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -1,4 +1,4 @@
-== MediaWiki 1.31 ==
+LOL== MediaWiki 1.31 ==
 
 THIS IS NOT A RELEASE YET
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Fun with PHP - https://3v4l.org/Gv3QB

2017-12-01 Thread Krinkle (Code Review)
Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394732 )

Change subject: [DNM] Fun with PHP - https://3v4l.org/Gv3QB
..

[DNM] Fun with PHP - https://3v4l.org/Gv3QB

Change-Id: I40bae7c35c8225c8473955d8cffda462602aa48d
---
M tests/common/TestSetup.php
M tests/phpunit/includes/jobqueue/JobTest.php
M tests/phpunit/phpunit.php
3 files changed, 2 insertions(+), 338 deletions(-)


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

diff --git a/tests/common/TestSetup.php b/tests/common/TestSetup.php
index 3733e60..098a63f54 100644
--- a/tests/common/TestSetup.php
+++ b/tests/common/TestSetup.php
@@ -1,113 +1,10 @@
  [ 'class' => 'JobQueueMemory', 'order' => 
'fifo' ],
-   ];
-
-   $wgUseDatabaseMessages = false; # Set for future resets
-
-   // Assume UTC for testing purposes
-   $wgLocaltimezone = 'UTC';
-
-   $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
-
-   // Do not bother updating search tables
-   $wgSearchType = 'SearchEngineDummy';
-
-   // Generic MediaWiki\Session\SessionManager configuration for 
tests
-   // We use CookieSessionProvider because things might be 
expecting
-   // cookies to show up in a FauxRequest somewhere.
-   $wgSessionProviders = [
-   [
-   'class' => 
MediaWiki\Session\CookieSessionProvider::class,
-   'args' => [ [
-   'priority' => 30,
-   'callUserSetCookiesHook' => true,
-   ] ],
-   ],
-   ];
-
-   // Single-iteration PBKDF2 session secret derivation, for speed.
-   $wgSessionPbkdf2Iterations = 1;
-
-   // Generic AuthManager configuration for testing
-   $wgAuthManagerConfig = [
-   'preauth' => [],
-   'primaryauth' => [
-   [
-   'class' => 
MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::class,
-   'args' => [ [
-   'authoritative' => false,
-   ] ],
-   ],
-   [
-   'class' => 
MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider::class,
-   'args' => [ [
-   'authoritative' => true,
-   ] ],
-   ],
-   ],
-   'secondaryauth' => [],
-   ];
-   $wgAuth = new MediaWiki\Auth\AuthManagerAuthPlugin();
-
-   // T46192 Do not attempt to send a real e-mail
-   Hooks::clear( 'AlternateUserMailer' );
-   Hooks::register(
-   'AlternateUserMailer',
-   function () {
-   return false;
-   }
-   );
-   // xdebug's default of 100 is too low for MediaWiki
-   ini_set( 'xdebug.max_nesting_level', 1000 );
-
// Bug T116683 serialize_precision of 100
// may break testing against floating point values
// treated with PHP's serialize()
ini_set( 'serialize_precision', 17 );
-
-   // TODO: we should call MediaWikiTestCase::prepareServices( new 
GlobalVarConfig() ) here.
-   // But PHPUnit may not be loaded yet, so we have to wait until 
just
-   // before PHPUnit_TextUI_Command::main() is executed.
}
-
 }
diff --git a/tests/phpunit/includes/jobqueue/JobTest.php 
b/tests/phpunit/includes/jobqueue/JobTest.php
index 6723a0b..eccf237 100644
--- a/tests/phpunit/includes/jobqueue/JobTest.php
+++ b/tests/phpunit/includes/jobqueue/JobTest.php
@@ -6,89 +6,9 @@
 class JobTest extends MediaWikiTestCase {
 
/**
-* @dataProvider provideTestToString
-*
-* @param Job $job
-* @param string $expected
-*
 * @covers Job::toString
 */
-   public function testToString( $job, $expected ) {
-   $this->assertEquals( $expected, $job->toString() );
-   }
-
-   public function provideTestToString() {
-   $mockToStringObj = $this->getMockBuilder( 'stdClass' )
-   ->setMethods( [ '__toString' ] )->getMock();
-   $mockToStringObj->expects( $this->any() )
-   ->method( '__toString' )
-   ->will( $this->returnValue( '{STRING_OBJ_VAL}' 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM

2017-11-28 Thread Anomie (Code Review)
Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393790 )

Change subject: DNM
..

DNM

Testing something.

Change-Id: Ib112f5ec43a23caf6b77d3d11665f77384e9890b
---
M tests/phpunit/includes/api/ApiMainTest.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/tests/phpunit/includes/api/ApiMainTest.php 
b/tests/phpunit/includes/api/ApiMainTest.php
index ad334e9..0af0aeb 100644
--- a/tests/phpunit/includes/api/ApiMainTest.php
+++ b/tests/phpunit/includes/api/ApiMainTest.php
@@ -11,6 +11,10 @@
  */
 class ApiMainTest extends ApiTestCase {
 
+   public function testFail() {
+   $this->fail( 'test' );
+   }
+
/**
 * Test that the API will accept a FauxRequest and execute.
 */

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Drop deprecated EnableAPI and EnableWriteAPI settings

2017-11-20 Thread Jforrester (Code Review)
Jforrester has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392542 )

Change subject: [DNM] Drop deprecated EnableAPI and EnableWriteAPI settings
..

[DNM] Drop deprecated EnableAPI and EnableWriteAPI settings

Bug: T115414
Change-Id: I54ff9428b247ba203d67aba079149393f323d5a9
---
M api.php
M includes/DefaultSettings.php
M includes/OutputPage.php
M includes/Preferences.php
M includes/diff/DifferenceEngine.php
M includes/page/Article.php
M includes/resourceloader/ResourceLoaderStartUpModule.php
M includes/skins/Skin.php
M includes/specials/SpecialApiSandbox.php
M includes/specials/forms/UploadForm.php
M opensearch_desc.php
M tests/phpunit/includes/OutputPageTest.php
M tests/phpunit/includes/api/ApiTestCaseUpload.php
13 files changed, 48 insertions(+), 93 deletions(-)


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

diff --git a/api.php b/api.php
index d9a69db..9c5ac95 100644
--- a/api.php
+++ b/api.php
@@ -2,13 +2,10 @@
 /**
  * This file is the entry point for all API queries.
  *
- * It begins by checking whether the API is enabled on this wiki; if not,
- * it informs the user that s/he should set $wgEnableAPI to true and exits.
- * Otherwise, it constructs a new ApiMain using the parameter passed to it
- * as an argument in the URL ('?action=') and with write-enabled set to the
- * value of $wgEnableWriteAPI as specified in LocalSettings.php.
- * It then invokes "execute()" on the ApiMain object instance, which
- * produces output in the format specified in the URL.
+ * It begins by constructing a new ApiMain using the parameter passed to it
+ * as an argument in the URL ('?action='). It then invokes "execute()" on the
+ * ApiMain object instance, which produces output in the format specified in
+ * the URL.
  *
  * Copyright © 2006 Yuri Astrakhan @gmail.com
  *
@@ -55,14 +52,6 @@
die( 1 );
 }
 
-// Verify that the API has not been disabled
-if ( !$wgEnableAPI ) {
-   header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration 
Error', true, 500 );
-   echo 'MediaWiki API is not enabled for this site. Add the following 
line to your LocalSettings.php'
-   . '$wgEnableAPI=true;';
-   die( 1 );
-}
-
 // Set a dummy $wgTitle, because $wgTitle == null breaks various things
 // In a perfect world this wouldn't be necessary
 $wgTitle = Title::makeTitle( NS_SPECIAL, 'Badtitle/dummy title for API calls 
set in api.php' );
@@ -76,7 +65,7 @@
 * is some form of an ApiMain, possibly even one that produces an error 
message,
 * but we don't care here, as that is handled by the constructor.
 */
-   $processor = new ApiMain( RequestContext::getMain(), $wgEnableWriteAPI 
);
+   $processor = new ApiMain( RequestContext::getMain(), true );
 
// Last chance hook before executing the API
Hooks::run( 'ApiBeforeMain', [ &$processor ] );
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 3cd7ef1..5c3ad63 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -7964,25 +7964,6 @@
  */
 
 /**
- * Enable the MediaWiki API for convenient access to
- * machine-readable data via api.php
- *
- * See https://www.mediawiki.org/wiki/API
- *
- * @deprecated since 1.31
- */
-$wgEnableAPI = true;
-
-/**
- * Allow the API to be used to perform write operations
- * (page edits, rollback, etc.) when an authorised user
- * accesses it
- *
- * @deprecated since 1.31
- */
-$wgEnableWriteAPI = true;
-
-/**
  *
  * WARNING: SECURITY THREAT - debug use only
  *
@@ -8136,7 +8117,7 @@
 $wgAjaxUploadDestCheck = true;
 
 /**
- * Enable previewing licences via AJAX. Also requires $wgEnableAPI to be true.
+ * Enable previewing licences via AJAX.
  */
 $wgAjaxLicensePreview = true;
 
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 4635f99..049335b 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3406,24 +3406,22 @@
'title' => $this->msg( 'opensearch-desc' 
)->inContentLanguage()->text(),
] );
 
-   if ( $config->get( 'EnableAPI' ) ) {
-   # Real Simple Discovery link, provides auto-discovery 
information
-   # for the MediaWiki API (and potentially additional 
custom API
-   # support such as WordPress or Twitter-compatible APIs 
for a
-   # blogging extension, etc)
-   $tags['rsd'] = Html::element( 'link', [
-   'rel' => 'EditURI',
-   'type' => 'application/rsd+xml',
-   // Output a protocol-relative URL here if 
$wgServer is protocol-relative.
-   // Whether RSD accepts relative or 
protocol-relative URLs is completely
-   // undocumented, though.
-   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM [MCR] fixes made in various Revision* files to pass tests

2017-11-18 Thread Addshore (Code Review)
Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392199 )

Change subject: DNM [MCR] fixes made in various Revision* files to pass tests
..

DNM [MCR] fixes made in various Revision* files to pass tests

DO NOT MERGE!!!

This is simply to provide easy access to the things
changed in order to make tests pass.

Change-Id: If6065c740b5ee2fbfe6f5f9997fca7bd0a3dd905
---
M includes/Storage/RevisionArchiveRecord.php
M includes/Storage/RevisionRecord.php
M includes/Storage/RevisionStore.php
M includes/Storage/RevisionStoreRecord.php
4 files changed, 14 insertions(+), 11 deletions(-)


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

diff --git a/includes/Storage/RevisionArchiveRecord.php 
b/includes/Storage/RevisionArchiveRecord.php
index 0c3864b..c3bcace 100644
--- a/includes/Storage/RevisionArchiveRecord.php
+++ b/includes/Storage/RevisionArchiveRecord.php
@@ -73,7 +73,8 @@
// with the same title. Archive rows for that title will then 
have the wrong page id.
$this->mPageId = isset( $row->ar_page_id ) ? intval( 
$row->ar_page_id ) : $title->getArticleID();
 
-   $this->mParentId = isset( $row->ar_parent_id ) ? intval( 
$row->ar_parent_id ) : null;
+   $this->mParentId = isset( $row->ar_parent_id ) && 
$row->ar_parent_id != 0
+   ? intval( $row->ar_parent_id ) : null;
$this->mId = isset( $row->ar_rev_id ) ? intval( $row->ar_rev_id 
) : null;
$this->mComment = $comment;
$this->mUser = $user;
diff --git a/includes/Storage/RevisionRecord.php 
b/includes/Storage/RevisionRecord.php
index 58522ce..d244d9a 100644
--- a/includes/Storage/RevisionRecord.php
+++ b/includes/Storage/RevisionRecord.php
@@ -74,7 +74,7 @@
protected $mSize;
/** @var string|null */
protected $mSha1;
-   /** @var int */
+   /** @var int|null */
protected $mParentId;
/** @var CommentStoreComment|null */
protected $mComment;
diff --git a/includes/Storage/RevisionStore.php 
b/includes/Storage/RevisionStore.php
index aa6d30f..2cbb3a2 100644
--- a/includes/Storage/RevisionStore.php
+++ b/includes/Storage/RevisionStore.php
@@ -224,7 +224,7 @@
private function failOnNull( $value, $name ) {
if ( $value === null ) {
throw new IncompleteRevisionException(
-   "$name must not be null!"
+   "$name must not be " . var_export( null, true ) 
. "!"
);
}
 
@@ -236,7 +236,7 @@
 * @param string $name
 *
 * @throw IncompleteRevisionException if $value is null
-* @return mixed $value, if $value is not null
+* @return mixed $value, if $value is not empty
 */
private function failOnEmpty( $value, $name ) {
if ( $value === null || $value === 0 || $value === '' ) {
@@ -323,6 +323,7 @@
$blobAddress = 'tt:' . $textId;
 
$comment = $this->failOnNull( $rev->getComment(), 'comment' );
+   $user = $this->failOnNull( $rev->getUser(), 'user' );
$timestamp = $this->failOnEmpty( $rev->getTimestamp(), 
'timestamp field' );
 
# Record the edit in revisions
@@ -331,8 +332,8 @@
'rev_parent_id'  => $parentId,
'rev_text_id'=> $textId,
'rev_minor_edit' => $rev->isMinor() ? 1 : 0,
-   'rev_user'   => $this->failOnNull( 
$rev->getUser()->getId(), 'user field' ),
-   'rev_user_text'  => $this->failOnEmpty( 
$rev->getUser()->getName(), 'user_text field' ),
+   'rev_user'   => $rev->getUser()->getId(),
+   'rev_user_text'  => $rev->getUser()->getName(),
'rev_timestamp'  => $dbw->timestamp( $timestamp ),
'rev_deleted'=> $rev->getVisibility(),
'rev_len'=> $size,
@@ -988,8 +989,8 @@
 * @return UserIdentityValue
 */
private function getUserIdentityFromRowObject( $row, $prefix = 'rev_' ) 
{
-   $idField = "{$prefix}_user";
-   $nameField = "{$prefix}_user_text";
+   $idField = "{$prefix}user";
+   $nameField = "{$prefix}user_text";
 
$userId = intval( $row->$idField );
 
@@ -1160,6 +1161,7 @@
}
 
$mainSlot = $this->emulateMainSlot_1_29( $fields, $queryFlags, 
$title );
+
 
$revision = new MutableRevisionRecord( $title, $this->wikiId );
$this->initializeMutableRevisionFromArray( $revision, $fields );
@@ -1730,7 +1732,7 @@
__METHOD__
);
if ( $row ) {
- 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Remove redundant fields from old DB tables.

2017-09-18 Thread Daniel Kinzler (Code Review)
Daniel Kinzler has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378729 )

Change subject: [DNM] Remove redundant fields from old DB tables.
..

[DNM] Remove redundant fields from old DB tables.

This patch is intended as a showcase only!

Bug: T174028
Change-Id: I5e37c929713efad34218e616829235f417f1861c
---
M maintenance/tables.sql
1 file changed, 0 insertions(+), 42 deletions(-)


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

diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index 37c4dc5..c7a24e1 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -303,9 +303,6 @@
   -- Uncompressed length in bytes of the page's current source text.
   page_len int unsigned NOT NULL,
 
-  -- content model, see CONTENT_MODEL_XXX constants
-  page_content_model varbinary(32) DEFAULT NULL,
-
   -- Page content language
   page_lang varbinary(35) DEFAULT NULL
 ) /*$wgDBTableOptions*/;
@@ -339,12 +336,6 @@
   -- Key to page_id. This should _never_ be invalid.
   rev_page int unsigned NOT NULL,
 
-  -- Key to text.old_id, where the actual bulk text is stored.
-  -- It's possible for multiple revisions to use the same text,
-  -- for instance revisions where only metadata is altered
-  -- or a rollback to a previous version.
-  rev_text_id int unsigned NOT NULL,
-
   -- Text comment summarizing the change. Deprecated in favor of
   -- revision_comment_temp.revcomment_comment_id.
   rev_comment varbinary(767) NOT NULL default '',
@@ -375,12 +366,6 @@
 
   -- SHA-1 text content hash in base-36
   rev_sha1 varbinary(32) NOT NULL default '',
-
-  -- content model, see CONTENT_MODEL_XXX constants
-  rev_content_model varbinary(32) DEFAULT NULL,
-
-  -- content format, see CONTENT_FORMAT_XXX constants
-  rev_content_format varbinary(64) DEFAULT NULL
 
 ) /*$wgDBTableOptions*/ MAX_ROWS=1000 AVG_ROW_LENGTH=1024;
 -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 
4GB limit
@@ -536,14 +521,6 @@
   ar_namespace int NOT NULL default 0,
   ar_title varchar(255) binary NOT NULL default '',
 
-  -- Newly deleted pages will not store text in this table,
-  -- but will reference the separately existing text rows.
-  -- This field is retained for backwards compatibility,
-  -- so old archived pages will remain accessible after
-  -- upgrading from 1.4 to 1.5.
-  -- Text may be gzipped or otherwise funky.
-  ar_text mediumblob NOT NULL,
-
   -- Basic revision stuff...
   ar_comment varbinary(767) NOT NULL default '', -- Deprecated in favor of 
ar_comment_id
   ar_comment_id bigint unsigned NOT NULL DEFAULT 0, -- ("DEFAULT 0" is 
temporary, signaling that ar_comment should be used)
@@ -551,9 +528,6 @@
   ar_user_text varchar(255) binary NOT NULL,
   ar_timestamp binary(14) NOT NULL default '',
   ar_minor_edit tinyint NOT NULL default 0,
-
-  -- See ar_text note.
-  ar_flags tinyblob NOT NULL,
 
   -- When revisions are deleted, their unique rev_id is stored
   -- here so it can be retained after undeletion. This is necessary
@@ -563,17 +537,6 @@
   -- Old entries from 1.4 will be NULL here, and a new rev_id will
   -- be created on undeletion for those revisions.
   ar_rev_id int unsigned,
-
-  -- For newly deleted revisions, this is the text.old_id key to the
-  -- actual stored text. To avoid breaking the block-compression scheme
-  -- and otherwise making storage changes harder, the actual text is
-  -- *not* deleted from the text table, merely hidden by removal of the
-  -- page and revision entries.
-  --
-  -- Old entries deleted under 1.2-1.4 will have NULL here, and their
-  -- ar_text and ar_flags fields will be used to create a new text
-  -- row upon undeletion.
-  ar_text_id int unsigned,
 
   -- rev_deleted for archives
   ar_deleted tinyint unsigned NOT NULL default 0,
@@ -594,11 +557,6 @@
   -- SHA-1 text content hash in base-36
   ar_sha1 varbinary(32) NOT NULL default '',
 
-  -- content model, see CONTENT_MODEL_XXX constants
-  ar_content_model varbinary(32) DEFAULT NULL,
-
-  -- content format, see CONTENT_FORMAT_XXX constants
-  ar_content_format varbinary(64) DEFAULT NULL
 ) /*$wgDBTableOptions*/;
 
 -- Index for Special:Undelete to page through deleted revisions

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e37c929713efad34218e616829235f417f1861c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Use the main stash for LBFactory "memStash" parameter

2017-08-16 Thread Aaron Schulz (Code Review)
Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372220 )

Change subject: [DNM] Use the main stash for LBFactory "memStash" parameter
..

[DNM] Use the main stash for LBFactory "memStash" parameter

This store is used for ChronologyProtector positions.
It should be cross-DC since the sticky DC cookie may not work
for rapid cross-wiki farm activity, causing some request go to
the non-primary DC.

NOTE: this change should be deployed on all farm wikis at once

Change-Id: Ife126592aacace696e43912b9461164a9ea98bc1
---
M includes/db/MWLBFactory.php
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/372220/1

diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php
index 5196ac2..aa1918d 100644
--- a/includes/db/MWLBFactory.php
+++ b/includes/db/MWLBFactory.php
@@ -142,16 +142,18 @@
}
}
 
+   $services = MediaWikiServices::getInstance();
+
// Use APC/memcached style caching, but avoids loops with 
CACHE_DB (T141804)
-   $sCache = 
MediaWikiServices::getInstance()->getLocalServerObjectCache();
+   $sCache = $services->getLocalServerObjectCache();
if ( $sCache->getQoS( $sCache::ATTR_EMULATION ) > 
$sCache::QOS_EMULATION_SQL ) {
$lbConf['srvCache'] = $sCache;
}
-   $cCache = ObjectCache::getLocalClusterInstance();
-   if ( $cCache->getQoS( $cCache::ATTR_EMULATION ) > 
$cCache::QOS_EMULATION_SQL ) {
-   $lbConf['memStash'] = $cCache;
+   $mStash = $services->getMainObjectStash();
+   if ( $mStash->getQoS( $mStash::ATTR_EMULATION ) > 
$mStash::QOS_EMULATION_SQL ) {
+   $lbConf['memStash'] = $mStash;
}
-   $wCache = 
MediaWikiServices::getInstance()->getMainWANObjectCache();
+   $wCache = $services->getMainWANObjectCache();
if ( $wCache->getQoS( $wCache::ATTR_EMULATION ) > 
$wCache::QOS_EMULATION_SQL ) {
$lbConf['wanCache'] = $wCache;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Test

2017-07-05 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363482 )

Change subject: [DNM] Test
..

[DNM] Test

Change-Id: I06a3e132da57142b112a6608e13be838743e699d
---
M index.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/index.php b/index.php
index 743f77b..3d5c554 100644
--- a/index.php
+++ b/index.php
@@ -39,5 +39,6 @@
 
 require __DIR__ . '/includes/WebStart.php';
 
+// test
 $mediaWiki = new MediaWiki();
 $mediaWiki->run();

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] ParserCache: Add debug logging for T168040

2017-06-28 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361825 )

Change subject: [DNM] ParserCache: Add debug logging for T168040
..

[DNM] ParserCache: Add debug logging for T168040

Bug: T168040
Change-Id: Ida16e010fee464502bcd286a9fac275aa90b9290
---
M includes/parser/ParserCache.php
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/25/361825/1

diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index 76a7e1e..c089ce4 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -299,6 +299,17 @@
$parserOutput->mText .= "\n\n";
wfDebug( $msg );
 
+   // HACK: Debug logging for T168040
+   if ( !$parserOutput->getTOCEnabled() ) {
+   $ex = new Exception( 'Saving a ParserOutput 
with getTOCEnabled() == false' );
+   wfDebugLog( 'AdHocDebug', $ex->getMessage(), 
'private', [
+   'exception' => $ex,
+   'parserOutputKey' => $parserOutputKey,
+   'timestamp' => $cacheTime,
+   'revid' => $revId,
+   ] );
+   }
+
// Save the parser output
$this->mMemc->set( $parserOutputKey, $parserOutput, 
$expire );
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] qunit: Extend ajax tracking

2017-04-13 Thread Krinkle (Code Review)
Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348187 )

Change subject: [DNM] qunit: Extend ajax tracking
..

[DNM] qunit: Extend ajax tracking

Can't reproduce failure of https://gerrit.wikimedia.org/r/#/c/347523/
locally, comitting debug code here to test them together in Jenkins.

Change-Id: I56a09ed35851c1287aa13b672863879def7815fb
---
M tests/qunit/data/testrunner.js
1 file changed, 10 insertions(+), 4 deletions(-)


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

diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js
index b0118af..a84bcd7 100644
--- a/tests/qunit/data/testrunner.js
+++ b/tests/qunit/data/testrunner.js
@@ -125,7 +125,8 @@
QUnit.newMwEnvironment = ( function () {
var warn, error, liveConfig, liveMessages,
MwMap = mw.config.constructor, // internal use only
-   ajaxRequests = [];
+   ajaxRequests = [],
+   isTrackingAjax = false;
 
liveConfig = mw.config;
liveMessages = mw.messages;
@@ -172,9 +173,14 @@
 * @param {Object} ajaxOptions
 */
function trackAjax( event, jqXHR, ajaxOptions ) {
-   ajaxRequests.push( { xhr: jqXHR, options: ajaxOptions } 
);
+   if ( isTrackingAjax ) {
+   ajaxRequests.push( { xhr: jqXHR, options: 
ajaxOptions } );
+   } else {
+   console.info( 'Untracked ajax', ajaxOptions );
+   }
}
 
+   $( document ).on( 'ajaxSend', trackAjax );
return function ( localEnv ) {
localEnv = $.extend( {
// QUnit
@@ -202,7 +208,7 @@
this.restoreWarnings = restoreWarnings;
 
// Start tracking ajax requests
-   $( document ).on( 'ajaxSend', trackAjax 
);
+   isTrackingAjax = true;
 
localEnv.setup.call( this );
},
@@ -213,7 +219,7 @@
localEnv.teardown.call( this );
 
// Stop tracking ajax requests
-   $( document ).off( 'ajaxSend', 
trackAjax );
+   isTrackingAjax = false;
 
// Farewell, mock environment!
mw.config = liveConfig;

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM output unparsable input in phan postprocess

2017-01-06 Thread Addshore (Code Review)
Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/330877 )

Change subject: DNM output unparsable input in phan postprocess
..

DNM output unparsable input in phan postprocess

Change-Id: I7bad162a58020ace7f0f18a9d4475106d9b92190
---
M tests/phan/bin/postprocess-phan.php
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/tests/phan/bin/postprocess-phan.php 
b/tests/phan/bin/postprocess-phan.php
index 3e80598..9705e458 100644
--- a/tests/phan/bin/postprocess-phan.php
+++ b/tests/phan/bin/postprocess-phan.php
@@ -66,7 +66,11 @@
 */
public function suppress( $input ) {
$dom = new DOMDocument();
-   $dom->loadXML( $input );
+   $xmlLoadSuccess = $dom->loadXML( $input );
+   if ( !$xmlLoadSuccess ) {
+   throw new RuntimeException( 'Could not load XML from 
input: "' . $input . '""' );
+   }
+
$hasErrors = false;
// DOMNodeList's are "live", convert to an array so it works as 
expected
$files = [];

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Break Special:Blankpage for testing

2016-12-08 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326068 )

Change subject: [DNM] Break Special:Blankpage for testing
..

[DNM] Break Special:Blankpage for testing

Change-Id: I9e452ee037646733cd356f6871d89fbdb2b14611
---
M includes/specials/SpecialBlankpage.php
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/includes/specials/SpecialBlankpage.php 
b/includes/specials/SpecialBlankpage.php
index e61f12b..b128085 100644
--- a/includes/specials/SpecialBlankpage.php
+++ b/includes/specials/SpecialBlankpage.php
@@ -35,5 +35,8 @@
public function execute( $par ) {
$this->setHeaders();
$this->getOutput()->addWikiMsg( 'intentionallyblankpage' );
+   new ClassDoesntExist();
+
+   $this->notARealMethodEither();
}
 }

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] MessageCache invalidation improvements

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

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

Change subject: [DNM] MessageCache invalidation improvements
..

[DNM] MessageCache invalidation improvements

* Increase time range for getValidationHash() using "latest" values.
  The lower value ran the risk of regenerating from slaves and ending
  up with *older* data than what was there.
* Avoid cache set() calls in replace() unless the lock was acquired.
  Use delete() instead in that case, which invalidates the cache.
* Remember if the cache is volatile in process memory instead of doing
  check key lookups for each "big" message to determine this. Use the
  message hash in the big message keys so purges to the former chain
  down to the latter. An "EXCESSIVE" key/revision map is now used in
  the main cache for big messages. This means that editing an existing
  big message will result in a different hash value. This is needed so
  purges propage correctly.
* Add logging when replace() fails to acquire the lock.
* Factored message cache update code duplication into a new method.
* Use makeKey() in more places, replacing deprecated wfMemcKey().

Change-Id: I82c5baa8137d1ffaaec6adace82ccb0181441342
---
M includes/cache/MessageCache.php
M includes/page/WikiPage.php
2 files changed, 131 insertions(+), 97 deletions(-)


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

diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index 0c2f9de..3f78d9a 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -22,6 +22,7 @@
  */
 use MediaWiki\MediaWikiServices;
 use Wikimedia\ScopedCallback;
+use MediaWiki\Logger\LoggerFactory;
 
 /**
  * MediaWiki message cache structure version.
@@ -53,6 +54,11 @@
protected $mCache;
 
/**
+* @var bool[] Map of (language code => boolean)
+*/
+   protected $mCacheVolatile = [];
+
+   /**
 * Should mean that database cannot be used, but check
 * @var bool $mDisable
 */
@@ -65,10 +71,12 @@
protected $mExpiry;
 
/**
-* Message cache has its own parser which it uses to transform
-* messages.
+* Message cache has its own parser which it uses to transform messages
+* @var ParserOptions
 */
-   protected $mParserOptions, $mParser;
+   protected $mParserOptions;
+   /** @var Parser */
+   protected $mParser;
 
/**
 * Variable for tracking which variables are already loaded
@@ -129,6 +137,7 @@
 */
public static function normalizeKey( $key ) {
global $wgContLang;
+
$lckey = strtr( $key, ' ', '_' );
if ( ord( $lckey ) < 128 ) {
$lckey[0] = strtolower( $lckey[0] );
@@ -258,6 +267,7 @@
# Hash of the contents is stored in memcache, to detect if 
data-center cache
# or local cache goes out of date (e.g. due to replace() on 
some other server)
list( $hash, $hashVolatile ) = $this->getValidationHash( $code 
);
+   $this->mCacheVolatile[$code] = $hashVolatile;
 
# Try the local cache and check against the cluster hash key...
$cache = $this->getLocalCache( $code );
@@ -473,9 +483,16 @@
$bigConds[] = 'page_len > ' . intval( $wgMaxMsgCacheEntrySize );
 
# Load titles for all oversized pages in the MediaWiki namespace
-   $res = $dbr->select( 'page', 'page_title', $bigConds, 
__METHOD__ . "($code)-big" );
+   $res = $dbr->select(
+   'page',
+   [ 'page_title', 'page_latest' ],
+   $bigConds,
+   __METHOD__ . "($code)-big"
+   );
foreach ( $res as $row ) {
$cache[$row->page_title] = '!TOO BIG';
+   // At least include revision ID so page changes are 
reflected in the hash
+   $cache['EXCESSIVE'][$row->page_title] = 
$row->page_latest;
}
 
# Conditions to load the remaining pages with their contents
@@ -520,7 +537,7 @@
 * Updates cache as necessary when message page is changed
 *
 * @param string|bool $title Name of the page changed (false if deleted)
-* @param mixed $text New contents of the page.
+* @param string|bool $text New contents of the page (false if deleted)
 */
public function replace( $title, $text ) {
global $wgMaxMsgCacheEntrySize, $wgContLang, $wgLanguageCode;
@@ -540,31 +557,32 @@
// a self-deadlock. This is safe as no reads happen *directly* 
in this
// method between getReentrantScopedLock() and load() below. 
There is
// no risk of 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Test for T150512

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

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

Change subject: [DNM] Test for T150512
..

[DNM] Test for T150512

Change-Id: I51942856c7dc76b0882bb64389609a67232e4648
---
M includes/api/ApiBase.php
1 file changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 506ff73..08bf35b 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1572,6 +1572,13 @@
 * @throws UsageException always
 */
public function dieUsage( $description, $errorCode, $httpRespCode = 0, 
$extradata = null ) {
+   error_log( 'meJDMfj' );
+   error_log( $description );
+   error_log( $errorCode );
+   error_log( $httpRespCode );
+   error_log( serialize( $extradata ) );
+   error_log( serialize( $this->mParamCache ) );
+
throw new UsageException(
$description,
$this->encodeParamName( $errorCode ),

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: DNM MediaWikiTestCaseTest JENKINS VALIDATION

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

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

Change subject: DNM MediaWikiTestCaseTest JENKINS VALIDATION
..

DNM MediaWikiTestCaseTest JENKINS VALIDATION

Change-Id: I5921bac646c464e4a0fa7666b90a53fb8b0c2d69
---
M tests/phpunit/tests/MediaWikiTestCaseTest.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/322286/2

diff --git a/tests/phpunit/tests/MediaWikiTestCaseTest.php 
b/tests/phpunit/tests/MediaWikiTestCaseTest.php
index 5d2f37e..63f3d64 100644
--- a/tests/phpunit/tests/MediaWikiTestCaseTest.php
+++ b/tests/phpunit/tests/MediaWikiTestCaseTest.php
@@ -135,6 +135,7 @@
 * @covers MediaWikiTestCase::restoreLogger
 */
public function testLoggersAreRestoredOnTearDown() {
+   $this->fail( 'I should fail' );
// replacing an existing logger
$logger1 = LoggerFactory::getInstance( 'foo' );
$this->setLogger( 'foo', $this->getMock( LoggerInterface::class 
) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5921bac646c464e4a0fa7666b90a53fb8b0c2d69
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] Revert "resourceloader: Make cache-eval in mw.loader.w...

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

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

Change subject: [DNM] Revert "resourceloader: Make cache-eval in mw.loader.work 
asynchronous"
..

[DNM] Revert "resourceloader: Make cache-eval in mw.loader.work asynchronous"

This is to be applied to wmf.3 only to help verify the root cause
of T146510 one last time.

This reverts commit 2a895edbd23f796206e26fb7d08a79fe6c653103.

Change-Id: Ie21f5c3a7c34ccb273342fc3952bafd975cec088
---
M resources/src/mediawiki/mediawiki.js
1 file changed, 16 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/11/322211/1

diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 6b23439..f878e42 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -1681,26 +1681,6 @@
}
 
/**
-* @private
-* @param {string[]} implementations Array containing 
pieces of JavaScript code in the
-*  form of calls to mw.loader#implement().
-* @param {Function} cb Callback in case of failure
-* @param {Error} cb.err
-*/
-   function asyncEval( implementations, cb ) {
-   if ( !implementations.length ) {
-   return;
-   }
-   mw.requestIdleCallback( function () {
-   try {
-   $.globalEval( 
implementations.join( ';' ) );
-   } catch ( err ) {
-   cb( err );
-   }
-   } );
-   }
-
-   /**
 * Make a versioned key for a specific module.
 *
 * @private
@@ -1753,7 +1733,7 @@
 * @protected
 */
work: function () {
-   var q, batch, implementations, 
sourceModules;
+   var q, batch, concatSource, origBatch;
 
batch = [];
 
@@ -1783,18 +1763,19 @@
 
mw.loader.store.init();
if ( mw.loader.store.enabled ) {
-   implementations = [];
-   sourceModules = [];
+   concatSource = [];
+   origBatch = batch;
batch = $.grep( batch, function 
( module ) {
-   var implementation = 
mw.loader.store.get( module );
-   if ( implementation ) {
-   
implementations.push( implementation );
-   
sourceModules.push( module );
+   var source = 
mw.loader.store.get( module );
+   if ( source ) {
+   
concatSource.push( source );
return false;
}
return true;
} );
-   asyncEval( implementations, 
function ( err ) {
+   try {
+   $.globalEval( 
concatSource.join( ';' ) );
+   } catch ( err ) {
// Not good, the cached 
mw.loader.implement calls failed! This should
// never happen, 
barring ResourceLoader bugs, browser bugs and PEBKACs.
// Depending on how 
corrupt the string is, it is likely that some
@@ -1805,14 +1786,16 @@
// something that 
infected the implement call itself, don't take any
// risks and clear 
everything in this cache.
   

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [DNM] objectcache: detect default getWithSetCallback() set o...

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

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

Change subject: [DNM] objectcache: detect default getWithSetCallback() set 
options
..

[DNM] objectcache: detect default getWithSetCallback() set options

This works by setting a callback to return the cache set
options. The callback will watch DB reads and create a
merged result from said usage.

This handles callers that are missing getCacheSetOptions().

Change-Id: I6a1edc2a52da3ff98b94c1bcf373a9b0355a2e9f
---
M includes/ServiceWiring.php
M includes/db/MWLBFactory.php
M includes/libs/objectcache/WANObjectCache.php
M includes/libs/rdbms/database/DBConnRef.php
M includes/libs/rdbms/database/Database.php
M includes/libs/rdbms/database/IDatabase.php
M includes/libs/rdbms/lbfactory/ILBFactory.php
M includes/libs/rdbms/lbfactory/LBFactory.php
M includes/libs/rdbms/loadbalancer/ILoadBalancer.php
M includes/libs/rdbms/loadbalancer/LoadBalancer.php
M includes/libs/rdbms/loadbalancer/LoadBalancerSingle.php
M tests/phpunit/includes/db/LBFactoryTest.php
M tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
13 files changed, 419 insertions(+), 42 deletions(-)


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

diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php
index c2197a6..beefb33 100644
--- a/includes/ServiceWiring.php
+++ b/includes/ServiceWiring.php
@@ -52,7 +52,10 @@
);
$class = MWLBFactory::getLBFactoryClass( $lbConf );
 
-   return new $class( $lbConf );
+   $instance = new $class( $lbConf );
+   MWLBFactory::setCacheUsageCallbacks( $instance, $services );
+
+   return $instance;
},
 
'DBLoadBalancer' => function( MediaWikiServices $services ) {
diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php
index 42ef685..5a5c46c 100644
--- a/includes/db/MWLBFactory.php
+++ b/includes/db/MWLBFactory.php
@@ -134,6 +134,25 @@
}
 
/**
+* @param LBFactory $lbf New LBFactory instance that will be bound to 
$services
+* @param MediaWikiServices $services
+*/
+   public static function setCacheUsageCallbacks( LBFactory $lbf, 
MediaWikiServices $services ) {
+   // Account for lag and pending updates by default in cache 
generator callbacks
+   $wCache = $services->getMainWANObjectCache();
+   $wCache->setDefaultCacheSetOptionCallbacks(
+   function () use ( $lbf ) {
+   return $lbf->declareUsageSectionStart();
+   },
+   function ( $id ) use ( $lbf ) {
+   $info = $lbf->declareUsageSectionEnd( $id );
+
+   return $info['cacheSetOptions'] ?: [];
+   }
+   );
+   }
+
+   /**
 * Returns the LBFactory class to use and the load balancer 
configuration.
 *
 * @todo instead of this, use a ServiceContainer for managing the 
different implementations.
diff --git a/includes/libs/objectcache/WANObjectCache.php 
b/includes/libs/objectcache/WANObjectCache.php
index 8d3c6d9..b9753d3 100644
--- a/includes/libs/objectcache/WANObjectCache.php
+++ b/includes/libs/objectcache/WANObjectCache.php
@@ -93,6 +93,11 @@
/** @var mixed[] Temporary warm-up cache */
private $warmupCache = [];
 
+   /** @var callable Callback used in generating default options in 
getWithSetCallback() */
+   private $sowSetOptsCallback;
+   /** @var callable Callback used in generating default options in 
getWithSetCallback() */
+   private $reapSetOptsCallback;
+
/** Max time expected to pass between delete() and DB commit finishing 
*/
const MAX_COMMIT_DELAY = 3;
/** Max replication+snapshot lag before applying TTL_LAGGED or 
disallowing set() */
@@ -181,6 +186,12 @@
? $params['relayers']['purge']
: new EventRelayerNull( [] );
$this->setLogger( isset( $params['logger'] ) ? 
$params['logger'] : new NullLogger() );
+   $this->sowSetOptsCallback = function () {
+   return null; // no-op
+   };
+   $this->reapSetOptsCallback = function () {
+   return []; // no-op
+   };
}
 
public function setLogger( LoggerInterface $logger ) {
@@ -1001,7 +1012,9 @@
$setOpts = [];
++$this->callbackDepth;
try {
+   $tag = call_user_func( $this->sowSetOptsCallback );
$value = call_user_func_array( $callback, [ $cValue, 
&$ttl, &$setOpts, $asOf ] );
+   $setOptDefaults = call_user_func( 
$this->reapSetOptsCallback, $tag );
}