<exclude-pattern>*/includes/search/SearchEngine\.php</exclude-pattern>
<exclude-pattern>*/includes/specialpage/LoginSignupSpecialPage\.php</exclude-pattern>
<exclude-pattern>*/includes/specialpage/RedirectSpecialPage\.php</exclude-pattern>
+ <exclude-pattern>*/includes/specials/forms/PreferencesFormLegacy\.php</exclude-pattern>
<exclude-pattern>*/includes/specials/SpecialListusers\.php</exclude-pattern>
<exclude-pattern>*/includes/specials/SpecialMyRedirectPages\.php</exclude-pattern>
<exclude-pattern>*/includes/specials/SpecialUploadStash\.php</exclude-pattern>
used instead.
* The function wfShellWikiCmd() has been deprecated, use
MediaWiki\Shell::makeScriptCommand().
+* In the future, the hooks 'PreferencesFormPreSave' and 'PreferencesGetLegend'
+ will be allowed to provide any HTMLForm object rather than PreferencesForm.
+
=== Other changes in 1.31 ===
* Browser support for Internet Explorer 10 was lowered from Grade A to Grade C.
* Browser support for Opera 12 and older was dropped entirely. Opera 15+
* The jquery.farbtastic module, unused since 1.18, was removed.
* (T181318) The $wgStyleVersion setting and its appendage to various script and
style URLs in OutputPage, deprecated in 1.31, was removed.
+* The hooks 'PreferencesFormPreSave' and 'PreferencesGetLegend' may provide
+ any HTMLForm object rather than PreferencesForm.
=== Deprecations in 1.32 ===
* Use of a StartProfiler.php file is deprecated in favour of placing
'PostgresInstaller' => __DIR__ . '/includes/installer/PostgresInstaller.php',
'PostgresUpdater' => __DIR__ . '/includes/installer/PostgresUpdater.php',
'Preferences' => __DIR__ . '/includes/Preferences.php',
- 'PreferencesForm' => __DIR__ . '/includes/specials/forms/PreferencesForm.php',
+ 'PreferencesForm' => __DIR__ . '/includes/specials/forms/PreferencesFormLegacy.php',
'PreferencesFormLegacy' => __DIR__ . '/includes/specials/forms/PreferencesFormLegacy.php',
'PreferencesFormOOUI' => __DIR__ . '/includes/specials/forms/PreferencesFormOOUI.php',
'PrefixSearch' => __DIR__ . '/includes/PrefixSearch.php',
'PreferencesFormPreSave': Override preferences being saved
$formData: array of user submitted data
-$form: PreferencesForm object, also a ContextSource
+$form: HTMLForm object, also a ContextSource
$user: User object with preferences to be saved set
&$result: boolean indicating success
$oldUserOptions: array with user old options (before save)
'PreferencesGetLegend': Override the text used for the <legend> of a
preferences section.
-$form: the PreferencesForm object. This is a ContextSource as well
+$form: the HTMLForm object. This is a ContextSource as well
$key: the section name
&$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may
be overridden
$wgUseMediaWikiUIEverywhere = false;
/**
- * Temporary variable that determines whether the EditPage class should use OOjs UI or not.
- * This will be removed later and OOjs UI will become the only option.
+ * Temporary variable that determines whether Special:Preferences should use OOUI or not.
+ * This will be removed later and OOUI will become the only option.
*
* @since 1.32
*/
* @deprecated since 1.31, use PreferencesFactory
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return bool|Status|string
*/
public static function tryFormSubmit( $formData, $form ) {
/**
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return Status
*/
public static function tryUISubmit( $formData, $form ) {
use Parser;
use ParserOptions;
use PreferencesForm;
-use PreferencesFormOOUI;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use Skin;
* @param IContextSource $context
* @param string $formClass
* @param array $remove Array of items to remove
- * @return PreferencesForm
+ * @return HTMLForm
*/
public function getForm(
User $user,
IContextSource $context,
- $formClass = PreferencesFormOOUI::class,
+ $formClass = PreferencesForm::class,
array $remove = []
) {
if ( SpecialPreferences::isOouiEnabled( $context ) ) {
}
/**
- * @var $htmlForm PreferencesForm
+ * @var $htmlForm HTMLForm
*/
$htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
# Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
$htmlForm->setSubmitTooltip( 'preferences-save' );
$htmlForm->setSubmitID( 'prefcontrol' );
- $htmlForm->setSubmitCallback( function ( array $formData, PreferencesForm $form ) {
+ $htmlForm->setSubmitCallback( function ( array $formData, HTMLForm $form ) {
return $this->submitForm( $formData, $form );
} );
* Handle the form submission if everything validated properly
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return bool|Status|string
*/
- protected function saveFormData( $formData, PreferencesForm $form ) {
+ protected function saveFormData( $formData, HTMLForm $form ) {
$user = $form->getModifiedUser();
$hiddenPrefs = $this->config->get( 'HiddenPrefs' );
$result = true;
* @deprecated since 1.31, its inception
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return bool|Status|string
*/
- public function legacySaveFormData( $formData, PreferencesForm $form ) {
+ public function legacySaveFormData( $formData, HTMLForm $form ) {
return $this->saveFormData( $formData, $form );
}
* Save the form data and reload the page
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return Status
*/
- protected function submitForm( array $formData, PreferencesForm $form ) {
+ protected function submitForm( array $formData, HTMLForm $form ) {
$res = $this->saveFormData( $formData, $form );
if ( $res ) {
* @deprecated since 1.31, its inception
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return Status
*/
- public function legacySubmitForm( array $formData, PreferencesForm $form ) {
+ public function legacySubmitForm( array $formData, HTMLForm $form ) {
return $this->submitForm( $formData, $form );
}
/**
* Check if OOUI mode is enabled, by config or query string
+ *
+ * @since 1.32
* @param IContextSource $context The context.
* @return bool
*/
+++ /dev/null
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * Temporarily define PreferencesForm as an interface, so PreferencesFormOOUI
- * and PreferencesFormLegacy can implement it.
- *
- * When PreferencesFormLegacy we can merge PreferencesFormOOUI with PreferencesForm.
- */
-interface PreferencesForm {
-}
/**
* Form to edit user preferences.
+ *
+ * @since 1.32
*/
-class PreferencesFormLegacy extends HTMLForm implements PreferencesForm {
+class PreferencesFormLegacy extends HTMLForm {
// Override default value from HTMLForm
protected $mSubSectionBeforeFields = false;
return array_keys( array_filter( $this->mFieldTree, 'is_array' ) );
}
}
+
+// Retain the old class name for backwards compatibility.
+// In the future, this alias will be changed to point to PreferencesFormOOUI.
+class PreferencesForm extends PreferencesFormLegacy {
+}
+// Phan doesn't understand class_alias()?
+// class_alias( PreferencesFormLegacy::class, 'PreferencesForm' );
/**
* Form to edit user preferences.
+ *
+ * @since 1.32
*/
-class PreferencesFormOOUI extends OOUIHTMLForm implements PreferencesForm {
+class PreferencesFormOOUI extends OOUIHTMLForm {
// Override default value from HTMLForm
protected $mSubSectionBeforeFields = false;
}
/* preference page with js-genrated toc */
-/* TODO: Delete #preftoc when Special:Preference's non-OOUI mode is disabled */
+/* TODO: Delete #preftoc when Special:Preferences's non-OOUI mode is disabled */
#preftoc {
float: left;
margin: 1em 1em 1em 1em;