當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。