/** * Create downloadable zip-archived backup file. * * @param array $name array('zip' => 'zip_backup_file_name', 'xml' => 'xml_backup_file_name') * * @return void */ protected function finalizeBackup($name) { // Get XML data from XML object if (($data = $this->data->asXML()) === false) { throw new Exception(JText::_('JSN_EXTFW_DATA_XML_GENERATION_FAIL')); } // Prepend XML file to the array of backed up files array_unshift($this->files, array($name['xml'] => $data)); // Create zip file containing all backed up data and/or files if (!($this->zippedBackup = JSNUtilsArchive::createZip($this->files))) { throw new Exception(JText::_('JSN_EXTFW_DATA_ARCHIVE_CREATION_FAIL')); } }
/** * Create downloadable zip-archived backup file. * * @param array $name array('zip' => 'zip_backup_file_name', 'xml' => 'xml_backup_file_name') * * @return void */ protected function finalizeBackup($name) { // Get XML data from XML object if (($data = $this->jsnesdata->asXML()) === false) { return false; } if (!class_exists('JSNUtilsArchive')) { if (file_exists(JPATH_ROOT . '/plugins/system/jsnframework/libraries/joomlashine/utils/archive.php')) { require_once JPATH_ROOT . '/plugins/system/jsnframework/libraries/joomlashine/utils/archive.php'; } else { return false; } } // Prepend XML file to the array of backed up files //array_unshift($this->files, array($name['xml'] => $data)); $file = array(array($name['xml'] => $data)); // Create zip file containing all backed up data and/or files try { if (!($this->zippedBackup = JSNUtilsArchive::createZip($file))) { return false; } } catch (Exception $e) { return false; } return true; }