public/wordpress/wp-content/plugins/backupbuddy/lib/xzipbuddy/zipbuddy.php
/**
		 *	grow_zip()
		 *
		 *	This is called after the first step and carries on growing the zip with he already
		 *	calculated archive content
		 *
		 *	@param	string	$zip_file					Full path & filename of ZIP file to grow.
		 *	@param	string	$temporary_zip_directory	Full directory path to directory were we are working
		 *	@param	array	$state						State array that we need to pick up where we left off
		 *
		 *	@return	mixed								true on completion of archive, array for continuation, false on failure
		 *
		 */
grow_zip()
This is called after the first step and carries on growing the zip with he already
calculated archive content

@param  string  $zip_file                                       Full path & filename of ZIP file to grow.
@param  string  $temporary_zip_directory        Full directory path to directory were we are working
@param  array   $state                                          State array that we need to pick up where we left off

@return mixed                                                           true on completion of archive, array for continuation, false on failure
grow_zip () This is called after the first step and carries on growing the zip with he already calculated archive content @param string $zip_file Full path & filename of ZIP file to grow . @param string $temporary_zip_directory Full directory path to directory were we are working @param array $state State array that we need to pick up where we left off @return mixed true on completion of archive array for continuation false on failure
public function grow_zip( $zip_file, $temporary_zip_directory, $state ) {
			$zip_methods = array( $state[ 'zipbuddy' ][ 'mt' ] );
			foreach ( $zip_methods as $method_tag ) {
				if ( $this->_zip_methods_details[ $method_tag ][ 'attr' ][ 'is_archiver' ] === true ) {
					$class_name = 'pluginbuddy_zbzip' . $method_tag;
					$zipper = new $class_name( $this );
					$zipper->set_logger( $this->_default_child_logger );
					$zipper->set_compression( $this->get_compression() );
					$zipper->set_ignore_symlinks( $this->get_ignore_symlinks() );
					$zipper->set_ignore_warnings( $this->get_ignore_warnings() );
					$zipper->set_step_period( $state[ 'zipper' ][ 'sp' ] );
					$zipper->set_burst_gap( $this->get_burst_gap() );
					$zipper->set_min_burst_content( $this->get_min_burst_content() );
					$zipper->set_max_burst_content( $this->get_max_burst_content() );
					$zipper->set_method_details( $this->_zip_methods_details[ $method_tag ] );
					$zipper->set_sapi_name( $this->get_sapi_name() );
					$this->log( 'details', __('Trying ', 'it-l10n-backupbuddy' ) . $method_tag . __(' method for ZIP.','it-l10n-backupbuddy' ) );
					clearstatcache();
					if ( !empty( $temporary_zip_directory ) ) {
						if ( !file_exists( $temporary_zip_directory ) ) { 
							mkdir( $temporary_zip_directory );
						}
					}
					if (  true === ( $result = $zipper->grow( $zip_file, $temporary_zip_directory, $state ) ) ) {
						$this->log( 'details', __('The ', 'it-l10n-backupbuddy' ) . $method_tag . __(' method for ZIP was successful.','it-l10n-backupbuddy' ) );
						unset( $zipper );
						return true;
					} elseif ( is_array( $result ) ) {
						$this->log( 'details', __('The ', 'it-l10n-backupbuddy' ) . $method_tag . __(' method for ZIP partially completed.','it-l10n-backupbuddy' ) );
						unset( $zipper );
						return $result;
					} else {
						$this->log( 'details', __('The ', 'it-l10n-backupbuddy' ) . $method_tag . __(' method for ZIP was unsuccessful.','it-l10n-backupbuddy' ) );
						unset( $zipper );
					}
				} else {
					$this->log( 'details', __('The ','it-l10n-backupbuddy' ) . $method_tag . __(' method is not currently supported for backup.','it-l10n-backupbuddy' ) );					
				}
			}
			$this->log( 'details', __('Failed to create a Zip Archive file with any nominated method.','it-l10n-backupbuddy' ) );
			return false;
		}
public function grow_zip ( $ zip_file , $ temporary_zip_directory , $ state ) { $ zip_methods = array ( $ state [ 'zipbuddy' ] [ 'mt' ] ) ; foreach ( $ zip_methods as $ method_tag ) { if ( $ this -> _zip_methods_details [ $ method_tag ] [ 'attr' ] [ 'is_archiver' ] === true ) { $ class_name = 'pluginbuddy_zbzip' . $ method_tag ; $ zipper = new $ class_name ( $ this ) ; $ zipper -> set_logger ( $ this -> _default_child_logger ) ; $ zipper -> set_compression ( $ this -> get_compression ( ) ) ; $ zipper -> set_ignore_symlinks ( $ this -> get_ignore_symlinks ( ) ) ; $ zipper -> set_ignore_warnings ( $ this -> get_ignore_warnings ( ) ) ; $ zipper -> set_step_period ( $ state [ 'zipper' ] [ 'sp' ] ) ; $ zipper -> set_burst_gap ( $ this -> get_burst_gap ( ) ) ; $ zipper -> set_min_burst_content ( $ this -> get_min_burst_content ( ) ) ; $ zipper -> set_max_burst_content ( $ this -> get_max_burst_content ( ) ) ; $ zipper -> set_method_details ( $ this -> _zip_methods_details [ $ method_tag ] ) ; $ zipper -> set_sapi_name ( $ this -> get_sapi_name ( ) ) ; $ this -> log ( 'details' , __ ( 'Trying ' , 'it-l10n-backupbuddy' ) . $ method_tag . __ ( ' method for ZIP.' , 'it-l10n-backupbuddy' ) ) ; clearstatcache ( ) ; if ( ! empty ( $ temporary_zip_directory ) ) { if ( ! file_exists ( $ temporary_zip_directory ) ) { mkdir ( $ temporary_zip_directory ) ; } } if ( true === ( $ result = $ zipper -> grow ( $ zip_file , $ temporary_zip_directory , $ state ) ) ) { $ this -> log ( 'details' , __ ( 'The ' , 'it-l10n-backupbuddy' ) . $ method_tag . __ ( ' method for ZIP was successful.' , 'it-l10n-backupbuddy' ) ) ; unset ( $ zipper ) ; return true ; } elseif ( is_array ( $ result ) ) { $ this -> log ( 'details' , __ ( 'The ' , 'it-l10n-backupbuddy' ) . $ method_tag . __ ( ' method for ZIP partially completed.' , 'it-l10n-backupbuddy' ) ) ; unset ( $ zipper ) ; return $ result ; } else { $ this -> log ( 'details' , __ ( 'The ' , 'it-l10n-backupbuddy' ) . $ method_tag . __ ( ' method for ZIP was unsuccessful.' , 'it-l10n-backupbuddy' ) ) ; unset ( $ zipper ) ; } } else { $ this -> log ( 'details' , __ ( 'The ' , 'it-l10n-backupbuddy' ) . $ method_tag . __ ( ' method is not currently supported for backup.' , 'it-l10n-backupbuddy' ) ) ; } } $ this -> log ( 'details' , __ ( 'Failed to create a Zip Archive file with any nominated method.' , 'it-l10n-backupbuddy' ) ) ; return false ; }
grow_zip()
      This is called after the first step and carries on growing the zip with he already
      calculated archive content
grow_zip () This is called after the first step and carries on growing the zip with he already calculated archive content
// Initialize the zip method tag of the method we are using // Iterate over the methods - once we succeed just return directly otherwise drop through // First make sure we can archive with this method // Zipper will initially inherit our logger and // our process monitor // Now override logger - will define a prefix here // Set these on specific zipper based on the values we derived at construnction or // overridden by subsequent method calls // We need to tell the method what details belong to it // Tell the method the server api in use // As we are looping make sure we have no stale file information // The temporary zip directory _must_ exist // Create temp dir if it does not exist. // Now we are ready to try and produce the backup // Got a valid zip file so we can just return - method will have cleaned up the temporary directory // We have to return here because we cannot break out of foreach // Didn't finish zip creation on that step so we need to set up for another step // Add in any addiitonal state information and simply return the state // We failed on a continuation step so we are done really... // Method will have cleaned up the temporary directory				 // This method is not considered suitable (reliable enough) for creating archives or lacked zip capability // If we get here then have failed in all attempts