Merge "Fix "UTPage" creation in tests"
[lhc/web/wiklou.git] / includes / specials / SpecialWatchlist.php
index 68a514c..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 );
        }
@@ -110,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;
@@ -123,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 ) {
@@ -164,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;
@@ -260,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,
@@ -320,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;
@@ -518,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() ) {
@@ -534,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(),
@@ -573,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