Index: branches/REL1_19/phase3/tests/phpunit/includes/filerepo/FileBackendTest.php |
— | — | @@ -200,6 +200,7 @@ |
201 | 201 | $this->backend = $this->multiBackend; |
202 | 202 | $this->tearDownFiles(); |
203 | 203 | $this->doTestStore( $op ); |
| 204 | + $this->filesToPrune[] = $op['src']; # avoid file leaking |
204 | 205 | $this->tearDownFiles(); |
205 | 206 | } |
206 | 207 | |
— | — | @@ -662,6 +663,7 @@ |
663 | 664 | $this->backend = $this->multiBackend; |
664 | 665 | $this->tearDownFiles(); |
665 | 666 | $this->doTestConcatenate( $op, $srcs, $srcsContent, $alreadyExists, $okStatus ); |
| 667 | + $this->filesToPrune[] = $op['dst']; # avoid file leaking |
666 | 668 | $this->tearDownFiles(); |
667 | 669 | } |
668 | 670 | |
Index: branches/REL1_19/phase3/tests/phpunit/includes/media/ExifRotationTest.php |
— | — | @@ -5,11 +5,17 @@ |
6 | 6 | */ |
7 | 7 | class ExifRotationTest extends MediaWikiTestCase { |
8 | 8 | |
| 9 | + /** track directories creations. Content will be deleted. */ |
| 10 | + private $createdDirs = array(); |
| 11 | + |
9 | 12 | function setUp() { |
10 | 13 | parent::setUp(); |
11 | 14 | $this->handler = new BitmapHandler(); |
12 | 15 | $filePath = dirname( __FILE__ ) . '/../../data/media'; |
| 16 | + |
13 | 17 | $tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand(); |
| 18 | + $this->createdDirs[] = $tmpDir; |
| 19 | + |
14 | 20 | $this->repo = new FSRepo( array( |
15 | 21 | 'name' => 'temp', |
16 | 22 | 'url' => 'http://localhost/thumbtest', |
— | — | @@ -30,12 +36,25 @@ |
31 | 37 | $this->oldAuto = $wgEnableAutoRotation; |
32 | 38 | $wgEnableAutoRotation = true; |
33 | 39 | } |
| 40 | + |
34 | 41 | public function tearDown() { |
35 | 42 | global $wgShowEXIF, $wgEnableAutoRotation; |
36 | 43 | $wgShowEXIF = $this->show; |
37 | 44 | $wgEnableAutoRotation = $this->oldAuto; |
| 45 | + |
| 46 | + $this->tearDownFiles(); |
38 | 47 | } |
39 | 48 | |
| 49 | + private function tearDownFiles() { |
| 50 | + foreach( $this->createdDirs as $dir ) { |
| 51 | + wfRecursiveRemoveDir( $dir ); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + function __destruct() { |
| 56 | + $this->tearDownFiles(); |
| 57 | + } |
| 58 | + |
40 | 59 | /** |
41 | 60 | * |
42 | 61 | * @dataProvider providerFiles |
Index: branches/REL1_19/phase3/includes/SeleniumWebSettings.php |
— | — | @@ -201,21 +201,3 @@ |
202 | 202 | $testUploadPath = getTestUploadPathFromResourceName( $testResourceName ); |
203 | 203 | $wgUploadPath = $testUploadPath; |
204 | 204 | } |
205 | | - |
206 | | -function wfRecursiveRemoveDir( $dir ) { |
207 | | - // taken from http://de3.php.net/manual/en/function.rmdir.php#98622 |
208 | | - if ( is_dir( $dir ) ) { |
209 | | - $objects = scandir( $dir ); |
210 | | - foreach ( $objects as $object ) { |
211 | | - if ( $object != "." && $object != ".." ) { |
212 | | - if ( filetype( $dir . '/' . $object ) == "dir" ) { |
213 | | - wfRecursiveRemoveDir( $dir . '/' . $object ); |
214 | | - } else { |
215 | | - unlink( $dir . '/' . $object ); |
216 | | - } |
217 | | - } |
218 | | - } |
219 | | - reset( $objects ); |
220 | | - rmdir( $dir ); |
221 | | - } |
222 | | -} |
\ No newline at end of file |
Index: branches/REL1_19/phase3/includes/GlobalFunctions.php |
— | — | @@ -2589,6 +2589,29 @@ |
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | /** |
| 2593 | + * Remove a directory and all its content. |
| 2594 | + * Does not hide error. |
| 2595 | + */ |
| 2596 | +function wfRecursiveRemoveDir( $dir ) { |
| 2597 | + wfDebug( __FUNCTION__ . "( $dir )\n" ); |
| 2598 | + // taken from http://de3.php.net/manual/en/function.rmdir.php#98622 |
| 2599 | + if ( is_dir( $dir ) ) { |
| 2600 | + $objects = scandir( $dir ); |
| 2601 | + foreach ( $objects as $object ) { |
| 2602 | + if ( $object != "." && $object != ".." ) { |
| 2603 | + if ( filetype( $dir . '/' . $object ) == "dir" ) { |
| 2604 | + wfRecursiveRemoveDir( $dir . '/' . $object ); |
| 2605 | + } else { |
| 2606 | + unlink( $dir . '/' . $object ); |
| 2607 | + } |
| 2608 | + } |
| 2609 | + } |
| 2610 | + reset( $objects ); |
| 2611 | + rmdir( $dir ); |
| 2612 | + } |
| 2613 | +} |
| 2614 | + |
| 2615 | +/** |
2593 | 2616 | * @param $nr Mixed: the number to format |
2594 | 2617 | * @param $acc Integer: the number of digits after the decimal point, default 2 |
2595 | 2618 | * @param $round Boolean: whether or not to round the value, default true |
Property changes on: branches/REL1_19/phase3/includes/GlobalFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2596 | 2619 | Merged /trunk/phase3/includes/GlobalFunctions.php:r112326-112327,112352 |