r93132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93131‎ | r93132 | r93133 >
Date:22:01, 25 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Adding __METHOD__ to parameters passed to wfMkdirParents()
Modified paths:
  • /trunk/phase3/includes/LocalisationCache.php (modified) (history)
  • /trunk/phase3/includes/cache/HTMLFileCache.php (modified) (history)
  • /trunk/phase3/includes/cache/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FSRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/ForeignAPIRepo.php (modified) (history)
  • /trunk/phase3/includes/installer/SqliteInstaller.php (modified) (history)
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)
  • /trunk/phase3/includes/media/DjVu.php (modified) (history)
  • /trunk/phase3/includes/media/SVG.php (modified) (history)
  • /trunk/phase3/maintenance/cleanupImages.php (modified) (history)
  • /trunk/phase3/maintenance/generateSitemap.php (modified) (history)
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTest.inc (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php (modified) (history)
  • /trunk/phase3/tests/phpunit/suites/UploadFromUrlTestSuite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/generateSitemap.php
@@ -194,7 +194,7 @@
195195 }
196196 # Create directory if needed
197197 if ( $fspath && !is_dir( $fspath ) ) {
198 - wfMkdirParents( $fspath ) or die( "Can not create directory $fspath.\n" );
 198+ wfMkdirParents( $fspath, null, __METHOD__ ) or die( "Can not create directory $fspath.\n" );
199199 }
200200
201201 return realpath( $fspath ) . DIRECTORY_SEPARATOR ;
Index: trunk/phase3/maintenance/refreshLinks.php
@@ -213,13 +213,14 @@
214214 if ( is_null( $title ) ) {
215215 return;
216216 }
217 - $dbw->begin();
218217
219218 $revision = Revision::newFromTitle( $title );
220219 if ( !$revision ) {
221220 return;
222221 }
223222
 223+ $dbw->begin();
 224+
224225 $options = new ParserOptions;
225226 $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
226227 $update = new LinksUpdate( $title, $parserOutput, false );
@@ -229,7 +230,7 @@
230231
231232 /**
232233 * Removes non-existing links from pages from pagelinks, imagelinks,
233 - * categorylinks, templatelinks and externallinks tables.
 234+ * categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables.
234235 *
235236 * @param $maxLag
236237 * @param $batchSize The size of deletion batches
@@ -271,7 +272,6 @@
272273 $counter = 0;
273274 $list = array();
274275 $this->output( "0.." );
275 -
276276 foreach ( $results as $row ) {
277277 $counter++;
278278 $list[] = $row->$field;
Index: trunk/phase3/maintenance/cleanupImages.php
@@ -166,7 +166,7 @@
167167 __METHOD__ );
168168 $dir = dirname( $finalPath );
169169 if ( !file_exists( $dir ) ) {
170 - if ( !wfMkdirParents( $dir ) ) {
 170+ if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) {
171171 $this->log( "RENAME FAILED, COULD NOT CREATE $dir" );
172172 $db->rollback();
173173 return;
Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php
@@ -13,7 +13,7 @@
1414 /* The dataProvider is run on a different instance than the test, so it must be static
1515 * When running tests from several files, all tests will see all articles.
1616 */
17 -
 17+
1818 public $uploadDir;
1919 public $keepUploads = false;
2020 public $runDisabled = false;
@@ -31,16 +31,16 @@
3232 public $memoryLimit = 50;
3333
3434 protected $file = false;
35 -
 35+
3636 /*function __construct($a = null,$b = array(),$c = null ) {
3737 parent::__construct($a,$b,$c);
3838 }*/
39 -
 39+
4040 function setUp() {
4141 global $wgContLang, $wgNamespaceProtection, $wgNamespaceAliases;
4242 global $wgHooks, $IP;
4343 $wgContLang = Language::factory( 'en' );
44 -
 44+
4545 //Setup CLI arguments
4646 if ( $this->getCliArg( 'regex=' ) ) {
4747 $this->regex = $this->getCliArg( 'regex=' );
@@ -48,11 +48,11 @@
4949 # Matches anything
5050 $this->regex = '';
5151 }
52 -
 52+
5353 $this->keepUploads = $this->getCliArg( 'keep-uploads' );
54 -
 54+
5555 $tmpGlobals = array();
56 -
 56+
5757 $tmpGlobals['wgScript'] = '/index.php';
5858 $tmpGlobals['wgScriptPath'] = '/';
5959 $tmpGlobals['wgArticlePath'] = '/wiki/$1';
@@ -68,7 +68,7 @@
6969 'hashLevels' => 2,
7070 'transformVia404' => false,
7171 );
72 -
 72+
7373 $tmpGlobals['wgEnableParserCache'] = false;
7474 $tmpGlobals['wgHooks'] = $wgHooks;
7575 $tmpGlobals['wgDeferredUpdateList'] = array();
@@ -87,8 +87,8 @@
8888 if ( $GLOBALS['wgStyleDirectory'] === false ) {
8989 $tmpGlobals['wgStyleDirectory'] = "$IP/skins";
9090 }
91 -
92 -
 91+
 92+
9393 foreach ( $tmpGlobals as $var => $val ) {
9494 if ( array_key_exists( $var, $GLOBALS ) ) {
9595 $this->savedInitialGlobals[$var] = $GLOBALS[$var];
@@ -96,30 +96,30 @@
9797
9898 $GLOBALS[$var] = $val;
9999 }
100 -
 100+
101101 $this->savedWeirdGlobals['mw_namespace_protection'] = $wgNamespaceProtection[NS_MEDIAWIKI];
102102 $this->savedWeirdGlobals['image_alias'] = $wgNamespaceAliases['Image'];
103103 $this->savedWeirdGlobals['image_talk_alias'] = $wgNamespaceAliases['Image_talk'];
104 -
 104+
105105 $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
106106 $wgNamespaceAliases['Image'] = NS_FILE;
107107 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
108 -
 108+
109109 }
110 -
 110+
111111 public function tearDown() {
112 -
 112+
113113 foreach ( $this->savedInitialGlobals as $var => $val ) {
114114 $GLOBALS[$var] = $val;
115115 }
116 -
 116+
117117 global $wgNamespaceProtection, $wgNamespaceAliases;
118 -
 118+
119119 $wgNamespaceProtection[NS_MEDIAWIKI] = $this->savedWeirdGlobals['mw_namespace_protection'];
120120 $wgNamespaceAliases['Image'] = $this->savedWeirdGlobals['image_alias'];
121121 $wgNamespaceAliases['Image_talk'] = $this->savedWeirdGlobals['image_talk_alias'];
122122 }
123 -
 123+
124124 function addDBData() {
125125 # Hack: insert a few Wikipedia in-project interwiki prefixes,
126126 # for testing inter-language links
@@ -162,7 +162,7 @@
163163
164164
165165 # Update certain things in site_stats
166 - $this->db->insert( 'site_stats',
 166+ $this->db->insert( 'site_stats',
167167 array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ),
168168 __METHOD__,
169169 /**
@@ -181,7 +181,7 @@
182182
183183 $user = User::newFromId( 0 );
184184 LinkCache::singleton()->clear(); # Avoids the odd failure at creating the nullRevision
185 -
 185+
186186 $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) );
187187 $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array(
188188 'size' => 12345,
@@ -210,12 +210,12 @@
211211 ), $this->db->timestamp( '20010115123500' ), $user );
212212
213213 }
214 -
215 -
216 -
217 -
 214+
 215+
 216+
 217+
218218 //ParserTest setup/teardown functions
219 -
 219+
220220 /**
221221 * Set up the global variables for a consistent environment for each test.
222222 * Ideally this should replace the global configuration entirely.
@@ -331,7 +331,7 @@
332332 # The entries saved into RepoGroup cache with previous globals will be wrong.
333333 RepoGroup::destroySingleton();
334334 MessageCache::singleton()->destroyInstance();
335 -
 335+
336336 global $wgUser;
337337 $wgUser = new User();
338338 }
@@ -361,14 +361,14 @@
362362 return $dir;
363363 }
364364
365 - wfMkdirParents( $dir . '/3/3a' );
 365+ wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
366366 copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
367 - wfMkdirParents( $dir . '/0/09' );
 367+ wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
368368 copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
369369
370370 return $dir;
371371 }
372 -
 372+
373373 /**
374374 * Restore default values and perform any necessary clean-up
375375 * after each test runs.
@@ -380,7 +380,7 @@
381381 foreach ( $this->savedGlobals as $var => $val ) {
382382 $GLOBALS[$var] = $val;
383383 }
384 -
 384+
385385 $this->teardownUploadDir( $this->uploadDir );
386386 }
387387
@@ -452,7 +452,7 @@
453453 }
454454 }
455455 }
456 -
 456+
457457 public function parserTestProvider() {
458458 if ( $this->file === false ) {
459459 global $wgParserTestFiles;
@@ -460,14 +460,14 @@
461461 }
462462 return new TestFileIterator( $this->file, $this );
463463 }
464 -
 464+
465465 /**
466466 * Set the file from whose tests will be run by this instance
467467 */
468468 public function setParserTestFile( $filename ) {
469469 $this->file = $filename;
470470 }
471 -
 471+
472472 /** @dataProvider parserTestProvider */
473473 public function testParserTest( $desc, $input, $result, $opts, $config ) {
474474 if ( !preg_match( '/' . $this->regex . '/', $desc ) ) return; //$this->markTestSkipped( 'Filtered out by the user' );
@@ -490,7 +490,7 @@
491491 $local = isset( $opts['local'] );
492492 $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
493493 $parser = $this->getParser( $preprocessor );
494 -
 494+
495495 $title = Title::newFromText( $titleText );
496496
497497 if ( isset( $opts['pst'] ) ) {
@@ -541,30 +541,30 @@
542542 }
543543
544544 $this->teardownGlobals();
545 -
 545+
546546 $this->assertEquals( $result, $out, $desc );
547547 }
548 -
 548+
549549 /**
550550 * Run a fuzz test series
551551 * Draw input from a set of test files
552552 */
553553 function testFuzzTests() {
554 -
 554+
555555 $this->markTestIncomplete( 'Breaks tesla due to memory restrictions' );
556 -
 556+
557557 global $wgParserTestFiles;
558 -
 558+
559559 $files = $wgParserTestFiles;
560 -
 560+
561561 if( $this->getCliArg( 'file=' ) ) {
562562 $files = array( $this->getCliArg( 'file=' ) );
563563 }
564 -
 564+
565565 $dict = $this->getFuzzInput( $files );
566566 $dictSize = strlen( $dict );
567567 $logMaxLength = log( $this->maxFuzzTestLength );
568 -
 568+
569569 ini_set( 'memory_limit', $this->memoryLimit * 1048576 );
570570
571571 $user = new User;
@@ -572,9 +572,9 @@
573573 $title = Title::makeTitle( NS_MAIN, 'Parser_test' );
574574
575575 $id = 1;
576 -
 576+
577577 while ( true ) {
578 -
 578+
579579 // Generate test input
580580 mt_srand( ++$this->fuzzSeed );
581581 $totalLength = mt_rand( 1, $this->maxFuzzTestLength );
@@ -596,7 +596,7 @@
597597 $this->assertTrue( true, "Test $id, fuzz seed {$this->fuzzSeed}" );
598598 } catch ( Exception $exception ) {
599599 $input_dump = sprintf( "string(%d) \"%s\"\n", strlen( $input ), $input );
600 -
 600+
601601 $this->assertTrue( false, "Test $id, fuzz seed {$this->fuzzSeed}. \n\nInput: $input_dump\n\nError: {$exception->getMessage()}\n\nBacktrace: {$exception->getTraceAsString()}" );
602602 }
603603
@@ -613,18 +613,18 @@
614614 foreach ( $memStats as $name => $usage ) {
615615 $ret .= "$name: $usage\n";
616616 }
617 -
 617+
618618 throw new MWException( $ret );
619619 }
620620 }
621 -
 621+
622622 $id++;
623 -
 623+
624624 }
625625 }
626626
627627 //Various getter functions
628 -
 628+
629629 /**
630630 * Get an input dictionary from a set of parser test files
631631 */
@@ -642,7 +642,7 @@
643643
644644 return $dict;
645645 }
646 -
 646+
647647 /**
648648 * Get a memory usage breakdown
649649 */
@@ -677,7 +677,7 @@
678678
679679 return $memStats;
680680 }
681 -
 681+
682682 /**
683683 * Get a Parser object
684684 */
@@ -696,8 +696,8 @@
697697
698698 public function addArticle( $name, $text, $line ) {
699699 self::$articles[$name] = $text;
700 - }
701 -
 700+ }
 701+
702702 public function publishTestArticles() {
703703 if ( empty( self::$articles ) ) {
704704 return;
@@ -711,7 +711,7 @@
712712 }
713713 }
714714 }
715 -
 715+
716716 /**
717717 * Steal a callback function from the primary parser, save it for
718718 * application to our scary parser. If the hook is not installed,
@@ -732,7 +732,7 @@
733733 return isset( $wgParser->mFunctionHooks[$name] );
734734 }
735735 //Various "cleanup" functions
736 -
 736+
737737 /*
738738 * Run the "tidy" command on text if the $wgUseTidy
739739 * global is true
@@ -749,7 +749,7 @@
750750
751751 return $text;
752752 }
753 -
 753+
754754 /**
755755 * Remove last character if it is a newline
756756 */
@@ -767,7 +767,7 @@
768768 }
769769
770770 //Test options parser functions
771 -
 771+
772772 protected function parseOptions( $instring ) {
773773 $opts = array();
774774 // foo
@@ -822,7 +822,7 @@
823823 }
824824 return $opts;
825825 }
826 -
 826+
827827 protected function cleanupOption( $opt ) {
828828 if ( substr( $opt, 0, 1 ) == '"' ) {
829829 return substr( $opt, 1, -1 );
@@ -833,7 +833,7 @@
834834 }
835835 return $opt;
836836 }
837 -
 837+
838838 /**
839839 * Use a regex to find out the value of an option
840840 * @param $key String: name of option val to retrieve
Index: trunk/phase3/tests/phpunit/suites/UploadFromUrlTestSuite.php
@@ -159,10 +159,10 @@
160160 return $dir;
161161 }
162162
163 - wfMkdirParents( $dir . '/3/3a' );
 163+ wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
164164 copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
165165
166 - wfMkdirParents( $dir . '/0/09' );
 166+ wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
167167 copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
168168
169169 return $dir;
Index: trunk/phase3/tests/parser/parserTest.inc
@@ -901,9 +901,9 @@
902902 return $dir;
903903 }
904904
905 - wfMkdirParents( $dir . '/3/3a' );
 905+ wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
906906 copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
907 - wfMkdirParents( $dir . '/0/09' );
 907+ wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
908908 copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
909909
910910 return $dir;
Index: trunk/phase3/includes/LocalisationCache.php
@@ -869,7 +869,7 @@
870870
871871 public function startWrite( $code ) {
872872 if ( !file_exists( $this->directory ) ) {
873 - if ( !wfMkdirParents( $this->directory ) ) {
 873+ if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
874874 throw new MWException( "Unable to create the localisation store " .
875875 "directory \"{$this->directory}\"" );
876876 }
Index: trunk/phase3/includes/filerepo/FSRepo.php
@@ -162,18 +162,18 @@
163163 * same contents as the source
164164 */
165165 function storeBatch( $triplets, $flags = 0 ) {
166 - wfDebug( __METHOD__ . ': Storing ' . count( $triplets ) .
 166+ wfDebug( __METHOD__ . ': Storing ' . count( $triplets ) .
167167 " triplets; flags: {$flags}\n" );
168 -
 168+
169169 // Try creating directories
170 - if ( !wfMkdirParents( $this->directory ) ) {
 170+ if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
171171 return $this->newFatal( 'upload_directory_missing', $this->directory );
172172 }
173173 if ( !is_writable( $this->directory ) ) {
174174 return $this->newFatal( 'upload_directory_read_only', $this->directory );
175175 }
176 -
177 - // Validate each triplet
 176+
 177+ // Validate each triplet
178178 $status = $this->newGood();
179179 foreach ( $triplets as $i => $triplet ) {
180180 list( $srcPath, $dstZone, $dstRel ) = $triplet;
@@ -191,7 +191,7 @@
192192
193193 // Create destination directories for this triplet
194194 if ( !is_dir( $dstDir ) ) {
195 - if ( !wfMkdirParents( $dstDir ) ) {
 195+ if ( !wfMkdirParents( $dstDir, null, __METHOD__ ) ) {
196196 return $this->newFatal( 'directorycreateerror', $dstDir );
197197 }
198198 if ( $dstZone == 'deleted' ) {
@@ -199,7 +199,7 @@
200200 }
201201 }
202202
203 - // Resolve source
 203+ // Resolve source
204204 if ( self::isVirtualUrl( $srcPath ) ) {
205205 $srcPath = $triplets[$i][0] = $this->resolveVirtualUrl( $srcPath );
206206 }
@@ -208,7 +208,7 @@
209209 $status->fatal( 'filenotfound', $srcPath );
210210 continue;
211211 }
212 -
 212+
213213 // Check overwriting
214214 if ( !( $flags & self::OVERWRITE ) && file_exists( $dstPath ) ) {
215215 if ( $flags & self::OVERWRITE_SAME ) {
@@ -256,11 +256,11 @@
257257 $hashSource = sha1_file( $srcPath );
258258 $hashDest = sha1_file( $dstPath );
259259 wfRestoreWarnings();
260 -
 260+
261261 if ( $hashDest === false || $hashSource !== $hashDest ) {
262 - wfDebug( __METHOD__ . ': File copy validation failed: ' .
 262+ wfDebug( __METHOD__ . ': File copy validation failed: ' .
263263 "$srcPath ($hashSource) to $dstPath ($hashDest)\n" );
264 -
 264+
265265 $status->error( 'filecopyerror', $srcPath, $dstPath );
266266 $good = false;
267267 }
@@ -276,12 +276,12 @@
277277 }
278278 return $status;
279279 }
280 -
 280+
281281 /**
282282 * Deletes a batch of files. Each file can be a (zone, rel) pairs, a
283 - * virtual url or a real path. It will try to delete each file, but
 283+ * virtual url or a real path. It will try to delete each file, but
284284 * ignores any errors that may occur
285 - *
 285+ *
286286 * @param $pairs array List of files to delete
287287 */
288288 function cleanupBatch( $files ) {
@@ -293,14 +293,14 @@
294294 $path = "$root/$rel";
295295 } else {
296296 if ( self::isVirtualUrl( $file ) ) {
297 - // This is a virtual url, resolve it
 297+ // This is a virtual url, resolve it
298298 $path = $this->resolveVirtualUrl( $file );
299299 } else {
300300 // This is a full file name
301301 $path = $file;
302302 }
303303 }
304 -
 304+
305305 wfSuppressWarnings();
306306 unlink( $path );
307307 wfRestoreWarnings();
@@ -432,7 +432,7 @@
433433 */
434434 function publishBatch( $triplets, $flags = 0 ) {
435435 // Perform initial checks
436 - if ( !wfMkdirParents( $this->directory ) ) {
 436+ if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
437437 return $this->newFatal( 'upload_directory_missing', $this->directory );
438438 }
439439 if ( !is_writable( $this->directory ) ) {
@@ -457,10 +457,10 @@
458458 $dstDir = dirname( $dstPath );
459459 $archiveDir = dirname( $archivePath );
460460 // Abort immediately on directory creation errors since they're likely to be repetitive
461 - if ( !is_dir( $dstDir ) && !wfMkdirParents( $dstDir ) ) {
 461+ if ( !is_dir( $dstDir ) && !wfMkdirParents( $dstDir, null, __METHOD__ ) ) {
462462 return $this->newFatal( 'directorycreateerror', $dstDir );
463463 }
464 - if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir ) ) {
 464+ if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) {
465465 return $this->newFatal( 'directorycreateerror', $archiveDir );
466466 }
467467 if ( !is_file( $srcPath ) ) {
@@ -563,7 +563,7 @@
564564 $archivePath = "{$this->deletedDir}/$archiveRel";
565565 $archiveDir = dirname( $archivePath );
566566 if ( !is_dir( $archiveDir ) ) {
567 - if ( !wfMkdirParents( $archiveDir ) ) {
 567+ if ( !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) {
568568 $status->fatal( 'directorycreateerror', $archiveDir );
569569 continue;
570570 }
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php
@@ -300,7 +300,7 @@
301301 return false;
302302 }
303303 if ( !is_dir($localPath) ) {
304 - if( !wfMkdirParents($localPath) ) {
 304+ if( !wfMkdirParents( $localPath, null, __METHOD__ ) ) {
305305 wfDebug( __METHOD__ . " could not create directory $localPath for thumb\n" );
306306 return $foreignUrl;
307307 }
Index: trunk/phase3/includes/installer/SqliteInstaller.php
@@ -102,7 +102,7 @@
103103 # if it's still writable
104104 if ( $create ) {
105105 wfSuppressWarnings();
106 - $ok = wfMkdirParents( $dir, 0700 );
 106+ $ok = wfMkdirParents( $dir, 0700, __METHOD__ );
107107 wfRestoreWarnings();
108108 if ( !$ok ) {
109109 return Status::newFatal( 'config-sqlite-mkdir-error', $dir );
Index: trunk/phase3/includes/media/SVG.php
@@ -90,7 +90,7 @@
9191 return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
9292 }
9393
94 - if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
 94+ if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
9595 return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
9696 wfMsg( 'thumbnail_dest_directory' ) );
9797 }
@@ -120,7 +120,7 @@
121121 if ( is_array( $wgSVGConverters[$wgSVGConverter] ) ) {
122122 // This is a PHP callable
123123 $func = $wgSVGConverters[$wgSVGConverter][0];
124 - $args = array_merge( array( $srcPath, $dstPath, $width, $height ),
 124+ $args = array_merge( array( $srcPath, $dstPath, $width, $height ),
125125 array_slice( $wgSVGConverters[$wgSVGConverter], 1 ) );
126126 if ( !is_callable( $func ) ) {
127127 throw new MWException( "$func is not callable" );
@@ -152,13 +152,13 @@
153153 }
154154 return true;
155155 }
156 -
 156+
157157 public static function rasterizeImagickExt( $srcPath, $dstPath, $width, $height ) {
158158 $im = new Imagick( $srcPath );
159159 $im->setImageFormat( 'png' );
160160 $im->setBackgroundColor( 'transparent' );
161161 $im->setImageDepth( 8 );
162 -
 162+
163163 if ( !$im->thumbnailImage( intval( $width ), intval( $height ), /* fit */ false ) ) {
164164 return 'Could not resize image';
165165 }
Index: trunk/phase3/includes/media/DjVu.php
@@ -141,13 +141,13 @@
142142 return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page );
143143 }
144144
145 - if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
 145+ if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
146146 return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'thumbnail_dest_directory' ) );
147147 }
148148
149149 # Use a subshell (brackets) to aggregate stderr from both pipeline commands
150150 # before redirecting it to the overall stdout. This works in both Linux and Windows XP.
151 - $cmd = '(' . wfEscapeShellArg( $wgDjvuRenderer ) . " -format=ppm -page={$page}" .
 151+ $cmd = '(' . wfEscapeShellArg( $wgDjvuRenderer ) . " -format=ppm -page={$page}" .
152152 " -size={$params['physicalWidth']}x{$params['physicalHeight']} " .
153153 wfEscapeShellArg( $srcPath );
154154 if ( $wgDjvuPostProcessor ) {
Index: trunk/phase3/includes/media/Bitmap.php
@@ -35,9 +35,9 @@
3636 wfDebug( __METHOD__ . ": Swapping width and height because the file will be rotated $rotation degrees\n" );
3737
3838 $swapDimensions = true;
39 - list( $params['width'], $params['height'] ) =
 39+ list( $params['width'], $params['height'] ) =
4040 array( $params['width'], $params['height'] );
41 - list( $params['physicalWidth'], $params['physicalHeight'] ) =
 41+ list( $params['physicalWidth'], $params['physicalHeight'] ) =
4242 array( $params['physicalWidth'], $params['physicalHeight'] );
4343 }
4444 }
@@ -46,16 +46,16 @@
4747 if ( $params['physicalWidth'] >= $srcWidth ) {
4848 if ( $swapDimensions ) {
4949 $params['physicalWidth'] = $srcHeight;
50 - $params['physicalHeight'] = $srcWidth;
 50+ $params['physicalHeight'] = $srcWidth;
5151 } else {
5252 $params['physicalWidth'] = $srcWidth;
5353 $params['physicalHeight'] = $srcHeight;
5454 }
5555 }
56 -
 56+
5757 # Skip scaling limit checks if no scaling is required
5858 if ( !$image->mustRender() )
59 - return true;
 59+ return true;
6060
6161 # Don't thumbnail an image so big that it will fill hard drives and send servers into swap
6262 # JPEG has the handy property of allowing thumbnailing without full decompression, so we make
@@ -69,10 +69,10 @@
7070
7171 return true;
7272 }
73 -
 73+
7474 /**
7575 * Extracts the width/height if the image will be scaled before rotating
76 - *
 76+ *
7777 * @param $params array Parameters as returned by normaliseParams
7878 * @param $rotation int The rotation angle that will be applied
7979 * @return array ($width, $height) array
@@ -157,7 +157,7 @@
158158 }
159159
160160 # Try to make a target path for the thumbnail
161 - if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
 161+ if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) {
162162 wfDebug( __METHOD__ . ": Unable to create thumbnail destination directory, falling back to client scaling\n" );
163163 return $this->getClientScalingThumbnailImage( $image, $scalerParams );
164164 }
@@ -234,7 +234,7 @@
235235 }
236236
237237 if ( $scaler != 'client' && $dstPath ) {
238 - if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
 238+ if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) {
239239 # Unable to create a path for the thumbnail
240240 return 'client';
241241 }
@@ -312,7 +312,7 @@
313313 if ( strval( $wgImageMagickTempDir ) !== '' ) {
314314 $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir;
315315 }
316 -
 316+
317317 $rotation = $this->getRotation( $image );
318318 list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation );
319319
Index: trunk/phase3/includes/cache/HTMLFileCache.php
@@ -184,8 +184,8 @@
185185 $mydir2 = substr($filename,0,strrpos($filename,'/')); # subdirectory level 2
186186 $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
187187
188 - wfMkdirParents( $mydir1 );
189 - wfMkdirParents( $mydir2 );
 188+ wfMkdirParents( $mydir1, null, __METHOD__ );
 189+ wfMkdirParents( $mydir2, null, __METHOD__ );
190190 }
191191
192192 public function saveToFileCache( $text ) {
Index: trunk/phase3/includes/cache/MessageCache.php
@@ -176,7 +176,7 @@
177177 global $wgCacheDirectory;
178178
179179 $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
180 - wfMkdirParents( $wgCacheDirectory ); // might fail
 180+ wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail
181181
182182 wfSuppressWarnings();
183183 $file = fopen( $filename, 'w' );
@@ -199,7 +199,7 @@
200200
201201 $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
202202 $tempFilename = $filename . '.tmp';
203 - wfMkdirParents( $wgCacheDirectory ); // might fail
 203+ wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail
204204
205205 wfSuppressWarnings();
206206 $file = fopen( $tempFilename, 'w' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r93157Followup r93132, misplaced ) caused 'dirname() expects exactly 1 parameter, 3...dantman02:44, 26 July 2011

Status & tagging log