HTMLTitleTextField: Remove B&C code
Bug: T288181 Change-Id: Iec9225d0f0fe47dd972f6c302ca803e65b8232a7
This commit is contained in:
parent
579fea47f8
commit
408999928d
3 changed files with 5 additions and 24 deletions
|
|
@ -90,6 +90,9 @@ because of Phabricator reports.
|
|||
process.
|
||||
* The signature of PageUpdater::markAsRevert method was changed. It has never
|
||||
been used outside of MediaWiki core.
|
||||
* If you want to use interwiki titles with HTMLTitleTextField, you now need
|
||||
to pass 'interwiki' => true. In 1.37, the default behavior was to let
|
||||
interwiki title through by default, logging a deprecation warning.
|
||||
* …
|
||||
|
||||
=== Deprecations in 1.38 ===
|
||||
|
|
|
|||
|
|
@ -29,10 +29,7 @@ class HTMLTitleTextField extends HTMLTextField {
|
|||
'relative' => false,
|
||||
'creatable' => false,
|
||||
'exists' => false,
|
||||
// Default to null during the deprecation process so we can differentiate between
|
||||
// callers who intentionally want to disallow interwiki titles and legacy callers
|
||||
// who aren't aware of the setting.
|
||||
'interwiki' => null,
|
||||
'interwiki' => false,
|
||||
// This overrides the default from HTMLFormField
|
||||
'required' => true,
|
||||
];
|
||||
|
|
@ -71,20 +68,6 @@ class HTMLTitleTextField extends HTMLTextField {
|
|||
if ( $this->mParams['interwiki'] ) {
|
||||
// We cannot validate external titles, skip the rest of the validation
|
||||
return parent::validate( $value, $alldata );
|
||||
} elseif ( $this->mParams['interwiki'] === null ) {
|
||||
// Legacy caller, they probably don't need/want interwiki titles as those don't
|
||||
// make sense in most use cases. To avoid a B/C break without deprecation, though,
|
||||
// we let the title through and raise a warning. That way, code that needs to allow
|
||||
// interwiki titles will get deprecation warnings as long as users actually submit
|
||||
// interwiki titles to the form. That's not ideal but a less conditional warning
|
||||
// would be impractical - having to update every title field in the world to avoid
|
||||
// warnings would be too much of a burden.
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' will reject external titles in 1.38 when interwiki is false '
|
||||
. "(field: $this->mName)",
|
||||
'1.37'
|
||||
);
|
||||
return parent::validate( $value, $alldata );
|
||||
} else {
|
||||
return $this->msg( 'htmlform-title-interwiki', $title->getPrefixedText() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class HTMLTitleTextFieldTest extends MediaWikiIntegrationTestCase {
|
|||
public function provideInterwiki() {
|
||||
return [
|
||||
'local title' => [ [ 'interwiki' => false ], 'SomeTitle', true ],
|
||||
'interwiki title, default' => [ [], 'unittest_foo:SomeTitle', false ],
|
||||
'interwiki title, disallowed' => [ [ 'interwiki' => false ],
|
||||
'unittest_foo:SomeTitle', false ],
|
||||
'interwiki title, allowed' => [ [ 'interwiki' => true ],
|
||||
|
|
@ -50,12 +51,6 @@ class HTMLTitleTextFieldTest extends MediaWikiIntegrationTestCase {
|
|||
$field->validate( 'SomeTitle', [ 'foo' => 'SomeTitle' ] );
|
||||
}
|
||||
|
||||
public function testInterwiki_deprecation() {
|
||||
$this->expectError();
|
||||
$field = new HTMLTitleTextField( [ 'fieldname' => 'foo' ] );
|
||||
$field->validate( 'unittest_foo:SomeTitle', [ 'foo' => 'SomeTitle' ] );
|
||||
}
|
||||
|
||||
protected function setupInterwikiTable() {
|
||||
$site = new Site( Site::TYPE_MEDIAWIKI );
|
||||
$site->setGlobalId( 'unittest_foowiki' );
|
||||
|
|
|
|||
Loading…
Reference in a new issue