public/wordpress/wp-content/plugins/backupbuddy/classes/housekeeping.php
/* s32_cancel_multipart_pieces()
	 *
	 * Note: Cannot cleanup both s32 & s33 type desinations togetehr because of Amazon library
	 * conflicts. First check whether we have both any s32 or s33 type destinations  - if not then
	 * there is no problem as we have nothing to do anyway. if we do then as this is a periodic
	 * process we randomy choose which type of destination to clean up this invocation.
	 *
	 */
s32_cancel_multipart_pieces()
Note: Cannot cleanup both s32 & s33 type desinations togetehr because of Amazon library
conflicts. First check whether we have both any s32 or s33 type destinations  - if not then
there is no problem as we have nothing to do anyway. if we do then as this is a periodic
process we randomy choose which type of destination to clean up this invocation.
s32_cancel_multipart_pieces () Note : Cannot cleanup both s32 & s33 type desinations togetehr because of Amazon library conflicts . First check whether we have both any s32 or s33 type destinations - if not then there is no problem as we have nothing to do anyway . if we do then as this is a periodic process we randomy choose which type of destination to clean up this invocation .
public static function s32_cancel_multipart_pieces() {
		$s3x_destination = array( 'types' => array( 's32', 's33' ), 'present' => array() );
		foreach( pb_backupbuddy::$options[ 'remote_destinations' ] as $destination ) {
			if ( in_array( $destination[ 'type' ], $s3x_destination[ 'types' ] ) &&
			     !in_array( $destination[ 'type' ], $s3x_destination[ 'present' ] ) ) {
				$s3x_destination[ 'present' ][] = $destination[ 'type' ];
			}
		}
		if ( !empty( $s3x_destination[ 'present' ]) ) {
			$s3x_destination_type = $s3x_destination[ 'present' ][ rand( 0, ( count( $s3x_destination[ 'present' ] ) - 1 ) ) ];
			foreach( pb_backupbuddy::$options['remote_destinations'] as $destination ) {
				if ( $destination['type'] != $s3x_destination_type ) {
					continue;
				}
				pb_backupbuddy::status( 'details', 'Found ' . $destination[ 'title' ] . ' (' . $s3x_destination_type . ') Multipart Chunking Destination to cleanup.' );
				require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' );
				$cleanup_result = pb_backupbuddy_destinations::multipart_cleanup( $destination );
				if ( true === $cleanup_result ) {
					pb_backupbuddy::status( 'details', $destination[ 'title' ] . ' (' . $s3x_destination_type . ') Multipart Chunking Destination Cleanup Success.' );
				} else {
					pb_backupbuddy::status( 'warning', 'Warning #2389328: ' . $destination[ 'title' ] . ' (' .$s3x_destination_type . ') Multipart Chunking Destination Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.' );
				}
			}
		}
	}
public static function s32_cancel_multipart_pieces ( ) { $ s3x_destination = array ( 'types' => array ( 's32' , 's33' ) , 'present' => array ( ) ) ; foreach ( pb_backupbuddy :: $ options [ 'remote_destinations' ] as $ destination ) { if ( in_array ( $ destination [ 'type' ] , $ s3x_destination [ 'types' ] ) && ! in_array ( $ destination [ 'type' ] , $ s3x_destination [ 'present' ] ) ) { $ s3x_destination [ 'present' ] [ ] = $ destination [ 'type' ] ; } } if ( ! empty ( $ s3x_destination [ 'present' ] ) ) { $ s3x_destination_type = $ s3x_destination [ 'present' ] [ rand ( 0 , ( count ( $ s3x_destination [ 'present' ] ) - 1 ) ) ] ; foreach ( pb_backupbuddy :: $ options [ 'remote_destinations' ] as $ destination ) { if ( $ destination [ 'type' ] != $ s3x_destination_type ) { continue ; } pb_backupbuddy :: status ( 'details' , 'Found ' . $ destination [ 'title' ] . ' (' . $ s3x_destination_type . ') Multipart Chunking Destination to cleanup.' ) ; require_once ( pb_backupbuddy :: plugin_path ( ) . '/destinations/bootstrap.php' ) ; $ cleanup_result = pb_backupbuddy_destinations :: multipart_cleanup ( $ destination ) ; if ( true === $ cleanup_result ) { pb_backupbuddy :: status ( 'details' , $ destination [ 'title' ] . ' (' . $ s3x_destination_type . ') Multipart Chunking Destination Cleanup Success.' ) ; } else { pb_backupbuddy :: status ( 'warning' , 'Warning #2389328: ' . $ destination [ 'title' ] . ' (' . $ s3x_destination_type . ') Multipart Chunking Destination Cleanup FAILURE. Manually cleanup stalled multipart send via S3 or try again later.' ) ; } } } }
s32_cancel_multipart_pieces()
 Note: Cannot cleanup both s32 & s33 type desinations togetehr because of Amazon library
 conflicts.
s32_cancel_multipart_pieces () Note : Cannot cleanup both s32 & s33 type desinations togetehr because of Amazon library conflicts .
// Derive which s3x types destinations are present (only record each type once) // If we have no s3x type destinations then nothing to do // We have s3x types destinations - decide which to process this time // Randomly choose a destination type from those present to process by // generating a random aray index to select which type from those present.