static function extract_from_archive($filename) { $modules_archive_dir = new Dir(self::MODULES_ARCHIVE_DIR); $modules_archive_dir->touch(); $module_archive = $modules_archive_dir->newFile($filename); $properties = FFArchive::getArchiveProperties($module_archive); $module_dir = new Dir(ModuleUtils::get_modules_path() . "/" . $properties["category_name"] . "/" . $properties["module_name"]); return FFArchive::extract($module_archive, $module_dir); }
function execute() { $archive_file_path = $this->archive_file_path; $to_folder = $this->to_folder; if (self::$dummy_mode) { echo "Extracting : " . $archive_file_path . " to " . $to_folder . "<br />"; return; } $real_archive_file_path = new File($this->module_dir . DS . $archive_file_path); $real_folder = new Dir(self::$root_dir . DS . $to_folder); FFArchive::extract($real_archive_file_path, $real_folder); }
public static function restore_dir($dir) { $backup_dir = new Dir(self::$current_backup_dir); if (!$backup_dir->exists()) { return false; } if ($dir instanceof Dir) { $d = $dir; } else { $d = new Dir($dir); } $file = new File(self::getDirBackupFile($d)); FFArchive::extract($file, $dir); return $file->getPath(); }
function testArchiveProperties() { $f = new File("/" . FRAMEWORK_CORE_PATH . "tests/utils/compress/test.ffa"); $f->delete(); $this->assertFalse($f->exists()); $input_properties["description"] = "Archivio immagini rotator"; $input_properties["image1"] = "colori.jpg"; $input_properties["image2"] = "other"; FFArchive::compress($f, new Dir("/" . FRAMEWORK_CORE_PATH . "tests/utils/compress/data/"), $input_properties); $this->assertTrue($f->exists()); $output_properties = FFArchive::getArchiveProperties($f); $this->assertEqual($output_properties["description"], "Archivio immagini rotator", "La descrizione non e' stata letta correttamente dall'archivio!!"); $this->assertEqual($output_properties["image1"], "colori.jpg", "La proprieta' image1 non e' stata letta correttamente dall'archivio!!"); $this->assertEqual($output_properties["image2"], "other", "La proprieta' image2 non e' stata letta correttamente dall'archivio!!"); $f->delete(true); }
<?php /* This software is released under the BSD license. Full text at project root -> license.txt */ require_once "../init.php"; if (isset($_POST["extract"])) { FFArchive::extract(new File($_POST["target_file"]), new Dir($_POST["target_dir"])); $result = "Archive extracted."; } else { $result = null; } ?> <html> <head> <title>Extract a Frozen Framework Archive (FFA)</title> </head> <body> <?php if ($result !== null) { echo "<h1>" . $result . "</h1>"; } ?> <form name="create_archive" method="post" action="/framework/utilities/extract_archive.php"> <input type="hidden" name="extract" value="extract" /> Archive file : <input type="text" name="target_file" value="/package.ffa" /><br /> Target dir : <input type="text" name="target_dir" value="/" /><br /> <br /> <button type="submit"> <div> Extract </div> </button>
<?php /* This software is released under the BSD license. Full text at project root -> license.txt */ require_once "../init.php"; if (isset($_POST["compress"])) { FFArchive::compress(new File($_POST["target_file"]), new Dir($_POST["root_dir"]), $_POST["description"], $_POST["properties"]); $result = "Archive created."; } else { $result = null; } ?> <html> <head> <title>Create a Frozen Framework Archive (FFA)</title> </head> <body> <?php if ($result !== null) { echo "<h1>" . $result . "</h1>"; } ?> <form name="create_archive" method="post" action="/framework/utilities/create_archive.php"> <input type="hidden" name="compress" value="compress" /> Description : <input type="text" name="description" value="" size="40"/><br /> Properties : <br /> <textarea name="properties" rows="7" cols="30"></textarea><br /> Root dir : <input type="text" name="root_dir" value="/" /><br /> Target file : <input type="text" name="target_file" value="/package.ffa" /><br /> <br /> <button type="submit"> <div>
require_once "io/FileSystemUtils.class.php"; require_once "io/Dir.class.php"; require_once "io/File.class.php"; require_once "io/FileReader.class.php"; require_once "io/FileWriter.class.php"; require_once "utils/FFArchive.class.php"; ?> <html> <head> <title>Frostlab gate framework updater</title> </head> <body> <?php if (isset($_POST["do"])) { echo "Archiving ..."; FFArchive::compress(new File("/framework/utilities/framework.ffa"), new Dir("/framework/core")); } else { ?> <form name="form__framework_updater" action="/framework/utilities/framework_update2.php" method="POST"> <input type="hidden" name="do" value="do" /> <br /> <button type="submit"> <div> Aggiorna framework </div> </button> </form> <?php } ?> </body>