Merge "Several tweaks to the install.php script"
[lhc/web/wiklou.git] / includes / specials / SpecialNewpages.php
index 43d4855..505a1ec 100644 (file)
  * @ingroup SpecialPage
  */
 class SpecialNewpages extends IncludableSpecialPage {
-       // Stored objects
-
        /**
         * @var FormOptions
         */
        protected $opts;
        protected $customFilters;
 
-       // Some internal settings
        protected $showNavigation = false;
 
        public function __construct() {
@@ -124,8 +121,8 @@ class SpecialNewpages extends IncludableSpecialPage {
        /**
         * Show a form for filtering namespace and username
         *
-        * @param $par String
-        * @return String
+        * @param string $par
+        * @return string
         */
        public function execute( $par ) {
                $out = $this->getOutput();
@@ -194,7 +191,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $changed = $this->opts->getChangedValues();
                unset( $changed['offset'] ); // Reset offset if query type changes
 
-               $self = $this->getTitle();
+               $self = $this->getPageTitle();
                foreach ( $filters as $key => $msg ) {
                        $onoff = 1 - $this->opts->getValue( $key );
                        $link = Linker::link( $self, $showhide[$onoff], array(),
@@ -233,7 +230,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                }
 
                $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) .
-                       Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
+                       Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
                        Xml::fieldset( $this->msg( 'newpages' )->text() ) .
                        Xml::openElement( 'table', array( 'id' => 'mw-newpages-table' ) ) .
                        '<tr>
@@ -301,7 +298,7 @@ class SpecialNewpages extends IncludableSpecialPage {
         * size, user links, and a comment
         *
         * @param object $result Result row
-        * @return String
+        * @return string
         */
        public function formatRow( $result ) {
                $title = Title::newFromRow( $result );
@@ -394,14 +391,15 @@ class SpecialNewpages extends IncludableSpecialPage {
                        $oldTitleText = $this->msg( 'rc-old-title' )->params( $oldTitleText )->escaped();
                }
 
-               return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
+               return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} "
+                       . "{$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
        }
 
        /**
         * Should a specific result row provide "patrollable" links?
         *
         * @param object $result Result row
-        * @return Boolean
+        * @return bool
         */
        protected function patrollable( $result ) {
                return ( $this->getUser()->useNPPatrol() && !$result->rc_patrolled );
@@ -410,7 +408,7 @@ class SpecialNewpages extends IncludableSpecialPage {
        /**
         * Output a subscription feed listing recent edits to this page.
         *
-        * @param $type String
+        * @param string $type
         */
        protected function feed( $type ) {
                global $wgFeed, $wgFeedClasses, $wgFeedLimit;
@@ -430,7 +428,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $feed = new $wgFeedClasses[$type](
                        $this->feedTitle(),
                        $this->msg( 'tagline' )->text(),
-                       $this->getTitle()->getFullURL()
+                       $this->getPageTitle()->getFullURL()
                );
 
                $pager = new NewPagesPager( $this, $this->opts );
@@ -524,15 +522,14 @@ class NewPagesPager extends ReverseChronologicalPager {
                $username = $this->opts->getValue( 'username' );
                $user = Title::makeTitleSafe( NS_USER, $username );
 
+               $rcIndexes = array();
+
                if ( $namespace !== false ) {
                        if ( $this->opts->getValue( 'invert' ) ) {
                                $conds[] = 'rc_namespace != ' . $this->mDb->addQuotes( $namespace );
                        } else {
                                $conds['rc_namespace'] = $namespace;
                        }
-                       $rcIndexes = array( 'new_name_timestamp' );
-               } else {
-                       $rcIndexes = array( 'rc_timestamp' );
                }
 
                # $wgEnableNewpagesUserFilter - temp WMF hack
@@ -572,11 +569,17 @@ class NewPagesPager extends ReverseChronologicalPager {
                wfRunHooks( 'SpecialNewpagesConditions',
                        array( &$this, $this->opts, &$conds, &$tables, &$fields, &$join_conds ) );
 
+               $options = array();
+
+               if ( $rcIndexes ) {
+                       $options = array( 'USE INDEX' => array( 'recentchanges' => $rcIndexes ) );
+               }
+
                $info = array(
                        'tables' => $tables,
                        'fields' => $fields,
                        'conds' => $conds,
-                       'options' => array( 'USE INDEX' => array( 'recentchanges' => $rcIndexes ) ),
+                       'options' => $options,
                        'join_conds' => $join_conds
                );