Adding __METHOD__ to parameters passed to wfMkdirParents()
authorSam Reed <reedy@users.mediawiki.org>
Mon, 25 Jul 2011 22:01:19 +0000 (22:01 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Mon, 25 Jul 2011 22:01:19 +0000 (22:01 +0000)
15 files changed:
includes/LocalisationCache.php
includes/cache/HTMLFileCache.php
includes/cache/MessageCache.php
includes/filerepo/FSRepo.php
includes/filerepo/ForeignAPIRepo.php
includes/installer/SqliteInstaller.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/SVG.php
maintenance/cleanupImages.php
maintenance/generateSitemap.php
maintenance/refreshLinks.php
tests/parser/parserTest.inc
tests/phpunit/includes/parser/NewParserTest.php
tests/phpunit/suites/UploadFromUrlTestSuite.php

index d3579cc..8d8c03f 100644 (file)
@@ -869,7 +869,7 @@ class LCStore_CDB implements LCStore {
 
        public function startWrite( $code ) {
                if ( !file_exists( $this->directory ) ) {
-                       if ( !wfMkdirParents( $this->directory ) ) {
+                       if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
                                throw new MWException( "Unable to create the localisation store " .
                                        "directory \"{$this->directory}\"" );
                        }
index 1095da2..f981999 100644 (file)
@@ -184,8 +184,8 @@ class HTMLFileCache {
                $mydir2 = substr($filename,0,strrpos($filename,'/')); # subdirectory level 2
                $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
 
-               wfMkdirParents( $mydir1 );
-               wfMkdirParents( $mydir2 );
+               wfMkdirParents( $mydir1, null, __METHOD__ );
+               wfMkdirParents( $mydir2, null, __METHOD__ );
        }
 
        public function saveToFileCache( $text ) {
index bdd363a..88b8501 100644 (file)
@@ -176,7 +176,7 @@ class MessageCache {
                global $wgCacheDirectory;
 
                $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
-               wfMkdirParents( $wgCacheDirectory ); // might fail
+               wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail
 
                wfSuppressWarnings();
                $file = fopen( $filename, 'w' );
@@ -199,7 +199,7 @@ class MessageCache {
 
                $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
                $tempFilename = $filename . '.tmp';
-               wfMkdirParents( $wgCacheDirectory ); // might fail
+               wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail
 
                wfSuppressWarnings();
                $file = fopen( $tempFilename, 'w' );
index 2610ac6..a2d5b50 100644 (file)
@@ -162,18 +162,18 @@ class FSRepo extends FileRepo {
         *                             same contents as the source
         */
        function storeBatch( $triplets, $flags = 0 ) {
-               wfDebug( __METHOD__  . ': Storing ' . count( $triplets ) . 
+               wfDebug( __METHOD__  . ': Storing ' . count( $triplets ) .
                        " triplets; flags: {$flags}\n" );
-               
+
                // Try creating directories
-               if ( !wfMkdirParents( $this->directory ) ) {
+               if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
                        return $this->newFatal( 'upload_directory_missing', $this->directory );
                }
                if ( !is_writable( $this->directory ) ) {
                        return $this->newFatal( 'upload_directory_read_only', $this->directory );
                }
-               
-               // Validate each triplet 
+
+               // Validate each triplet
                $status = $this->newGood();
                foreach ( $triplets as $i => $triplet ) {
                        list( $srcPath, $dstZone, $dstRel ) = $triplet;
@@ -191,7 +191,7 @@ class FSRepo extends FileRepo {
 
                        // Create destination directories for this triplet
                        if ( !is_dir( $dstDir ) ) {
-                               if ( !wfMkdirParents( $dstDir ) ) {
+                               if ( !wfMkdirParents( $dstDir, null, __METHOD__ ) ) {
                                        return $this->newFatal( 'directorycreateerror', $dstDir );
                                }
                                if ( $dstZone == 'deleted' ) {
@@ -199,7 +199,7 @@ class FSRepo extends FileRepo {
                                }
                        }
 
-                       // Resolve source 
+                       // Resolve source
                        if ( self::isVirtualUrl( $srcPath ) ) {
                                $srcPath = $triplets[$i][0] = $this->resolveVirtualUrl( $srcPath );
                        }
@@ -208,7 +208,7 @@ class FSRepo extends FileRepo {
                                $status->fatal( 'filenotfound', $srcPath );
                                continue;
                        }
-                       
+
                        // Check overwriting
                        if ( !( $flags & self::OVERWRITE ) && file_exists( $dstPath ) ) {
                                if ( $flags & self::OVERWRITE_SAME ) {
@@ -256,11 +256,11 @@ class FSRepo extends FileRepo {
                                        $hashSource = sha1_file( $srcPath );
                                        $hashDest = sha1_file( $dstPath );
                                        wfRestoreWarnings();
-                                       
+
                                        if ( $hashDest === false || $hashSource !== $hashDest ) {
-                                               wfDebug( __METHOD__ . ': File copy validation failed: ' . 
+                                               wfDebug( __METHOD__ . ': File copy validation failed: ' .
                                                        "$srcPath ($hashSource) to $dstPath ($hashDest)\n" );
-                                               
+
                                                $status->error( 'filecopyerror', $srcPath, $dstPath );
                                                $good = false;
                                        }
@@ -276,12 +276,12 @@ class FSRepo extends FileRepo {
                }
                return $status;
        }
-       
+
        /**
         * Deletes a batch of files. Each file can be a (zone, rel) pairs, a
-        * virtual url or a real path. It will try to delete each file, but 
+        * virtual url or a real path. It will try to delete each file, but
         * ignores any errors that may occur
-        * 
+        *
         * @param $pairs array List of files to delete
         */
        function cleanupBatch( $files ) {
@@ -293,14 +293,14 @@ class FSRepo extends FileRepo {
                                $path = "$root/$rel";
                        } else {
                                if ( self::isVirtualUrl( $file ) ) {
-                                       // This is a virtual url, resolve it 
+                                       // This is a virtual url, resolve it
                                        $path = $this->resolveVirtualUrl( $file );
                                } else {
                                        // This is a full file name
                                        $path = $file;
                                }
                        }
-                       
+
                        wfSuppressWarnings();
                        unlink( $path );
                        wfRestoreWarnings();
@@ -432,7 +432,7 @@ class FSRepo extends FileRepo {
         */
        function publishBatch( $triplets, $flags = 0 ) {
                // Perform initial checks
-               if ( !wfMkdirParents( $this->directory ) ) {
+               if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
                        return $this->newFatal( 'upload_directory_missing', $this->directory );
                }
                if ( !is_writable( $this->directory ) ) {
@@ -457,10 +457,10 @@ class FSRepo extends FileRepo {
                        $dstDir = dirname( $dstPath );
                        $archiveDir = dirname( $archivePath );
                        // Abort immediately on directory creation errors since they're likely to be repetitive
-                       if ( !is_dir( $dstDir ) && !wfMkdirParents( $dstDir ) ) {
+                       if ( !is_dir( $dstDir ) && !wfMkdirParents( $dstDir, null, __METHOD__ ) ) {
                                return $this->newFatal( 'directorycreateerror', $dstDir );
                        }
-                       if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir ) ) {
+                       if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) {
                                return $this->newFatal( 'directorycreateerror', $archiveDir );
                        }
                        if ( !is_file( $srcPath ) ) {
@@ -563,7 +563,7 @@ class FSRepo extends FileRepo {
                        $archivePath = "{$this->deletedDir}/$archiveRel";
                        $archiveDir = dirname( $archivePath );
                        if ( !is_dir( $archiveDir ) ) {
-                               if ( !wfMkdirParents( $archiveDir ) ) {
+                               if ( !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) {
                                        $status->fatal( 'directorycreateerror', $archiveDir );
                                        continue;
                                }
index 38b6f5e..2e329b1 100644 (file)
@@ -300,7 +300,7 @@ class ForeignAPIRepo extends FileRepo {
                        return false;
                }
                if ( !is_dir($localPath) ) {
-                       if( !wfMkdirParents($localPath) ) {
+                       if( !wfMkdirParents( $localPath, null, __METHOD__ ) ) {
                                wfDebug(  __METHOD__ . " could not create directory $localPath for thumb\n" );
                                return $foreignUrl;
                        }
index 144e710..67dd1ba 100644 (file)
@@ -102,7 +102,7 @@ class SqliteInstaller extends DatabaseInstaller {
                        # if it's still writable
                        if ( $create ) {
                                wfSuppressWarnings();
-                               $ok = wfMkdirParents( $dir, 0700 );
+                               $ok = wfMkdirParents( $dir, 0700, __METHOD__ );
                                wfRestoreWarnings();
                                if ( !$ok ) {
                                        return Status::newFatal( 'config-sqlite-mkdir-error', $dir );
index a1cbbc5..08d9eaf 100644 (file)
@@ -35,9 +35,9 @@ class BitmapHandler extends ImageHandler {
                                wfDebug( __METHOD__ . ": Swapping width and height because the file will be rotated $rotation degrees\n" );
 
                                $swapDimensions = true;
-                               list( $params['width'], $params['height'] ) = 
+                               list( $params['width'], $params['height'] ) =
                                        array(  $params['width'], $params['height'] );
-                               list( $params['physicalWidth'], $params['physicalHeight'] ) = 
+                               list( $params['physicalWidth'], $params['physicalHeight'] ) =
                                        array( $params['physicalWidth'], $params['physicalHeight'] );
                        }
                }
@@ -46,16 +46,16 @@ class BitmapHandler extends ImageHandler {
                if ( $params['physicalWidth'] >= $srcWidth ) {
                        if ( $swapDimensions ) {
                                $params['physicalWidth'] = $srcHeight;
-                               $params['physicalHeight'] = $srcWidth;                          
+                               $params['physicalHeight'] = $srcWidth;
                        } else {
                                $params['physicalWidth'] = $srcWidth;
                                $params['physicalHeight'] = $srcHeight;
                        }
                }
-               
+
                # Skip scaling limit checks if no scaling is required
                if ( !$image->mustRender() )
-                       return true;            
+                       return true;
 
                # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
                # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
@@ -69,10 +69,10 @@ class BitmapHandler extends ImageHandler {
 
                return true;
        }
-       
+
        /**
         * Extracts the width/height if the image will be scaled before rotating
-        * 
+        *
         * @param $params array Parameters as returned by normaliseParams
         * @param $rotation int The rotation angle that will be applied
         * @return array ($width, $height) array
@@ -157,7 +157,7 @@ class BitmapHandler extends ImageHandler {
                }
 
                # Try to make a target path for the thumbnail
-               if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
+               if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) {
                        wfDebug( __METHOD__ . ": Unable to create thumbnail destination directory, falling back to client scaling\n" );
                        return $this->getClientScalingThumbnailImage( $image, $scalerParams );
                }
@@ -234,7 +234,7 @@ class BitmapHandler extends ImageHandler {
                }
 
                if ( $scaler != 'client' && $dstPath ) {
-                       if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
+                       if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) {
                                # Unable to create a path for the thumbnail
                                return 'client';
                        }
@@ -312,7 +312,7 @@ class BitmapHandler extends ImageHandler {
                if ( strval( $wgImageMagickTempDir ) !== '' ) {
                        $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir;
                }
-               
+
                $rotation = $this->getRotation( $image );
                list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
 
index 2833f68..e1aa41b 100644 (file)
@@ -141,13 +141,13 @@ class DjVuHandler extends ImageHandler {
                        return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page );
                }
 
-               if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
+               if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
                        return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'thumbnail_dest_directory' ) );
                }
 
                # Use a subshell (brackets) to aggregate stderr from both pipeline commands
                # before redirecting it to the overall stdout. This works in both Linux and Windows XP.
-               $cmd = '(' . wfEscapeShellArg( $wgDjvuRenderer ) . " -format=ppm -page={$page}" . 
+               $cmd = '(' . wfEscapeShellArg( $wgDjvuRenderer ) . " -format=ppm -page={$page}" .
                        " -size={$params['physicalWidth']}x{$params['physicalHeight']} " .
                        wfEscapeShellArg( $srcPath );
                if ( $wgDjvuPostProcessor ) {
index 17fb946..bb2d47d 100644 (file)
@@ -90,7 +90,7 @@ class SvgHandler extends ImageHandler {
                        return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
 
-               if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
+               if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
                        return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
                                wfMsg( 'thumbnail_dest_directory' ) );
                }
@@ -120,7 +120,7 @@ class SvgHandler extends ImageHandler {
                        if ( is_array( $wgSVGConverters[$wgSVGConverter] ) ) {
                                // This is a PHP callable
                                $func = $wgSVGConverters[$wgSVGConverter][0];
-                               $args = array_merge( array( $srcPath, $dstPath, $width, $height ), 
+                               $args = array_merge( array( $srcPath, $dstPath, $width, $height ),
                                        array_slice( $wgSVGConverters[$wgSVGConverter], 1 ) );
                                if ( !is_callable( $func ) ) {
                                        throw new MWException( "$func is not callable" );
@@ -152,13 +152,13 @@ class SvgHandler extends ImageHandler {
                }
                return true;
        }
-       
+
        public static function rasterizeImagickExt( $srcPath, $dstPath, $width, $height ) {
                $im = new Imagick( $srcPath );
                $im->setImageFormat( 'png' );
                $im->setBackgroundColor( 'transparent' );
                $im->setImageDepth( 8 );
-               
+
                if ( !$im->thumbnailImage( intval( $width ), intval( $height ), /* fit */ false ) ) {
                        return 'Could not resize image';
                }
index c8e9095..3781616 100644 (file)
@@ -166,7 +166,7 @@ class ImageCleanup extends TableCleanup {
                                __METHOD__ );
                        $dir = dirname( $finalPath );
                        if ( !file_exists( $dir ) ) {
-                               if ( !wfMkdirParents( $dir ) ) {
+                               if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
                                        $this->log( "RENAME FAILED, COULD NOT CREATE $dir" );
                                        $db->rollback();
                                        return;
index 84c3d6a..6fd7f81 100644 (file)
@@ -194,7 +194,7 @@ class GenerateSitemap extends Maintenance {
                }
                # Create directory if needed
                if ( $fspath && !is_dir( $fspath ) ) {
-                       wfMkdirParents( $fspath ) or die( "Can not create directory $fspath.\n" );
+                       wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" );
                }
 
                return realpath( $fspath ) . DIRECTORY_SEPARATOR ;
index 0515ef1..0ec4e47 100644 (file)
@@ -213,13 +213,14 @@ class RefreshLinks extends Maintenance {
                if ( is_null( $title ) ) {
                        return;
                }
-               $dbw->begin();
 
                $revision = Revision::newFromTitle( $title );
                if ( !$revision ) {
                        return;
                }
 
+               $dbw->begin();
+
                $options = new ParserOptions;
                $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
                $update = new LinksUpdate( $title, $parserOutput, false );
@@ -229,7 +230,7 @@ class RefreshLinks extends Maintenance {
 
        /**
         * Removes non-existing links from pages from pagelinks, imagelinks,
-        * categorylinks, templatelinks and externallinks tables.
+        * categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables.
         *
         * @param $maxLag
         * @param $batchSize The size of deletion batches
@@ -271,7 +272,6 @@ class RefreshLinks extends Maintenance {
                        $counter = 0;
                        $list = array();
                        $this->output( "0.." );
-
                        foreach ( $results as $row ) {
                                $counter++;
                                $list[] = $row->$field;
index f4a952c..6d465bf 100644 (file)
@@ -901,9 +901,9 @@ class ParserTest {
                        return $dir;
                }
 
-               wfMkdirParents( $dir . '/3/3a' );
+               wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
-               wfMkdirParents( $dir . '/0/09' );
+               wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
 
                return $dir;
index a6ca36b..088f036 100644 (file)
@@ -13,7 +13,7 @@ class NewParserTest extends MediaWikiTestCase {
        /* The dataProvider is run on a different instance than the test, so it must be static
         * When running tests from several files, all tests will see all articles.
         */
-       
+
        public $uploadDir;
        public $keepUploads = false;
        public $runDisabled = false;
@@ -31,16 +31,16 @@ class NewParserTest extends MediaWikiTestCase {
        public $memoryLimit = 50;
 
        protected $file = false;
-       
+
        /*function __construct($a = null,$b = array(),$c = null ) {
                parent::__construct($a,$b,$c);
        }*/
-       
+
        function setUp() {
                global $wgContLang, $wgNamespaceProtection, $wgNamespaceAliases;
                global $wgHooks, $IP;
                $wgContLang = Language::factory( 'en' );
-               
+
                //Setup CLI arguments
                if ( $this->getCliArg( 'regex=' ) ) {
                        $this->regex = $this->getCliArg( 'regex=' );
@@ -48,11 +48,11 @@ class NewParserTest extends MediaWikiTestCase {
                        # Matches anything
                        $this->regex = '';
                }
-               
+
                $this->keepUploads = $this->getCliArg( 'keep-uploads' );
-                               
+
                $tmpGlobals = array();
-               
+
                $tmpGlobals['wgScript'] = '/index.php';
                $tmpGlobals['wgScriptPath'] = '/';
                $tmpGlobals['wgArticlePath'] = '/wiki/$1';
@@ -68,7 +68,7 @@ class NewParserTest extends MediaWikiTestCase {
                        'hashLevels' => 2,
                        'transformVia404' => false,
                );
-               
+
                $tmpGlobals['wgEnableParserCache'] = false;
                $tmpGlobals['wgHooks'] = $wgHooks;
                $tmpGlobals['wgDeferredUpdateList'] = array();
@@ -87,8 +87,8 @@ class NewParserTest extends MediaWikiTestCase {
                if ( $GLOBALS['wgStyleDirectory'] === false ) {
                        $tmpGlobals['wgStyleDirectory'] = "$IP/skins";
                }
-               
-               
+
+
                foreach ( $tmpGlobals as $var => $val ) {
                        if ( array_key_exists( $var, $GLOBALS ) ) {
                                $this->savedInitialGlobals[$var] = $GLOBALS[$var];
@@ -96,30 +96,30 @@ class NewParserTest extends MediaWikiTestCase {
 
                        $GLOBALS[$var] = $val;
                }
-               
+
                $this->savedWeirdGlobals['mw_namespace_protection'] = $wgNamespaceProtection[NS_MEDIAWIKI];
                $this->savedWeirdGlobals['image_alias'] = $wgNamespaceAliases['Image'];
                $this->savedWeirdGlobals['image_talk_alias'] = $wgNamespaceAliases['Image_talk'];
-               
+
                $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
                $wgNamespaceAliases['Image'] = NS_FILE;
                $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
-               
+
        }
-       
+
        public function tearDown() {
-       
+
                foreach ( $this->savedInitialGlobals as $var => $val ) {
                        $GLOBALS[$var] = $val;
                }
-               
+
                global $wgNamespaceProtection, $wgNamespaceAliases;
-               
+
                $wgNamespaceProtection[NS_MEDIAWIKI] = $this->savedWeirdGlobals['mw_namespace_protection'];
                $wgNamespaceAliases['Image'] = $this->savedWeirdGlobals['image_alias'];
                $wgNamespaceAliases['Image_talk'] = $this->savedWeirdGlobals['image_talk_alias'];
        }
-       
+
        function addDBData() {
                # Hack: insert a few Wikipedia in-project interwiki prefixes,
                # for testing inter-language links
@@ -162,7 +162,7 @@ class NewParserTest extends MediaWikiTestCase {
 
 
                # Update certain things in site_stats
-               $this->db->insert( 'site_stats', 
+               $this->db->insert( 'site_stats',
                        array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ),
                        __METHOD__,
                        /**
@@ -181,7 +181,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                $user = User::newFromId( 0 );
                LinkCache::singleton()->clear(); # Avoids the odd failure at creating the nullRevision
-               
+
                $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) );
                $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array(
                        'size'        => 12345,
@@ -210,12 +210,12 @@ class NewParserTest extends MediaWikiTestCase {
                        ), $this->db->timestamp( '20010115123500' ), $user );
 
        }
-       
-       
-       
-       
+
+
+
+
        //ParserTest setup/teardown functions
-       
+
        /**
         * Set up the global variables for a consistent environment for each test.
         * Ideally this should replace the global configuration entirely.
@@ -331,7 +331,7 @@ class NewParserTest extends MediaWikiTestCase {
                # The entries saved into RepoGroup cache with previous globals will be wrong.
                RepoGroup::destroySingleton();
                MessageCache::singleton()->destroyInstance();
-               
+
                global $wgUser;
                $wgUser = new User();
        }
@@ -361,14 +361,14 @@ class NewParserTest extends MediaWikiTestCase {
                        return $dir;
                }
 
-               wfMkdirParents( $dir . '/3/3a' );
+               wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
-               wfMkdirParents( $dir . '/0/09' );
+               wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
 
                return $dir;
        }
-       
+
        /**
         * Restore default values and perform any necessary clean-up
         * after each test runs.
@@ -380,7 +380,7 @@ class NewParserTest extends MediaWikiTestCase {
                foreach ( $this->savedGlobals as $var => $val ) {
                        $GLOBALS[$var] = $val;
                }
-               
+
                $this->teardownUploadDir( $this->uploadDir );
        }
 
@@ -452,7 +452,7 @@ class NewParserTest extends MediaWikiTestCase {
                        }
                }
        }
-       
+
        public function parserTestProvider() {
                if ( $this->file === false ) {
                        global $wgParserTestFiles;
@@ -460,14 +460,14 @@ class NewParserTest extends MediaWikiTestCase {
                }
                return new TestFileIterator( $this->file, $this );
        }
-       
+
        /**
         * Set the file from whose tests will be run by this instance
         */
        public function setParserTestFile( $filename ) {
                $this->file = $filename;
        }
-       
+
        /** @dataProvider parserTestProvider */
        public function testParserTest( $desc, $input, $result, $opts, $config ) {
                if ( !preg_match( '/' . $this->regex . '/', $desc ) ) return; //$this->markTestSkipped( 'Filtered out by the user' );
@@ -490,7 +490,7 @@ class NewParserTest extends MediaWikiTestCase {
                $local = isset( $opts['local'] );
                $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
                $parser = $this->getParser( $preprocessor );
-               
+
                $title = Title::newFromText( $titleText );
 
                if ( isset( $opts['pst'] ) ) {
@@ -541,30 +541,30 @@ class NewParserTest extends MediaWikiTestCase {
                }
 
                $this->teardownGlobals();
-               
+
                $this->assertEquals( $result, $out, $desc );
        }
-       
+
        /**
         * Run a fuzz test series
         * Draw input from a set of test files
         */
        function testFuzzTests() {
-               
+
                $this->markTestIncomplete( 'Breaks tesla due to memory restrictions' );
-               
+
                global $wgParserTestFiles;
-               
+
                $files = $wgParserTestFiles;
-               
+
                if( $this->getCliArg( 'file=' ) ) {
                        $files = array( $this->getCliArg( 'file=' ) );
                }
-               
+
                $dict = $this->getFuzzInput( $files );
                $dictSize = strlen( $dict );
                $logMaxLength = log( $this->maxFuzzTestLength );
-               
+
                ini_set( 'memory_limit', $this->memoryLimit * 1048576 );
 
                $user = new User;
@@ -572,9 +572,9 @@ class NewParserTest extends MediaWikiTestCase {
                $title = Title::makeTitle( NS_MAIN, 'Parser_test' );
 
                $id = 1;
-               
+
                while ( true ) {
-                       
+
                        // Generate test input
                        mt_srand( ++$this->fuzzSeed );
                        $totalLength = mt_rand( 1, $this->maxFuzzTestLength );
@@ -596,7 +596,7 @@ class NewParserTest extends MediaWikiTestCase {
                                $this->assertTrue( true, "Test $id, fuzz seed {$this->fuzzSeed}" );
                        } catch ( Exception $exception ) {
                                $input_dump = sprintf( "string(%d) \"%s\"\n", strlen( $input ), $input );
-                               
+
                                $this->assertTrue( false, "Test $id, fuzz seed {$this->fuzzSeed}. \n\nInput: $input_dump\n\nError: {$exception->getMessage()}\n\nBacktrace: {$exception->getTraceAsString()}" );
                        }
 
@@ -613,18 +613,18 @@ class NewParserTest extends MediaWikiTestCase {
                                        foreach ( $memStats as $name => $usage ) {
                                                $ret .= "$name: $usage\n";
                                        }
-                                       
+
                                        throw new MWException( $ret );
                                }
                        }
-                       
+
                        $id++;
-                       
+
                }
        }
 
        //Various getter functions
-       
+
        /**
         * Get an input dictionary from a set of parser test files
         */
@@ -642,7 +642,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                return $dict;
        }
-       
+
        /**
         * Get a memory usage breakdown
         */
@@ -677,7 +677,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                return $memStats;
        }
-       
+
        /**
         * Get a Parser object
         */
@@ -696,8 +696,8 @@ class NewParserTest extends MediaWikiTestCase {
 
        public function addArticle( $name, $text, $line ) {
                self::$articles[$name] = $text;
-       }       
-       
+       }
+
        public function publishTestArticles() {
                if ( empty( self::$articles ) ) {
                        return;
@@ -711,7 +711,7 @@ class NewParserTest extends MediaWikiTestCase {
                        }
                }
        }
-       
+
        /**
         * Steal a callback function from the primary parser, save it for
         * application to our scary parser. If the hook is not installed,
@@ -732,7 +732,7 @@ class NewParserTest extends MediaWikiTestCase {
                return isset( $wgParser->mFunctionHooks[$name] );
        }
        //Various "cleanup" functions
-       
+
        /*
         * Run the "tidy" command on text if the $wgUseTidy
         * global is true
@@ -749,7 +749,7 @@ class NewParserTest extends MediaWikiTestCase {
 
                return $text;
        }
-       
+
        /**
         * Remove last character if it is a newline
         */
@@ -767,7 +767,7 @@ class NewParserTest extends MediaWikiTestCase {
        }
 
        //Test options parser functions
-       
+
        protected function parseOptions( $instring ) {
                $opts = array();
                // foo
@@ -822,7 +822,7 @@ class NewParserTest extends MediaWikiTestCase {
                }
                return $opts;
        }
-       
+
        protected function cleanupOption( $opt ) {
                if ( substr( $opt, 0, 1 ) == '"' ) {
                        return substr( $opt, 1, -1 );
@@ -833,7 +833,7 @@ class NewParserTest extends MediaWikiTestCase {
                }
                return $opt;
        }
-       
+
        /**
         * Use a regex to find out the value of an option
         * @param $key String: name of option val to retrieve
index 9b66682..521f48d 100644 (file)
@@ -159,10 +159,10 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite {
                        return $dir;
                }
 
-               wfMkdirParents( $dir . '/3/3a' );
+               wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
 
-               wfMkdirParents( $dir . '/0/09' );
+               wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
                copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
 
                return $dir;