本文整理汇总了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;
}
示例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']);