/** * Initialises the archiver class, seeding from an existent installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive (ignored in this class) * @param array $options A named key array of options (optional) * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, __CLASS__ . " :: new instance"); // No setup! JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, __CLASS__ . " :: Initializing with {$sourceJPAPath}"); parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, creating the archive from an existent * installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive * @param array $options A named key array of options (optional). This is currently not supported * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTAR :: initialize - archive {$targetArchivePath}"); // Get names of temporary files $configuration =& JoomlapackModelRegistry::getInstance(); $this->_dataFileName = $targetArchivePath; // Try to kill the archive if it exists JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerTAR :: Killing old archive"); $fp = fopen($this->_dataFileName, "wb"); if (!($fp === false)) { ftruncate($fp, 0); fclose($fp); } else { @unlink($this->_dataFileName); } if (!@touch($this->_dataFileName)) { $this->setError(JText::_('CUBE_ARCHIVER_CANTWRITE')); return false; } $this->_tarObject = new Archive_Tar($targetArchivePath); $this->_tarObject->owningObject =& $this; parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, creating the archive from an existent * installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive * @param array $options A named key array of options (optional) * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerJPA :: new instance - archive {$targetArchivePath}"); $this->_dataFileName = $targetArchivePath; // Try to kill the archive if it exists JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerJPA :: Killing old archive"); $fp = @fopen($this->_dataFileName, "wb"); if (!($fp === false)) { @ftruncate($fp, 0); @fclose($fp); } else { if (file_exists($this->_dataFileName)) { @unlink($this->_dataFileName); } @touch($this->_dataFileName); } // Write the initial instance of the archive header $this->_writeArchiveHeader(); if ($this->getError()) { return; } parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, creating the archive from an existent * installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive * @param array $options A named key array of options (optional). This is currently not supported * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: initialize - archive {$targetArchivePath}"); // Get names of temporary files $configuration =& JoomlapackModelRegistry::getInstance(); $this->_ctrlDirFileName = tempnam($configuration->getTemporaryDirectory(), 'jpzcd'); $this->_dataFileName = $targetArchivePath; // If we use splitting, initialize if ($this->_useSplitZIP) { JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlapackPackerZIP :: Split ZIP creation enabled"); $this->_dataFileNameBase = dirname($targetArchivePath) . DS . basename($targetArchivePath, '.zip'); $this->_dataFileName = $this->_dataFileNameBase . '.z01'; } jimport('joomla.filesystem.file'); $tempname = JFile::getName($this->_ctrlDirFileName); JoomlapackCUBETempfiles::registerTempFile($tempname); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: CntDir Tempfile = " . $this->_ctrlDirFileName); // Create temporary file if (!@touch($this->_ctrlDirFileName)) { $this->setError(JText::_('CUBE_ZIPARCHIVER_CANTWRITETEMP')); return false; } // Try to kill the archive if it exists JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: Killing old archive"); $fp = fopen($this->_dataFileName, "wb"); if (!($fp === false)) { ftruncate($fp, 0); fclose($fp); } else { @unlink($this->_dataFileName); } if (!@touch($this->_dataFileName)) { $this->setError(JText::_('CUBE_ZIPARCHIVER_CANTWRITEZIP')); return false; } // On split archives, include the "Split ZIP" header, for PKZIP 2.50+ compatibility if ($this->_useSplitZIP) { file_put_contents($this->_dataFileName, "PK"); // Also update the statistics table that we are a multipart archive... $cube =& JoomlapackCUBE::getInstance(); $cube->updateMultipart(1); } parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, creating the archive from an existent * installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive * @param array $options A named key array of options (optional) * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerJPA :: new instance - archive {$targetArchivePath}"); $this->_dataFileName = $targetArchivePath; // NEW 2.3: Should we enable Split ZIP feature? $registry =& JoomlapackModelRegistry::getInstance(); $fragmentsize = $registry->get('splitpartsize', 0); if ($fragmentsize >= 65536) { // If the fragment size is AT LEAST 64Kb, enable Split ZIP $this->_useSplitZIP = true; $this->_fragmentSize = $fragmentsize; // Enable CUBE that we have a multipart archive $cube =& JoomlapackCUBE::getInstance(); $cube->updateMultipart(1); // Indicate that we have at least 1 part $this->_totalFragments = 1; JoomlapackLogger::WriteLog(_JP_LOG_INFO, "JoomlapackPackerJPA :: Spanned JPA creation enabled"); $this->_dataFileNameBase = dirname($targetArchivePath) . DS . basename($targetArchivePath, '.jpa'); $this->_dataFileName = $this->_dataFileNameBase . '.j01'; } // NEW 2.3: Should I use Symlink Target Storage? $dereferencesymlinks = $registry->get('dereferencesymlinks', true); if (!$dereferencesymlinks) { // We are told not to dereference symlinks. Are we on Windows? if (function_exists('php_uname')) { $isWindows = stristr(php_uname(), 'windows'); } else { $isWindows = DS == '\\'; } // If we are not on Windows, enable symlink target storage $this->_symlink_store_target = !$isWindows; } // Try to kill the archive if it exists JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerJPA :: Killing old archive"); $fp = @fopen($this->_dataFileName, "wb"); if (!($fp === false)) { @ftruncate($fp, 0); @fclose($fp); } else { if (file_exists($this->_dataFileName)) { @unlink($this->_dataFileName); } @touch($this->_dataFileName); } // Write the initial instance of the archive header $this->_writeArchiveHeader(); if ($this->getError()) { return; } parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, seeding the remote installation * from an existent installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive (ignored in this class) * @param array $options A named key array of options (optional) * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, __CLASS__ . " :: new instance"); $registry =& JoomlapackModelRegistry::getInstance(); $this->_host = $registry->get('df_host', ''); $this->_port = $registry->get('df_port', '21'); $this->_user = $registry->get('df_user', ''); $this->_pass = $registry->get('df_pass', ''); $this->_initdir = $registry->get('df_initdir', ''); $this->_usessl = $registry->get('df_usessl', false); $this->_passive = $registry->get('df_passive', true); if (isset($options['host'])) { $this->_host = $options['host']; } if (isset($options['port'])) { $this->_port = $options['port']; } if (isset($options['user'])) { $this->_user = $options['user']; } if (isset($options['pass'])) { $this->_pass = $options['pass']; } if (isset($options['initdir'])) { $this->_initdir = $options['initdir']; } if (isset($options['usessl'])) { $this->_usessl = $options['usessl']; } if (isset($options['passive'])) { $this->_passive = $options['passive']; } $this->connect_ok = $this->_connectFTP(); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, __CLASS__ . " :: Initializing with {$sourceJPAPath}"); parent::initialize($sourceJPAPath, $targetArchivePath, $options); }
/** * Initialises the archiver class, creating the archive from an existent * installer's JPA archive. * * @param string $sourceJPAPath Absolute path to an installer's JPA archive * @param string $targetArchivePath Absolute path to the generated archive * @param array $options A named key array of options (optional). This is currently not supported * @access public */ function initialize($sourceJPAPath, $targetArchivePath, $options = array()) { JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: initialize - archive {$targetArchivePath}"); // Get names of temporary files $configuration =& JoomlapackModelRegistry::getInstance(); $this->_ctrlDirFileName = tempnam($configuration->getTemporaryDirectory(), 'jpzcd'); $this->_dataFileName = $targetArchivePath; jimport('joomla.filesystem.file'); $tempname = JFile::getName($this->_ctrlDirFileName); JoomlapackCUBETempfiles::registerTempFile($tempname); JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: CntDir Tempfile = " . $this->_ctrlDirFileName); // Create temporary file if (!@touch($this->_ctrlDirFileName)) { $this->setError(JText::_('CUBE_ZIPARCHIVER_CANTWRITETEMP')); return false; } // Try to kill the archive if it exists JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackPackerZIP :: Killing old archive"); $fp = fopen($this->_dataFileName, "wb"); if (!($fp === false)) { ftruncate($fp, 0); fclose($fp); } else { @unlink($this->_dataFileName); } if (!@touch($this->_dataFileName)) { $this->setError(JText::_('CUBE_ZIPARCHIVER_CANTWRITEZIP')); return false; } parent::initialize($sourceJPAPath, $targetArchivePath, $options); }