r22671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22670‎ | r22671 | r22672 >
Date:09:05, 3 June 2007
Author:tstarling
Status:old
Tags:
Comment:
Fixed most of the parser tests broken by filerepo merge
Modified paths:
  • /trunk/phase3/includes/filerepo/RepoGroup.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -372,8 +372,14 @@
373373 'wgScriptPath' => '/',
374374 'wgArticlePath' => '/wiki/$1',
375375 '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+ ),
378384 'wgStyleSheetPath' => '/skins',
379385 'wgSitename' => 'MediaWiki',
380386 'wgServerName' => 'Britney Spears',
@@ -541,20 +547,12 @@
542548 */
543549 private function setupUploadDir() {
544550 global $IP;
545 -
546551 $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images";
 552+ wfDebug( "Creating upload directory $dir\n" );
547553 mkdir( $dir );
548554 mkdir( $dir . '/3' );
549555 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" );
559557 return $dir;
560558 }
561559
@@ -563,6 +561,7 @@
564562 * after each test runs.
565563 */
566564 private function teardownGlobals() {
 565+ RepoGroup::destroySingleton();
567566 foreach( $this->savedGlobals as $var => $val ) {
568567 $GLOBALS[$var] = $val;
569568 }
Index: trunk/phase3/includes/filerepo/RepoGroup.php
@@ -14,7 +14,7 @@
1515 * Get a RepoGroup instance. At present only one instance of RepoGroup is
1616 * needed in a MediaWiki invocation, this may change in the future.
1717 */
18 - function singleton() {
 18+ static function singleton() {
1919 if ( self::$instance ) {
2020 return self::$instance;
2121 }
@@ -24,6 +24,14 @@
2525 }
2626
2727 /**
 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+ /**
2836 * Construct a group of file repositories.
2937 * @param array $data Array of repository info arrays.
3038 * Each info array is an associative array with the 'class' member

Follow-up revisions

RevisionCommit summaryAuthorDate
r22717Merged revisions 22667-22715 via svnmerge from...david20:00, 4 June 2007

Status & tagging log