[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Revert "[MCR] Turn Revision into a proxy to new code."

2017-12-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399156 )

Change subject: Revert "[MCR] Turn Revision into a proxy to new code."
..


Revert "[MCR] Turn Revision into a proxy to new code."

This reverts commit 9dcc56b3c9e7a3212d0900ee23808b9402cad952.

With this patch applied, newly created revisions are sometimes not found
just after submitting an edit, until replicas have caught up.

Our best theory is that it somehow interfere with ChronologyProtector,
but we don't have a good idea how.

Also, as legoktm mentioned, the commit message is terrible and needs fixing.

Change-Id: Idf3404f3fa8f8d08a7fb2ab8268726e2c1edecfe
---
M RELEASE-NOTES-1.31
M docs/hooks.txt
M includes/Revision.php
M includes/ServiceWiring.php
M includes/actions/HistoryAction.php
M includes/cache/MessageCache.php
M includes/page/WikiPage.php
M includes/parser/Parser.php
M includes/resourceloader/ResourceLoaderWikiModule.php
M includes/specials/SpecialNewpages.php
M tests/phpunit/includes/MediaWikiServicesTest.php
M tests/phpunit/includes/RevisionDbTestBase.php
M tests/phpunit/includes/RevisionTest.php
13 files changed, 1,420 insertions(+), 711 deletions(-)

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



diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index 67026f4..1a1a9f7 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -123,9 +123,6 @@
 * The Block class will no longer accept usable-but-missing usernames for
   'byText' or ->setBlocker(). Callers should either ensure the blocker exists
   locally or use a new interwiki-format username like "iw>Example".
-* The RevisionInsertComplete hook is now deprecated, use 
RevisionRecordInserted instead.
-  RevisionInsertComplete is still called, but the second and third parameter 
will always be null.
-  Hard deprecation is scheduled for 1.32.
 * The following methods that get and set ParserOutput state are deprecated.
   Callers should use the new stateless $options parameter to
   ParserOutput::getText() instead.
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 1f4a5f4..ee38ea9 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2810,14 +2810,14 @@
   added to any module.
 &$ResourceLoader: object
 
-'RevisionRecordInserted': Called after a revision is inserted into the 
database.
-$revisionRecord: the RevisionRecord that has just been inserted.
-
-'RevisionInsertComplete': DEPRECATED! Use RevisionRecordInserted hook instead.
-Called after a revision is inserted into the database.
-$revision: the Revision
-$data: DEPRECATED! Always null!
-$flags: DEPRECATED! Always null!
+'RevisionInsertComplete': Called after a revision is inserted into the 
database.
+&$revision: the Revision
+$data: the data stored in old_text.  The meaning depends on $flags: if external
+  is set, it's the URL of the revision text in external storage; otherwise,
+  it's the revision text itself.  In either case, if gzip is set, the revision
+  text is gzipped.
+$flags: a comma-delimited list of strings representing the options used.  May
+  include: utf8 (this will always be set for new revisions); gzip; external.
 
 'SearchableNamespaces': An option to modify which namespaces are searchable.
 &$arr: Array of namespaces ($nsId => $name) which will be used.
diff --git a/includes/Revision.php b/includes/Revision.php
index ea73a61..25c89c2 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -20,14 +20,7 @@
  * @file
  */
 
-use MediaWiki\Storage\MutableRevisionRecord;
-use MediaWiki\Storage\RevisionAccessException;
-use MediaWiki\Storage\RevisionRecord;
-use MediaWiki\Storage\RevisionStore;
-use MediaWiki\Storage\RevisionStoreRecord;
-use MediaWiki\Storage\SlotRecord;
-use MediaWiki\Storage\SqlBlobStore;
-use MediaWiki\User\UserIdentityValue;
+use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
@@ -35,50 +28,78 @@
 use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
- * @deprecated since 1.31, use RevisionRecord, RevisionStore, and BlobStore 
instead.
+ * @todo document
  */
 class Revision implements IDBAccessObject {
+   /** @var int|null */
+   protected $mId;
+   /** @var int|null */
+   protected $mPage;
+   /** @var string */
+   protected $mUserText;
+   /** @var string */
+   protected $mOrigUserText;
+   /** @var int */
+   protected $mUser;
+   /** @var bool */
+   protected $mMinorEdit;
+   /** @var string */
+   protected $mTimestamp;
+   /** @var int */
+   protected $mDeleted;
+   /** @var int */
+   protected $mSize;
+   /** @var string */
+   protected $mSha1;
+   /** @var int */
+   protected $mParentId;
+   /** @var string */
+   protected $mComment;
+   /** @var string */
+   protected $mText;
+   /** @var int */
+   protected $mTextId;
+   /** @var 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Revert "[MCR] Turn Revision into a proxy to new code."

2017-12-19 Thread Daniel Kinzler (Code Review)
Hello Bene, Cicalese, Ladsgroup, Brion VIBBER, Legoktm, Addshore, jenkins-bot, 
Anomie,

I'd like you to do a code review.  Please visit

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

to review the following change.


Change subject: Revert "[MCR] Turn Revision into a proxy to new code."
..

Revert "[MCR] Turn Revision into a proxy to new code."

This reverts commit 9dcc56b3c9e7a3212d0900ee23808b9402cad952.

With this patch applied, newly created revisions are sometimes not fund just 
after submitting an edit, until replicas have caught up. Our best theory is 
that it somehow interfere with ChronologyProtector, but we don't have a good 
idea how.

Also, as legoktm mentioned, the commit message is terrible and needs fixing.

Change-Id: Idf3404f3fa8f8d08a7fb2ab8268726e2c1edecfe
---
M RELEASE-NOTES-1.31
M docs/hooks.txt
M includes/Revision.php
M includes/ServiceWiring.php
M includes/actions/HistoryAction.php
M includes/cache/MessageCache.php
M includes/page/WikiPage.php
M includes/parser/Parser.php
M includes/resourceloader/ResourceLoaderWikiModule.php
M includes/specials/SpecialNewpages.php
M tests/phpunit/includes/MediaWikiServicesTest.php
M tests/phpunit/includes/RevisionDbTestBase.php
M tests/phpunit/includes/RevisionTest.php
13 files changed, 1,414 insertions(+), 752 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/399156/1

diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31
index 67026f4..1a1a9f7 100644
--- a/RELEASE-NOTES-1.31
+++ b/RELEASE-NOTES-1.31
@@ -123,9 +123,6 @@
 * The Block class will no longer accept usable-but-missing usernames for
   'byText' or ->setBlocker(). Callers should either ensure the blocker exists
   locally or use a new interwiki-format username like "iw>Example".
-* The RevisionInsertComplete hook is now deprecated, use 
RevisionRecordInserted instead.
-  RevisionInsertComplete is still called, but the second and third parameter 
will always be null.
-  Hard deprecation is scheduled for 1.32.
 * The following methods that get and set ParserOutput state are deprecated.
   Callers should use the new stateless $options parameter to
   ParserOutput::getText() instead.
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 1f4a5f4..ee38ea9 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2810,14 +2810,14 @@
   added to any module.
 &$ResourceLoader: object
 
-'RevisionRecordInserted': Called after a revision is inserted into the 
database.
-$revisionRecord: the RevisionRecord that has just been inserted.
-
-'RevisionInsertComplete': DEPRECATED! Use RevisionRecordInserted hook instead.
-Called after a revision is inserted into the database.
-$revision: the Revision
-$data: DEPRECATED! Always null!
-$flags: DEPRECATED! Always null!
+'RevisionInsertComplete': Called after a revision is inserted into the 
database.
+&$revision: the Revision
+$data: the data stored in old_text.  The meaning depends on $flags: if external
+  is set, it's the URL of the revision text in external storage; otherwise,
+  it's the revision text itself.  In either case, if gzip is set, the revision
+  text is gzipped.
+$flags: a comma-delimited list of strings representing the options used.  May
+  include: utf8 (this will always be set for new revisions); gzip; external.
 
 'SearchableNamespaces': An option to modify which namespaces are searchable.
 &$arr: Array of namespaces ($nsId => $name) which will be used.
diff --git a/includes/Revision.php b/includes/Revision.php
index ea73a61..25c89c2 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -20,14 +20,7 @@
  * @file
  */
 
-use MediaWiki\Storage\MutableRevisionRecord;
-use MediaWiki\Storage\RevisionAccessException;
-use MediaWiki\Storage\RevisionRecord;
-use MediaWiki\Storage\RevisionStore;
-use MediaWiki\Storage\RevisionStoreRecord;
-use MediaWiki\Storage\SlotRecord;
-use MediaWiki\Storage\SqlBlobStore;
-use MediaWiki\User\UserIdentityValue;
+use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
@@ -35,50 +28,78 @@
 use Wikimedia\Rdbms\FakeResultWrapper;
 
 /**
- * @deprecated since 1.31, use RevisionRecord, RevisionStore, and BlobStore 
instead.
+ * @todo document
  */
 class Revision implements IDBAccessObject {
+   /** @var int|null */
+   protected $mId;
+   /** @var int|null */
+   protected $mPage;
+   /** @var string */
+   protected $mUserText;
+   /** @var string */
+   protected $mOrigUserText;
+   /** @var int */
+   protected $mUser;
+   /** @var bool */
+   protected $mMinorEdit;
+   /** @var string */
+   protected $mTimestamp;
+   /** @var int */
+   protected $mDeleted;
+   /** @var int */
+   protected $mSize;
+   /** @var string */
+   protected $mSha1;
+   /** @var int */
+   protected $mParentId;
+   /** @var string */
+   protected $mComment;