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


PHP File_Archive::toArchive方法代码示例

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


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

示例1: Backup

 /**
  * Returns downloadable backup file
  *
  * @access  public
  * @return void
  */
 function Backup()
 {
     $this->gadget->CheckPermission('Backup');
     $tmpDir = sys_get_temp_dir();
     $domain = preg_replace("/^(www.)|(:{$_SERVER['SERVER_PORT']})\$|[^a-z0-9\\-\\.]/", '', strtolower($_SERVER['HTTP_HOST']));
     $nameArchive = $domain . '-' . date('Y-m-d') . '.tar.gz';
     $pathArchive = $tmpDir . DIRECTORY_SEPARATOR . $nameArchive;
     //Dump database data
     $dbFileName = 'dbdump.xml';
     $dbFilePath = $tmpDir . DIRECTORY_SEPARATOR . $dbFileName;
     Jaws_DB::getInstance()->Dump($dbFilePath);
     $files = array();
     require_once PEAR_PATH . 'File/Archive.php';
     $files[] = File_Archive::read(JAWS_DATA);
     $files[] = File_Archive::read($dbFilePath, $dbFileName);
     File_Archive::extract($files, File_Archive::toArchive($pathArchive, File_Archive::toFiles()));
     Jaws_Utils::Delete($dbFilePath);
     // browser must download file from server instead of cache
     header("Expires: 0");
     header("Pragma: public");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     // force download dialog
     header("Content-Type: application/force-download");
     // set data type, size and filename
     header("Content-Disposition: attachment; filename=\"{$nameArchive}\"");
     header("Content-Transfer-Encoding: binary");
     header('Content-Length: ' . @filesize($pathArchive));
     @readfile($pathArchive);
     Jaws_Utils::Delete($pathArchive);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Backup.php

示例2: packTheme

 /**
  * Creates a .zip file of the theme in themes/ directory
  *
  * @access  public
  * @param   string  $theme      Name of the theme
  * @param   string  $srcDir     Source directory
  * @param   string  $destDir    Target directory
  * @param   bool    $copy_example_to_repository  If copy example.png too or not
  * @return  bool    Returns true if:
  *                    - Theme exists
  *                    - Theme exists and could be packed
  *                  Returns false if:
  *                    - Theme doesn't exist
  *                    - Theme doesn't exists and couldn't be packed
  */
 function packTheme($theme, $srcDir, $destDir, $copy_example_to_repository = true)
 {
     $themeSrc = $srcDir . '/' . $theme;
     if (!is_dir($themeSrc)) {
         return new Jaws_Error(_t('TMS_ERROR_THEME_DOES_NOT_EXISTS', $theme));
     }
     if (!Jaws_Utils::is_writable($destDir)) {
         return new Jaws_Error(_t('GLOBAL_ERROR_FAILED_DIRECTORY_UNWRITABLE', $destDir), $this->gadget->name);
     }
     $themeDest = $destDir . '/' . $theme . '.zip';
     //If file exists.. delete it
     if (file_exists($themeDest)) {
         @unlink($themeDest);
     }
     require_once PEAR_PATH . 'File/Archive.php';
     $reader = File_Archive::read($themeSrc, $theme);
     $innerWriter = File_Archive::toFiles();
     $writer = File_Archive::toArchive($themeDest, $innerWriter);
     $res = File_Archive::extract($reader, $writer);
     if (PEAR::isError($res)) {
         return new Jaws_Error(_t('TMS_ERROR_COULD_NOT_PACK_THEME'));
     }
     Jaws_Utils::chmod($themeDest);
     if ($copy_example_to_repository) {
         //Copy image to repository/images
         if (file_exists($srcDir . '/example.png')) {
             @copy($srcDir . '/example.png', JAWS_DATA . "themes/repository/Resources/images/{$theme}.png");
             Jaws_Utils::chmod(JAWS_DATA . 'themes/repository/Resources/images/' . $theme . '.png');
         }
     }
     return $themeDest;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:47,代码来源:Themes.php

示例3: 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

示例4: Export

 /**
  * Export language
  *
  * @access  public
  * @return  void
  */
 function Export()
 {
     $lang = jaws()->request->fetch('lang', 'get');
     require_once PEAR_PATH . 'File/Archive.php';
     $tmpDir = sys_get_temp_dir();
     $tmpFileName = "{$lang}.tar";
     $tmpArchiveName = $tmpDir . DIRECTORY_SEPARATOR . $tmpFileName;
     $writerObj = File_Archive::toFiles();
     $src = File_Archive::read(JAWS_DATA . "languages/{$lang}", $lang);
     $dst = File_Archive::toArchive($tmpArchiveName, $writerObj);
     $res = File_Archive::extract($src, $dst);
     if (!PEAR::isError($res)) {
         return Jaws_Utils::Download($tmpArchiveName, $tmpFileName);
     }
     Jaws_Header::Referrer();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:22,代码来源:Export.php

示例5: execute

    /**
     * ダウンロードメイン表示クラス
     *
     * @access  public
     */
    function execute()
    {
        $header = <<<EOD
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>NetCommons</title>
</head>
<body>

EOD;
        $footer = <<<EOD
</body>
</html>
EOD;
        require_once "File/Archive.php";
        $dest = File_Archive::toArchive("document.zip", File_Archive::toOutput());
        $dest->newFile("document.html");
        $download_url = "?action=" . $this->download_action . "&upload_id=";
        $count = substr_count($this->content, $download_url);
        if (!$count) {
            $dest->writeData($header . $this->content . $footer);
            $dest->close();
            exit;
        }
        $upload_id = array();
        $files = array();
        $trans = array();
        $parts = explode($download_url, $this->content);
        for ($i = 1; $i <= $count; $i++) {
            $id = substr($parts[$i], 0, strpos($parts[$i], '"'));
            if (!isset($upload_id[$id])) {
                $upload_id[$id] = true;
                list($pathname, $filename, $physical_file_name, $space_type) = $this->uploadsView->downloadCheck($id, null, 0, "common_download_main");
                if ($pathname != null) {
                    $files[] = $pathname . $physical_file_name;
                    $trans[BASE_URL . '/' . $download_url . $id] = "./" . $physical_file_name;
                    $trans[$download_url . $id] = $physical_file_name;
                }
            }
        }
        clearstatcache();
        $dest->writeData($header . strtr($this->content, $trans) . $footer);
        File_Archive::extract($files, $dest);
    }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:50,代码来源:Zip.class.php

示例6: appenderFromSource

 /**
  * Create a writer that can be used to append files to an archive inside a source
  * If the archive can't be found in the source, it will be created
  * If source is set to null, File_Archive::toFiles will be assumed
  * If type is set to null, the type of the archive will be determined looking at
  * the extension in the URL
  * stat is the array of stat (returned by stat() PHP function of Reader getStat())
  * to use if the archive must be created
  *
  * This function allows to create or append data to nested archives. Only one
  * archive will be created and if your creation requires creating several nested
  * archives, a PEAR error will be returned
  *
  * After this call, $source will be closed and should not be used until the
  * returned writer is closed.
  *
  * @param File_Archive_Reader $source A reader where some files will be appended
  * @param string $URL URL to reach the archive in the source.
  *        if $URL is null, a writer to append files to the $source reader will
  *        be returned
  * @param bool $unique If true, the duplicate files will be deleted on close
  *        Default is false (and setting it to true may have some performance
  *        consequences)
  * @param string $type Extension of the archive (or null to use the one in the URL)
  * @param array $stat Used only if archive is created, array of stat as returned
  *        by PHP stat function or Reader getStat function: stats of the archive)
  *        Time (index 9) will be overwritten to current time
  * @return File_Archive_Writer a writer that you can use to append files to the reader
  */
 function appenderFromSource(&$toConvert, $URL = null, $unique = null, $type = null, $stat = array())
 {
     $source =& File_Archive::_convertToReader($toConvert);
     if (PEAR::isError($source)) {
         return $source;
     }
     if ($unique == null) {
         $unique = File_Archive::getOption("appendRemoveDuplicates");
     }
     //Do not report the fact that the archive does not exist as an error
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     if ($URL === null) {
         $result =& $source;
     } else {
         if ($type === null) {
             $result = File_Archive::_readSource($source, $URL . '/', $reachable, $baseDir);
         } else {
             $result = File_Archive::readArchive($type, File_Archive::_readSource($source, $URL, $reachable, $baseDir));
         }
     }
     PEAR::popErrorHandling();
     if (!PEAR::isError($result)) {
         if ($unique) {
             require_once dirname(__FILE__) . "/Archive/Writer/UniqueAppender.php";
             return new File_Archive_Writer_UniqueAppender($result);
         } else {
             return $result->makeAppendWriter();
         }
     }
     //The source can't be found and has to be created
     $stat[9] = $stat['mtime'] = time();
     if (empty($baseDir)) {
         if ($source !== null) {
             $writer =& $source->makeWriter();
         } else {
             $writer =& File_Archive::toFiles();
         }
         if (PEAR::isError($writer)) {
             return $writer;
         }
         PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
         $result = File_Archive::toArchive($reachable, $writer, $type);
         PEAR::popErrorHandling();
         if (PEAR::isError($result)) {
             $result = File_Archive::toFiles($reachable);
         }
     } else {
         $reachedSource = File_Archive::readSource($source, $reachable);
         if (PEAR::isError($reachedSource)) {
             return $reachedSource;
         }
         $writer = $reachedSource->makeWriter();
         if (PEAR::isError($writer)) {
             return $writer;
         }
         PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
         $result = File_Archive::toArchive($baseDir, $writer, $type);
         PEAR::popErrorHandling();
         if (PEAR::isError($result)) {
             require_once dirname(__FILE__) . "/Archive/Writer/AddBaseName.php";
             $result = new File_Archive_Writer_AddBaseName($baseDir, $writer);
             if (PEAR::isError($result)) {
                 return $result;
             }
         }
     }
     return $result;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:97,代码来源:Archive.php

示例7: zip_it

function zip_it($source, $destination)
{
    $source = realpath($source);
    if (is_readable($source) === true) {
        if (extension_loaded('zip') === true) {
            $zip = new ZipArchive();
            if ($zip->open($destination, ZIPARCHIVE::CREATE) === true) {
                $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
                // Iterate through files & directories and add to archive object
                foreach ($files as $file) {
                    if (is_dir($file) === true) {
                        $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
                    } else {
                        if (is_file($file) === true) {
                            $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
                        }
                    }
                }
            } else {
                echo "Couldn't create zip file<br />";
            }
            return $zip->close();
        } else {
            $original_dir = getcwd();
            chdir($source);
            File_Archive::extract(File_Archive::read('.'), File_Archive::toArchive($destination, File_Archive::toFiles(), 'zip'));
            chdir($original_dir);
            // TODO: add filesize check?
            if (is_readable($destination)) {
                return true;
            }
        }
    } else {
        echo "Source content does not exist or is not readable<br />";
    }
    return false;
}
开发者ID:neofreko,项目名称:anthologize,代码行数:37,代码来源:index.php

示例8: 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

示例9: run

 /**
  * Execute action when called for explicitly by the user
  *
  * This function also contains the actions available in the interface provided, including file
  * uploading, compressed file extraction and the creation of folders.
  * @return void
  */
 function run()
 {
     global $Templates, $USER, $Controller, $ID, $CONFIG;
     /**
      * User input types
      */
     $_REQUEST->setType('action', 'string');
     $_REQUEST->setType('popup', 'string');
     $_REQUEST->setType('filter', 'string');
     if (!$this->may($USER, READ)) {
         errorPage(401);
     } else {
         if (!in_array($CMPRExtension = $CONFIG->files->compression_format, array('tar', 'gz', 'tgz', 'tbz', 'zip', 'ar', 'deb'))) {
             $CONFIG->files->compression_format = $CMPRExtension = 'zip';
         }
         $render = true;
         switch ($_REQUEST['action']) {
             // All users
             case 'download':
                 global $PREVENT_CSIZE_HEADER;
                 $PREVENT_CSIZE_HEADER = true;
                 while (ob_get_level()) {
                     echo ob_get_clean();
                 }
                 require_once "File/Archive.php";
                 File_Archive::extract($this->path, File_Archive::toArchive($this->filename . '.' . $CMPRExtension, File_Archive::toOutput()));
                 die;
             default:
                 $this->setContent("main", $this->genHTML());
                 break;
         }
         if ($render) {
             $t = 'admin';
             if ($_REQUEST['popup']) {
                 $t = 'popup';
             }
             $Templates->{$t}->render();
         }
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:47,代码来源:Folder.php

示例10: _testRemove

 function _testRemove($extension)
 {
     $writer = File_Archive::toArchive("test.{$extension}", File_Archive::toVariable($x));
     $writer->newFile('foo.txt');
     $writer->writeData('ABCDEF');
     $writer->newFile('bla_to_remove.txt');
     $writer->writeData('GHIJKL');
     $writer->newFile('bar.txt');
     $writer->writeData('MNOP');
     $writer->close();
     File_Archive::removeFromSource(File_Archive::predEreg('_to_remove'), $source = File_Archive::readSource(File_Archive::readMemory($x, "test.{$extension}"), "test.{$extension}/"));
     $this->assertEquals("foo.txt\nbar.txt", implode("\n", $source->getFileList()));
 }
开发者ID:andychang88,项目名称:jianzhanseo.com,代码行数:13,代码来源:test.php

示例11: _roomBackUp


//.........这里部分代码省略.........
                 $xml_data .= "\n";
             }
             $write_xml_data .= $xml_data;
             //fwrite ($this->xml_handle, $xml_data);
             //
             // アップロードファイルコピー処理
             //
             if (!$this->_uploadCopy($temporary_file_path, $page)) {
                 $this->_delUploads();
                 return false;
             }
             $write_xml_data .= $this->_createDumpXML($page['page_id']);
             //if(!$this->_createDumpXML($page['page_id'])) return false;
             // 子グループがあれば、その子グループもバックアップ対象とする
             $where_params = array("parent_id" => $page['page_id'], "page_id = room_id" => null);
             $child_pages = $this->pagesView->getPages($where_params);
             if ($child_pages === false) {
                 return false;
             }
             if (count($child_pages) > 0) {
                 foreach ($child_pages as $child_page) {
                     if (!$this->_uploadCopy($temporary_file_path, $child_page)) {
                         $this->_delUploads();
                         return false;
                     }
                     $write_xml_data .= $this->_createDumpXML($child_page['page_id'], true);
                 }
             }
             //
             // 書き込み
             //
             $write_xml_data .= "</rooms>";
             $xml_handle = fopen($temporary_file_path . BACKUP_ROOM_XML_FILE_NAME, "w");
             if (!$xml_handle) {
                 $this->_delUploads();
                 $this->errorList->add("backup", BACKUP_MKDIR_ERROR);
                 return false;
             }
             $result = fwrite($xml_handle, $write_xml_data);
             fclose($xml_handle);
             if ($result === false) {
                 $this->errorList->add("backup", BACKUP_MKDIR_ERROR);
                 return false;
             }
             //
             // 暗号化したペアキーの有効期限書き込み
             //
             $ini_handle = fopen($temporary_file_path . BACKUP_ROOM_XML_INI_NAME, "w");
             if (!$ini_handle) {
                 $this->errorList->add("backup", BACKUP_MKDIR_ERROR);
                 $this->_delUploads();
                 return false;
             }
             // ハッシュ化データを秘密鍵で暗号化
             $encryption = $this->encryption->getEncryptionKeys();
             $hash_text = sha1($write_xml_data);
             $encrypt_text = $this->encryption->encrypt($hash_text, $encryption['private_key']);
             $xml_data = "<?xml version=\"1.0\" encoding=\"" . _CHARSET . "\"?>\n" . "<_expiration>\n" . "\t<encrypt_text>" . $encrypt_text . "</encrypt_text>\n" . "\t<host_field><![CDATA[" . BASE_URL . INDEX_FILE_NAME . "]]></host_field>\n" . "\t<expiration_time>" . $encryption['expiration_time'] . "</expiration_time>\n" . "</_expiration>\n";
             fwrite($ini_handle, $xml_data);
             fclose($ini_handle);
             //
             // 圧縮
             //
             //$physical_file = FILEUPLOADS_DIR."backup/".$upload_id.".".$extension;
             if (!is_dir(FILEUPLOADS_DIR . "backup/")) {
                 mkdir(FILEUPLOADS_DIR . "backup/", 0755);
             }
             $target_file = FILEUPLOADS_DIR . "backup/" . $upload_id . "." . $extension;
             //$target_file = mb_convert_encoding($file_obj["file_name"], $this->encode, "auto").".".$file_obj["extension"];
             if (file_exists($temporary_file_path)) {
                 File_Archive::extract(File_Archive::read($temporary_file_path), File_Archive::toArchive($target_file, File_Archive::toFiles()));
                 // テンポラリーファイル削除
                 $this->fileAction->delDir($temporary_file_path);
                 // 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;
                 }
             }
             //
             // バックアップ暗号データ履歴登録
             //
             $params = array("encrypt_data" => $encrypt_text, "room_id" => $this->backup_page_id);
             $result = $this->db->insertExecute("backup_encrypt_history", $params, true);
             if ($result === false) {
                 return $result;
             }
         } else {
             $this->errorList->add("backup", BACKUP_MKDIR_ERROR);
             $this->_delUploads();
             return false;
         }
         //$physical_file_name = "${upload_id}.${extension}";
         //$this->fileUpload->move($i, FILEUPLOADS_DIR.$file_path.$physical_file_name);
     }
     return true;
 }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:101,代码来源:Init.class.php

示例12: cmdGetDoc

/**
 * cmdGetDoc()
 *
 * @param  string $sPath
 * @return void
 */
function cmdGetDoc($sPath)
{
    if (isset($_SERVER['PWD'])) {
        chdir($_SERVER['PWD']);
    }
    File_Archive::extract(File_Archive::read(BLOCKEN_DOC_DIR), File_Archive::toArchive('BlockenDoc.zip', File_Archive::toFiles($sPath)));
}
开发者ID:syttru,项目名称:blocken-test,代码行数:13,代码来源:BlockenCommand.php

示例13: compressFile

 /**
  * 圧縮処理
  *
  * @return boolean
  * @access public
  */
 function compressFile()
 {
     $cabinet = $this->_request->getParameter("cabinet");
     $file = $this->_request->getParameter("file");
     $module_id = $this->_request->getParameter("module_id");
     $configView =& $this->_container->getComponent("configView");
     $config = $configView->getConfigByConfname($module_id, "compress_ext");
     if ($config === false) {
         return false;
     }
     if (defined($config['conf_value'])) {
         $extension = constant($config['conf_value']);
     } else {
         $extension = $config['conf_value'];
     }
     $file_path = "cabinet/";
     if (!file_exists(FILEUPLOADS_DIR . "/" . $file_path)) {
         mkdir(FILEUPLOADS_DIR . "/" . $file_path, octdec(_UPLOAD_FOLDER_MODE));
     }
     $file_name = $this->_cabinetView->renameFile($file["org_file_name"], $extension);
     $params = array("room_id" => $this->_request->getParameter("room_id"), "module_id" => $module_id, "unique_id" => $file["cabinet_id"], "file_name" => $file_name . "." . $extension, "physical_file_name" => "", "file_path" => $file_path, "action_name" => "common_download_main", "file_size" => 0, "mimetype" => $this->_uploadsView->mimeinfo("type", $file_name . "." . $extension), "extension" => $extension, "garbage_flag" => _ON);
     $upload_id = $this->_uploadsAction->insUploads($params);
     if ($upload_id === false) {
         return false;
     }
     $archive_file_name = $upload_id;
     $this->archive_full_path = FILEUPLOADS_DIR . "/" . $file_path . "/" . $archive_file_name . "." . $extension;
     if (stristr($_SERVER['HTTP_USER_AGENT'], "Mac")) {
         // Macの場合
         $this->encode = "UTF-8";
     } else {
         if (stristr($_SERVER['HTTP_USER_AGENT'], "Windows")) {
             // Windowsの場合
             $this->encode = "SJIS";
         } else {
             $this->encode = _CHARSET;
         }
     }
     if ($file["file_type"] == CABINET_FILETYPE_FOLDER) {
         $result = $this->_compressFile($file["file_id"], mb_convert_encoding($file["org_file_name"], $this->encode, "auto") . "/");
         if ($result === false) {
             return false;
         }
         if (count($this->_source) > 0) {
             File_Archive::extract($this->_source, File_Archive::toArchive($this->archive_full_path, File_Archive::toFiles()));
         }
     } else {
         $sql = "SELECT F.file_id, F.parent_id, F.file_type, F.file_name, F.extension, U.file_path, U.physical_file_name " . "FROM {cabinet_file} F " . "LEFT JOIN {uploads} U ON (F.upload_id=U.upload_id) ";
         $sql .= "WHERE F.cabinet_id = ? ";
         $sql .= "AND F.file_id = ? ";
         $params = array("cabinet_id" => $file["cabinet_id"], "file_id" => $file["file_id"]);
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
         $physical_file = FILEUPLOADS_DIR . $result[0]["file_path"] . $result[0]["physical_file_name"];
         $target_file = mb_convert_encoding($file["org_file_name"], $this->encode, "auto") . "." . $file["extension"];
         if (file_exists($physical_file)) {
             File_Archive::extract(File_Archive::read($physical_file, $target_file), File_Archive::toArchive($this->archive_full_path, File_Archive::toFiles()));
         }
     }
     if (file_exists($this->archive_full_path)) {
         $file_size = filesize($this->archive_full_path);
     } else {
         return false;
     }
     if ($cabinet["compress_download"] == _OFF) {
         $result = $this->_uploadsAction->updUploads(array("file_size" => $file_size, "garbage_flag" => _OFF), array("upload_id" => $upload_id));
         if ($result === false) {
             return false;
         }
         $params = array("cabinet_id" => $file["cabinet_id"], "upload_id" => $upload_id, "parent_id" => $file["parent_id"], "file_name" => $file_name, "extension" => $extension, "depth" => $file["depth"], "size" => $file_size, "download_num" => 0, "file_type" => CABINET_FILETYPE_FILE, "display_sequence" => 0);
         $file_id = $this->_db->insertExecute("cabinet_file", $params, true, "file_id");
         $params = array("file_id" => $file_id, "comment" => "");
         $result = $this->_db->insertExecute("cabinet_comment", $params, true);
         if ($result === false) {
             return false;
         }
     } else {
         $result = $this->_uploadsAction->updUploads(array("file_size" => $file_size), array("upload_id" => $upload_id));
         if ($result === false) {
             return false;
         }
         $pathname = FILEUPLOADS_DIR . $file_path;
         $filename = $file_name . "." . $extension;
         $physical_file_name = $archive_file_name . "." . $extension;
         clearstatcache();
         $this->_uploadsView->headerOutput($pathname, $filename, $physical_file_name);
         $result = $this->_uploadsAction->delUploadsById($upload_id);
         if ($file['file_type'] == CABINET_FILETYPE_FILE) {
             $this->setDownload($file['file_id']);
         }
         exit;
//.........这里部分代码省略.........
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:101,代码来源:Action.class.php

示例14: ExportLogs

 /**
  * Export Logs
  *
  * @access  public
  * @return  void
  */
 function ExportLogs()
 {
     $this->gadget->CheckPermission('ExportLogs');
     $filters = jaws()->request->fetch(array('from_date', 'to_date', 'gname', 'user', 'priority', 'status'), 'get');
     $filters['gadget'] = $filters['gname'];
     unset($filters['gname']);
     $model = $this->gadget->model->load('Logs');
     $logs = $model->GetLogs($filters);
     if (Jaws_Error::IsError($logs) || count($logs) < 1) {
         return;
     }
     $tmpDir = sys_get_temp_dir();
     $tmpCSVFileName = uniqid(rand(), true) . '.csv';
     $fp = fopen($tmpDir . DIRECTORY_SEPARATOR . $tmpCSVFileName, 'w');
     $date = Jaws_Date::getInstance();
     foreach ($logs as $log) {
         $exportData = '';
         $exportData .= $log['id'] . ',';
         $exportData .= $log['username'] . ',';
         $exportData .= $log['gadget'] . ',';
         $exportData .= $log['action'] . ',';
         $exportData .= $log['priority'] . ',';
         $exportData .= $log['apptype'] . ',';
         $exportData .= $log['backend'] . ',';
         $exportData .= long2ip($log['ip']) . ',';
         $exportData .= $log['status'] . ',';
         $exportData .= $date->Format($log['insert_time'], 'Y-m-d H:i:s');
         $exportData .= PHP_EOL;
         fwrite($fp, $exportData);
     }
     fclose($fp);
     require_once PEAR_PATH . 'File/Archive.php';
     $tmpFileName = uniqid(rand(), true) . '.tar.gz';
     $tmpArchiveName = $tmpDir . DIRECTORY_SEPARATOR . $tmpFileName;
     $writerObj = File_Archive::toFiles();
     $src = File_Archive::read($tmpDir . DIRECTORY_SEPARATOR . $tmpCSVFileName);
     $dst = File_Archive::toArchive($tmpArchiveName, $writerObj);
     $res = File_Archive::extract($src, $dst);
     if (!PEAR::isError($res)) {
         return Jaws_Utils::Download($tmpArchiveName, $tmpFileName);
     }
     Jaws_Header::Referrer();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:49,代码来源:Logs.php

示例15:

	}
	if ( $file_cnt >= OUTPUT_FILE_LIMIT ){
		WriteFinFile($fin_file,"WAR:file size limit over\n");
		break;
	}
	$file_size += $row_len;
	$zip_file=sprintf("%s/%s/%s_%03d.zip",DIR_RESULT,$hive_uid,$hive_id,$file_cnt);
	$zip_file_in=sprintf("%s_%03d.csv",$hive_id,$file_cnt);

	//出力ファイルのオープン
	if ( $sv_zip_file != $zip_file ){
		if ( $sv_zip_file != "" ){
			WriteFinFile($fin_file,"OUT:$sv_zip_file\n");
			$ofp->close();
		}
		$ofp = File_Archive::toArchive($zip_file, File_Archive::toFiles(),"zip");
		$ofp->newFile($zip_file_in);
	}
	$sv_zip_file=$zip_file;

	//出力
	$row=mb_convert_encoding($row,"SJIS-WIN","UTF-8");
	$ofp->writeData($row);
}
pclose($ifp);

if ( $sv_zip_file != "" ){
	WriteFinFile($fin_file,"OUT:$sv_zip_file\n");
	$ofp->close();
}
开发者ID:recruitcojp,项目名称:WebHive,代码行数:30,代码来源:hive_request.php


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