Merge "importImages.php: Run input file names through UTF8 normalization"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 9 Jan 2016 10:36:18 +0000 (10:36 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 9 Jan 2016 10:36:18 +0000 (10:36 +0000)
21 files changed:
includes/Xml.php
includes/installer/WebInstallerComplete.php
includes/installer/WebInstallerCopying.php
includes/installer/WebInstallerDBConnect.php
includes/installer/WebInstallerDBSettings.php
includes/installer/WebInstallerDocument.php
includes/installer/WebInstallerExistingWiki.php
includes/installer/WebInstallerInstall.php
includes/installer/WebInstallerLanguage.php
includes/installer/WebInstallerName.php
includes/installer/WebInstallerOptions.php
includes/installer/WebInstallerReadme.php
includes/installer/WebInstallerReleaseNotes.php
includes/installer/WebInstallerRestart.php
includes/installer/WebInstallerUpgrade.php
includes/installer/WebInstallerUpgradeDoc.php
includes/installer/WebInstallerWelcome.php
tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/phpunit/data/parser/320x240.ogv [new file with mode: 0644]
tests/phpunit/includes/parser/NewParserTest.php

index 11f14db..63301ac 100644 (file)
@@ -91,7 +91,7 @@ class Xml {
        public static function elementClean( $element, $attribs = array(), $contents = '' ) {
                global $wgContLang;
                if ( $attribs ) {
-                       $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
+                       $attribs = array_map( array( 'UtfNormal\Validator', 'cleanUp' ), $attribs );
                }
                if ( $contents ) {
                        $contents = $wgContLang->normalize( $contents );
index a54264c..f443db4 100644 (file)
@@ -55,5 +55,3 @@ class WebInstallerComplete extends WebInstallerPage {
        }
 
 }
-
-
index c539ed2..36fec86 100644 (file)
@@ -29,4 +29,3 @@ class WebInstallerCopying extends WebInstallerDocument {
        }
 
 }
-
index bf1787f..7a0825e 100644 (file)
@@ -119,5 +119,3 @@ class WebInstallerDBConnect extends WebInstallerPage {
        }
 
 }
-
-
index 9b95c0a..f214663 100644 (file)
@@ -52,5 +52,3 @@ class WebInstallerDBSettings extends WebInstallerPage {
        }
 
 }
-
-
index 2b35bc6..fc1c33f 100644 (file)
@@ -47,4 +47,3 @@ abstract class WebInstallerDocument extends WebInstallerPage {
        }
 
 }
-
index ebe0ead..2c08c9c 100644 (file)
@@ -182,5 +182,3 @@ class WebInstallerExistingWiki extends WebInstallerPage {
        }
 
 }
-
-
index 261a661..51a58ae 100644 (file)
@@ -93,4 +93,3 @@ class WebInstallerInstall extends WebInstallerPage {
        }
 
 }
-
index ba2745c..cfd4a86 100644 (file)
@@ -119,4 +119,3 @@ class WebInstallerLanguage extends WebInstallerPage {
        }
 
 }
-
index 7d0073c..717d67b 100644 (file)
@@ -247,5 +247,3 @@ class WebInstallerName extends WebInstallerPage {
        }
 
 }
-
-
index 30ea10e..fb8e35b 100644 (file)
@@ -458,4 +458,3 @@ class WebInstallerOptions extends WebInstallerPage {
        }
 
 }
-
index 36bc306..97c9f83 100644 (file)
@@ -29,4 +29,3 @@ class WebInstallerReadme extends WebInstallerDocument {
        }
 
 }
-
index e185876..c0a8d71 100644 (file)
@@ -36,4 +36,3 @@ class WebInstallerReleaseNotes extends WebInstallerDocument {
        }
 
 }
-
index 8717cb8..be55c32 100644 (file)
@@ -44,4 +44,3 @@ class WebInstallerRestart extends WebInstallerPage {
        }
 
 }
-
index 7136120..72973e7 100644 (file)
@@ -108,4 +108,3 @@ class WebInstallerUpgrade extends WebInstallerPage {
        }
 
 }
-
index 627ce65..f8fa736 100644 (file)
@@ -29,4 +29,3 @@ class WebInstallerUpgradeDoc extends WebInstallerDocument {
        }
 
 }
-
index e011770..44ff0bb 100644 (file)
@@ -47,5 +47,3 @@ class WebInstallerWelcome extends WebInstallerPage {
        }
 
 }
-
-
index 6a6d447..6a95205 100644 (file)
@@ -512,6 +512,7 @@ class ParserTest {
                        $ok = true;
 
                        foreach ( $filenames as $filename ) {
+                               echo "Running parser tests from: $filename\n";
                                $tests = new TestFileIterator( $filename, $this );
                                $ok = $this->runTests( $tests ) && $ok;
                        }
@@ -1099,6 +1100,19 @@ class ParserTest {
                        'fileExists' => true
                ), $this->db->timestamp( '20010115123500' ), $user );
 
+               $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Video.ogv' ) );
+               $image->recordUpload2( '', 'A pretty movie', 'Will it play', array(
+                       'size' => 12345,
+                       'width' => 320,
+                       'height' => 240,
+                       'bits' => 0,
+                       'media_type' => MEDIATYPE_VIDEO,
+                       'mime' => 'application/ogg',
+                       'metadata' => serialize( array() ),
+                       'sha1' => Wikimedia\base_convert( '', 16, 36, 31 ),
+                       'fileExists' => true
+               ), $this->db->timestamp( '20010115123500' ), $user );
+
                # A DjVu file
                $image = wfLocalFile( Title::makeTitle( NS_FILE, 'LoremIpsum.djvu' ) );
                $image->recordUpload2( '', 'Upload a DjVu', 'A DjVu', array(
@@ -1212,6 +1226,8 @@ class ParserTest {
                        ' version="1.1" width="240" height="180"/>' );
                wfMkdirParents( $dir . '/5/5f', null, __METHOD__ );
                copy( "$IP/tests/phpunit/data/parser/LoremIpsum.djvu", "$dir/5/5f/LoremIpsum.djvu" );
+               wfMkdirParents( $dir . '/0/00', null, __METHOD__ );
+               copy( "$IP/tests/phpunit/data/parser/320x240.ogv", "$dir/0/00/Video.ogv" );
 
                return;
        }
@@ -1253,6 +1269,14 @@ class ParserTest {
                                "$dir/f/ff/Foobar.svg",
                                "$dir/thumb/f/ff/Foobar.svg/*-Foobar.svg.png",
                                "$dir/math/f/a/5/fa50b8b616463173474302ca3e63586b.png",
+                               "$dir/0/00/Video.ogv",
+                               "$dir/thumb/0/00/Video.ogv/120px--Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/180px--Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/240px--Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/320px--Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/270px--Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/320px-seek=2-Video.ogv.jpg",
+                               "$dir/thumb/0/00/Video.ogv/320px-seek=3.3666666666667-Video.ogv.jpg",
                        )
                );
 
@@ -1270,10 +1294,14 @@ class ParserTest {
                                "$dir/thumb/f/ff/Foobar.svg",
                                "$dir/thumb/f/ff/",
                                "$dir/thumb/f/",
+                               "$dir/0/00/",
                                "$dir/0/09/",
                                "$dir/0/",
                                "$dir/5/5f",
                                "$dir/5",
+                               "$dir/thumb/0/00/Video.ogv",
+                               "$dir/thumb/0/00",
+                               "$dir/thumb/0",
                                "$dir/thumb/5/5f/LoremIpsum.djvu",
                                "$dir/thumb/5/5f",
                                "$dir/thumb/5",
index d0a3d08..cd2b769 100644 (file)
@@ -9669,7 +9669,7 @@ Magic Word: {{NUMBEROFFILES}}
 !! wikitext
 {{NUMBEROFFILES}}
 !! html
-<p>5
+<p>6
 </p>
 !! end
 
diff --git a/tests/phpunit/data/parser/320x240.ogv b/tests/phpunit/data/parser/320x240.ogv
new file mode 100644 (file)
index 0000000..7903820
Binary files /dev/null and b/tests/phpunit/data/parser/320x240.ogv differ
index 5c6c17d..256ad69 100644 (file)
@@ -304,6 +304,22 @@ class NewParserTest extends MediaWikiTestCase {
                        ), $this->db->timestamp( '20010115123500' ), $user );
                }
 
+               $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Video.ogv' ) );
+               if ( !$this->db->selectField( 'image', '1', array( 'img_name' => $image->getName() ) ) ) {
+                       $image->recordUpload2( '', 'A pretty movie', 'Will it play', array(
+                                       'size'        => 12345,
+                                       'width'       => 240,
+                                       'height'      => 180,
+                                       'bits'        => 0,
+                                       'media_type'  => MEDIATYPE_VIDEO,
+                                       'mime'        => 'application/ogg',
+                                       'metadata'    => serialize( array() ),
+                                       'sha1'        => Wikimedia\base_convert( '', 16, 36, 31 ),
+                                       'fileExists'  => true
+                       ), $this->db->timestamp( '20010115123500' ), $user );
+               }
+
+               # A DjVu file
                # A DjVu file
                $image = wfLocalFile( Title::makeTitle( NS_FILE, 'LoremIpsum.djvu' ) );
                if ( !$this->db->selectField( 'image', '1', array( 'img_name' => $image->getName() ) ) ) {