public/wordpress/wp-content/plugins/backupbuddy/destinations/s33/init.php
/* deleteFiles()
	 *
	 * true success deleting all files else string error message.
	 *
	 */
deleteFiles()
true success deleting all files else string error message.
deleteFiles () true success deleting all files else string error message .
public static function deleteFiles( $settings, $files = array() ) {
		$settings = self::_init( $settings );
		if ( ! is_array( $files ) ) {
			$files = array( $files );
		}
		$fileKeys = array();
		foreach( (array)$files as $file ) {
			$path = rtrim( $settings['directory'], '/\\' );
			$path = ( empty( $path ) ) ? $path : ( $path . '/' );
			$fileKeys[] = array(
				'Key' => ( $path . ltrim( $file, '/\\' ) ),
			);
		}
		try {
			$response = self::$_client->deleteObjects( array(
				'Bucket' => $settings['bucket'],
				'Delete' => array(
					'Objects' => $fileKeys
				),
			) ); 
		} Catch( Exception $e ) {
			$error = 'Error #83823233393b: Unable to delete one or more files. Details: `' . $e->getMessage() . '`.';
			self::_error( $error );
			return $error;
		}
		$error = '';
		if ( isset( $response['Errors'] ) ) {
			foreach( $response['Errors'] as $responseError ) {
				$error .= $responseError['Message'];
			}
			pb_backupbuddy::status( 'error', $error );
			return $error;
		}
		return true;
	}
public static function deleteFiles ( $ settings , $ files = array ( ) ) { $ settings = self :: _init ( $ settings ) ; if ( ! is_array ( $ files ) ) { $ files = array ( $ files ) ; } $ fileKeys = array ( ) ; foreach ( ( array ) $ files as $ file ) { $ path = rtrim ( $ settings [ 'directory' ] , '/\\' ) ; $ path = ( empty ( $ path ) ) ? $ path : ( $ path . '/' ) ; $ fileKeys [ ] = array ( 'Key' => ( $ path . ltrim ( $ file , '/\\' ) ) , ) ; } try { $ response = self :: $ _client -> deleteObjects ( array ( 'Bucket' => $ settings [ 'bucket' ] , 'Delete' => array ( 'Objects' => $ fileKeys ) , ) ) ; } Catch ( Exception $ e ) { $ error = 'Error #83823233393b: Unable to delete one or more files. Details: `' . $ e -> getMessage ( ) . '`.' ; self :: _error ( $ error ) ; return $ error ; } $ error = '' ; if ( isset ( $ response [ 'Errors' ] ) ) { foreach ( $ response [ 'Errors' ] as $ responseError ) { $ error .= $ responseError [ 'Message' ] ; } pb_backupbuddy :: status ( 'error' , $ error ) ; return $ error ; } return true ; }
deleteFiles()
 true success deleting all files else string error message.
deleteFiles () true success deleting all files else string error message .
// list all the files in the subscriber account