Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -372,8 +372,14 @@ |
373 | 373 | 'wgScriptPath' => '/', |
374 | 374 | 'wgArticlePath' => '/wiki/$1', |
375 | 375 | 'wgActionPaths' => array(), |
376 | | - 'wgUploadPath' => 'http://example.com/images', |
377 | | - 'wgUploadDirectory' => $this->uploadDir, |
| 376 | + 'wgLocalFileRepo' => array( |
| 377 | + 'class' => 'LocalRepo', |
| 378 | + 'name' => 'local', |
| 379 | + 'directory' => $this->uploadDir, |
| 380 | + 'url' => 'http://example.com/images', |
| 381 | + 'hashLevels' => 2, |
| 382 | + 'transformVia404' => false, |
| 383 | + ), |
378 | 384 | 'wgStyleSheetPath' => '/skins', |
379 | 385 | 'wgSitename' => 'MediaWiki', |
380 | 386 | 'wgServerName' => 'Britney Spears', |
— | — | @@ -541,20 +547,12 @@ |
542 | 548 | */ |
543 | 549 | private function setupUploadDir() { |
544 | 550 | global $IP; |
545 | | - |
546 | 551 | $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images"; |
| 552 | + wfDebug( "Creating upload directory $dir\n" ); |
547 | 553 | mkdir( $dir ); |
548 | 554 | mkdir( $dir . '/3' ); |
549 | 555 | mkdir( $dir . '/3/3a' ); |
550 | | - |
551 | | - $img = "$IP/skins/monobook/headbg.jpg"; |
552 | | - $h = fopen($img, 'r'); |
553 | | - $c = fread($h, filesize($img)); |
554 | | - fclose($h); |
555 | | - |
556 | | - $f = fopen( $dir . '/3/3a/Foobar.jpg', 'wb' ); |
557 | | - fwrite( $f, $c ); |
558 | | - fclose( $f ); |
| 556 | + copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
559 | 557 | return $dir; |
560 | 558 | } |
561 | 559 | |
— | — | @@ -563,6 +561,7 @@ |
564 | 562 | * after each test runs. |
565 | 563 | */ |
566 | 564 | private function teardownGlobals() { |
| 565 | + RepoGroup::destroySingleton(); |
567 | 566 | foreach( $this->savedGlobals as $var => $val ) { |
568 | 567 | $GLOBALS[$var] = $val; |
569 | 568 | } |
Index: trunk/phase3/includes/filerepo/RepoGroup.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * Get a RepoGroup instance. At present only one instance of RepoGroup is |
16 | 16 | * needed in a MediaWiki invocation, this may change in the future. |
17 | 17 | */ |
18 | | - function singleton() { |
| 18 | + static function singleton() { |
19 | 19 | if ( self::$instance ) { |
20 | 20 | return self::$instance; |
21 | 21 | } |
— | — | @@ -24,6 +24,14 @@ |
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
| 28 | + * Destroy the singleton instance, so that a new one will be created next |
| 29 | + * time singleton() is called. |
| 30 | + */ |
| 31 | + static function destroySingleton() { |
| 32 | + self::$instance = null; |
| 33 | + } |
| 34 | + |
| 35 | + /** |
28 | 36 | * Construct a group of file repositories. |
29 | 37 | * @param array $data Array of repository info arrays. |
30 | 38 | * Each info array is an associative array with the 'class' member |