Merge "[FileBackend] Avoid stat call in getFileContents() for swift."
[lhc/web/wiklou.git] / includes / filebackend / TempFSFile.php
index ed6bf2f..5032bf6 100644 (file)
@@ -43,7 +43,7 @@ class TempFSFile extends FSFile {
         */
        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}";
@@ -54,7 +54,7 @@ class TempFSFile extends FSFile {
                                fclose( $newFileHandle );
                                break; // got it
                        }
-                       if ( $attempt >= 15 ) {
+                       if ( $attempt >= 5 ) {
                                wfProfileOut( __METHOD__ );
                                return null; // give up
                        }