Special:Watchlist: Add user preference to "Show last" options, fix float comparison
[lhc/web/wiklou.git] / includes / specials / SpecialUnwatchedpages.php
index 954e3ff..4ad6ac0 100644 (file)
@@ -35,7 +35,7 @@ class UnwatchedpagesPage extends QueryPage {
                parent::__construct( $name, 'unwatchedpages' );
        }
 
-       function isExpensive() {
+       public function isExpensive() {
                return true;
        }
 
@@ -43,16 +43,19 @@ class UnwatchedpagesPage extends QueryPage {
                return false;
        }
 
-       function getQueryInfo() {
+       public function getQueryInfo() {
                return array(
                        'tables' => array( 'page', 'watchlist' ),
-                       'fields' => array( 'namespace' => 'page_namespace',
-                                       'title' => 'page_title',
-                                       'value' => 'page_namespace' ),
-                       'conds' => array( 'wl_title IS NULL',
-                                       'page_is_redirect' => 0,
-                                       "page_namespace != '" . NS_MEDIAWIKI .
-                                       "'" ),
+                       'fields' => array(
+                               'namespace' => 'page_namespace',
+                               'title' => 'page_title',
+                               'value' => 'page_namespace'
+                       ),
+                       'conds' => array(
+                               'wl_title IS NULL',
+                               'page_is_redirect' => 0,
+                               "page_namespace != '" . NS_MEDIAWIKI . "'"
+                       ),
                        'join_conds' => array( 'watchlist' => array(
                                'LEFT JOIN', array( 'wl_title = page_title',
                                        'wl_namespace = page_namespace' ) ) )
@@ -67,6 +70,15 @@ class UnwatchedpagesPage extends QueryPage {
                return array( 'page_namespace', 'page_title' );
        }
 
+       /**
+        * Add the JS
+        * @param string|null $par
+        */
+       public function execute( $par ) {
+               parent::execute( $par );
+               $this->getOutput()->addModules( 'mediawiki.special.unwatchedPages' );
+       }
+
        /**
         * @param Skin $skin
         * @param object $result Result row
@@ -84,12 +96,11 @@ class UnwatchedpagesPage extends QueryPage {
                $text = $wgContLang->convert( $nt->getPrefixedText() );
 
                $plink = Linker::linkKnown( $nt, htmlspecialchars( $text ) );
-               $token = WatchAction::getWatchToken( $nt, $this->getUser() );
                $wlink = Linker::linkKnown(
                        $nt,
                        $this->msg( 'watch' )->escaped(),
-                       array(),
-                       array( 'action' => 'watch', 'token' => $token )
+                       array( 'class' => 'mw-watch-link' ),
+                       array( 'action' => 'watch' )
                );
 
                return $this->getLanguage()->specialList( $plink, $wlink );