From 733704ed8248f71dfb982d22799104a976d1ada4 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 20 Sep 2018 10:13:26 -0700 Subject: [PATCH] CommentStore: Hard-deprecate newKey() Not used by any extensions known to Wikimedia git. Change-Id: I3c07ad6db9d88feddad1cf29d4794fef622298ea --- includes/CommentStore.php | 3 +-- tests/phpunit/includes/ActorMigrationTest.php | 5 +++-- tests/phpunit/includes/CommentStoreTest.php | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/CommentStore.php b/includes/CommentStore.php index bf3e3d6608..9969b78782 100644 --- a/includes/CommentStore.php +++ b/includes/CommentStore.php @@ -115,8 +115,7 @@ class CommentStore { */ public static function newKey( $key ) { global $wgCommentTableSchemaMigrationStage; - // TODO uncomment once not used in extensions - // wfDeprecated( __METHOD__, '1.31' ); + wfDeprecated( __METHOD__, '1.31' ); $store = new CommentStore( MediaWikiServices::getInstance()->getContentLanguage(), $wgCommentTableSchemaMigrationStage ); $store->key = $key; diff --git a/tests/phpunit/includes/ActorMigrationTest.php b/tests/phpunit/includes/ActorMigrationTest.php index d28be7a53c..c9387507c2 100644 --- a/tests/phpunit/includes/ActorMigrationTest.php +++ b/tests/phpunit/includes/ActorMigrationTest.php @@ -1,6 +1,7 @@ method( 'getName' )->willReturn( $user->getName() ); $userIdentity->method( 'getActorId' )->willReturn( 0 ); - list( $cFields, $cCallback ) = CommentStore::newKey( 'rev_comment' ) - ->insertWithTempTable( $this->db, '' ); + list( $cFields, $cCallback ) = MediaWikiServices::getInstance()->getCommentStore() + ->insertWithTempTable( $this->db, 'rev_comment', '' ); $m = $this->makeMigration( MIGRATION_WRITE_BOTH ); list( $fields, $callback ) = $m->getInsertValuesWithTempTable( $this->db, 'rev_user', $userIdentity ); diff --git a/tests/phpunit/includes/CommentStoreTest.php b/tests/phpunit/includes/CommentStoreTest.php index f9b592ec01..0c5d8e3143 100644 --- a/tests/phpunit/includes/CommentStoreTest.php +++ b/tests/phpunit/includes/CommentStoreTest.php @@ -35,6 +35,7 @@ class CommentStoreTest extends MediaWikiLangTestCase { * @return CommentStore */ protected function makeStoreWithKey( $stage, $key ) { + $this->hideDeprecated( 'CommentStore::newKey' ); $store = CommentStore::newKey( $key ); TestingAccessWrapper::newFromObject( $store )->stage = $stage; return $store; @@ -774,6 +775,7 @@ class CommentStoreTest extends MediaWikiLangTestCase { } public function testNewKey() { + $this->hideDeprecated( 'CommentStore::newKey' ); $this->assertInstanceOf( CommentStore::class, CommentStore::newKey( 'dummy' ) ); } -- 2.20.1