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


PHP eZFileHandler::unlink方法代码示例

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


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

示例1: downloadAndImportPackage

 /**
  * Downloads and imports package.
  *
  * Sets $this->ErrorMsg in case of an error.
  *
  * \param $forceDownload  download even if this package already exists.
  * \private
  * \return false on error, package object otherwise.
  */
 function downloadAndImportPackage($packageName, $packageUrl, $forceDownload = false)
 {
     $package = eZPackage::fetch($packageName, false, false, false);
     if (is_object($package)) {
         if ($forceDownload) {
             $package->remove();
         } else {
             eZDebug::writeNotice("Skipping download of package '{$packageName}': package already exists.");
             return $package;
         }
     }
     $archiveName = $this->downloadFile($packageUrl, eZStepSiteTypes::tempDir());
     if ($archiveName === false) {
         eZDebug::writeWarning("Download of package '{$packageName}' from '{$packageUrl}' failed: {$this->ErrorMsg}");
         $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Download of package \'%pkg\' failed. You may upload the package manually.', false, array('%pkg' => $packageName));
         return false;
     }
     $package = eZPackage::import($archiveName, $packageName, false);
     // Remove downloaded ezpkg file
     eZFileHandler::unlink($archiveName);
     if (!$package instanceof eZPackage) {
         if ($package == eZPackage::STATUS_INVALID_NAME) {
             eZDebug::writeNotice("The package name {$packageName} is invalid");
         } else {
             eZDebug::writeNotice("Invalid package");
         }
         $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Invalid package');
         return false;
     }
     return $package;
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:40,代码来源:ezstep_site_types.php

示例2: generatePDF

 /**
  * Converts xhtml to pdf
  *
  * @param $xhtml
  * @return Binary pdf content or false if error
  */
 public function generatePDF($xhtml)
 {
     //check if $tmpdir exists else try to create it
     if (!eZFileHandler::doExists($this->tmpDir)) {
         if (!eZDir::mkdir($this->tmpDir, eZDir::directoryPermission(), true)) {
             eZDebug::writeWarning("ParadoxPDF::generatePDF Error : could not create temporary directory {$this->tmpDir} ", 'ParadoxPDF::generatePDF');
             eZLog::write("ParadoxPDF::generatePDF Error : could not create temporary directory {$this->tmpDir} ", 'paradoxpdf.log');
             return false;
         }
     } elseif (!eZFileHandler::doIsWriteable($this->tmpDir)) {
         //check if $tmpdir is writable
         eZDebug::writeWarning("ParadoxPDF::generatePDF Error : please make {$this->tmpDir} writable ", 'ParadoxPDF::generatePDF');
         eZLog::write("ParadoxPDF::generatePDF Error : please make {$this->tmpDir} writable ", 'paradoxpdf.log');
         return false;
     }
     $rand = md5('paradoxpdf' . getmypid() . mt_rand());
     $tmpXHTMLFile = eZDir::path(array($this->tmpDir, "{$rand}.xhtml"));
     $tmpPDFFile = eZDir::path(array($this->tmpDir, "{$rand}.pdf"));
     //fix relative urls to match ez root directory
     $xhtml = $this->fixURL($xhtml);
     eZFile::create($tmpXHTMLFile, false, $xhtml);
     $pdfContent = '';
     //run jar in headless mode
     $command = $this->javaExec . " -Djava.awt.headless=true";
     if ($this->debugEnabled && $this->debugVerbose) {
         $command .= " -Dxr.util-logging.loggingEnabled=true";
     }
     $command .= " -jar " . $this->paradoxPDFExec . " {$tmpXHTMLFile} {$tmpPDFFile}";
     //fix to get all command output
     $command .= "  2>&1";
     //Enter the Matrix
     exec($command, $output, $returnCode);
     //Cant trust java return code so we test if a plain pdf file is genereated
     if (!(eZFileHandler::doExists($tmpPDFFile) && ($this->size = filesize($tmpPDFFile)))) {
         $this->writeCommandLog($command, $output, false);
         return false;
     }
     $this->writeCommandLog($command, $output, true);
     $pdfContent = file_get_contents($tmpPDFFile);
     //cleanup temporary files
     //if debug enabled preseves the temporary pdf file
     //else remove all temporary files
     if (!$this->debugEnabled) {
         eZFileHandler::unlink($tmpPDFFile);
         eZFileHandler::unlink($tmpXHTMLFile);
     }
     return $pdfContent;
 }
开发者ID:informaticatrentina,项目名称:paradoxpdf,代码行数:54,代码来源:paradoxpdf.php


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