r112327 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112326‎ | r112327 | r112328 >
Date:15:43, 24 February 2012
Author:hashar
Status:ok
Tags:
Comment:
avoid exif tests file leakage

Exif test are leaking files heavily on our test server. This quick patch make
it sure we delete temporary files.

Ideally, we should have something like a temporary filesystem backend that
would self destruct :-D

requires r112326: wfRecursiveRemoveDir()
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/media/ExifRotationTest.php
@@ -5,11 +5,17 @@
66 */
77 class ExifRotationTest extends MediaWikiTestCase {
88
 9+ /** track directories creations. Content will be deleted. */
 10+ private $createdDirs = array();
 11+
912 function setUp() {
1013 parent::setUp();
1114 $this->handler = new BitmapHandler();
1215 $filePath = dirname( __FILE__ ) . '/../../data/media';
 16+
1317 $tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand();
 18+ $this->createdDirs[] = $tmpDir;
 19+
1420 $this->repo = new FSRepo( array(
1521 'name' => 'temp',
1622 'url' => 'http://localhost/thumbtest',
@@ -30,12 +36,25 @@
3137 $this->oldAuto = $wgEnableAutoRotation;
3238 $wgEnableAutoRotation = true;
3339 }
 40+
3441 public function tearDown() {
3542 global $wgShowEXIF, $wgEnableAutoRotation;
3643 $wgShowEXIF = $this->show;
3744 $wgEnableAutoRotation = $this->oldAuto;
 45+
 46+ $this->tearDownFiles();
3847 }
3948
 49+ private function tearDownFiles() {
 50+ foreach( $this->createdDirs as $dir ) {
 51+ wfRecursiveRemoveDir( $dir );
 52+ }
 53+ }
 54+
 55+ function __destruct() {
 56+ $this->tearDownFiles();
 57+ }
 58+
4059 /**
4160 *
4261 * @dataProvider providerFiles

Follow-up revisions

RevisionCommit summaryAuthorDate
r112354MFT to REL1_19 fix tests leaking files...hashar20:38, 24 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112326move wfRecursiveRemoveDir to global functions...hashar15:41, 24 February 2012

Status & tagging log