*/
public static function factory( $prefix, $extension = '' ) {
wfProfileIn( __METHOD__ );
- $base = wfTempDir() . '/' . $prefix . dechex( mt_rand( 0, 99999999 ) );
+ $base = wfTempDir() . '/' . $prefix . wfRandomString( 12 );
$ext = ( $extension != '' ) ? ".{$extension}" : "";
for ( $attempt = 1; true; $attempt++ ) {
$path = "{$base}-{$attempt}{$ext}";
fclose( $newFileHandle );
break; // got it
}
- if ( $attempt >= 15 ) {
+ if ( $attempt >= 5 ) {
wfProfileOut( __METHOD__ );
return null; // give up
}