當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZPackage::temporaryExportPath方法代碼示例

本文整理匯總了PHP中eZPackage::temporaryExportPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZPackage::temporaryExportPath方法的具體用法?PHP eZPackage::temporaryExportPath怎麽用?PHP eZPackage::temporaryExportPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZPackage的用法示例。


在下文中一共展示了eZPackage::temporaryExportPath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exportToArchive

 function exportToArchive($archivePath)
 {
     $temporaryExportPath = eZPackage::temporaryExportPath();
     $tempPath = $temporaryExportPath . '/' . $this->attribute('name');
     $this->removeFiles($tempPath);
     // Create package temp dir and copy package's XML file there
     $this->storePackageFile($tempPath, false);
     // Copy package's directories
     $directoryList = array($this->documentDirectory(), $this->filesDirectory(), $this->simpleFilesDirectory(), $this->settingsDirectory());
     $installItems = $this->Parameters['install'];
     foreach ($installItems as $installItem) {
         if (!in_array($installItem['sub-directory'], $directoryList)) {
             $directoryList[] = $installItem['sub-directory'];
         }
     }
     $path = $this->path();
     foreach ($directoryList as $dirName) {
         $destDir = $tempPath;
         $dir = $path . '/' . $dirName;
         if (file_exists($dir)) {
             eZDir::copy($dir, $destDir);
         }
     }
     $tarArchivePath = $temporaryExportPath . '/archive.tmp';
     $tarArchive = ezcArchive::open($tarArchivePath, ezcArchive::TAR_USTAR);
     $tarArchive->truncate();
     $prefix = $tempPath . '/';
     $fileList = array();
     eZDir::recursiveList($tempPath, $tempPath, $fileList);
     foreach ($fileList as $fileInfo) {
         $path = $fileInfo['type'] === 'dir' ? $fileInfo['path'] . '/' . $fileInfo['name'] . '/' : $fileInfo['path'] . '/' . $fileInfo['name'];
         $tarArchive->append(array($path), $prefix);
     }
     $tarArchive->close();
     copy($tarArchivePath, "compress.zlib://{$archivePath}");
     unlink($tarArchivePath);
     $this->removeFiles($tempPath);
     return $archivePath;
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:39,代碼來源:ezpackage.php

示例2: clearstatcache

/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.6
 * @package kernel
 */
$module = $Params['Module'];
$packageName = $Params['PackageName'];
$package = eZPackage::fetch($packageName);
if (!$package) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if (!$package->attribute('can_export')) {
    return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$exportDirectory = eZPackage::temporaryExportPath();
$exportName = $package->exportName();
$exportPath = $exportDirectory . '/' . $exportName;
$exportPath = $package->exportToArchive($exportPath);
//return $module->redirectToView( 'view', array( 'full', $package->attribute( 'name' ) ) );
$fileName = $exportPath;
if ($fileName != "" and file_exists($fileName)) {
    clearstatcache();
    $fileSize = filesize($fileName);
    $mimeType = 'application/octet-stream';
    $originalFileName = $exportName;
    $contentLength = $fileSize;
    $fileOffset = false;
    $fileLength = false;
    if (isset($_SERVER['HTTP_RANGE'])) {
        $httpRange = trim($_SERVER['HTTP_RANGE']);
開發者ID:legende91,項目名稱:ez,代碼行數:31,代碼來源:export.php


注:本文中的eZPackage::temporaryExportPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。