MediaWiki  REL1_24
SpecialUnwatchedpages.php
Go to the documentation of this file.
00001 <?php
00032 class UnwatchedpagesPage extends QueryPage {
00033 
00034     function __construct( $name = 'Unwatchedpages' ) {
00035         parent::__construct( $name, 'unwatchedpages' );
00036     }
00037 
00038     function isExpensive() {
00039         return true;
00040     }
00041 
00042     function isSyndicated() {
00043         return false;
00044     }
00045 
00046     function getQueryInfo() {
00047         return array(
00048             'tables' => array( 'page', 'watchlist' ),
00049             'fields' => array(
00050                 'namespace' => 'page_namespace',
00051                 'title' => 'page_title',
00052                 'value' => 'page_namespace'
00053             ),
00054             'conds' => array(
00055                 'wl_title IS NULL',
00056                 'page_is_redirect' => 0,
00057                 "page_namespace != '" . NS_MEDIAWIKI . "'"
00058             ),
00059             'join_conds' => array( 'watchlist' => array(
00060                 'LEFT JOIN', array( 'wl_title = page_title',
00061                     'wl_namespace = page_namespace' ) ) )
00062         );
00063     }
00064 
00065     function sortDescending() {
00066         return false;
00067     }
00068 
00069     function getOrderFields() {
00070         return array( 'page_namespace', 'page_title' );
00071     }
00072 
00077     public function execute( $par ) {
00078         parent::execute( $par );
00079         $this->getOutput()->addModules( 'mediawiki.special.unwatchedPages' );
00080     }
00081 
00087     function formatResult( $skin, $result ) {
00088         global $wgContLang;
00089 
00090         $nt = Title::makeTitleSafe( $result->namespace, $result->title );
00091         if ( !$nt ) {
00092             return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
00093                 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
00094         }
00095 
00096         $text = $wgContLang->convert( $nt->getPrefixedText() );
00097 
00098         $plink = Linker::linkKnown( $nt, htmlspecialchars( $text ) );
00099         $token = WatchAction::getWatchToken( $nt, $this->getUser() );
00100         $wlink = Linker::linkKnown(
00101             $nt,
00102             $this->msg( 'watch' )->escaped(),
00103             array( 'class' => 'mw-watch-link' ),
00104             array( 'action' => 'watch', 'token' => $token )
00105         );
00106 
00107         return $this->getLanguage()->specialList( $plink, $wlink );
00108     }
00109 
00110     protected function getGroupName() {
00111         return 'maintenance';
00112     }
00113 }