Revert "Deprecate Skin::setupSkinUserCss"

The commit did not really hard-deprecate overriding of setupSkinUserCss() as stated in the commit message, rather it removed core calls to setupSkinUserCss(), instantly breaking the many skins that still override it. It did not actually create a deprecation period for graceful migration.

As discussed in T267080, there is presently no way to hard-deprecate the override of a method.

This reverts commit 334cfeffd6.

Bug: T257990
Change-Id: I8f669ba30affc437800890c3a875994a9f2eb3c8
This commit is contained in:
Tim Starling 2020-11-22 23:07:27 +00:00
parent 77e1b24473
commit e9608cc17d
5 changed files with 11 additions and 7 deletions

View file

@ -2993,6 +2993,7 @@ class OutputPage extends ContextSource {
'noscript',
'user.styles',
] );
$this->getSkin()->setupSkinUserCss( $this );
// Prepare exempt modules for buildExemptModules()
$exemptGroups = [ 'site' => [], 'noscript' => [], 'private' => [], 'user' => [] ];

View file

@ -388,6 +388,8 @@ class ApiParse extends ApiBase {
$context->setOutput( $outputPage );
if ( $skin ) {
// Based on OutputPage::headElement()
$skin->setupSkinUserCss( $outputPage );
// Based on OutputPage::output()
$outputPage->loadSkinModules( $skin );
}

View file

@ -454,7 +454,7 @@ abstract class Skin extends ContextSource {
* @param OutputPage $out Legacy parameter, identical to $this->getOutput()
*/
public function setupSkinUserCss( OutputPage $out ) {
wfDeprecated( __METHOD__, '1.32' );
// Stub.
}
/**

View file

@ -159,17 +159,18 @@ class ApiParseTest extends ApiTestCase {
$factory = new SkinFactory( new ObjectFactory( $this->createMock( ContainerInterface::class ) ), [] );
$factory->register( 'testing', 'Testing', function () {
$skin = $this->getMockBuilder( SkinFallback::class )
->setMethods( [ 'getDefaultModules' ] )
->setMethods( [ 'getDefaultModules', 'setupSkinUserCss' ] )
->getMock();
$skin->expects( $this->once() )->method( 'getDefaultModules' )
->willReturn( [
'styles' => [
'user' => [ 'foo.styles' ],
'core' => [ 'quux.styles' ]
],
'styles' => [ 'core' => [ 'quux.styles' ] ],
'core' => [ 'foo', 'bar' ],
'content' => [ 'baz' ]
] );
$skin->expects( $this->once() )->method( 'setupSkinUserCss' )
->will( $this->returnCallback( function ( OutputPage $out ) {
$out->addModuleStyles( 'foo.styles' );
} ) );
return $skin;
} );
$this->setService( 'SkinFactory', $factory );

View file

@ -7,7 +7,7 @@ class SkinTest extends MediaWikiIntegrationTestCase {
*/
public function testGetDefaultModules() {
$skin = $this->getMockBuilder( Skin::class )
->setMethods( [ 'outputPage' ] )
->setMethods( [ 'outputPage', 'setupSkinUserCss' ] )
->getMock();
$modules = $skin->getDefaultModules();