Remove PageProps::overrideInstance()

Test-only code

Change-Id: Ib9fd9ed315078e42beae7ca24f5eec457b5f48d6
This commit is contained in:
DannyS712 2021-03-12 03:42:40 +00:00 committed by DannyS712
parent 8ff5ed5cfe
commit 7dd251691d
2 changed files with 3 additions and 35 deletions

View file

@ -416,6 +416,9 @@ because of Phabricator reports.
* The following functions from the Title class have been removed:
- countRevisionsBetween
- getAuthorsBetween
* The PageProps class was converted to a service. PageProps::overrideInstance
was removed, and MediaWikiServices::redefineService should be used
instead.
* The $wgContLang variable, deprecated in 1.32, was removed. You can instead use
MediaWikiServices::getInstance()->getContentLanguage().
* …
@ -456,9 +459,6 @@ because of Phabricator reports.
OutputPage::getIndicators.
* Skin::makeVariablesScript() has been deprecated. Use
ResourceLoader::makeInlineScript() instead.
* The PageProps class was converted to a service. PageProps::overrideInstance
was deprecated, and MediaWikiServices::redefineService should be used
instead.
* Title::nameOf() is deprecated; use Title::newFromID()->getPrefixedDBkey()
instead.
* DatabaseBlock::insert, DatabaseBlock::update, DatabaseBlock::purgeExpired and

View file

@ -23,7 +23,6 @@
use MediaWiki\Cache\LinkBatchFactory;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\ILoadBalancer;
use Wikimedia\ScopedCallback;
/**
* Gives access to properties of a page.
@ -45,37 +44,6 @@ class PageProps {
/** @var MapCacheLRU */
private $cache = null;
/**
* Overrides the default instance of this class
* This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
*
* @since 1.27
* @deprecated since 1.36
*
* @param PageProps $store
*
* @return ScopedCallback to reset the overridden value
* @throws MWException
*/
public static function overrideInstance( PageProps $store ) {
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
throw new MWException(
'Cannot override ' . __CLASS__ . 'default instance in operation.'
);
}
MediaWikiServices::getInstance()->redefineService(
'PageProps',
static function () use ( $store ) {
return $store;
}
);
return new ScopedCallback( static function () {
MediaWikiServices::getInstance()->resetServiceForTesting( 'PageProps' );
} );
}
/**
* @return PageProps
*/