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()
This commit is contained in:
parent
6e7dfac65a
commit
f5b45904e1
1 changed files with 19 additions and 0 deletions
|
|
@ -5,11 +5,17 @@
|
|||
*/
|
||||
class ExifRotationTest extends MediaWikiTestCase {
|
||||
|
||||
/** track directories creations. Content will be deleted. */
|
||||
private $createdDirs = array();
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->handler = new BitmapHandler();
|
||||
$filePath = dirname( __FILE__ ) . '/../../data/media';
|
||||
|
||||
$tmpDir = wfTempDir() . '/exif-test-' . time() . '-' . mt_rand();
|
||||
$this->createdDirs[] = $tmpDir;
|
||||
|
||||
$this->repo = new FSRepo( array(
|
||||
'name' => 'temp',
|
||||
'url' => 'http://localhost/thumbtest',
|
||||
|
|
@ -30,10 +36,23 @@ class ExifRotationTest extends MediaWikiTestCase {
|
|||
$this->oldAuto = $wgEnableAutoRotation;
|
||||
$wgEnableAutoRotation = true;
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
global $wgShowEXIF, $wgEnableAutoRotation;
|
||||
$wgShowEXIF = $this->show;
|
||||
$wgEnableAutoRotation = $this->oldAuto;
|
||||
|
||||
$this->tearDownFiles();
|
||||
}
|
||||
|
||||
private function tearDownFiles() {
|
||||
foreach( $this->createdDirs as $dir ) {
|
||||
wfRecursiveRemoveDir( $dir );
|
||||
}
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->tearDownFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue