Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2159,10 +2159,10 @@ |
2160 | 2160 | } |
2161 | 2161 | |
2162 | 2162 | /** |
2163 | | - * Tries to get the system directory for temporary files. For PHP >= 5.2.1, |
2164 | | - * we'll use sys_get_temp_dir(). The TMPDIR, TMP, and TEMP environment |
2165 | | - * variables are then checked in sequence, and if none are set /tmp is |
2166 | | - * returned as the generic Unix default. |
| 2163 | + * Tries to get the system directory for temporary files. The TMPDIR, TMP, and |
| 2164 | + * TEMP environment variables are then checked in sequence, and if none are set |
| 2165 | + * try sys_get_temp_dir() for PHP >= 5.2.1. All else fails, return /tmp for Unix |
| 2166 | + * or C:\Windows\Temp for Windows and hope for the best. |
2167 | 2167 | * It is common to call it with tempnam(). |
2168 | 2168 | * |
2169 | 2169 | * NOTE: When possible, use instead the tmpfile() function to create |
— | — | @@ -2171,17 +2171,17 @@ |
2172 | 2172 | * @return String |
2173 | 2173 | */ |
2174 | 2174 | function wfTempDir() { |
2175 | | - if( function_exists( 'sys_get_temp_dir' ) ) { |
2176 | | - return sys_get_temp_dir(); |
2177 | | - } |
2178 | 2175 | foreach( array( 'TMPDIR', 'TMP', 'TEMP' ) as $var ) { |
2179 | 2176 | $tmp = getenv( $var ); |
2180 | 2177 | if( $tmp && file_exists( $tmp ) && is_dir( $tmp ) && is_writable( $tmp ) ) { |
2181 | 2178 | return $tmp; |
2182 | 2179 | } |
2183 | 2180 | } |
| 2181 | + if( function_exists( 'sys_get_temp_dir' ) ) { |
| 2182 | + return sys_get_temp_dir(); |
| 2183 | + } |
2184 | 2184 | # Hope this is Unix of some kind! |
2185 | | - return '/tmp'; |
| 2185 | + return wfIsWindows() ? 'C:\Windows\Temp' : '/tmp'; |
2186 | 2186 | } |
2187 | 2187 | |
2188 | 2188 | /** |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -301,6 +301,8 @@ |
302 | 302 | revisions" on diffs when appropriate. |
303 | 303 | * (bug 23703) ForeignAPIRepo fails on findBySha1() when using a 1.14 install as |
304 | 304 | a repository due to missing 'name' attribute from the API list=allimages |
| 305 | +* (bug 24898) MediaWiki uses /tmp even if a vHost-specific tempdir is set, also |
| 306 | + make wfTempDir() return a sane value for Windows on worst-case |
305 | 307 | |
306 | 308 | === API changes in 1.17 === |
307 | 309 | * (bug 22738) Allow filtering by action type on query=logevent. |