示例#1
0
 /**
  *	__construct()
  *	
  *	Default constructor.
  *	
  *	@param		string		$temp_dir		The path of the temporary directory to use
  *	@param		array		$zip_methods	Optional: The set of zip methods requested to use
  *	@param		string		$mode			Optional: The zip mode for the object (ignored currently - may be reused?)
  *	@return		null
  *
  */
 public function __construct($temp_dir, $zip_methods = array(), $mode = 'zip')
 {
     // Normalize the trailing directory separator on the path
     $temp_dir = rtrim($temp_dir, self::DIRECTORY_SEPARATORS) . self::NORM_DIRECTORY_SEPARATOR;
     // Normalize platform specific directory separators in path
     $this->_tempdir = str_replace(DIRECTORY_SEPARATOR, self::NORM_DIRECTORY_SEPARATOR, $temp_dir);
     // Note: this will be removed and should no longer be used - an object is instantiated for
     // both zip & unzip services
     $this->_mode = $mode;
     // Record where we are located (the directory name)
     $this->_whereami = basename(dirname(__FILE__));
     // Use our location to determine which zip methods transient we should be using
     $this->_zip_methods_transient = 0 === strcmp($this->_whereami, 'zipbuddy') ? self::ZIP_METHODS_TRANSIENT : self::ZIP_METHODS_TRANSIENT_EXPERIMENTAL;
     // Set a flag for easy conditional testing
     $this->_is_experimental = 0 === strcmp($this->_whereami, 'zipbuddy') ? false : true;
     // Set the sapi name so we can use it later
     $this->set_sapi_name();
     // Make sure we load the core abstract class as this will always be needed
     require_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipcore.php';
     // If we loaded that ok then try the method specific classes
     // Could make this more generic based on config or somesuch
     if (class_exists('pluginbuddy_zbzipcore')) {
         // Only provide proc mode when experimental zip enabled
         if (true === $this->_is_experimental) {
             include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipproc.php';
             if (class_exists('pluginbuddy_zbzipproc')) {
                 if ($this->check_method_dependencies('pluginbuddy_zbzipproc')) {
                     $this->set_supported_zip_methods(pluginbuddy_zbzipproc::get_method_tag_static());
                 }
             }
         }
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipexec.php';
         if (class_exists('pluginbuddy_zbzipexec')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzipexec')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzipexec::get_method_tag_static());
             }
         }
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipziparchive.php';
         if (class_exists('pluginbuddy_zbzipziparchive')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzipziparchive')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzipziparchive::get_method_tag_static());
             }
         }
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzippclzip.php';
         if (class_exists('pluginbuddy_zbzippclzip')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzippclzip')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzippclzip::get_method_tag_static());
             }
         }
     }
     // Work out the list of zip methods from the requested and available along with their details
     $this->set_zip_methods($zip_methods);
 }
示例#2
0
 /**
  *	__construct()
  *	
  *	Default constructor.
  *	
  *	@param		string		$temp_dir		The path of the temporary directory to use
  *	@param		array		$zip_methods	Optional: The set of zip methods requested to use
  *	@return		null
  *
  */
 public function __construct($temp_dir, $zip_methods = array())
 {
     // Zipbuddy creates it's own default logger but can be overridden
     // Note: if user wants to override they must "get" the current logger
     // and destroy it otherwise it gets orphaned.
     $this->set_logger(new pluginbuddy_zipbuddy_logger());
     // Use this for all our children unless they need a specific logger
     $this->_default_child_logger = new pluginbuddy_zipbuddy_logger();
     // Zipbuddy creates it's own default process monitor but can be overridden
     // Note: if user wants to override they must "get" the current process
     // monitor and destroy it otherwise it gets orphaned. We'll give it our
     // logger
     $this->set_process_monitor(new pluginbuddy_zipbuddy_process_monitor($this));
     // Normalize the trailing directory separator on the path
     $temp_dir = rtrim($temp_dir, self::DIRECTORY_SEPARATORS) . self::NORM_DIRECTORY_SEPARATOR;
     // Normalize platform specific directory separators in path
     $this->_tempdir = str_replace(DIRECTORY_SEPARATOR, self::NORM_DIRECTORY_SEPARATOR, $temp_dir);
     // Record where we are located (the directory name)
     $this->_whereami = basename(dirname(__FILE__));
     // Set a flag for easy conditional testing
     $this->_is_experimental = 0 === strcmp($this->_whereami, 'zipbuddy') ? false : true;
     // Use our experimental flag to determine which zip methods transient we should be using
     $this->_zip_methods_transient = $this->_is_experimental ? self::ZIP_METHODS_TRANSIENT_EXPERIMENTAL : self::ZIP_METHODS_TRANSIENT;
     // Set the sapi name so we can use it later
     $this->set_sapi_name();
     // Derive whether we are ignoring Warnings or not (can be overridden by method call)
     $this->set_ignore_warnings();
     // Derive whether we are ignoring/not-following symlinks or not (can be overridden by method call)
     $this->set_ignore_symlinks();
     // Derive whether compression should be used (can be overridden by method call)
     $this->set_compression();
     // Derive what the step period should be for any action after which a new step must be initiated
     $this->set_step_period();
     // Derive what the interburst gap should be for any burst related action
     $this->set_burst_gap();
     // Derive what the min burst content size should be for any burst related action
     $this->set_min_burst_content();
     // Derive what the max burst content size should be for any burst related action
     $this->set_max_burst_content();
     // Make sure we load the core abstract class as this will always be needed
     require_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipcore.php';
     // If we loaded that ok then try the method specific classes
     // Could make this more generic based on config or somesuch
     if (class_exists('pluginbuddy_zbzipcore')) {
         //
         // 				// Only provide proc mode when experimental zip enabled
         // 				if ( true === $this->_is_experimental ) {
         //
         // 					include_once( pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipproc.php' );
         //
         // 					if ( class_exists( 'pluginbuddy_zbzipproc' ) ) {
         //
         // 						if ( $this->check_method_dependencies( 'pluginbuddy_zbzipproc' ) ) {
         //
         // 							$this->set_supported_zip_methods( pluginbuddy_zbzipproc::get_method_tag_static() );
         //
         // 						}
         //
         // 					}
         //
         // 				}
         //
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipexec.php';
         if (class_exists('pluginbuddy_zbzipexec')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzipexec')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzipexec::get_method_tag_static());
             }
         }
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzipziparchive.php';
         if (class_exists('pluginbuddy_zbzipziparchive')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzipziparchive')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzipziparchive::get_method_tag_static());
             }
         }
         include_once pb_backupbuddy::plugin_path() . '/lib/' . $this->_whereami . '/zbzippclzip.php';
         if (class_exists('pluginbuddy_zbzippclzip')) {
             if ($this->check_method_dependencies('pluginbuddy_zbzippclzip')) {
                 $this->set_supported_zip_methods(pluginbuddy_zbzippclzip::get_method_tag_static());
             }
         }
     }
     // Work out the list of zip methods from the requested and available along with their details
     $this->set_zip_methods($zip_methods);
 }