* (bug 33967) "Previous revision" and "Newer revision" links now display the correct...
[lhc/web/wiklou.git] / includes / Preferences.php
index 323ef68..3fe6a8c 100644 (file)
@@ -849,15 +849,18 @@ class Preferences {
         * @param $defaultPreferences
         */
        static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgUseRCPatrol, $wgEnableAPI;
+               global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
 
+               $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) );
+               
                ## Watchlist #####################################
                $defaultPreferences['watchlistdays'] = array(
                        'type' => 'float',
                        'min' => 0,
-                       'max' => 7,
+                       'max' => $watchlistdaysMax,
                        'section' => 'watchlist/displaywatchlist',
-                       'help' => $context->msg( 'prefs-watchlist-days-max' )->escaped(),
+                       'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams(
+                                                $watchlistdaysMax )->text(),
                        'label-message' => 'prefs-watchlist-days',
                );
                $defaultPreferences['wllimit'] = array(
@@ -1215,6 +1218,10 @@ class Preferences {
                        $removeKeys = array_flip( $remove );
                        $formDescriptor = array_diff_key( $formDescriptor, $removeKeys );
                }
+
+               /**
+                * @var $htmlForm PreferencesForm
+                */
                $htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
 
                $htmlForm->setModifiedUser( $user );
@@ -1334,7 +1341,7 @@ class Preferences {
 
        /**
         * @param $formData
-        * @param $form HTMLForm
+        * @param $form PreferencesForm
         * @param $entryPoint string
         * @return bool|Status|string
         */
@@ -1393,6 +1400,7 @@ class Preferences {
 
        /**
         * @param $formData
+        * @param $form PreferencesForm
         * @return Status
         */
        public static function tryUISubmit( $formData, $form ) {
@@ -1455,10 +1463,13 @@ class Preferences {
        }
 
        /**
+        * @deprecated in 1.19; will be removed in 1.20.
         * @param $user User
         * @return array
         */
        public static function loadOldSearchNs( $user ) {
+               wfDeprecated( __METHOD__, '1.19' );
+
                $searchableNamespaces = SearchEngine::searchableNamespaces();
                // Back compat with old format
                $arr = array();
@@ -1480,10 +1491,16 @@ class PreferencesForm extends HTMLForm {
 
        private $modifiedUser;
 
+       /**
+        * @param $user User
+        */
        public function setModifiedUser( $user ) {
                $this->modifiedUser = $user;
        }
 
+       /**
+        * @return User
+        */
        public function getModifiedUser() {
                if ( $this->modifiedUser === null ) {
                        return $this->getUser();
@@ -1550,8 +1567,10 @@ class PreferencesForm extends HTMLForm {
 
                return $data;
        }
+
        /**
         * Get the whole body of the form.
+        * @return string
         */
        function getBody() {
                return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
@@ -1560,6 +1579,8 @@ class PreferencesForm extends HTMLForm {
        /**
         * Get the <legend> for a given section key. Normally this is the
         * prefs-$key message but we'll allow extensions to override it.
+        * @param $key string
+        * @return string
         */
        function getLegend( $key ) {
                $legend = parent::getLegend( $key );