Make WordPress Core

Changeset 7058


Ignore:
Timestamp:
02/27/2008 12:47:15 AM (17 years ago)
Author:
ryan
Message:

get_temp_dir(). fixes #5984

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r7055 r7058  
    4141
    4242    return $real_file;
     43}
     44
     45function get_temp_dir() {
     46    if ( defined('WP_TEMP_DIR') )
     47        return trailingslashit(WP_TEMP_DIR);
     48
     49    $temp = ABSPATH . 'wp-content/';
     50    if ( is_dir($temp) && is_writable($temp) )
     51        return $temp;
     52
     53    if  ( function_exists('sys_get_temp_dir') )
     54        return trailingslashit(sys_get_temp_dir());
     55
     56    return '/tmp/';
    4357}
    4458
     
    183197        return false;
    184198
    185     $tmpfname = tempnam('/tmp', 'wpupdate');
     199    $tmpfname = tempnam(get_temp_dir(), 'wpupdate');
    186200    if( ! $tmpfname )
    187201        return false;
     
    289303
    290304function get_filesystem_method() {
    291     $tempFile = tempnam('/tmp', 'WPU');
     305    $tempFile = tempnam(get_temp_dir(), 'WPU');
    292306
    293307    if ( getmyuid() == fileowner($tempFile) ) {
Note: See TracChangeset for help on using the changeset viewer.