Merge "Show a warning in edit preview when a template loop is detected"
[lhc/web/wiklou.git] / includes / specialpage / ChangesListSpecialPage.php
index 4d27d35..d943d03 100644 (file)
@@ -519,16 +519,25 @@ abstract class ChangesListSpecialPage extends SpecialPage {
        public function execute( $subpage ) {
                $this->rcSubpage = $subpage;
 
-               $this->setHeaders();
-               $this->outputHeader();
-               $this->addModules();
-
                $rows = $this->getRows();
                $opts = $this->getOptions();
                if ( $rows === false ) {
                        $rows = new FakeResultWrapper( [] );
                }
 
+               // Used by Structured UI app to get results without MW chrome
+               if ( $this->getRequest()->getVal( 'action' ) === 'render' ) {
+                       $this->getOutput()->setArticleBodyOnly( true );
+               }
+
+               // Used by "live update" and "view newest" to check
+               // if there's new changes with minimal data transfer
+               if ( $this->getRequest()->getBool( 'peek' ) ) {
+                       $code = $rows->numRows() > 0 ? 200 : 304;
+                       $this->getOutput()->setStatusCode( $code );
+                       return;
+               }
+
                $batch = new LinkBatch;
                foreach ( $rows as $row ) {
                        $batch->add( NS_USER, $row->rc_user_text );
@@ -542,6 +551,10 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        }
                }
                $batch->execute();
+
+               $this->setHeaders();
+               $this->outputHeader();
+               $this->addModules();
                $this->webOutput( $rows, $opts );
 
                $rows->free();
@@ -795,6 +808,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         * ChangesListFilterGroup constructors.
         *
         * There is light processing to simplify core maintenance.
+        * @param array $definition
         */
        protected function registerFiltersFromDefinitions( array $definition ) {
                $autoFillPriority = -1;
@@ -904,6 +918,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                $opts->add( 'invert', false );
                $opts->add( 'associated', false );
                $opts->add( 'urlversion', 1 );
+               $opts->add( 'tagfilter', '' );
 
                return $opts;
        }
@@ -1535,7 +1550,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         *
         * @return bool
         */
-       protected function isStructuredFilterUiEnabled() {
+       public function isStructuredFilterUiEnabled() {
                return $this->getUser()->getOption( 'rcenhancedfilters' );
        }