public/wordpress/wp-content/plugins/backupbuddy/lib/xzipbuddy/zipbuddy.php
/**
		 *	unzip()
		 *
		 *	Extracts the contents of a zip file to the specified directory using the best unzip methods possible.
		 *
		 *	@param	string		$zip_file					Full path & filename of ZIP file to extract from.
		 *	@param	string		$destination_directory		Full directory path to extract into.
		 *	@param	bool|string $force_compatibility_mode	False: use all available, String: use that method
		 *
		 *	@return	bool									true on success, false otherwise
		 */
unzip()
Extracts the contents of a zip file to the specified directory using the best unzip methods possible.

@param  string          $zip_file                                       Full path & filename of ZIP file to extract from.
@param  string          $destination_directory          Full directory path to extract into.
@param  bool|string $force_compatibility_mode   False: use all available, String: use that method

@return bool                                                                    true on success, false otherwise
unzip () Extracts the contents of a zip file to the specified directory using the best unzip methods possible . @param string $zip_file Full path & filename of ZIP file to extract from . @param string $destination_directory Full directory path to extract into . @param bool|string $force_compatibility_mode False : use all available String : use that method @return bool true on success false otherwise
public function unzip( $zip_file, $destination_directory, $force_compatibility_mode = false ) {
			$zip_methods = array();
			if ( $force_compatibility_mode == 'ziparchive' ) {
				$zip_methods = array( 'ziparchive' );				
				$this->log( 'message', __('Forced compatibility unzip method (ZipArchive; medium speed) based on settings.','it-l10n-backupbuddy' ) );
			} elseif ( $force_compatibility_mode == 'pclzip' ) {
				$zip_methods = array( 'pclzip' );				
				$this->log( 'message', __('Forced compatibility unzip method (PCLZip; slow speed) based on settings.','it-l10n-backupbuddy' ) );			
			} else {
				$zip_methods = $this->_zip_methods;
				$this->log( 'details', __('Using all available unzip methods in preferred order.','it-l10n-backupbuddy' ) );
			}
			if ( empty( $zip_methods ) ) {
				$this->log( 'details', sprintf( __('Unable to extract backup file contents (%1$s to %2$s): No available unzip methods found.','it-l10n-backupbuddy' ), $zip_file, $destination_directory ) );
				return false;
			}
			$destination_directory = rtrim( $destination_directory, self::DIRECTORY_SEPARATORS ) . self::NORM_DIRECTORY_SEPARATOR;		
			foreach ( $zip_methods as $method_tag ) {
				if ( $this->_zip_methods_details[ $method_tag ][ 'attr' ][ 'is_unarchiver' ] === true ) {
					$class_name = 'pluginbuddy_zbzip' . $method_tag;
					$zipper = new $class_name( $this );
					$zipper->set_logger( $this->_default_child_logger );
					$zipper->set_method_details( $this->_zip_methods_details[ $method_tag ] );
					$result = $zipper->extract( $zip_file, $destination_directory );
					if ( $result === true ) {
						unset( $zipper );
						return true;
					} else {
						unset( $zipper );
					}
				}
			}
			$this->log( 'details', sprintf( __('Unable to extract backup file contents (%1$s to %2$s): No compatible zip method found.','it-l10n-backupbuddy' ), $zip_file, $destination_directory ) );
			return false;
		}
public function unzip ( $ zip_file , $ destination_directory , $ force_compatibility_mode = false ) { $ zip_methods = array ( ) ; if ( $ force_compatibility_mode == 'ziparchive' ) { $ zip_methods = array ( 'ziparchive' ) ; $ this -> log ( 'message' , __ ( 'Forced compatibility unzip method (ZipArchive; medium speed) based on settings.' , 'it-l10n-backupbuddy' ) ) ; } elseif ( $ force_compatibility_mode == 'pclzip' ) { $ zip_methods = array ( 'pclzip' ) ; $ this -> log ( 'message' , __ ( 'Forced compatibility unzip method (PCLZip; slow speed) based on settings.' , 'it-l10n-backupbuddy' ) ) ; } else { $ zip_methods = $ this -> _zip_methods ; $ this -> log ( 'details' , __ ( 'Using all available unzip methods in preferred order.' , 'it-l10n-backupbuddy' ) ) ; } if ( empty ( $ zip_methods ) ) { $ this -> log ( 'details' , sprintf ( __ ( 'Unable to extract backup file contents (%1$s to %2$s): No available unzip methods found.' , 'it-l10n-backupbuddy' ) , $ zip_file , $ destination_directory ) ) ; return false ; } $ destination_directory = rtrim ( $ destination_directory , self :: DIRECTORY_SEPARATORS ) . self :: NORM_DIRECTORY_SEPARATOR ; foreach ( $ zip_methods as $ method_tag ) { if ( $ this -> _zip_methods_details [ $ method_tag ] [ 'attr' ] [ 'is_unarchiver' ] === true ) { $ class_name = 'pluginbuddy_zbzip' . $ method_tag ; $ zipper = new $ class_name ( $ this ) ; $ zipper -> set_logger ( $ this -> _default_child_logger ) ; $ zipper -> set_method_details ( $ this -> _zip_methods_details [ $ method_tag ] ) ; $ result = $ zipper -> extract ( $ zip_file , $ destination_directory ) ; if ( $ result === true ) { unset ( $ zipper ) ; return true ; } else { unset ( $ zipper ) ; } } } $ this -> log ( 'details' , sprintf ( __ ( 'Unable to extract backup file contents (%1$s to %2$s): No compatible zip method found.' , 'it-l10n-backupbuddy' ) , $ zip_file , $ destination_directory ) ) ; return false ; }
unzip()
      Extracts the contents of a zip file to the specified directory using the best unzip methods possible.
unzip () Extracts the contents of a zip file to the specified directory using the best unzip methods possible .
// The following is just to match current functionality for importbuddy - ideally would rather // do it by selecting available compatibility methods based on method attributes - may do that later // (would also need get_compatibility_zip_methods() to be updated to take parameter to check // whether compatibility method for that particular function. // Decide which methods we are going to try // Better make sure we have some available methods // Hmm, we don't seem to have any available methods, oops, best go no further // Make sure we have a normalized directory separator suffix	 // Iterate over the methods - once we succeed just return directly otherwise drop through // First make sure we can check file existence with this method (ignore silently if not) // Note: has to be able to unzip as well but if that functionality wasn't available in // the method the is_checker attribute will have been set false // We need to tell the method what details belong to it // Now we are ready to try and extract the backup // Will be false if we couldn't extract the backup // Must assume that we extracted ok // We have to return here because we cannot break out of foreach // The zipper encountered an error so we need to drop through and loop round to try another // We'll not process the result here, just drop through silently (the method will have logged it) // If we got this far then no method to extract backup content was available or worked