Merge "Remove unused variables from closures"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 19 Sep 2017 17:27:52 +0000 (17:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 19 Sep 2017 17:27:52 +0000 (17:27 +0000)
includes/installer/MysqlUpdater.php
includes/page/WikiPage.php
includes/parser/Parser.php
resources/src/mediawiki.skinning/interface.css
tests/parser/parserTests.txt

index e2ff960..556d0d5 100644 (file)
@@ -390,7 +390,7 @@ class MysqlUpdater extends DatabaseUpdater {
                global $IP;
 
                if ( !$this->doTable( 'interwiki' ) ) {
-                       return true;
+                       return;
                }
 
                if ( $this->db->tableExists( "interwiki", __METHOD__ ) ) {
index bbf22ba..c04eb0a 100644 (file)
@@ -983,18 +983,12 @@ class WikiPage implements Page, IDBAccessObject {
 
                $dbr = wfGetDB( DB_REPLICA );
 
-               if ( $dbr->implicitGroupby() ) {
-                       $realNameField = 'user_real_name';
-               } else {
-                       $realNameField = 'MIN(user_real_name) AS user_real_name';
-               }
-
                $tables = [ 'revision', 'user' ];
 
                $fields = [
                        'user_id' => 'rev_user',
                        'user_name' => 'rev_user_text',
-                       $realNameField,
+                       'user_real_name' => 'MIN(user_real_name)',
                        'timestamp' => 'MAX(rev_timestamp)',
                ];
 
index e901f6f..d00b333 100644 (file)
@@ -2296,8 +2296,13 @@ class Parser {
                                                $this->mOutput->addLanguageLink( $nt->getFullText() );
                                        }
 
+                                       /**
+                                        * Strip the whitespace interwiki links produce, see T10897
+                                        */
                                        $s = rtrim( $s . $prefix );
-                                       $s .= trim( $trail, "\n" ) == '' ? '' : $prefix . $trail;
+                                       // Special case: strip newlines when only thing between
+                                       // this link and next are newlines
+                                       $s .= trim( $trail, "\n" ) === '' ? '' : $trail;
                                        continue;
                                }
 
@@ -2322,7 +2327,13 @@ class Parser {
                                                continue;
                                        }
                                } elseif ( $ns == NS_CATEGORY ) {
-                                       $s = rtrim( $s . "\n" ); # T2087
+                                       /**
+                                        * Strip the whitespace Category links produce, see T2087
+                                        */
+                                       $s = rtrim( $s . $prefix ); # T2087, T87753
+                                       // Special case: strip newlines when only thing between
+                                       // this link and next are newlines
+                                       $s .= trim( $trail, "\n" ) === '' ? '' : $trail;
 
                                        if ( $wasblank ) {
                                                $sortkey = $this->getDefaultSort();
@@ -2334,11 +2345,6 @@ class Parser {
                                        $sortkey = $this->getConverterLanguage()->convertCategoryKey( $sortkey );
                                        $this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
 
-                                       /**
-                                        * Strip the whitespace Category links produce, see T2087
-                                        */
-                                       $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail;
-
                                        continue;
                                }
                        }
index 3e0d2b9..916c463 100644 (file)
@@ -76,6 +76,16 @@ textarea {
        width: auto;
 }
 
+#contentSub:empty,
+#contentSub2:empty {
+       display: none;
+}
+
+#contentSub:empty ~ #jump-to-nav,
+#contentSub2:empty ~ #jump-to-nav {
+       margin-top: 0;
+}
+
 span.subpages {
        display: block;
 }
index 2064e03..0aa0e03 100644 (file)
@@ -16142,6 +16142,68 @@ parsoid=wt2html
 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
 !! end
 
+!! test
+9. Categories and newlines: should behave properly with linkprefix (T87753)
+!! options
+language=ar
+!! wikitext
+foo bar
+foo bar
+[[تصنيف:Foo]]
+[[تصنيف:Bar]]
+!! html/php
+<p>foo bar
+foo bar
+</p>
+!! html/parsoid
+<p>foo bar
+foo bar</p>
+<link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
+<link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
+!! end
+
+!! test
+10. No regressions on internal links following category (T174639)
+!! options
+parsoid=wt2html,html2html
+!! wikitext
+[[Category:Foo]]<div>a
+
+[[Foo]]</div>
+!! html/php
+<div>a
+<a href="/wiki/Foo" title="Foo">Foo</a></div>
+
+!! html/parsoid
+<link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
+
+<a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
+!! end
+
+# NOTE that Parsoid does not currently implement this special case
+# (T175416).  The plan is to remove this weird special-case in the PHP
+# parser to make it match the Parsoid output.
+!! test
+11. Special case where only newlines separate links
+!! options
+parsoid=wt2html,html2html
+!! wikitext
+[[Category:Foo]]
+
+[[Foo]][[es:Alimento]]
+
+[[Foo]]
+!! html/php
+<p><a href="/wiki/Foo" title="Foo">Foo</a><a href="/wiki/Foo" title="Foo">Foo</a>
+</p>
+!! html/parsoid
+<link rel="mw:PageProp/Category" href="./Category:Foo"/>
+
+<p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
+
+<p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
+!! end
+
 !! test
 Category links with multiple namespaces
 !! wikitext
@@ -16189,6 +16251,20 @@ x[[Category:Foo]]y
 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
 !! end
 
+!! test
+Link prefix/suffixes aren't applied to language links
+!! options
+parsoid=wt2html
+language=is
+!! wikitext
+x[[es:Foo]]y
+!! html/php
+<p>xy
+</p>
+!! html/parsoid
+<p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
+!! end
+
 !! test
 Parsoid: Serialize link to file page with colon escape
 !! options