Enable users to watch category membership changes
[lhc/web/wiklou.git] / includes / specialpage / ChangesListSpecialPage.php
index 3476c26..0938316 100644 (file)
@@ -65,6 +65,12 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        $batch->add( NS_USER, $row->rc_user_text );
                        $batch->add( NS_USER_TALK, $row->rc_user_text );
                        $batch->add( $row->rc_namespace, $row->rc_title );
+                       if ( $row->rc_source === RecentChange::SRC_LOG ) {
+                               $formatter = LogFormatter::newFromRow( $row );
+                               foreach ( $formatter->getPreloadTitles() as $title ) {
+                                       $batch->addObj( $title );
+                               }
+                       }
                }
                $batch->execute();
 
@@ -138,6 +144,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                $opts->add( 'hideliu', false );
                $opts->add( 'hidepatrolled', false );
                $opts->add( 'hidemyself', false );
+               $opts->add( 'hidecategorization', false );
 
                $opts->add( 'namespace', '', FormOptions::INTNULL );
                $opts->add( 'invert', false );
@@ -243,6 +250,9 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                                $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $user->getName() );
                        }
                }
+               if ( $opts['hidecategorization'] === true ) {
+                       $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE );
+               }
 
                // Namespace filtering
                if ( $opts['namespace'] !== '' ) {
@@ -309,7 +319,9 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                );
        }
 
-       protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) {
+       protected function runMainQueryHook( &$tables, &$fields, &$conds,
+               &$query_options, &$join_conds, $opts
+       ) {
                return Hooks::run(
                        'ChangesListSpecialPageQuery',
                        array( $this->getName(), &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts )
@@ -426,7 +438,8 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        $legend .= Html::element( 'dt',
                                array( 'class' => $cssClass ), $context->msg( $letter )->text()
                        ) . "\n" .
-                       Html::rawElement( 'dd', array(),
+                       Html::rawElement( 'dd',
+                               array( 'class' => Sanitizer::escapeClass( 'mw-changeslist-legend-' . $key ) ),
                                $context->msg( $label )->parse()
                        ) . "\n";
                }