attachment_id <= 0 ) { return new WP_Error( 'r2clouder_missing_attachment_id', __( 'The offload job has no attachment.', 'devsyed-media-offloader' ), array( 'permanent' => true ) ); } $offloader = new Offloader(); $result = $offloader->offload( $job->attachment_id, array( 'force' => (bool) $job->get( 'force', false ) ) ); return is_wp_error( $result ) ? $result : true; } /** * Removes the local copies of an offloaded attachment. * * @param Job $job Job to run. * @return true|WP_Error */ public static function cleanup( Job $job ) { if ( $job->attachment_id <= 0 ) { return new WP_Error( 'r2clouder_missing_attachment_id', __( 'The cleanup job has no attachment.', 'devsyed-media-offloader' ), array( 'permanent' => true ) ); } $offloader = new Offloader(); return $offloader->cleanup_local( $job->attachment_id ); } }