/** * Saves the contents of a file or a directory in a zip archive file. * @param string $dest_file The path to the contents for adding to the zip file. * @param string $dest_name The name of the zip file. * @param string $zip_dir The directory for saving zip files. */ public static function save_zip_archive($dest_file, $dest_name, $zip_dir) { if (!class_exists('\\compress_zip')) { include objects::$phpbb_root_path . 'includes/functions_compress.' . objects::$phpEx; } // Remove additional ext/ prefix. $src_rm_prefix = strpos($dest_file, 'ext/') === 0 ? substr($dest_file, 0, 4) : ''; $zip = new \compress_zip('w', $zip_dir . '/' . $dest_name . '.zip'); $zip->add_file($dest_file, $src_rm_prefix); $zip->close(); }
/** * Save the previous version of the extension that is being updated in a zip archive file */ function save_zip_archive($dest_file, $dest_name) { global $phpbb_root_path, $phpEx; if (!class_exists('\\compress_zip')) { include $phpbb_root_path . 'includes/functions_compress.' . $phpEx; } $zip = new \compress_zip('w', $this->zip_dir . '/' . $dest_name . '.zip'); $zip->add_file($dest_file); $zip->close(); }