Fixed some @params documentation (includes/[specialpage|specials])
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 4c3f17b..fc39ef5 100644 (file)
@@ -28,9 +28,6 @@
  * @ingroup SpecialPage
  */
 class SpecialWatchlist extends ChangesListSpecialPage {
-       /**
-        * Constructor
-        */
        public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
                parent::__construct( $page, $restriction );
        }
@@ -58,6 +55,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        }
 
                        $output->redirect( $title->getLocalURL() );
+
                        return;
                }
 
@@ -66,11 +64,13 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $user = $this->getUser();
                $opts = $this->getOptions();
 
-               if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
-                       $request->wasPosted() )
-               {
+               if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker )
+                       && $request->getVal( 'reset' )
+                       && $request->wasPosted()
+               ) {
                        $user->clearAllNotifications();
                        $output->redirect( $this->getPageTitle()->getFullURL( $opts->getChangedValues() ) );
+
                        return;
                }
 
@@ -107,8 +107,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         */
        protected function getCustomFilters() {
                if ( $this->customFilters === null ) {
-                       $this->customFilters = array();
-                       wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
+                       $this->customFilters = parent::getCustomFilters();
+                       wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ), '1.23' );
                }
 
                return $this->customFilters;
@@ -120,7 +120,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         * Maps old pre-1.23 request parameters Watchlist used to use (different from Recentchanges' ones)
         * to the current ones.
         *
-        * @param FormOptions $parameters
+        * @param FormOptions $opts
         * @return FormOptions
         */
        protected function fetchOptionsFromRequest( $opts ) {
@@ -145,6 +145,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                // methods defined on WebRequest and removing this dependency would cause some code duplication.
                $request = new DerivativeRequest( $this->getRequest(), $params );
                $opts->fetchValuesFromRequest( $request );
+
                return $opts;
        }
 
@@ -160,7 +161,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                // Calculate cutoff
                if ( $opts['days'] > 0 ) {
-                       $conds[] = 'rc_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
+                       $conds[] = 'rc_timestamp > ' .
+                               $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
                }
 
                return $conds;
@@ -256,7 +258,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                );
 
                wfRunHooks( 'SpecialWatchlistQuery',
-                       array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
+                       array( &$conds, &$tables, &$join_conds, &$fields, $opts ),
+                       '1.23' );
 
                return $dbr->select(
                        $tables,
@@ -316,6 +319,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                $list = ChangesList::newFromContext( $this->getContext() );
                $list->setWatchlistDivs();
+               $list->initChangesListRows( $rows );
+               $dbr->dataSeek( $rows, 0 );
 
                $s = $list->beginRecentChangesList();
                $counter = 1;
@@ -379,7 +384,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                if ( $opts['days'] > 0 ) {
                        $timestamp = wfTimestampNow();
                        $wlInfo = $this->msg( 'wlnote2' )->numParams( round( $opts['days'] * 24 ) )->params(
-                               $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
+                               $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
+                       )->parse() . "<br />\n";
                }
 
                $nondefaults = $opts->getChangedValues();
@@ -513,7 +519,9 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $label = $this->msg( $value ? 'show' : 'hide' )->escaped();
                $options[$name] = 1 - (int)$value;
 
-               return $this->msg( $message )->rawParams( Linker::linkKnown( $this->getPageTitle(), $label, array(), $options ) )->escaped();
+               return $this->msg( $message )
+                       ->rawParams( Linker::linkKnown( $this->getPageTitle(), $label, array(), $options ) )
+                       ->escaped();
        }
 
        protected function hoursLink( $h, $options = array() ) {
@@ -529,7 +537,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
        protected function daysLink( $d, $options = array() ) {
                $options['days'] = $d;
-               $message = ( $d ? $this->getLanguage()->formatNum( $d ) : $this->msg( 'watchlistall2' )->escaped() );
+               $message = $d ? $this->getLanguage()->formatNum( $d )
+                       : $this->msg( 'watchlistall2' )->escaped();
 
                return Linker::linkKnown(
                        $this->getPageTitle(),
@@ -557,6 +566,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                foreach ( $days as $d ) {
                        $days[$i++] = $this->daysLink( $d, $options );
                }
+
                return $this->msg( 'wlshowlast' )->rawParams(
                        $this->getLanguage()->pipeList( $hours ),
                        $this->getLanguage()->pipeList( $days ),
@@ -567,7 +577,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         * Count the number of items on a user's watchlist
         *
         * @param DatabaseBase $dbr A database connection
-        * @return Integer
+        * @return int
         */
        protected function countItems( $dbr ) {
                # Fetch the raw count