Index: trunk/phase3/maintenance/generateSitemap.php |
— | — | @@ -194,7 +194,7 @@ |
195 | 195 | } |
196 | 196 | # Create directory if needed |
197 | 197 | 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" ); |
199 | 199 | } |
200 | 200 | |
201 | 201 | return realpath( $fspath ) . DIRECTORY_SEPARATOR ; |
Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -213,13 +213,14 @@ |
214 | 214 | if ( is_null( $title ) ) { |
215 | 215 | return; |
216 | 216 | } |
217 | | - $dbw->begin(); |
218 | 217 | |
219 | 218 | $revision = Revision::newFromTitle( $title ); |
220 | 219 | if ( !$revision ) { |
221 | 220 | return; |
222 | 221 | } |
223 | 222 | |
| 223 | + $dbw->begin(); |
| 224 | + |
224 | 225 | $options = new ParserOptions; |
225 | 226 | $parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() ); |
226 | 227 | $update = new LinksUpdate( $title, $parserOutput, false ); |
— | — | @@ -229,7 +230,7 @@ |
230 | 231 | |
231 | 232 | /** |
232 | 233 | * Removes non-existing links from pages from pagelinks, imagelinks, |
233 | | - * categorylinks, templatelinks and externallinks tables. |
| 234 | + * categorylinks, templatelinks, externallinks, interwikilinks, langlinks and redirect tables. |
234 | 235 | * |
235 | 236 | * @param $maxLag |
236 | 237 | * @param $batchSize The size of deletion batches |
— | — | @@ -271,7 +272,6 @@ |
272 | 273 | $counter = 0; |
273 | 274 | $list = array(); |
274 | 275 | $this->output( "0.." ); |
275 | | - |
276 | 276 | foreach ( $results as $row ) { |
277 | 277 | $counter++; |
278 | 278 | $list[] = $row->$field; |
Index: trunk/phase3/maintenance/cleanupImages.php |
— | — | @@ -166,7 +166,7 @@ |
167 | 167 | __METHOD__ ); |
168 | 168 | $dir = dirname( $finalPath ); |
169 | 169 | if ( !file_exists( $dir ) ) { |
170 | | - if ( !wfMkdirParents( $dir ) ) { |
| 170 | + if ( !wfMkdirParents( $dir, null, __METHOD__ ) ) { |
171 | 171 | $this->log( "RENAME FAILED, COULD NOT CREATE $dir" ); |
172 | 172 | $db->rollback(); |
173 | 173 | return; |
Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | /* The dataProvider is run on a different instance than the test, so it must be static |
15 | 15 | * When running tests from several files, all tests will see all articles. |
16 | 16 | */ |
17 | | - |
| 17 | + |
18 | 18 | public $uploadDir; |
19 | 19 | public $keepUploads = false; |
20 | 20 | public $runDisabled = false; |
— | — | @@ -31,16 +31,16 @@ |
32 | 32 | public $memoryLimit = 50; |
33 | 33 | |
34 | 34 | protected $file = false; |
35 | | - |
| 35 | + |
36 | 36 | /*function __construct($a = null,$b = array(),$c = null ) { |
37 | 37 | parent::__construct($a,$b,$c); |
38 | 38 | }*/ |
39 | | - |
| 39 | + |
40 | 40 | function setUp() { |
41 | 41 | global $wgContLang, $wgNamespaceProtection, $wgNamespaceAliases; |
42 | 42 | global $wgHooks, $IP; |
43 | 43 | $wgContLang = Language::factory( 'en' ); |
44 | | - |
| 44 | + |
45 | 45 | //Setup CLI arguments |
46 | 46 | if ( $this->getCliArg( 'regex=' ) ) { |
47 | 47 | $this->regex = $this->getCliArg( 'regex=' ); |
— | — | @@ -48,11 +48,11 @@ |
49 | 49 | # Matches anything |
50 | 50 | $this->regex = ''; |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | $this->keepUploads = $this->getCliArg( 'keep-uploads' ); |
54 | | - |
| 54 | + |
55 | 55 | $tmpGlobals = array(); |
56 | | - |
| 56 | + |
57 | 57 | $tmpGlobals['wgScript'] = '/index.php'; |
58 | 58 | $tmpGlobals['wgScriptPath'] = '/'; |
59 | 59 | $tmpGlobals['wgArticlePath'] = '/wiki/$1'; |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | 'hashLevels' => 2, |
70 | 70 | 'transformVia404' => false, |
71 | 71 | ); |
72 | | - |
| 72 | + |
73 | 73 | $tmpGlobals['wgEnableParserCache'] = false; |
74 | 74 | $tmpGlobals['wgHooks'] = $wgHooks; |
75 | 75 | $tmpGlobals['wgDeferredUpdateList'] = array(); |
— | — | @@ -87,8 +87,8 @@ |
88 | 88 | if ( $GLOBALS['wgStyleDirectory'] === false ) { |
89 | 89 | $tmpGlobals['wgStyleDirectory'] = "$IP/skins"; |
90 | 90 | } |
91 | | - |
92 | | - |
| 91 | + |
| 92 | + |
93 | 93 | foreach ( $tmpGlobals as $var => $val ) { |
94 | 94 | if ( array_key_exists( $var, $GLOBALS ) ) { |
95 | 95 | $this->savedInitialGlobals[$var] = $GLOBALS[$var]; |
— | — | @@ -96,30 +96,30 @@ |
97 | 97 | |
98 | 98 | $GLOBALS[$var] = $val; |
99 | 99 | } |
100 | | - |
| 100 | + |
101 | 101 | $this->savedWeirdGlobals['mw_namespace_protection'] = $wgNamespaceProtection[NS_MEDIAWIKI]; |
102 | 102 | $this->savedWeirdGlobals['image_alias'] = $wgNamespaceAliases['Image']; |
103 | 103 | $this->savedWeirdGlobals['image_talk_alias'] = $wgNamespaceAliases['Image_talk']; |
104 | | - |
| 104 | + |
105 | 105 | $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'; |
106 | 106 | $wgNamespaceAliases['Image'] = NS_FILE; |
107 | 107 | $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; |
108 | | - |
| 108 | + |
109 | 109 | } |
110 | | - |
| 110 | + |
111 | 111 | public function tearDown() { |
112 | | - |
| 112 | + |
113 | 113 | foreach ( $this->savedInitialGlobals as $var => $val ) { |
114 | 114 | $GLOBALS[$var] = $val; |
115 | 115 | } |
116 | | - |
| 116 | + |
117 | 117 | global $wgNamespaceProtection, $wgNamespaceAliases; |
118 | | - |
| 118 | + |
119 | 119 | $wgNamespaceProtection[NS_MEDIAWIKI] = $this->savedWeirdGlobals['mw_namespace_protection']; |
120 | 120 | $wgNamespaceAliases['Image'] = $this->savedWeirdGlobals['image_alias']; |
121 | 121 | $wgNamespaceAliases['Image_talk'] = $this->savedWeirdGlobals['image_talk_alias']; |
122 | 122 | } |
123 | | - |
| 123 | + |
124 | 124 | function addDBData() { |
125 | 125 | # Hack: insert a few Wikipedia in-project interwiki prefixes, |
126 | 126 | # for testing inter-language links |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | |
164 | 164 | |
165 | 165 | # Update certain things in site_stats |
166 | | - $this->db->insert( 'site_stats', |
| 166 | + $this->db->insert( 'site_stats', |
167 | 167 | array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ), |
168 | 168 | __METHOD__, |
169 | 169 | /** |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | |
183 | 183 | $user = User::newFromId( 0 ); |
184 | 184 | LinkCache::singleton()->clear(); # Avoids the odd failure at creating the nullRevision |
185 | | - |
| 185 | + |
186 | 186 | $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) ); |
187 | 187 | $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array( |
188 | 188 | 'size' => 12345, |
— | — | @@ -210,12 +210,12 @@ |
211 | 211 | ), $this->db->timestamp( '20010115123500' ), $user ); |
212 | 212 | |
213 | 213 | } |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
218 | 218 | //ParserTest setup/teardown functions |
219 | | - |
| 219 | + |
220 | 220 | /** |
221 | 221 | * Set up the global variables for a consistent environment for each test. |
222 | 222 | * Ideally this should replace the global configuration entirely. |
— | — | @@ -331,7 +331,7 @@ |
332 | 332 | # The entries saved into RepoGroup cache with previous globals will be wrong. |
333 | 333 | RepoGroup::destroySingleton(); |
334 | 334 | MessageCache::singleton()->destroyInstance(); |
335 | | - |
| 335 | + |
336 | 336 | global $wgUser; |
337 | 337 | $wgUser = new User(); |
338 | 338 | } |
— | — | @@ -361,14 +361,14 @@ |
362 | 362 | return $dir; |
363 | 363 | } |
364 | 364 | |
365 | | - wfMkdirParents( $dir . '/3/3a' ); |
| 365 | + wfMkdirParents( $dir . '/3/3a', null, __METHOD__ ); |
366 | 366 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
367 | | - wfMkdirParents( $dir . '/0/09' ); |
| 367 | + wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); |
368 | 368 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); |
369 | 369 | |
370 | 370 | return $dir; |
371 | 371 | } |
372 | | - |
| 372 | + |
373 | 373 | /** |
374 | 374 | * Restore default values and perform any necessary clean-up |
375 | 375 | * after each test runs. |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | foreach ( $this->savedGlobals as $var => $val ) { |
382 | 382 | $GLOBALS[$var] = $val; |
383 | 383 | } |
384 | | - |
| 384 | + |
385 | 385 | $this->teardownUploadDir( $this->uploadDir ); |
386 | 386 | } |
387 | 387 | |
— | — | @@ -452,7 +452,7 @@ |
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
456 | | - |
| 456 | + |
457 | 457 | public function parserTestProvider() { |
458 | 458 | if ( $this->file === false ) { |
459 | 459 | global $wgParserTestFiles; |
— | — | @@ -460,14 +460,14 @@ |
461 | 461 | } |
462 | 462 | return new TestFileIterator( $this->file, $this ); |
463 | 463 | } |
464 | | - |
| 464 | + |
465 | 465 | /** |
466 | 466 | * Set the file from whose tests will be run by this instance |
467 | 467 | */ |
468 | 468 | public function setParserTestFile( $filename ) { |
469 | 469 | $this->file = $filename; |
470 | 470 | } |
471 | | - |
| 471 | + |
472 | 472 | /** @dataProvider parserTestProvider */ |
473 | 473 | public function testParserTest( $desc, $input, $result, $opts, $config ) { |
474 | 474 | if ( !preg_match( '/' . $this->regex . '/', $desc ) ) return; //$this->markTestSkipped( 'Filtered out by the user' ); |
— | — | @@ -490,7 +490,7 @@ |
491 | 491 | $local = isset( $opts['local'] ); |
492 | 492 | $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null; |
493 | 493 | $parser = $this->getParser( $preprocessor ); |
494 | | - |
| 494 | + |
495 | 495 | $title = Title::newFromText( $titleText ); |
496 | 496 | |
497 | 497 | if ( isset( $opts['pst'] ) ) { |
— | — | @@ -541,30 +541,30 @@ |
542 | 542 | } |
543 | 543 | |
544 | 544 | $this->teardownGlobals(); |
545 | | - |
| 545 | + |
546 | 546 | $this->assertEquals( $result, $out, $desc ); |
547 | 547 | } |
548 | | - |
| 548 | + |
549 | 549 | /** |
550 | 550 | * Run a fuzz test series |
551 | 551 | * Draw input from a set of test files |
552 | 552 | */ |
553 | 553 | function testFuzzTests() { |
554 | | - |
| 554 | + |
555 | 555 | $this->markTestIncomplete( 'Breaks tesla due to memory restrictions' ); |
556 | | - |
| 556 | + |
557 | 557 | global $wgParserTestFiles; |
558 | | - |
| 558 | + |
559 | 559 | $files = $wgParserTestFiles; |
560 | | - |
| 560 | + |
561 | 561 | if( $this->getCliArg( 'file=' ) ) { |
562 | 562 | $files = array( $this->getCliArg( 'file=' ) ); |
563 | 563 | } |
564 | | - |
| 564 | + |
565 | 565 | $dict = $this->getFuzzInput( $files ); |
566 | 566 | $dictSize = strlen( $dict ); |
567 | 567 | $logMaxLength = log( $this->maxFuzzTestLength ); |
568 | | - |
| 568 | + |
569 | 569 | ini_set( 'memory_limit', $this->memoryLimit * 1048576 ); |
570 | 570 | |
571 | 571 | $user = new User; |
— | — | @@ -572,9 +572,9 @@ |
573 | 573 | $title = Title::makeTitle( NS_MAIN, 'Parser_test' ); |
574 | 574 | |
575 | 575 | $id = 1; |
576 | | - |
| 576 | + |
577 | 577 | while ( true ) { |
578 | | - |
| 578 | + |
579 | 579 | // Generate test input |
580 | 580 | mt_srand( ++$this->fuzzSeed ); |
581 | 581 | $totalLength = mt_rand( 1, $this->maxFuzzTestLength ); |
— | — | @@ -596,7 +596,7 @@ |
597 | 597 | $this->assertTrue( true, "Test $id, fuzz seed {$this->fuzzSeed}" ); |
598 | 598 | } catch ( Exception $exception ) { |
599 | 599 | $input_dump = sprintf( "string(%d) \"%s\"\n", strlen( $input ), $input ); |
600 | | - |
| 600 | + |
601 | 601 | $this->assertTrue( false, "Test $id, fuzz seed {$this->fuzzSeed}. \n\nInput: $input_dump\n\nError: {$exception->getMessage()}\n\nBacktrace: {$exception->getTraceAsString()}" ); |
602 | 602 | } |
603 | 603 | |
— | — | @@ -613,18 +613,18 @@ |
614 | 614 | foreach ( $memStats as $name => $usage ) { |
615 | 615 | $ret .= "$name: $usage\n"; |
616 | 616 | } |
617 | | - |
| 617 | + |
618 | 618 | throw new MWException( $ret ); |
619 | 619 | } |
620 | 620 | } |
621 | | - |
| 621 | + |
622 | 622 | $id++; |
623 | | - |
| 623 | + |
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
627 | 627 | //Various getter functions |
628 | | - |
| 628 | + |
629 | 629 | /** |
630 | 630 | * Get an input dictionary from a set of parser test files |
631 | 631 | */ |
— | — | @@ -642,7 +642,7 @@ |
643 | 643 | |
644 | 644 | return $dict; |
645 | 645 | } |
646 | | - |
| 646 | + |
647 | 647 | /** |
648 | 648 | * Get a memory usage breakdown |
649 | 649 | */ |
— | — | @@ -677,7 +677,7 @@ |
678 | 678 | |
679 | 679 | return $memStats; |
680 | 680 | } |
681 | | - |
| 681 | + |
682 | 682 | /** |
683 | 683 | * Get a Parser object |
684 | 684 | */ |
— | — | @@ -696,8 +696,8 @@ |
697 | 697 | |
698 | 698 | public function addArticle( $name, $text, $line ) { |
699 | 699 | self::$articles[$name] = $text; |
700 | | - } |
701 | | - |
| 700 | + } |
| 701 | + |
702 | 702 | public function publishTestArticles() { |
703 | 703 | if ( empty( self::$articles ) ) { |
704 | 704 | return; |
— | — | @@ -711,7 +711,7 @@ |
712 | 712 | } |
713 | 713 | } |
714 | 714 | } |
715 | | - |
| 715 | + |
716 | 716 | /** |
717 | 717 | * Steal a callback function from the primary parser, save it for |
718 | 718 | * application to our scary parser. If the hook is not installed, |
— | — | @@ -732,7 +732,7 @@ |
733 | 733 | return isset( $wgParser->mFunctionHooks[$name] ); |
734 | 734 | } |
735 | 735 | //Various "cleanup" functions |
736 | | - |
| 736 | + |
737 | 737 | /* |
738 | 738 | * Run the "tidy" command on text if the $wgUseTidy |
739 | 739 | * global is true |
— | — | @@ -749,7 +749,7 @@ |
750 | 750 | |
751 | 751 | return $text; |
752 | 752 | } |
753 | | - |
| 753 | + |
754 | 754 | /** |
755 | 755 | * Remove last character if it is a newline |
756 | 756 | */ |
— | — | @@ -767,7 +767,7 @@ |
768 | 768 | } |
769 | 769 | |
770 | 770 | //Test options parser functions |
771 | | - |
| 771 | + |
772 | 772 | protected function parseOptions( $instring ) { |
773 | 773 | $opts = array(); |
774 | 774 | // foo |
— | — | @@ -822,7 +822,7 @@ |
823 | 823 | } |
824 | 824 | return $opts; |
825 | 825 | } |
826 | | - |
| 826 | + |
827 | 827 | protected function cleanupOption( $opt ) { |
828 | 828 | if ( substr( $opt, 0, 1 ) == '"' ) { |
829 | 829 | return substr( $opt, 1, -1 ); |
— | — | @@ -833,7 +833,7 @@ |
834 | 834 | } |
835 | 835 | return $opt; |
836 | 836 | } |
837 | | - |
| 837 | + |
838 | 838 | /** |
839 | 839 | * Use a regex to find out the value of an option |
840 | 840 | * @param $key String: name of option val to retrieve |
Index: trunk/phase3/tests/phpunit/suites/UploadFromUrlTestSuite.php |
— | — | @@ -159,10 +159,10 @@ |
160 | 160 | return $dir; |
161 | 161 | } |
162 | 162 | |
163 | | - wfMkdirParents( $dir . '/3/3a' ); |
| 163 | + wfMkdirParents( $dir . '/3/3a', null, __METHOD__ ); |
164 | 164 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
165 | 165 | |
166 | | - wfMkdirParents( $dir . '/0/09' ); |
| 166 | + wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); |
167 | 167 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); |
168 | 168 | |
169 | 169 | return $dir; |
Index: trunk/phase3/tests/parser/parserTest.inc |
— | — | @@ -901,9 +901,9 @@ |
902 | 902 | return $dir; |
903 | 903 | } |
904 | 904 | |
905 | | - wfMkdirParents( $dir . '/3/3a' ); |
| 905 | + wfMkdirParents( $dir . '/3/3a', null, __METHOD__ ); |
906 | 906 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
907 | | - wfMkdirParents( $dir . '/0/09' ); |
| 907 | + wfMkdirParents( $dir . '/0/09', null, __METHOD__ ); |
908 | 908 | copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); |
909 | 909 | |
910 | 910 | return $dir; |
Index: trunk/phase3/includes/LocalisationCache.php |
— | — | @@ -869,7 +869,7 @@ |
870 | 870 | |
871 | 871 | public function startWrite( $code ) { |
872 | 872 | if ( !file_exists( $this->directory ) ) { |
873 | | - if ( !wfMkdirParents( $this->directory ) ) { |
| 873 | + if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) { |
874 | 874 | throw new MWException( "Unable to create the localisation store " . |
875 | 875 | "directory \"{$this->directory}\"" ); |
876 | 876 | } |
Index: trunk/phase3/includes/filerepo/FSRepo.php |
— | — | @@ -162,18 +162,18 @@ |
163 | 163 | * same contents as the source |
164 | 164 | */ |
165 | 165 | function storeBatch( $triplets, $flags = 0 ) { |
166 | | - wfDebug( __METHOD__ . ': Storing ' . count( $triplets ) . |
| 166 | + wfDebug( __METHOD__ . ': Storing ' . count( $triplets ) . |
167 | 167 | " triplets; flags: {$flags}\n" ); |
168 | | - |
| 168 | + |
169 | 169 | // Try creating directories |
170 | | - if ( !wfMkdirParents( $this->directory ) ) { |
| 170 | + if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) { |
171 | 171 | return $this->newFatal( 'upload_directory_missing', $this->directory ); |
172 | 172 | } |
173 | 173 | if ( !is_writable( $this->directory ) ) { |
174 | 174 | return $this->newFatal( 'upload_directory_read_only', $this->directory ); |
175 | 175 | } |
176 | | - |
177 | | - // Validate each triplet |
| 176 | + |
| 177 | + // Validate each triplet |
178 | 178 | $status = $this->newGood(); |
179 | 179 | foreach ( $triplets as $i => $triplet ) { |
180 | 180 | list( $srcPath, $dstZone, $dstRel ) = $triplet; |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | |
193 | 193 | // Create destination directories for this triplet |
194 | 194 | if ( !is_dir( $dstDir ) ) { |
195 | | - if ( !wfMkdirParents( $dstDir ) ) { |
| 195 | + if ( !wfMkdirParents( $dstDir, null, __METHOD__ ) ) { |
196 | 196 | return $this->newFatal( 'directorycreateerror', $dstDir ); |
197 | 197 | } |
198 | 198 | if ( $dstZone == 'deleted' ) { |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | | - // Resolve source |
| 203 | + // Resolve source |
204 | 204 | if ( self::isVirtualUrl( $srcPath ) ) { |
205 | 205 | $srcPath = $triplets[$i][0] = $this->resolveVirtualUrl( $srcPath ); |
206 | 206 | } |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | $status->fatal( 'filenotfound', $srcPath ); |
210 | 210 | continue; |
211 | 211 | } |
212 | | - |
| 212 | + |
213 | 213 | // Check overwriting |
214 | 214 | if ( !( $flags & self::OVERWRITE ) && file_exists( $dstPath ) ) { |
215 | 215 | if ( $flags & self::OVERWRITE_SAME ) { |
— | — | @@ -256,11 +256,11 @@ |
257 | 257 | $hashSource = sha1_file( $srcPath ); |
258 | 258 | $hashDest = sha1_file( $dstPath ); |
259 | 259 | wfRestoreWarnings(); |
260 | | - |
| 260 | + |
261 | 261 | if ( $hashDest === false || $hashSource !== $hashDest ) { |
262 | | - wfDebug( __METHOD__ . ': File copy validation failed: ' . |
| 262 | + wfDebug( __METHOD__ . ': File copy validation failed: ' . |
263 | 263 | "$srcPath ($hashSource) to $dstPath ($hashDest)\n" ); |
264 | | - |
| 264 | + |
265 | 265 | $status->error( 'filecopyerror', $srcPath, $dstPath ); |
266 | 266 | $good = false; |
267 | 267 | } |
— | — | @@ -276,12 +276,12 @@ |
277 | 277 | } |
278 | 278 | return $status; |
279 | 279 | } |
280 | | - |
| 280 | + |
281 | 281 | /** |
282 | 282 | * 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 |
284 | 284 | * ignores any errors that may occur |
285 | | - * |
| 285 | + * |
286 | 286 | * @param $pairs array List of files to delete |
287 | 287 | */ |
288 | 288 | function cleanupBatch( $files ) { |
— | — | @@ -293,14 +293,14 @@ |
294 | 294 | $path = "$root/$rel"; |
295 | 295 | } else { |
296 | 296 | if ( self::isVirtualUrl( $file ) ) { |
297 | | - // This is a virtual url, resolve it |
| 297 | + // This is a virtual url, resolve it |
298 | 298 | $path = $this->resolveVirtualUrl( $file ); |
299 | 299 | } else { |
300 | 300 | // This is a full file name |
301 | 301 | $path = $file; |
302 | 302 | } |
303 | 303 | } |
304 | | - |
| 304 | + |
305 | 305 | wfSuppressWarnings(); |
306 | 306 | unlink( $path ); |
307 | 307 | wfRestoreWarnings(); |
— | — | @@ -432,7 +432,7 @@ |
433 | 433 | */ |
434 | 434 | function publishBatch( $triplets, $flags = 0 ) { |
435 | 435 | // Perform initial checks |
436 | | - if ( !wfMkdirParents( $this->directory ) ) { |
| 436 | + if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) { |
437 | 437 | return $this->newFatal( 'upload_directory_missing', $this->directory ); |
438 | 438 | } |
439 | 439 | if ( !is_writable( $this->directory ) ) { |
— | — | @@ -457,10 +457,10 @@ |
458 | 458 | $dstDir = dirname( $dstPath ); |
459 | 459 | $archiveDir = dirname( $archivePath ); |
460 | 460 | // 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__ ) ) { |
462 | 462 | return $this->newFatal( 'directorycreateerror', $dstDir ); |
463 | 463 | } |
464 | | - if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir ) ) { |
| 464 | + if ( !is_dir( $archiveDir ) && !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) { |
465 | 465 | return $this->newFatal( 'directorycreateerror', $archiveDir ); |
466 | 466 | } |
467 | 467 | if ( !is_file( $srcPath ) ) { |
— | — | @@ -563,7 +563,7 @@ |
564 | 564 | $archivePath = "{$this->deletedDir}/$archiveRel"; |
565 | 565 | $archiveDir = dirname( $archivePath ); |
566 | 566 | if ( !is_dir( $archiveDir ) ) { |
567 | | - if ( !wfMkdirParents( $archiveDir ) ) { |
| 567 | + if ( !wfMkdirParents( $archiveDir, null, __METHOD__ ) ) { |
568 | 568 | $status->fatal( 'directorycreateerror', $archiveDir ); |
569 | 569 | continue; |
570 | 570 | } |
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -300,7 +300,7 @@ |
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | if ( !is_dir($localPath) ) { |
304 | | - if( !wfMkdirParents($localPath) ) { |
| 304 | + if( !wfMkdirParents( $localPath, null, __METHOD__ ) ) { |
305 | 305 | wfDebug( __METHOD__ . " could not create directory $localPath for thumb\n" ); |
306 | 306 | return $foreignUrl; |
307 | 307 | } |
Index: trunk/phase3/includes/installer/SqliteInstaller.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | # if it's still writable |
104 | 104 | if ( $create ) { |
105 | 105 | wfSuppressWarnings(); |
106 | | - $ok = wfMkdirParents( $dir, 0700 ); |
| 106 | + $ok = wfMkdirParents( $dir, 0700, __METHOD__ ); |
107 | 107 | wfRestoreWarnings(); |
108 | 108 | if ( !$ok ) { |
109 | 109 | return Status::newFatal( 'config-sqlite-mkdir-error', $dir ); |
Index: trunk/phase3/includes/media/SVG.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath ); |
92 | 92 | } |
93 | 93 | |
94 | | - if ( !wfMkdirParents( dirname( $dstPath ) ) ) { |
| 94 | + if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) { |
95 | 95 | return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, |
96 | 96 | wfMsg( 'thumbnail_dest_directory' ) ); |
97 | 97 | } |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | if ( is_array( $wgSVGConverters[$wgSVGConverter] ) ) { |
122 | 122 | // This is a PHP callable |
123 | 123 | $func = $wgSVGConverters[$wgSVGConverter][0]; |
124 | | - $args = array_merge( array( $srcPath, $dstPath, $width, $height ), |
| 124 | + $args = array_merge( array( $srcPath, $dstPath, $width, $height ), |
125 | 125 | array_slice( $wgSVGConverters[$wgSVGConverter], 1 ) ); |
126 | 126 | if ( !is_callable( $func ) ) { |
127 | 127 | throw new MWException( "$func is not callable" ); |
— | — | @@ -152,13 +152,13 @@ |
153 | 153 | } |
154 | 154 | return true; |
155 | 155 | } |
156 | | - |
| 156 | + |
157 | 157 | public static function rasterizeImagickExt( $srcPath, $dstPath, $width, $height ) { |
158 | 158 | $im = new Imagick( $srcPath ); |
159 | 159 | $im->setImageFormat( 'png' ); |
160 | 160 | $im->setBackgroundColor( 'transparent' ); |
161 | 161 | $im->setImageDepth( 8 ); |
162 | | - |
| 162 | + |
163 | 163 | if ( !$im->thumbnailImage( intval( $width ), intval( $height ), /* fit */ false ) ) { |
164 | 164 | return 'Could not resize image'; |
165 | 165 | } |
Index: trunk/phase3/includes/media/DjVu.php |
— | — | @@ -141,13 +141,13 @@ |
142 | 142 | return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page ); |
143 | 143 | } |
144 | 144 | |
145 | | - if ( !wfMkdirParents( dirname( $dstPath ) ) ) { |
| 145 | + if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) { |
146 | 146 | return new MediaTransformError( 'thumbnail_error', $width, $height, wfMsg( 'thumbnail_dest_directory' ) ); |
147 | 147 | } |
148 | 148 | |
149 | 149 | # Use a subshell (brackets) to aggregate stderr from both pipeline commands |
150 | 150 | # 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}" . |
152 | 152 | " -size={$params['physicalWidth']}x{$params['physicalHeight']} " . |
153 | 153 | wfEscapeShellArg( $srcPath ); |
154 | 154 | if ( $wgDjvuPostProcessor ) { |
Index: trunk/phase3/includes/media/Bitmap.php |
— | — | @@ -35,9 +35,9 @@ |
36 | 36 | wfDebug( __METHOD__ . ": Swapping width and height because the file will be rotated $rotation degrees\n" ); |
37 | 37 | |
38 | 38 | $swapDimensions = true; |
39 | | - list( $params['width'], $params['height'] ) = |
| 39 | + list( $params['width'], $params['height'] ) = |
40 | 40 | array( $params['width'], $params['height'] ); |
41 | | - list( $params['physicalWidth'], $params['physicalHeight'] ) = |
| 41 | + list( $params['physicalWidth'], $params['physicalHeight'] ) = |
42 | 42 | array( $params['physicalWidth'], $params['physicalHeight'] ); |
43 | 43 | } |
44 | 44 | } |
— | — | @@ -46,16 +46,16 @@ |
47 | 47 | if ( $params['physicalWidth'] >= $srcWidth ) { |
48 | 48 | if ( $swapDimensions ) { |
49 | 49 | $params['physicalWidth'] = $srcHeight; |
50 | | - $params['physicalHeight'] = $srcWidth; |
| 50 | + $params['physicalHeight'] = $srcWidth; |
51 | 51 | } else { |
52 | 52 | $params['physicalWidth'] = $srcWidth; |
53 | 53 | $params['physicalHeight'] = $srcHeight; |
54 | 54 | } |
55 | 55 | } |
56 | | - |
| 56 | + |
57 | 57 | # Skip scaling limit checks if no scaling is required |
58 | 58 | if ( !$image->mustRender() ) |
59 | | - return true; |
| 59 | + return true; |
60 | 60 | |
61 | 61 | # Don't thumbnail an image so big that it will fill hard drives and send servers into swap |
62 | 62 | # JPEG has the handy property of allowing thumbnailing without full decompression, so we make |
— | — | @@ -69,10 +69,10 @@ |
70 | 70 | |
71 | 71 | return true; |
72 | 72 | } |
73 | | - |
| 73 | + |
74 | 74 | /** |
75 | 75 | * Extracts the width/height if the image will be scaled before rotating |
76 | | - * |
| 76 | + * |
77 | 77 | * @param $params array Parameters as returned by normaliseParams |
78 | 78 | * @param $rotation int The rotation angle that will be applied |
79 | 79 | * @return array ($width, $height) array |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | } |
159 | 159 | |
160 | 160 | # Try to make a target path for the thumbnail |
161 | | - if ( !wfMkdirParents( dirname( $dstPath ) ) ) { |
| 161 | + if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) { |
162 | 162 | wfDebug( __METHOD__ . ": Unable to create thumbnail destination directory, falling back to client scaling\n" ); |
163 | 163 | return $this->getClientScalingThumbnailImage( $image, $scalerParams ); |
164 | 164 | } |
— | — | @@ -234,7 +234,7 @@ |
235 | 235 | } |
236 | 236 | |
237 | 237 | if ( $scaler != 'client' && $dstPath ) { |
238 | | - if ( !wfMkdirParents( dirname( $dstPath ) ) ) { |
| 238 | + if ( !wfMkdirParents( dirname( $dstPath, null, __METHOD__ ) ) ) { |
239 | 239 | # Unable to create a path for the thumbnail |
240 | 240 | return 'client'; |
241 | 241 | } |
— | — | @@ -312,7 +312,7 @@ |
313 | 313 | if ( strval( $wgImageMagickTempDir ) !== '' ) { |
314 | 314 | $env['MAGICK_TMPDIR'] = $wgImageMagickTempDir; |
315 | 315 | } |
316 | | - |
| 316 | + |
317 | 317 | $rotation = $this->getRotation( $image ); |
318 | 318 | list( $width, $height ) = $this->extractPreRotationDimensions( $params, $rotation ); |
319 | 319 | |
Index: trunk/phase3/includes/cache/HTMLFileCache.php |
— | — | @@ -184,8 +184,8 @@ |
185 | 185 | $mydir2 = substr($filename,0,strrpos($filename,'/')); # subdirectory level 2 |
186 | 186 | $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1 |
187 | 187 | |
188 | | - wfMkdirParents( $mydir1 ); |
189 | | - wfMkdirParents( $mydir2 ); |
| 188 | + wfMkdirParents( $mydir1, null, __METHOD__ ); |
| 189 | + wfMkdirParents( $mydir2, null, __METHOD__ ); |
190 | 190 | } |
191 | 191 | |
192 | 192 | public function saveToFileCache( $text ) { |
Index: trunk/phase3/includes/cache/MessageCache.php |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | global $wgCacheDirectory; |
178 | 178 | |
179 | 179 | $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code"; |
180 | | - wfMkdirParents( $wgCacheDirectory ); // might fail |
| 180 | + wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail |
181 | 181 | |
182 | 182 | wfSuppressWarnings(); |
183 | 183 | $file = fopen( $filename, 'w' ); |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | |
201 | 201 | $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code"; |
202 | 202 | $tempFilename = $filename . '.tmp'; |
203 | | - wfMkdirParents( $wgCacheDirectory ); // might fail |
| 203 | + wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail |
204 | 204 | |
205 | 205 | wfSuppressWarnings(); |
206 | 206 | $file = fopen( $tempFilename, 'w' ); |