Merge "EditPage: Remove separator between cancel and help"
[lhc/web/wiklou.git] / includes / api / ApiOptions.php
index 466d186..bb5a261 100644 (file)
@@ -24,6 +24,8 @@
  * @file
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * API module that facilitates the changing of user's preferences.
  * Requires API write mode to be enabled.
@@ -64,7 +66,7 @@ class ApiOptions extends ApiBase {
                }
 
                $changes = [];
-               if ( count( $params['change'] ) ) {
+               if ( $params['change'] ) {
                        foreach ( $params['change'] as $entry ) {
                                $array = explode( '=', $entry, 2 );
                                $changes[$array[0]] = isset( $array[1] ) ? $array[1] : null;
@@ -78,7 +80,8 @@ class ApiOptions extends ApiBase {
                        $this->dieWithError( 'apierror-nochanges' );
                }
 
-               $prefs = Preferences::getPreferences( $user, $this->getContext() );
+               $preferencesFactory = MediaWikiServices::getInstance()->getPreferencesFactory();
+               $prefs = $preferencesFactory->getFormDescriptor( $user, $this->getContext() );
                $prefsKinds = $user->getOptionKinds( $this->getContext(), $changes );
 
                $htmlForm = null;
@@ -169,7 +172,7 @@ class ApiOptions extends ApiBase {
        }
 
        public function getHelpUrls() {
-               return 'https://www.mediawiki.org/wiki/API:Options';
+               return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Options';
        }
 
        protected function getExamplesMessages() {