|
@@ 456-468 (lines=13) @@
|
| 453 |
|
$full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
| 454 |
|
$file_type = ! empty($file_type) ? rtrim($file_type, ' ') . ' ' : ''; |
| 455 |
|
$folder = EEH_File::remove_filename_from_filepath($full_file_path); |
| 456 |
|
if (! EEH_File::verify_is_writable($folder, 'folder')) { |
| 457 |
|
if (defined('WP_DEBUG') && WP_DEBUG) { |
| 458 |
|
$msg = |
| 459 |
|
sprintf( |
| 460 |
|
__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), |
| 461 |
|
$file_type, |
| 462 |
|
$full_file_path |
| 463 |
|
); |
| 464 |
|
$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
| 465 |
|
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 466 |
|
} |
| 467 |
|
return false; |
| 468 |
|
} |
| 469 |
|
// load WP_Filesystem and set file permissions |
| 470 |
|
$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
| 471 |
|
// write the file |
|
@@ 734-747 (lines=14) @@
|
| 731 |
|
EEH_File::convert_local_filepath_to_remote_filepath($destination_file), |
| 732 |
|
$overwrite |
| 733 |
|
); |
| 734 |
|
if (! $copied) { |
| 735 |
|
if (defined('WP_DEBUG') && WP_DEBUG) { |
| 736 |
|
$msg = sprintf( |
| 737 |
|
__( |
| 738 |
|
'Attempted writing to file %1$s, but could not, probably because of permissions issues', |
| 739 |
|
'event_espresso' |
| 740 |
|
), |
| 741 |
|
$source_file |
| 742 |
|
); |
| 743 |
|
$msg .= EEH_File::_permissions_error_for_unreadable_filepath($source_file, 'f'); |
| 744 |
|
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 745 |
|
} |
| 746 |
|
return false; |
| 747 |
|
} |
| 748 |
|
return true; |
| 749 |
|
} |
| 750 |
|
|
|
@@ 889-901 (lines=13) @@
|
| 886 |
|
private static function validateFileForCopyOrMove($source_file) |
| 887 |
|
{ |
| 888 |
|
$full_source_path = EEH_File::standardise_directory_separators($source_file); |
| 889 |
|
if (! EEH_File::exists($full_source_path)) { |
| 890 |
|
if (defined('WP_DEBUG') && WP_DEBUG) { |
| 891 |
|
$msg = |
| 892 |
|
sprintf( |
| 893 |
|
__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), |
| 894 |
|
'', |
| 895 |
|
$full_source_path |
| 896 |
|
); |
| 897 |
|
$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
| 898 |
|
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 899 |
|
} |
| 900 |
|
return ''; |
| 901 |
|
} |
| 902 |
|
return $full_source_path; |
| 903 |
|
} |
| 904 |
|
|
|
@@ 915-926 (lines=12) @@
|
| 912 |
|
$full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
| 913 |
|
$folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
| 914 |
|
EEH_File::ensure_folder_exists_and_is_writable($folder); |
| 915 |
|
if (! EEH_File::verify_is_writable($folder, 'folder')) { |
| 916 |
|
if (defined('WP_DEBUG') && WP_DEBUG) { |
| 917 |
|
$msg = sprintf( |
| 918 |
|
__('The file located at "%2$s" is not writable.', 'event_espresso'), |
| 919 |
|
'', |
| 920 |
|
$full_dest_path |
| 921 |
|
); |
| 922 |
|
$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
| 923 |
|
EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 924 |
|
} |
| 925 |
|
return ''; |
| 926 |
|
} |
| 927 |
|
return $full_dest_path; |
| 928 |
|
} |
| 929 |
|
} |