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


PHP File_Archive::setOption方法代码示例

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


在下文中一共展示了File_Archive::setOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exportUploadedFiles

 function exportUploadedFiles($gid)
 {
     require_once "File/Archive.php";
     File_Archive::setOption('zipCompressionLevel', 0);
     $baseDir = CUSTOMER_IMAGE_DIR . $gid;
     $files = list_files_dir($baseDir);
     File_Archive::extract($files, File_Archive::toArchive("campaign_" . $gid . "_uploadedfiles_" . date('dFY') . ".zip", File_Archive::toOutput()));
 }
开发者ID:restiaka,项目名称:Guinn-App-Gen,代码行数:8,代码来源:export_m.php

示例2: catch

<?php

/**
* FIXME ... just fixme, like 99% of it. Count this as a draft or something. 
* 
*  
* 
* @package test
*
* Trying out File_Archive
*/
require_once '../../autoload.php';
try {
    Module::require('File_Archive');
} catch (Exception $e) {
    die('Script requires PEAR File_Archive to work.');
}
// Set cache dir for Cache Lite
$options = array('cacheDir' => 'tmp');
if (Module::isLoaded('Cache_Lite')) {
    File_Archive::setOption('cache', new Cache_Lite($options));
}
File_Archive::setOption('zipCompressionLevel', 0);
// $files is an array of path to the files that must be added to the archive
File_Archive::extract($files, File_Archive::toArchive('myFiles.zip', File_Archive::toOutput()));
开发者ID:RobertGresdal,项目名称:widget-testcase-framework,代码行数:25,代码来源:pear_file_archive.php

示例3: _fullBackUp


//.........这里部分代码省略.........
         $webappDirHandle = opendir(WEBAPP_DIR);
         while (false !== ($file = readdir($webappDirHandle))) {
             if ($file == '.' || $file == '..' || $file == 'config' || $file == 'style' || $file == 'uploads' || $file == 'templates_c') {
                 continue;
             }
             $filePath = WEBAPP_DIR . '/' . $file;
             $source[] = File_Archive::read($filePath, $archiveDir . basename(WEBAPP_DIR) . '/' . $file);
         }
         closedir($webappDirHandle);
         $configDirHandle = opendir(WEBAPP_DIR . '/config');
         while (false !== ($file = readdir($configDirHandle))) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if ($file == 'install.inc.php') {
                 $filePath = WEBAPP_DIR . '/config/install.inc.dist.php';
                 $source[] = File_Archive::read($filePath, $archiveDir . basename(WEBAPP_DIR) . '/config/install.inc.php');
                 continue;
             }
             $filePath = WEBAPP_DIR . '/config/' . $file;
             $source[] = File_Archive::read($filePath, $archiveDir . basename(WEBAPP_DIR) . '/config/' . $file);
         }
         closedir($configDirHandle);
     }
     $archiveDir = $archiveBaseDir . implode('/', $installIncDirs) . '/';
     $source[] = File_Archive::read(INSTALL_INC_DIR . '/install.inc.php', $archiveDir . '/install.inc.php');
     $archiveDir = $archiveBaseDir . implode('/', $styleDirs);
     $source[] = File_Archive::read(STYLE_DIR, $archiveDir);
     $archiveDir = $archiveBaseDir . implode('/', $uploadDirs);
     $uploadDirHandle = opendir(FILEUPLOADS_DIR);
     $upload_dir_flag = false;
     while (false !== ($file = readdir($uploadDirHandle))) {
         if ($file == '.' || $file == '..' || $file == 'backup') {
             continue;
         }
         $filePath = FILEUPLOADS_DIR . $file;
         $source[] = File_Archive::read($filePath, $archiveDir . $file);
         $upload_dir_flag = true;
     }
     closedir($uploadDirHandle);
     $backupDir = FILEUPLOADS_DIR . 'backup';
     if (is_dir($backupDir)) {
         $uploadIDs = array();
         $params = array(_OFF);
         $sql = "SELECT upload_id " . "FROM {backup_uploads} " . "WHERE space_type = ?";
         $uploadIDs = $this->db->execute($sql, $params);
         if ($uploadIDs === false) {
             $this->db->addError();
             return false;
         }
         $backupDirHandle = opendir($backupDir);
         while (false !== ($file = readdir($backupDirHandle))) {
             if ($file == '.' || $file == '..') {
                 continue;
             }
             $uploadID = str_replace('.' . BACKUP_COMPRESS_EXT, '', $file);
             $needle = array('upload_id' => $uploadID);
             if (in_array($needle, $uploadIDs)) {
                 continue;
             }
             $filePath = $backupDir . '/' . $file;
             $source[] = File_Archive::read($filePath, $archiveDir . basename($backupDir) . '/' . $file);
             $upload_dir_flag = true;
         }
         closedir($backupDirHandle);
     }
     File_Archive::setOption("tmpDirectory", $temporary_file_path);
     $target_file = FILEUPLOADS_DIR . "backup/" . $upload_id . "." . $extension;
     $dest = File_Archive::toArchive($target_file, File_Archive::toFiles());
     if ($upload_dir_flag === false) {
         // uploadsされたものが1件も無い場合
         $archiveDir = $archiveBaseDir . implode('/', $uploadDirs);
         $archiveDir = substr($archiveDir, 0, strlen($archiveDir) - 1);
         $temp_stat = stat(FILEUPLOADS_DIR);
         $stat = array(2 => $temp_stat[2], "mode" => $temp_stat["mode"]);
         $dest->newFile($archiveDir, $stat);
     }
     if (_FULLBACKUP_OUTPUT_SOURCE) {
         $archiveDir = $archiveBaseDir . implode('/', $baseDirs) . '/' . basename(WEBAPP_DIR) . '/' . 'templates_c';
         $temp_stat = stat(WEBAPP_DIR . "/templates_c");
         $stat = array(2 => $temp_stat[2], "mode" => $temp_stat["mode"]);
         $dest->newFile($archiveDir, $stat);
     }
     File_Archive::extract($source, $dest);
     // file_size 更新
     $params = array('file_size' => $this->fileView->getSize($target_file), 'garbage_flag' => _OFF);
     $where_params = array("upload_id" => $upload_id);
     $result = $this->uploadsAction->updUploads($params, $where_params);
     if ($result === false) {
         $this->_delUploads();
         return false;
     }
     //
     // ダンプファイル削除
     //
     unlink($temporary_file_path . BACKUP_FULL_SQL_FILE_NAME);
     rmdir($temporary_file_path);
     rmdir(WEBAPP_DIR . "/templates_c/" . BACKUP_BACKUP_DIR_NAME . "/");
     return true;
 }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:101,代码来源:Init.class.php


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