本文整理汇总了PHP中Zip::open方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::open方法的具体用法?PHP Zip::open怎么用?PHP Zip::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zip
的用法示例。
在下文中一共展示了Zip::open方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
function upload($incVersion)
{
$vs = qg::remoteGet($this->name);
if (!is_dir(sysPATH . $this->name)) {
return false;
}
$v = explode('.', $vs['version']);
$v = @array((int) $v[0], (int) $v[1], (int) $v[2]);
foreach ($v as $i => $vp) {
if ($i >= $incVersion) {
$v[$i] = 0;
}
}
isset($v[$incVersion - 1]) && ++$v[$incVersion - 1];
$vs['version'] = implode('.', $v);
$tmpFile = appPATH . 'cache/tmp/module_export1.zip';
is_file($tmpFile) && unlink($tmpFile);
// zzz unlink???
ini_set('max_execution_time', '600');
$zip = new Zip();
$zip->open($tmpFile, Zip::CREATE);
$zip->addDir(sysPATH . $this->name, null, '/(\\.svn)|(zzz)/');
$zip->close();
$vs['size'] = filesize($tmpFile);
$this->local_version = $vs['version'];
@qg::Ftp()->mkdir('/module/' . $this->name . '/');
qg::Ftp()->put('/module/' . $this->name . '/' . $vs['version'] . '.zip', $tmpFile, FTP_BINARY);
qg::remoteSet($this->name, $vs);
return $vs['version'];
}
示例2: compress
/**
* Compresses the directory with ZIP.
* @param string $fileName The file name of the ZIP archive.
* @param int $flags [optional] The mode to use to open the archive.
* @return mixed The ZIP archive or an error code on failure.
*/
public function compress($fileName, $flags = \ZipArchive::CREATE)
{
$zip = new Zip();
if (($res = $zip->open($fileName, $flags)) === true) {
$zip->addDir($this->path);
$zip->close();
return $zip;
}
return $res;
}
示例3: run
function run($args)
{
if (empty($args[1])) {
echo $this->getHelp();
return;
}
$path = $args[0];
$version = $args[1];
echo "Preparing {$path} release.\n";
require dirname(__FILE__) . '/GenerateDocsCommand.php';
$docProcessor = new GenerateDocsCommand($this->getName(), $this->getCommandRunner());
$outFiles = $docProcessor->processDocuments($path);
// copy extension dir to temp
$extPath = Yii::getPathOfAlias('ext') . '/' . $path;
$copiedExtRoot = Yii::getPathOfAlias('application.runtime.extension');
echo "Removing {$copiedExtRoot}.\n";
if (file_exists($copiedExtRoot)) {
$this->recursiveDelete($copiedExtRoot);
}
$copiedExtPath = $copiedExtRoot . '/' . $path;
if (!file_exists($copiedExtPath)) {
mkdir($copiedExtPath, 0777, true);
}
echo "Copying extension files from {$extPath} to {$copiedExtPath}.\n";
CFileHelper::copyDirectory($extPath, $copiedExtPath, array('exclude' => array('.svn', 'readme_en.txt', 'readme_ru.txt')));
echo "Copying documentation to {$copiedExtPath}.\n";
foreach ($outFiles as $file) {
copy($file, $copiedExtPath . '/' . basename($file));
}
$pathExp = explode('/', $path);
$zipName = end($pathExp) . '_' . $version . '.zip';
$releasePath = Yii::getPathOfAlias('application.releases');
if (!file_exists($releasePath)) {
mkdir($releasePath, 0777, true);
}
$zipPath = "{$releasePath}/{$zipName}";
if (file_exists($zipPath)) {
unlink($zipPath);
}
//touch($zipPath);
echo "Creating Zip {$zipPath}.\n";
require dirname(__FILE__) . '/Zip.php';
$zip = new Zip();
if ($zip->open($zipPath, ZipArchive::OVERWRITE | ZipArchive::CREATE) !== TRUE) {
die("Failed to open Zip {$zipPath}.\n");
}
if (!$zip->addDir($copiedExtRoot)) {
die("Failed adding {$copiedExtRoot} to Zip.\n");
}
if ($zip->close()) {
echo "Done.\n";
} else {
die("Failed to write Zip {$zipPath}.\n");
}
}
示例4: download
static function download($name, $beta = false)
{
$vs = self::remoteGet($name, $beta);
self::ftp()->get(appPATH . 'cache/tmp/pri/remoteModule.zip', '/module/' . $name . '/' . $vs['version'] . '.zip', FTP_BINARY);
$zip = new Zip();
$go = $zip->open(appPATH . 'cache/tmp/pri/remoteModule.zip');
if (!$go) {
return;
}
rrmdir(sysPATH . $name);
$zip->extractTo(sysPATH);
$zip->close();
return $vs;
}
示例5: array
$File->replaceFromUpload($_FILES['cmsPageFile']);
$res = array('id' => (string) $File, 'url' => $File->url() . '/' . $File->vs['name']);
Answer($res);
}
}
if (isset($_GET['qgCms_page_files_as_zip'])) {
$P = Page($_GET['qgCms_page_files_as_zip']);
if (!$P->access() > 1) {
exit('no access');
}
if (!$P->Files()) {
exit('no files');
}
$Zip = new Zip();
$tmpfname = appPATH . 'cache/tmp/pri/' . randString() . '.zip';
$Zip->open($tmpfname, Zip::CREATE);
foreach ($P->Files() as $File) {
$Zip->addFile($File->path, $File->name());
}
$Zip->close();
$filename = isset($_GET['filename']) ? $_GET['filename'] : 'files_' . $P . '.zip';
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Length: ' . filesize($tmpfname));
readfile($tmpfname);
unlink($tmpfname);
exit;
}
});
qg::on('dbFile::access', function ($e) {
if ($e['access']) {
示例6: unlink
<?php
namespace qg;
if (!Usr()->superuser) {
return;
}
if (isset($_GET['export'])) {
//set_time_limit(0);
$tmpFile = appPATH . 'cache/tmp/pri/modExport.zip';
is_file($tmpFile) && unlink($tmpFile);
$zip = new Zip();
$zip->open($tmpFile, Zip::CREATE);
$zip->addDir(appPATH . 'm', null, '/(\\.svn)/');
$zip->addDir(appPATH . 'qg', null, '/(\\.svn)/');
foreach (scandir(appPATH) as $file) {
if (!is_file(appPATH . $file)) {
continue;
}
if ($file === 'error_log') {
continue;
}
$zip->addFile(appPATH . $file, $file);
}
/* only custom module:
foreach (dbEntry_module::all() as $M) {
If ($M->server_time) continue;
$zip->addDir(sysPATH.$name, 'm/'.$M->name, '/(\.svn)/');
}
/* add mysql export */