Merge "hooks: Drop Special{Watchlist|RecentChanges}Filters, deprecated in 1.23"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 13 Sep 2018 00:56:17 +0000 (00:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 13 Sep 2018 00:56:17 +0000 (00:56 +0000)
includes/htmlform/fields/HTMLTextField.php
maintenance/populateChangeTagDef.php
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.ItemMenuOptionWidget.js

index d988c29..60c63d6 100644 (file)
@@ -85,18 +85,19 @@ class HTMLTextField extends HTMLFormField {
                        'type',
                        'min',
                        'max',
-                       'pattern',
-                       'title',
                        'step',
-                       'list',
+                       'title',
                        'maxlength',
                        'tabindex',
                        'disabled',
                        'required',
                        'autofocus',
-                       'multiple',
                        'readonly',
                        'autocomplete',
+                       // Only used in HTML mode:
+                       'pattern',
+                       'list',
+                       'multiple',
                ];
 
                $attribs += $this->getAttributes( $allowedParams );
@@ -153,17 +154,22 @@ class HTMLTextField extends HTMLFormField {
                # @todo Enforce pattern, step, required, readonly on the server side as
                # well
                $allowedParams = [
+                       'type',
+                       'min',
+                       'max',
+                       'step',
+                       'title',
+                       'maxlength',
+                       'tabindex',
+                       'disabled',
+                       'required',
                        'autofocus',
+                       'readonly',
+                       'autocomplete',
+                       // Only used in OOUI mode:
                        'autosize',
-                       'disabled',
                        'flags',
                        'indicator',
-                       'maxlength',
-                       'readonly',
-                       'required',
-                       'tabindex',
-                       'type',
-                       'autocomplete',
                ];
 
                $attribs += OOUI\Element::configFromHtmlAttributes(
index b11b95f..7bec25a 100644 (file)
@@ -39,6 +39,7 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance {
                        true
                );
                $this->addOption( 'populate-only', 'Do not update change_tag_def table' );
+               $this->addOption( 'set-user-tags-only', 'Only update ctd_user_defined from valid_tag table' );
        }
 
        public function execute() {
@@ -61,10 +62,15 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance {
                                __METHOD__
                        )
                ) {
+                       if ( $this->hasOption( 'set-user-tags-only' ) ) {
+                               $this->setUserDefinedTags();
+                               return true;
+                       }
                        if ( !$this->hasOption( 'populate-only' ) ) {
                                $this->updateCountTag();
                        }
                        $this->backpopulateChangeTagId();
+                       $this->setUserDefinedTags();
                } else {
                        $this->updateCountTagId();
                }
@@ -75,6 +81,40 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance {
                return true;
        }
 
+       private function setUserDefinedTags() {
+               $dbr = $this->lbFactory->getMainLB()->getConnection( DB_REPLICA );
+
+               $userTags = $dbr->selectFieldValues(
+                       'valid_tag',
+                       'vt_tag',
+                       [],
+                       __METHOD__
+               );
+
+               if ( empty( $userTags ) ) {
+                       $this->output( "No user defined tags to set, moving on...\n" );
+                       return;
+               }
+
+               if ( $this->hasOption( 'dry-run' ) ) {
+                       $this->output(
+                               'These tags will have ctd_user_defined=1 : ' . implode( ', ', $userTags ) . "\n"
+                       );
+                       return;
+               }
+
+               $dbw = $this->lbFactory->getMainLB()->getConnection( DB_MASTER );
+
+               $dbw->update(
+                       'change_tag_def',
+                       [ 'ctd_user_defined' => 1 ],
+                       [ 'ctd_name' => $userTags ],
+                       __METHOD__
+               );
+               $this->lbFactory->waitForReplication();
+               $this->output( "Finished setting user defined tags in change_tag_def table\n" );
+       }
+
        private function updateCountTagId() {
                $dbr = $this->lbFactory->getMainLB()->getConnection( DB_REPLICA );
 
index 83d510b..1660fb2 100644 (file)
                                classes.push( 'mw-rcfilters-ui-itemMenuOptionWidget-identifier-' + ident );
                        } );
 
-                       this.$element.addClass( classes.join( ' ' ) );
+                       this.$element.addClass( classes );
                }
 
                this.updateUiBasedOnState();