当前位置: 首页>>代码示例>>PHP>>正文


PHP Zip::addDir方法代码示例

本文整理汇总了PHP中Zip::addDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Zip::addDir方法的具体用法?PHP Zip::addDir怎么用?PHP Zip::addDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zip的用法示例。


在下文中一共展示了Zip::addDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'];
 }
开发者ID:nuxodin,项目名称:shwups-cms-v4,代码行数:30,代码来源:module.class.php

示例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;
 }
开发者ID:rolandrajko,项目名称:BREAD,代码行数:16,代码来源:Directory.php

示例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");
     }
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:55,代码来源:ReleaseCommand.php

示例4: 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 */
开发者ID:nuxodin,项目名称:shwups-cms-v4,代码行数:31,代码来源:index.php


注:本文中的Zip::addDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。