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


PHP FilesystemInterface::deleteDir方法代码示例

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


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

示例1: clean

 /** @inheritdoc */
 public function clean($validPackages)
 {
     foreach (Linq::from($this->filesystem->listContents($this->vendorDir))->where(function ($v) {
         return $v['type'] == 'dir';
     }) as $vendor) {
         if (!Linq::from($validPackages)->any(function ($v, $k) use($vendor) {
             return preg_match('/^' . $vendor['basename'] . '/i', $k);
         })) {
             $this->notify("DELETING: " . $vendor['path'] . "\n");
             $this->filesystem->deleteDir($vendor['path']);
             continue;
         }
         foreach (Linq::from($this->filesystem->listContents($vendor['path']))->where(function ($v) {
             return $v['type'] == 'dir';
         }) as $package) {
             if (!Linq::from($validPackages)->any(function ($v, $k) use($vendor, $package) {
                 return $k == $vendor['basename'] . '/' . $package['basename'];
             })) {
                 $this->notify("DELETING: " . $package['path'] . "\n");
                 $this->filesystem->deleteDir($package['path']);
                 continue;
             }
             foreach (Linq::from($this->filesystem->listContents($package['path']))->where(function ($v) {
                 return $v['type'] == 'dir';
             }) as $version) {
                 if (!Linq::from($validPackages[$vendor['basename'] . '/' . $package['basename']])->any(function ($v) use($version) {
                     return $v == $version['basename'];
                 })) {
                     $this->notify("DELETING: " . $version['path'] . "\n");
                     $this->filesystem->deleteDir($version['path']);
                 }
             }
         }
     }
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:36,代码来源:PackageCleaner.php

示例2: uploadImagePreview

 public function uploadImagePreview(int $themeId, string $path) : string
 {
     $theme = $this->getThemeById($themeId);
     $dir = $theme->getId();
     $name = sprintf('%s.png', GenerateRandomString::gen(self::GENERATE_FILENAME_LENGTH));
     $newPath = sprintf('%s/%s', $dir, $name);
     if ($this->fileSystem->has($dir)) {
         $this->fileSystem->deleteDir($dir);
     }
     $this->fileSystem->write($newPath, file_get_contents($path));
     $theme->setPreview($newPath);
     $this->themeRepository->saveTheme($theme);
     return $theme->getPreview();
 }
开发者ID:cass-project,项目名称:cass,代码行数:14,代码来源:ThemeService.php

示例3: deleteCache

 /**
  * Delete cached manipulations for an image.
  * @param  string $path Image path.
  * @return bool   Whether the delete succeeded.
  */
 public function deleteCache($path)
 {
     if (!$this->groupCacheInFolders) {
         throw new InvalidArgumentException('Deleting cached image manipulations is not possible when grouping cache into folders is disabled.');
     }
     return $this->cache->deleteDir(dirname($this->getCachePath($path)));
 }
开发者ID:mambax7,项目名称:glide,代码行数:12,代码来源:Server.php

示例4: deleteFolder

 /**
  * Removes a folder in filesystem.
  *
  * @param string $folderIdentifier
  * @param bool $deleteRecursively
  * @return bool
  * @throws FileOperationErrorException
  */
 public function deleteFolder($folderIdentifier, $deleteRecursively = false)
 {
     $folderIdentifier = ltrim($folderIdentifier, '/');
     $result = $this->filesystem->deleteDir($folderIdentifier);
     if (false === $result) {
         throw new FileOperationErrorException('Deleting folder "' . $folderIdentifier . '" failed.', 1330119451);
     }
     return $result;
 }
开发者ID:cedricziel,项目名称:fal-flysystem,代码行数:17,代码来源:FlysystemDriver.php

示例5: extract

 /** @inheritdoc */
 public function extract($zipBallPath, $to)
 {
     $absolutePathToZipBall = $this->filesystem->getAdapter()->applyPathPrefix($zipBallPath);
     if ($this->zip->open($absolutePathToZipBall) === true) {
         $absolutePathToExtract = $this->filesystem->getAdapter()->applyPathPrefix($to);
         $this->zip->extractTo($absolutePathToExtract);
         $this->zip->close();
         $zipCreatedFolder = Linq::from($this->filesystem->listContents($to))->single(function ($object) {
             return $object['type'] == 'dir';
         })['path'];
         foreach ($this->filesystem->listContents($zipCreatedFolder, true) as $object) {
             if ($object['type'] == "file") {
                 $segments = explode('/', $object['path']);
                 unset($segments[4]);
                 $this->filesystem->rename($object['path'], implode('/', $segments));
             }
         }
         $this->filesystem->deleteDir($zipCreatedFolder);
         return;
     }
     throw new ZipExtractionFailed($zipBall, $to);
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:23,代码来源:ZipExtractor.php

示例6: removeEmptyDirectories

 /**
  * {@inheritdoc}
  */
 protected function removeEmptyDirectories($backupName)
 {
     /**
      * @var \SplFileInfo $dir
      */
     foreach ($this->flysystem->listContents($backupName) as $dir) {
         if ($dir['type'] != 'dir') {
             continue;
         }
         if (count($this->flysystem->listContents($dir['path'])) > 0) {
             $this->removeEmptyDirectories($dir['path']);
         } else {
             $this->flysystem->deleteDir($dir['path']);
         }
     }
 }
开发者ID:runopencode,项目名称:backup,代码行数:19,代码来源:FlysystemDestination.php

示例7: eraseDir

 /**
  * Erase a directory.
  *
  * @param string $dirname
  * @throws IoWriteException
  */
 public function eraseDir($dirname = '')
 {
     try {
         $listing = $this->fs->listContents($dirname, false);
         foreach ($listing as $item) {
             if ($item['type'] === 'dir') {
                 $this->fs->deleteDir($item['path']);
             } else {
                 $this->fs->delete($item['path']);
             }
         }
     } catch (Error $ex) {
         throw new IoWriteException("Directory {$dirname} could not be erased.", $ex);
     } catch (Exception $ex) {
         throw new IoWriteException("Directory {$dirname} could not be erased.", $ex);
     }
 }
开发者ID:khelle,项目名称:surume,代码行数:23,代码来源:Filesystem.php

示例8: ensuredEraseDir

 /**
  * Erase a directory.
  *
  * @param string $dirname
  * @throws WriteException
  */
 private function ensuredEraseDir($dirname)
 {
     try {
         $listing = $this->fs->listContents($dirname, false);
         foreach ($listing as $item) {
             if ($item['type'] === 'dir') {
                 $this->fs->deleteDir($item['path']);
             } else {
                 $this->fs->delete($item['path']);
             }
         }
         return;
     } catch (Error $ex) {
     } catch (Exception $ex) {
     }
     throw new WriteException("Directory {$dirname} could not be erased.", $ex);
 }
开发者ID:kraken-php,项目名称:framework,代码行数:23,代码来源:Filesystem.php

示例9: deleteDirectory

 /**
  * Recursively delete a directory.
  *
  * @param  string  $directory
  * @return bool
  */
 public function deleteDirectory($directory)
 {
     return $this->driver->deleteDir($directory);
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:10,代码来源:FilesystemAdapter.php

示例10: _rmdir

 /**
  * Remove dir
  *
  * @param  string  $path  dir path
  * @return bool
  **/
 protected function _rmdir($path)
 {
     return $this->fs->deleteDir($path);
 }
开发者ID:quepasso,项目名称:dashboard,代码行数:10,代码来源:ElFinderVolumeFlysystem.php

示例11: deleteDirectory

 public function deleteDirectory($spiPath)
 {
     $this->filesystem->deleteDir($spiPath);
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:4,代码来源:Flysystem.php

示例12: deleteCache

 /**
  * Delete cached manipulations for an image.
  * @param  string $path Image path.
  * @return bool   Whether the delete succeeded.
  */
 public function deleteCache($path)
 {
     return $this->cache->deleteDir(dirname($this->getCachePath($path)));
 }
开发者ID:whismat,项目名称:glide,代码行数:9,代码来源:Server.php

示例13: delete

 /**
  * @param \livetyping\hermitage\foundation\entities\Image $image
  *
  * @throws \livetyping\hermitage\foundation\exceptions\ImageNotFoundException
  */
 public function delete(Image $image)
 {
     $this->assertPresent($image->getPath());
     $this->filesystem->deleteDir($image->getDirname());
 }
开发者ID:livetyping,项目名称:hermitage,代码行数:10,代码来源:Storage.php

示例14: deleteDir

 /**
  * Delete a directory.
  *
  * @param string $dirname
  *
  * @throws RootViolationException Thrown if $dirname is empty.
  *
  * @return bool True on success, false on failure.
  */
 public function deleteDir($dirname)
 {
     return $this->fileSystem->deleteDir($dirname);
 }
开发者ID:graze,项目名称:data-file,代码行数:13,代码来源:FilesystemWrapper.php


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