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


PHP Write::delete方法代码示例

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


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

示例1: handleDisable

 /**
  * @param \Magento\Framework\Filesystem\Directory\Write $flagDir
  * @param OutputInterface $output
  * @param null $offOption
  */
 protected function handleDisable(\Magento\Framework\Filesystem\Directory\Write $flagDir, OutputInterface $output, $offOption = null)
 {
     $flagDir->delete(MaintenanceMode::FLAG_FILENAME);
     $output->writeln(self::DISABLED_MESSAGE);
     if ($offOption === 'd') {
         // Also delete IP flag file
         $flagDir->delete(MaintenanceMode::IP_FILENAME);
         $output->writeln(self::DELETED_IP_MESSAGE);
     }
 }
开发者ID:brentwpeterson,项目名称:n98-magerun2,代码行数:15,代码来源:MaintenanceCommand.php

示例2: beforeDispatch

 /**
  * Clear temporary directories
  *
  * @param \Magento\Install\Controller\Index\Index $subject
  * @param \Magento\Framework\App\RequestInterface $request
  *
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function beforeDispatch(\Magento\Install\Controller\Index\Index $subject, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->appState->isInstalled()) {
         foreach ($this->varDirectory->read() as $dir) {
             if ($this->varDirectory->isDirectory($dir)) {
                 try {
                     $this->varDirectory->delete($dir);
                 } catch (FilesystemException $exception) {
                     $this->logger->log($exception->getMessage());
                 }
             }
         }
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:23,代码来源:Dir.php

示例3: _deleteFilesRecursively

 /**
  * Delete all files in a directory recursively
  *
  * @param string $targetDir
  * @return void
  */
 protected function _deleteFilesRecursively($targetDir)
 {
     if ($this->_directory->isExist($targetDir)) {
         foreach ($this->_directory->read($targetDir) as $path) {
             $this->_directory->delete($path);
         }
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:CopyService.php

示例4: deleteDirectory

 /**
  * Delete directory
  *
  * @param string $path
  * @return bool
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function deleteDirectory($path)
 {
     $rootCmp = rtrim($this->_helper->getStorageRoot(), '/');
     $pathCmp = rtrim($path, '/');
     if ($rootCmp == $pathCmp) {
         throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t delete root directory %1 right now.', $path));
     }
     return $this->mediaWriteDirectory->delete($path);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Storage.php

示例5: deleteFile

 /**
  * Delete file (and its thumbnail if exists) from storage
  *
  * @param string $target File path to be deleted
  * @return $this
  */
 public function deleteFile($target)
 {
     $relativePath = $this->_directory->getRelativePath($target);
     if ($this->_directory->isFile($relativePath)) {
         $this->_directory->delete($relativePath);
     }
     $this->_coreFileStorageDb->deleteFile($target);
     $thumb = $this->getThumbnailPath($target, true);
     $relativePathThumb = $this->_directory->getRelativePath($thumb);
     if ($thumb) {
         if ($this->_directory->isFile($relativePathThumb)) {
             $this->_directory->delete($relativePathThumb);
         }
         $this->_coreFileStorageDb->deleteFile($thumb);
     }
     return $this;
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:23,代码来源:Storage.php

示例6: compactValue

 /**
  * Export attribute value to entity model
  *
  * @param array|string $value
  * @return $this
  */
 public function compactValue($value)
 {
     if ($this->getIsAjaxRequest()) {
         return $this;
     }
     $attribute = $this->getAttribute();
     $original = $this->getEntity()->getData($attribute->getAttributeCode());
     $toDelete = false;
     if ($original) {
         if (!$attribute->getIsRequired() && !empty($value['delete'])) {
             $toDelete = true;
         }
         if (!empty($value['tmp_name'])) {
             $toDelete = true;
         }
     }
     $destinationFolder = $attribute->getEntity()->getEntityTypeCode();
     // unlink entity file
     if ($toDelete) {
         $this->getEntity()->setData($attribute->getAttributeCode(), '');
         $file = $destinationFolder . $original;
         if ($this->_directory->isExist($file)) {
             $this->_directory->delete($file);
         }
     }
     if (!empty($value['tmp_name'])) {
         try {
             $uploader = new \Magento\Framework\File\Uploader($value);
             $uploader->setFilesDispersion(true);
             $uploader->setFilenamesCaseSensitivity(false);
             $uploader->setAllowRenameFiles(true);
             $uploader->save($this->_directory->getAbsolutePath($destinationFolder), $value['name']);
             $fileName = $uploader->getUploadedFileName();
             $this->getEntity()->setData($attribute->getAttributeCode(), $fileName);
         } catch (\Exception $e) {
             $this->_logger->logException($e);
         }
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:46,代码来源:File.php

示例7: tearDown

 protected function tearDown()
 {
     $this->varDirectory->delete('generation');
     unset($this->_generator);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:5,代码来源:GeneratorTest.php

示例8: tearDown

 protected function tearDown()
 {
     $this->varDirectory->delete('generation');
     set_include_path($this->_includePath);
     unset($this->_generator);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:6,代码来源:GeneratorTest.php

示例9: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     self::$_varDirectory->delete(self::$_varDirectory->getRelativePath(self::$_tmpDir));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:4,代码来源:ConfigTest.php


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