32 $ext = ( $extension !=
'' ) ?
".{$extension}" :
'';
33 $tmpDirectory = $this->tmpDirectory;
34 if ( !is_string( $tmpDirectory ) ) {
35 $tmpDirectory = TempFSFile::getUsableTempDirectory();
39 while ( $attempts-- ) {
40 $hex = sprintf(
'%06x%06x', mt_rand( 0, 0xffffff ), mt_rand( 0, 0xffffff ) );
41 $path =
"$tmpDirectory/$prefix$hex$ext";
42 AtEase::suppressWarnings();
43 $newFileHandle = fopen(
$path,
'x' );
44 AtEase::restoreWarnings();
45 if ( $newFileHandle ) {
46 fclose( $newFileHandle );
48 $tmpFile->autocollect();