r81883 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81882‎ | r81883 | r81884 >
Date:10:48, 10 February 2011
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Fix for r80992. Remove posix extension requisite. Made to work in non-Unix systems.
Replaced fseek+fwrite with ftruncate()
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/UploadTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/UploadTest.php
@@ -77,11 +77,10 @@
7878
7979 // Helper used to create an empty file of size $size.
8080 private function createFileOfSize( $size ) {
81 - $filename = '/tmp/mwuploadtest-' . posix_getpid() . '.txt' ;
 81+ $filename = tempnam( wfTempDir(), "mwuploadtest" );
8282
8383 $fh = fopen( $filename, 'w' );
84 - fseek( $fh, $size-1, SEEK_SET);
85 - fwrite( $fh, 0x00 );
 84+ ftruncate( $fh, $size );
8685 fclose( $fh );
8786
8887 return $filename;

Follow-up revisions

RevisionCommit summaryAuthorDate
r82017Follow up r81883. Readd the extension. This kind of breaks the tempnam() guar...platonides14:58, 12 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80992Test uploading a file of size $wgMaxUploadSize...hashar21:26, 25 January 2011

Comments

#Comment by Hashar (talk | contribs)   21:08, 10 February 2011

Thanks for cleaning up my mess. I should look at globalfunctions a bit more.

ftruncate() is a great and cleaner idea. Kudos!

Status & tagging log