Changeset 14016 for trunk/wp-admin/includes/file.php
- Timestamp:
- 04/06/2010 11:20:51 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/file.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r13994 r14016 150 150 */ 151 151 function get_temp_dir() { 152 static $temp; 152 153 if ( defined('WP_TEMP_DIR') ) 153 154 return trailingslashit(WP_TEMP_DIR); 155 156 if ( $temp ) 157 return trailingslashit($temp); 154 158 155 159 $temp = WP_CONTENT_DIR . '/'; … … 157 161 return $temp; 158 162 159 if ( function_exists('sys_get_temp_dir') ) 160 return trailingslashit(sys_get_temp_dir()); 163 if ( function_exists('sys_get_temp_dir') ) { 164 $temp = sys_get_temp_dir(); 165 if ( is_writable($temp) ) 166 return trailingslashit($temp); 167 } 161 168 162 169 $temp = ini_get('upload_tmp_dir'); 163 if ( is_dir($temp) ) // always writable170 if ( is_dir($temp) && is_writable($temp) ) 164 171 return trailingslashit($temp); 165 172 166 return '/tmp/'; 173 $temp = '/tmp/'; 174 return $temp; 167 175 } 168 176 … … 180 188 * @return string a writable filename 181 189 */ 182 function wp_tempnam($filename = '', $dir = '') {190 function wp_tempnam($filename = '', $dir = '') { 183 191 if ( empty($dir) ) 184 192 $dir = get_temp_dir(); … … 604 612 605 613 if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) 606 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $ file['filename']);614 return new WP_Error('copy_failed', __('Could not copy file.'), $to . $info['filename']); 607 615 } 608 616
Note: See TracChangeset
for help on using the changeset viewer.