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


PHP Files::unlink方法代码示例

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


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

示例1: refresh

 /**
  * @param Thumbnail $thumbnail
  * @return void
  * @throws Exception\NoThumbnailAvailableException
  */
 public function refresh(Thumbnail $thumbnail)
 {
     $temporaryPathAndFilename = null;
     try {
         $filename = pathinfo($thumbnail->getOriginalAsset()->getResource()->getFilename(), PATHINFO_FILENAME);
         $temporaryLocalCopyFilename = $thumbnail->getOriginalAsset()->getResource()->createTemporaryLocalCopy();
         $temporaryPathAndFilename = $this->environment->getPathToTemporaryDirectory() . uniqid('ProcessedFontThumbnail-') . '.' . $filename . '.jpg';
         $width = 1000;
         $height = 1000;
         $im = imagecreate($width, $height);
         $red = imagecolorallocate($im, 0xff, 0xff, 0xff);
         $black = imagecolorallocate($im, 0x0, 0x0, 0x0);
         imagefilledrectangle($im, 0, 0, 1000, 1000, $red);
         imagefttext($im, 48, 0, 80, 150, $black, $temporaryLocalCopyFilename, 'Neos Font Preview');
         imagefttext($im, 32, 0, 80, 280, $black, $temporaryLocalCopyFilename, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
         imagefttext($im, 32, 0, 80, 360, $black, $temporaryLocalCopyFilename, 'abcdefghijklmopqrstuvwxyz');
         imagefttext($im, 32, 0, 80, 440, $black, $temporaryLocalCopyFilename, '1234567890');
         imagefttext($im, 32, 0, 80, 560, $black, $temporaryLocalCopyFilename, '+ " * ç % & / ( ) = ? @ €');
         imagejpeg($im, $temporaryPathAndFilename);
         $resource = $this->resourceManager->importResource($temporaryPathAndFilename);
         $processedImageInfo = $this->resize($thumbnail, $resource);
         $thumbnail->setResource($processedImageInfo['resource']);
         $thumbnail->setWidth($processedImageInfo['width']);
         $thumbnail->setHeight($processedImageInfo['height']);
         Files::unlink($temporaryPathAndFilename);
     } catch (\Exception $exception) {
         Files::unlink($temporaryPathAndFilename);
         $filename = $thumbnail->getOriginalAsset()->getResource()->getFilename();
         $sha1 = $thumbnail->getOriginalAsset()->getResource()->getSha1();
         $message = sprintf('Unable to generate thumbnail for the given font (filename: %s, SHA1: %s)', $filename, $sha1);
         throw new Exception\NoThumbnailAvailableException($message, 1433109653, $exception);
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:38,代码来源:FontDocumentThumbnailGenerator.php

示例2: getPatchFromGerrit

 /**
  * Gets the patch as zip package from gerrit
  *
  * @param int $patchId
  * @return bool|string
  * @throws \TYPO3\Flow\Utility\Exception
  */
 public function getPatchFromGerrit($patchId)
 {
     $uri = sprintf($this->gerritApiPattern, $patchId, 'revisions/current/patch?zip');
     $outputDirectory = Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'GerritPatches'));
     Files::createDirectoryRecursively($outputDirectory);
     $outputZipFilePath = Files::concatenatePaths(array($outputDirectory, $patchId . '.zip'));
     $httpClient = new Client();
     $httpClient->get($uri)->setResponseBody($outputZipFilePath)->send();
     $zip = new \ZipArchive();
     $zip->open($outputZipFilePath);
     $patchFile = $zip->getNameIndex(0);
     $zip->extractTo($outputDirectory);
     $zip->close();
     Files::unlink($outputZipFilePath);
     return Files::concatenatePaths(array($outputDirectory, $patchFile));
 }
开发者ID:kdambekalns,项目名称:Neos.Contribute,代码行数:23,代码来源:GerritService.php

示例3: unpublishFile

 /**
  * Removes the specified target file from the public directory
  *
  * This method fails silently if the given file could not be unpublished or already didn't exist anymore.
  *
  * @param string $relativeTargetPathAndFilename relative path and filename in the target directory
  * @return void
  */
 protected function unpublishFile($relativeTargetPathAndFilename)
 {
     $targetPathAndFilename = $this->path . $relativeTargetPathAndFilename;
     if (!file_exists($targetPathAndFilename)) {
         return;
     }
     if (!Files::unlink($targetPathAndFilename)) {
         return;
     }
     Files::removeEmptyDirectoriesOnPath(dirname($targetPathAndFilename));
 }
开发者ID:sakona999,项目名称:flow-login,代码行数:19,代码来源:FileSystemTarget.php

示例4: release

 /**
  * Releases the lock
  *
  * @return boolean TRUE on success, FALSE otherwise
  */
 public function release()
 {
     $success = true;
     if (is_resource($this->filePointer)) {
         if (flock($this->filePointer, LOCK_UN) === false) {
             $success = false;
         }
         fclose($this->filePointer);
         Files::unlink($this->lockFileName);
     }
     return $success;
 }
开发者ID:radmiraal,项目名称:flow,代码行数:17,代码来源:FlockLockStrategy.php

示例5: unlinkReturnsFalseIfSpecifiedPathDoesNotExist

 /**
  * @test
  * @outputBuffering enabled
  *     ... because the chmod call in ResourceManager emits a warning making this fail in strict mode
  */
 public function unlinkReturnsFalseIfSpecifiedPathDoesNotExist()
 {
     $this->assertFalse(Files::unlink('NonExistingPath'));
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:9,代码来源:FilesTest.php

示例6: flushCaches

 /**
  * Flushes all registered caches
  *
  * @param boolean $flushPersistentCaches If set to TRUE, even those caches which are flagged as "persistent" will be flushed
  * @return void
  * @api
  */
 public function flushCaches($flushPersistentCaches = FALSE)
 {
     $this->createAllCaches();
     /** @var FrontendInterface $cache */
     foreach ($this->caches as $identifier => $cache) {
         if (!$flushPersistentCaches && $this->isCachePersistent($identifier)) {
             continue;
         }
         $cache->flush();
     }
     $this->configurationManager->flushConfigurationCache();
     $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
     Files::unlink($dataTemporaryPath . 'AvailableProxyClasses.php');
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:21,代码来源:CacheManager.php

示例7: publishDirectory

 /**
  * Publishes the specified directory to this target, with the given relative path.
  *
  * @param string $sourcePath Absolute path to the source directory
  * @param string $relativeTargetPathAndFilename relative path and filename in the target directory
  * @throws Exception
  * @return void
  */
 protected function publishDirectory($sourcePath, $relativeTargetPathAndFilename)
 {
     $targetPathAndFilename = $this->path . $relativeTargetPathAndFilename;
     if (@stat($sourcePath) === false) {
         throw new Exception(sprintf('Could not publish directory "%s" into resource publishing target "%s" because the source is not accessible (file stat failed).', $sourcePath, $this->name), 1416244512);
     }
     if (!file_exists(dirname($targetPathAndFilename))) {
         Files::createDirectoryRecursively(dirname($targetPathAndFilename));
     }
     try {
         if (Files::is_link($targetPathAndFilename)) {
             Files::unlink($targetPathAndFilename);
         }
         $temporaryTargetPathAndFilename = uniqid($targetPathAndFilename . '.') . '.tmp';
         symlink($sourcePath, $temporaryTargetPathAndFilename);
         $result = rename($temporaryTargetPathAndFilename, $targetPathAndFilename);
     } catch (\Exception $exception) {
         $result = false;
     }
     if ($result === false) {
         throw new Exception(sprintf('Could not publish "%s" into resource publishing target "%s" because the source directory could not be symlinked at target location.', $sourcePath, $this->name), 1416244515, isset($exception) ? $exception : null);
     }
     $this->systemLogger->log(sprintf('FileSystemSymlinkTarget: Published directory. (target: %s, file: %s)', $this->name, $relativeTargetPathAndFilename), LOG_DEBUG);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:32,代码来源:FileSystemSymlinkTarget.php

示例8: flushCommand

 /**
  * Flush all caches
  *
  * The flush command flushes all caches (including code caches) which have been
  * registered with Flow's Cache Manager. It also removes any session data.
  *
  * If fatal errors caused by a package prevent the compile time bootstrap
  * from running, the removal of any temporary data can be forced by specifying
  * the option <b>--force</b>.
  *
  * This command does not remove the precompiled data provided by frozen
  * packages unless the <b>--force</b> option is used.
  *
  * @param boolean $force Force flushing of any temporary data
  * @return void
  * @see typo3.flow:cache:warmup
  * @see typo3.flow:package:freeze
  * @see typo3.flow:package:refreeze
  */
 public function flushCommand($force = FALSE)
 {
     // Internal note: the $force option is evaluated early in the Flow
     // bootstrap in order to reliably flush the temporary data before any
     // other code can cause fatal errors.
     $this->cacheManager->flushCaches();
     $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
     \TYPO3\Flow\Utility\Files::unlink($dataTemporaryPath . 'AvailableProxyClasses.php');
     $this->outputLine('Flushed all caches for "' . $this->bootstrap->getContext() . '" context.');
     if ($this->lockManager->isSiteLocked()) {
         $this->lockManager->unlockSite();
     }
     $frozenPackages = array();
     foreach (array_keys($this->packageManager->getActivePackages()) as $packageKey) {
         if ($this->packageManager->isPackageFrozen($packageKey)) {
             $frozenPackages[] = $packageKey;
         }
     }
     if ($frozenPackages !== array()) {
         $this->outputFormatted(PHP_EOL . 'Please note that the following package' . (count($frozenPackages) === 1 ? ' is' : 's are') . ' currently frozen: ' . PHP_EOL);
         $this->outputFormatted(implode(PHP_EOL, $frozenPackages) . PHP_EOL, array(), 2);
         $message = 'As code and configuration changes in these packages are not detected, the application may respond ';
         $message .= 'unexpectedly if modifications were done anyway or the remaining code relies on these changes.' . PHP_EOL . PHP_EOL;
         $message .= 'You may call <b>package:refreeze all</b> in order to refresh frozen packages or use the <b>--force</b> ';
         $message .= 'option of this <b>cache:flush</b> command to flush caches if Flow becomes unresponsive.' . PHP_EOL;
         $this->outputFormatted($message, array($frozenPackages));
     }
     $this->sendAndExit(0);
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:48,代码来源:CacheCommandController.php


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