CommentStore: Hard-deprecate newKey()
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 20 Sep 2018 17:13:26 +0000 (10:13 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 20 Sep 2018 17:15:39 +0000 (10:15 -0700)
Not used by any extensions known to Wikimedia git.

Change-Id: I3c07ad6db9d88feddad1cf29d4794fef622298ea

includes/CommentStore.php
tests/phpunit/includes/ActorMigrationTest.php
tests/phpunit/includes/CommentStoreTest.php

index bf3e3d6..9969b78 100644 (file)
@@ -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;
index d28be7a..c938750 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use MediaWiki\User\UserIdentity;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -635,8 +636,8 @@ class ActorMigrationTest extends MediaWikiLangTestCase {
                $userIdentity->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 );
index f9b592e..0c5d8e3 100644 (file)
@@ -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' ) );
        }