backupbuddy_backup/wp-content/plugins/backupbuddy/classes/backup.php
/*	backup_create_database_dump()
	 *	
	 *	Prepares configuration and passes to the mysqlbuddy library to handle backing up the database.
	 *	Automatically handles falling back to compatibility modes.
	 *	
	 *	@return		boolean				True on success; false otherwise.
	 */


Prepares configuration and passes to the mysqlbuddy library to handle backing up the database.
Automatically handles falling back to compatibility modes.

@return         boolean                         True on success; false otherwise.
Prepares configuration and passes to the mysqlbuddy library to handle backing up the database . Automatically handles falling back to compatibility modes . @return boolean True on success ; false otherwise .
function backup_create_database_dump( $tables, $rows_start = 0 ) {
		pb_backupbuddy::status( 'milestone', 'start_database' );
		pb_backupbuddy::status( 'message', __('Starting database backup process.', 'it-l10n-backupbuddy' ) );
		if ( 'php' == pb_backupbuddy::$options['database_method_strategy'] ) {
			$force_methods = array( 'php' );
		} elseif ( 'commandline' == pb_backupbuddy::$options['database_method_strategy'] ) {
			$force_methods = array( 'commandline' );
		} elseif ( 'all' == pb_backupbuddy::$options['database_method_strategy'] ) {
			$force_methods = array( 'php', 'commandline' );
		} else {
			pb_backupbuddy::status( 'error', 'Error #48934: Invalid forced database dump method setting: `' . pb_backupbuddy::$options['database_method_strategy'] . '`.' );
			return false;
		}
		$maxExecution = backupbuddy_core::adjustedMaxExecutionTime();
		if ( $this->_backup['profile']['backup_mode'] == '1' ) { 
			$maxExecution = -1;
		}
		require_once( pb_backupbuddy::plugin_path() . '/lib/mysqlbuddy/mysqlbuddy.php' );
		global $wpdb;
		pb_backupbuddy::$classes['mysqlbuddy'] = new pb_backupbuddy_mysqlbuddy( DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, $wpdb->prefix, $force_methods, $maxExecution ); 
		if ( '1' == pb_backupbuddy::$options['force_single_db_file'] ) {
			pb_backupbuddy::$classes['mysqlbuddy']->force_single_db_file( true );
		}
		$result = pb_backupbuddy::$classes['mysqlbuddy']->dump( $this->_backup['temp_directory'], $tables, $rows_start ); 
		if ( is_array( $result ) ) { 
			$newStep = array(
				'function'		=>	'backup_create_database_dump',
				'args'			=>	array( $result[0], $result[1] ),
				'start_time'	=>	0,
				'finish_time'	=>	0,
				'attempts'		=>	0,
			);
			array_splice( $this->_backup_options->options['steps'], $this->_currentStepIndex + 1, 0, array( $newStep ) );
			$this->_backup_options->save();
			pb_backupbuddy::status( 'details', 'Inserted additional database dump step at `' . ( $this->_currentStepIndex + 1 ) . '` to resume at row `' . $result[1] . '`. The next chunk will proceed shortly.' );
		}
		return $result;
	}
function backup_create_database_dump ( $ tables , $ rows_start = 0 ) { pb_backupbuddy :: status ( 'milestone' , 'start_database' ) ; pb_backupbuddy :: status ( 'message' , __ ( 'Starting database backup process.' , 'it-l10n-backupbuddy' ) ) ; if ( 'php' == pb_backupbuddy :: $ options [ 'database_method_strategy' ] ) { $ force_methods = array ( 'php' ) ; } elseif ( 'commandline' == pb_backupbuddy :: $ options [ 'database_method_strategy' ] ) { $ force_methods = array ( 'commandline' ) ; } elseif ( 'all' == pb_backupbuddy :: $ options [ 'database_method_strategy' ] ) { $ force_methods = array ( 'php' , 'commandline' ) ; } else { pb_backupbuddy :: status ( 'error' , 'Error #48934: Invalid forced database dump method setting: `' . pb_backupbuddy :: $ options [ 'database_method_strategy' ] . '`.' ) ; return false ; } $ maxExecution = backupbuddy_core :: adjustedMaxExecutionTime ( ) ; if ( $ this -> _backup [ 'profile' ] [ 'backup_mode' ] == '1' ) { $ maxExecution = - 1 ; } require_once ( pb_backupbuddy :: plugin_path ( ) . '/lib/mysqlbuddy/mysqlbuddy.php' ) ; global $ wpdb ; pb_backupbuddy :: $ classes [ 'mysqlbuddy' ] = new pb_backupbuddy_mysqlbuddy ( DB_HOST , DB_NAME , DB_USER , DB_PASSWORD , $ wpdb -> prefix , $ force_methods , $ maxExecution ) ; if ( '1' == pb_backupbuddy :: $ options [ 'force_single_db_file' ] ) { pb_backupbuddy :: $ classes [ 'mysqlbuddy' ] -> force_single_db_file ( true ) ; } $ result = pb_backupbuddy :: $ classes [ 'mysqlbuddy' ] -> dump ( $ this -> _backup [ 'temp_directory' ] , $ tables , $ rows_start ) ; if ( is_array ( $ result ) ) { $ newStep = array ( 'function' => 'backup_create_database_dump' , 'args' => array ( $ result [ 0 ] , $ result [ 1 ] ) , 'start_time' => 0 , 'finish_time' => 0 , 'attempts' => 0 , ) ; array_splice ( $ this -> _backup_options -> options [ 'steps' ] , $ this -> _currentStepIndex + 1 , 0 , array ( $ newStep ) ) ; $ this -> _backup_options -> save ( ) ; pb_backupbuddy :: status ( 'details' , 'Inserted additional database dump step at `' . ( $ this -> _currentStepIndex + 1 ) . '` to resume at row `' . $ result [ 1 ] . '`. The next chunk will proceed shortly.' ) ; } return $ result ; }
backup_create_database_dump()
backup_create_database_dump ()
// Disable DB chunking when in classic mode. // Load mysqlbuddy and perform dump. // $database_host, $database_name, $database_user, $database_pass, $old_prefix, $force_method = array() // Force to single db_1.sql file if enabled via advanced options. // Do the database dump. // if array, returns tables,rowstart // Chunking. //error_log( print_r( $this->_backup_options->options['steps'], true ) ); //error_log( print_r( $this->_backup_options->options['steps'], true ) ); // Made it this far so not chunking at this point. // Check and make sure mysql server is still around. If it's missing at this point we may not be able to trust that it succeeded properly. /*
		// REMOVED 3-3-2014. PHP dump now checks connection status after each table and command line is not related to this. Settings are all stored in fileoptions so this is no longer relevant.
		
		global $wpdb;
		if ( @mysql_ping( $wpdb->dbh ) === false ) { // No longer connected to database if false.
			pb_backupbuddy::status( 'error', __( 'ERROR #9027b: The mySQL server went away at some point during the database dump step. This is almost always caused by mySQL running out of memory or the mysql server timing out far too early. Contact your host. The database dump integrity can no longer be guaranteed so the backup has been halted.' ) );
			if ( $result === true ) {
				pb_backupbuddy::status( 'details', 'The database dump reported SUCCESS prior to this problem.' );
			} else {
				pb_backupbuddy::status( 'details', 'The database dump reported FAILURE prior to this problem.' );
			}
			pb_backupbuddy::status( 'haltScript', '' ); // Halt JS on page.
			return false;
		}
		*/