Hard deprecate LinkCache::addGoodLinkObj

LinkCache::addGoodLinkObj was hard deprecated.
Use addGoodLinkObjFromRow() instead. PHPUnit tests
must use LinkCacheTestTrait::addGoodLinkObject().

Bug: T284955
Change-Id: I0c22be2f00e6d6d4ba6dd1511c5385cad55e8ff7
This commit is contained in:
vladshapik 2021-10-26 18:21:32 +03:00
parent 164ec5cb29
commit 1ae8e89eb5
3 changed files with 5 additions and 2 deletions

View file

@ -267,6 +267,7 @@ because of Phabricator reports.
::getArchivedRevisionRecord, ::getPreviousRevisionRecord and
::getLastRevisionId.
- Use ArchivedRevisionLookup::hasArchivedRevisions instead of ::isDeleted.
* LinkCache::addGoodLinkObj() has been hard deprecated.
* …
=== Other changes in 1.38 ===

View file

@ -282,6 +282,7 @@ class LinkCache implements LoggerAwareInterface {
public function addGoodLinkObj( $id, $page, $len = -1, $redir = null,
$revision = 0, $model = null, $lang = null
) {
wfDeprecated( __METHOD__, '1.38' );
$this->addGoodLinkObjFromRow( $page, (object)[
'page_id' => (int)$id,
'page_namespace' => $page->getNamespace(),

View file

@ -16,6 +16,7 @@ use Wikimedia\TestingAccessWrapper;
*/
class TitleTest extends MediaWikiIntegrationTestCase {
use DummyServicesTrait;
use LinkCacheTestTrait;
protected function setUp(): void {
parent::setUp();
@ -367,10 +368,10 @@ class TitleTest extends MediaWikiIntegrationTestCase {
* @covers Title::clearCaches
*/
public function testClearCaches() {
$linkCache = MediaWikiServices::getInstance()->getLinkCache();
$linkCache = $this->getServiceContainer()->getLinkCache();
$title1 = Title::newFromText( 'Foo' );
$linkCache->addGoodLinkObj( 23, $title1 );
$this->addGoodLinkObject( 23, $title1 );
Title::clearCaches();