rdbms: Drop unused constructor property and default method arg
[lhc/web/wiklou.git] / includes / EditPage.php
index 4599564..23cdc3b 100644 (file)
@@ -1667,11 +1667,10 @@ class EditPage {
                        case self::AS_SUCCESS_NEW_ARTICLE:
                                $query = $resultDetails['redirect'] ? 'redirect=no' : '';
                                if ( $extraQueryRedirect ) {
-                                       if ( $query === '' ) {
-                                               $query = $extraQueryRedirect;
-                                       } else {
-                                               $query = $query . '&' . $extraQueryRedirect;
+                                       if ( $query !== '' ) {
+                                               $query .= '&';
                                        }
+                                       $query .= $extraQueryRedirect;
                                }
                                $anchor = $resultDetails['sectionanchor'] ?? '';
                                $out->redirect( $this->mTitle->getFullURL( $query ) . $anchor );
@@ -1688,18 +1687,16 @@ class EditPage {
                                );
 
                                if ( $resultDetails['redirect'] ) {
-                                       if ( $extraQuery == '' ) {
-                                               $extraQuery = 'redirect=no';
-                                       } else {
-                                               $extraQuery = 'redirect=no&' . $extraQuery;
+                                       if ( $extraQuery !== '' ) {
+                                               $extraQuery = '&' . $extraQuery;
                                        }
+                                       $extraQuery = 'redirect=no' . $extraQuery;
                                }
                                if ( $extraQueryRedirect ) {
-                                       if ( $extraQuery === '' ) {
-                                               $extraQuery = $extraQueryRedirect;
-                                       } else {
-                                               $extraQuery = $extraQuery . '&' . $extraQueryRedirect;
+                                       if ( $extraQuery !== '' ) {
+                                               $extraQuery .= '&';
                                        }
+                                       $extraQuery .= $extraQueryRedirect;
                                }
 
                                $out->redirect( $this->mTitle->getFullURL( $extraQuery ) . $sectionanchor );
@@ -3250,15 +3247,13 @@ ERROR;
         * @return array
         */
        private function getSummaryInputAttributes( array $inputAttrs = null ) {
-               $conf = $this->context->getConfig();
-               $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
                // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
                // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
-               // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+               // Unicode codepoints.
                return ( is_array( $inputAttrs ) ? $inputAttrs : [] ) + [
                        'id' => 'wpSummary',
                        'name' => 'wpSummary',
-                       'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT,
+                       'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT,
                        'tabindex' => 1,
                        'size' => 60,
                        'spellcheck' => 'true',
@@ -4562,7 +4557,10 @@ ERROR;
                        return $wgParser->guessLegacySectionNameFromWikiText( $text );
                }
                // Meanwhile, real browsers get real anchors
-               return $wgParser->guessSectionNameFromWikiText( $text );
+               $name = $wgParser->guessSectionNameFromWikiText( $text );
+               // With one little caveat: per T216029, fragments in HTTP redirects need to be urlencoded,
+               // otherwise Chrome double-escapes the rest of the URL.
+               return '#' . urlencode( mb_substr( $name, 1 ) );
        }
 
        /**