public/wordpress/wp-content/plugins/backupbuddy/classes/housekeeping.php
/* remove_temp_tables()
	 *
	 * Deletes any temporary BackupBuddy tables used by deployment or rollback functionality. Tables prefixed with bbold- or bbnew-.
	 *
	 * @param	string	$forceSerial	Optional. If provided then this only this serial will be cleaned up AND it will be cleaned up now regardless of its age.
	 * @return	null
	 */
remove_temp_tables()
Deletes any temporary BackupBuddy tables used by deployment or rollback functionality. Tables prefixed with bbold- or bbnew-.

@param       string  $forceSerial    Optional. If provided then this only this serial will be cleaned up AND it will be cleaned up now regardless of its age.
@return      null
remove_temp_tables () Deletes any temporary BackupBuddy tables used by deployment or rollback functionality . Tables prefixed with bbold - or bbnew - . @param string $forceSerial Optional . If provided then this only this serial will be cleaned up AND it will be cleaned up now regardless of its age . @return null
public static function remove_temp_tables( $forceSerial = '', $backup_age_limit = 0 ) {
		global $wpdb;
		if ( '' != $forceSerial ) {
			$cleanups = array( $forceSerial => 0 );
		} else {
			$cleanups = pb_backupbuddy::$options['rollback_cleanups'];
		}
		$possible_orphans = $wpdb->get_results('SELECT table_name, create_time FROM information_schema.tables WHERE table_name LIKE "bbold%" OR table_name LIKE "bbnew%"');
		foreach( (array) $possible_orphans as $possible_orphan ) {
			$serial = substr( $possible_orphan->table_name, 6, 4 );
			if ( empty( $forceSerial ) && ! isset( $cleanups[$serial] ) ) {
				$create_time = mysql2date( 'U', $possible_orphan->create_time );
				if ( ( time() - $create_time ) > $backup_age_limit ) {
					$cleanups[$serial] = $create_time;
				}
			}
		}
		foreach( $cleanups as $cleanup_serial => $start_time ) {
			$results = $wpdb->get_results( "SELECT table_name FROM information_schema.tables WHERE ( ( table_name LIKE 'bbnew-" . substr( $cleanup_serial, 0, 4 ) . "\_%' ) OR ( table_name LIKE 'bbold-" . substr( $cleanup_serial, 0, 4 ) . "\_%' ) ) AND table_schema = DATABASE()", ARRAY_A );
			if ( count( $results ) > 0 ) {
				foreach( $results as $result ) {
					if ( false === $wpdb->query( "DROP TABLE `" . backupbuddy_core::dbEscape( $result['table_name'] ) . "`" ) ) {
						pb_backupbuddy::status( 'error', 'Error #343344683: Unable to remove stale old temp table `' . $result['table_name'] . '`. Details: `' . $wpdb->last_error . '`.' );
						return false;
					}
				}
			}
			unset( pb_backupbuddy::$options['rollback_cleanups'][ $cleanup_serial ] );
			pb_backupbuddy::save();
		} 
		$undoFiles = glob( ABSPATH . 'backupbuddy_deploy_undo-*.php' );
		if ( ! is_array( $undoFiles ) ) {
			$undoFiles = array();
		}
		foreach( $undoFiles as $undoFile ) {
			@unlink( $undoFile );
		}
		return;
	}
public static function remove_temp_tables ( $ forceSerial = '' , $ backup_age_limit = 0 ) { global $ wpdb ; if ( '' != $ forceSerial ) { $ cleanups = array ( $ forceSerial => 0 ) ; } else { $ cleanups = pb_backupbuddy :: $ options [ 'rollback_cleanups' ] ; } $ possible_orphans = $ wpdb -> get_results ( 'SELECT table_name, create_time FROM information_schema.tables WHERE table_name LIKE "bbold%" OR table_name LIKE "bbnew%"' ) ; foreach ( ( array ) $ possible_orphans as $ possible_orphan ) { $ serial = substr ( $ possible_orphan -> table_name , 6 , 4 ) ; if ( empty ( $ forceSerial ) && ! isset ( $ cleanups [ $ serial ] ) ) { $ create_time = mysql2date ( 'U' , $ possible_orphan -> create_time ) ; if ( ( time ( ) - $ create_time ) > $ backup_age_limit ) { $ cleanups [ $ serial ] = $ create_time ; } } } foreach ( $ cleanups as $ cleanup_serial => $ start_time ) { $ results = $ wpdb -> get_results ( " SELECT table_name FROM information_schema.tables WHERE ( ( table_name LIKE 'bbnew- " . substr ( $ cleanup_serial , 0 , 4 ) . " \_%' ) OR ( table_name LIKE 'bbold- " . substr ( $ cleanup_serial , 0 , 4 ) . " \_%' ) ) AND table_schema = DATABASE() " , ARRAY_A ) ; if ( count ( $ results ) > 0 ) { foreach ( $ results as $ result ) { if ( false === $ wpdb -> query ( " DROP TABLE ` " . backupbuddy_core :: dbEscape ( $ result [ 'table_name' ] ) . " ` " ) ) { pb_backupbuddy :: status ( 'error' , 'Error #343344683: Unable to remove stale old temp table `' . $ result [ 'table_name' ] . '`. Details: `' . $ wpdb -> last_error . '`.' ) ; return false ; } } } unset ( pb_backupbuddy :: $ options [ 'rollback_cleanups' ] [ $ cleanup_serial ] ) ; pb_backupbuddy :: save ( ) ; } $ undoFiles = glob ( ABSPATH . 'backupbuddy_deploy_undo-*.php' ) ; if ( ! is_array ( $ undoFiles ) ) { $ undoFiles = array ( ) ; } foreach ( $ undoFiles as $ undoFile ) { @ unlink ( $ undoFile ) ; } return ; }
remove_temp_tables()
 Deletes any temporary BackupBuddy tables used by deployment or rollback functionality.
remove_temp_tables () Deletes any temporary BackupBuddy tables used by deployment or rollback functionality .
// Check for orphaned tables // end foreach. // Delete any undo PHP files.