Fix total breakage of SQLite web upgrade
[lhc/web/wiklou.git] / includes / specials / SpecialPreferences.php
index eee5b64..a5c24e7 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * A special page that allows users to change their preferences
  *
@@ -81,8 +83,7 @@ class SpecialPreferences extends SpecialPage {
                        $user = $this->getUser();
                }
 
-               $htmlForm = Preferences::getFormObject( $user, $this->getContext() );
-               $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] );
+               $htmlForm = $this->getFormObject( $user, $this->getContext() );
                $sectionTitles = $htmlForm->getPreferenceSections();
 
                $prefTabs = '';
@@ -117,7 +118,19 @@ class SpecialPreferences extends SpecialPage {
                $htmlForm->show();
        }
 
-       private function showResetForm() {
+       /**
+        * Get the preferences form to use.
+        * @param User $user The user.
+        * @param IContextSource $context The context.
+        * @return PreferencesForm|HTMLForm
+        */
+       protected function getFormObject( $user, IContextSource $context ) {
+               $preferencesFactory = MediaWikiServices::getInstance()->getPreferencesFactory();
+               $form = $preferencesFactory->getForm( $user, $context );
+               return $form;
+       }
+
+       protected function showResetForm() {
                if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
                        throw new PermissionsError( 'editmyoptions' );
                }
@@ -148,7 +161,7 @@ class SpecialPreferences extends SpecialPage {
                // Set session data for the success message
                $this->getRequest()->getSession()->set( 'specialPreferencesSaveSuccess', 1 );
 
-               $url = $this->getPageTitle()->getFullURL();
+               $url = $this->getPageTitle()->getFullUrlForRedirect();
                $this->getOutput()->redirect( $url );
 
                return true;