From c7767c9808e74f3e747f346c7a04daa66d90eb61 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 27 May 2009 00:56:32 +0000 Subject: [PATCH] Fix unlink warning. see #9936 git-svn-id: https://develop.svn.wordpress.org/trunk@11465 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/file.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 2431e2f2cb..61f3e8a0d3 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -631,10 +631,12 @@ function get_filesystem_method($args = array()) { if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ $temp_file_name = ABSPATH . '.' . time(); $temp_handle = @fopen($temp_file_name, 'w'); - if ( $temp_handle && getmyuid() == fileowner($temp_file_name) ) - $method = 'direct'; - @fclose($temp_handle); - unlink($temp_file_name); + if ( $temp_handle ) { + if ( getmyuid() == fileowner($temp_file_name) ) + $method = 'direct'; + @fclose($temp_handle); + unlink($temp_file_name); + } } if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2';