r105550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105549‎ | r105550 | r105551 >
Date:14:03, 8 December 2011
Author:hashar
Status:ok
Tags:
Comment:
clean some files when testing upload

This catch temporary uploaded files which are six characters long.

Follow-up r102458
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/api/ApiTestCaseUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/api/ApiTestCaseUpload.php
@@ -19,6 +19,10 @@
2020 $this->clearFakeUploads();
2121 }
2222
 23+ public function tearDown() {
 24+ $this->clearTempUpload();
 25+ }
 26+
2327 /**
2428 * Helper function -- remove files and associated articles by Title
2529 * @param $title Title: title to be removed
@@ -101,6 +105,15 @@
102106
103107 }
104108
 109+ function clearTempUpload() {
 110+ if( isset( $_FILES['file']['tmp_name'] ) ) {
 111+ $tmp = $_FILES['file']['tmp_name'];
 112+ if( file_exists( $tmp ) ) {
 113+ unlink( $tmp );
 114+ }
 115+ }
 116+ }
 117+
105118 /**
106119 * Remove traces of previous fake uploads
107120 */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102458Mark as FIXME. This three calls leak a png filename in sys_get_temp_dir() each,...platonides22:27, 8 November 2011

Status & tagging log