Removes an attachment's files from S3.
public remove_attachment_files_from_s3 ( integer $post_id, array $s3object, boolean $remove_backup_sizes = true, boolean $log_error = false, boolean $return_on_error = false, boolean $force_new_s3_client = false ) | ||
$post_id | integer | |
$s3object | array | |
$remove_backup_sizes | boolean | remove previous edited image versions |
$log_error | boolean | |
$return_on_error | boolean | |
$force_new_s3_client | boolean | if we are deleting in bulk, force new S3 client to cope with possible different regions |
/** * Allow the WordPress Image Editor to remove edited version of images * if the original image is being restored and 'IMAGE_EDIT_OVERWRITE' is set * * @param int $post_id * @param array $s3object * @param string $prefix * @param array $args */ function image_editor_remove_files($post_id, $s3object, $prefix, $args) { if (isset($_POST['do']) && 'restore' == $_POST['do'] && defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) { $meta = get_post_meta($post_id, '_wp_attachment_metadata', true); $this->as3cf->remove_attachment_files_from_s3($post_id, $s3object, $meta['file']); } }
/** * Allow the WordPress Image Editor to remove edited version of images * if the original image is being restored and 'IMAGE_EDIT_OVERWRITE' is set * * @param int $post_id * @param array $s3object * @param string $prefix * @param array $args */ function image_editor_remove_files($post_id, $s3object, $prefix, $args) { if (!isset($_POST['do']) || 'restore' !== $_POST['do']) { return; } if (!defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE) { return; } $this->as3cf->remove_attachment_files_from_s3($post_id, $s3object, false); }