本文整理汇总了PHP中League\Flysystem\Filesystem::deleteDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::deleteDir方法的具体用法?PHP Filesystem::deleteDir怎么用?PHP Filesystem::deleteDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Flysystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::deleteDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* Remove file or a directory
*
* @param $path
* @return void
*/
public function remove($path)
{
if (!$this->filesystem->has($path)) {
return;
}
$meta = $this->filesystem->getMetadata($path);
if ($meta['type'] === 'file') {
$this->filesystem->delete($path);
} else {
$this->filesystem->deleteDir($path);
}
}
示例2: execute
/**
* @return bool
*/
public function execute()
{
if ($this->filesystem->getMimetype($this->filePath) == 'application/x-gzip') {
if ($this->filesystem->getMimetype(str_replace('.tar.gz', '', $this->filePath)) == 'directory') {
$this->filesystem->deleteDir(str_replace('.tar.gz', '', $this->filePath));
}
}
if ($this->filesystem->getMimetype($this->filePath) == 'directory') {
return $this->filesystem->deleteDir($this->filePath);
} else {
return $this->filesystem->delete($this->filePath);
}
}
示例3: rmdir
/**
* {@inheritdoc}
*/
public function rmdir($path) {
try {
return @$this->flysystem->deleteDir($this->buildPath($path));
} catch (FileNotFoundException $e) {
return false;
}
}
示例4: 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)
{
try {
return $this->filesystem->deleteDir($dirname);
} catch (FlysystemRootViolationException $e) {
RootViolationException::rootViolation();
}
}
示例5: cleanCache
/**
* Clean the cache dir.
*
* @throws \DomainException
* @return void
*/
public static function cleanCache()
{
$filesystem = new Filesystem(new Local(self::$cacheDir));
foreach ($filesystem->listContents() as $path) {
if ('dir' == $path['type']) {
if (false == $filesystem->deleteDir($path['path'])) {
throw new \DomainException('Can not clean the cache.');
}
}
}
}
示例6: deleteDir
/**
* @inheritdoc
*/
public function deleteDir($dirname)
{
$innerDirname = $this->getInnerPath($dirname);
try {
$return = $this->fileSystem->deleteDir($innerDirname);
} catch (RootViolationException $e) {
throw $this->exceptionWrapper($e, $dirname);
}
if ($return !== false) {
$this->invokePlugin("removePathFromIndex", [$dirname, $innerDirname], $this);
}
return $return;
}
示例7: cleanupRemote
/**
* Clean up remote files.
*
* @return void
*/
public function cleanupRemote()
{
if (isset($this->config->keepfor)) {
$remotePath = './' . $this->dump_folder;
$directories = $this->remoteAdapter->listContents($remotePath);
$timestamp = date('YmdHi', time() - (time() - strtotime($this->config->keepfor . ' ago')));
foreach ($directories as $dir) {
if ($dir['filename'] < $timestamp) {
$this->remoteAdapter->deleteDir($dir['path']);
}
}
}
}
示例8: handleOptions
private function handleOptions()
{
if ($this->delete) {
$this->getItemsToDelete()->each(function ($item) {
if ($item['type'] === 'dir') {
dump($item);
$this->filesystem->deleteDir($item['path']);
return true;
}
$this->filesystem->delete($item['path']);
return true;
});
}
}
示例9: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$path = $input->getArgument('path');
if ($this->abortDeletion($path, $output)) {
$output->writeln("<comment>Aborted.</comment>");
return;
}
$package = Package::fromFolder($path);
$this->config->removePackage($package);
$output->writeln("<comment>Removing package...</comment>");
$filesystem = new Filesystem(new Local(getcwd()));
$filesystem->deleteDir($path);
$output->writeln("<info>Package successfully removed.</info>");
$output->writeln("<comment>Dumping autoloads...</comment>");
Shell::run('composer dump-autoload');
$output->writeln("<info>Autoloads successfully generated.</info>");
}
示例10: testConvertCommandWithNamespaceOption
public function testConvertCommandWithNamespaceOption()
{
$codeLocation = __DIR__ . '/mock/src/VendorName/ProjectName/Category/ProductName/v123456/';
$codeLocationArray = explode('/', $codeLocation);
$codeLocationArray = array_splice($codeLocationArray, 6, 4);
$directory = $codeLocationArray[0];
$destinationLocation = implode('/', $codeLocationArray);
$codeDestination = '/tmp/';
$input = new ArrayInput(['convert', 'code-location' => $codeLocation, '--code-destination' => '/tmp', '--create-namespace' => true, '--offset' => 6, '--length' => 4]);
$output = new BufferedOutput();
$app = new Application();
$app->get('convert')->run($input, $output);
$this->assertFileExists(sprintf('/%s/%s/Date.php', $codeDestination, $destinationLocation));
$this->assertFileExists(sprintf('/%s/%s/DateRange.php', $codeDestination, $destinationLocation));
$this->assertFileExists(sprintf('/%s/%s/OrderBy.php', $codeDestination, $destinationLocation));
// Delete all files/
$filesystem = new Filesystem(new Local($codeDestination));
$filesystem->deleteDir($directory);
}
示例11: remove
/**
* @param string[] $paths The paths where the original files are expected to be.
* @param string[] $filters The imagine filters in effect.
*/
public function remove(array $paths, array $filters)
{
if (empty($paths) && empty($filters)) {
return;
}
if (empty($paths)) {
foreach ($filters as $filter) {
$filterCacheDir = $this->cacheRoot . '/' . $filter;
$this->flysystem->deleteDir($filterCacheDir);
}
return;
}
foreach ($paths as $path) {
foreach ($filters as $filter) {
if ($this->flysystem->has($this->getFilePath($path, $filter))) {
$this->flysystem->delete($this->getFilePath($path, $filter));
}
}
}
}
示例12: deleteDir
public function deleteDir($directory)
{
$this->flysystem->deleteDir($directory);
}
示例13: deleteFiles
private function deleteFiles($codeDestination, $directory)
{
// Delete all files/
$filesystem = new Filesystem(new Local($codeDestination));
$filesystem->deleteDir($directory);
}
示例14: destroyCMS
public function destroyCMS($identifier)
{
$adapter = new Local($this->container_path);
$filesystem = new Filesystem($adapter);
if ($this->checkExistance($identifier)) {
if ($this->saveAsZip($identifier)) {
$filesystem->deleteDir($identifier);
return true;
}
}
return false;
}
示例15: testDeleteDir
/**
* 3.txt
* 2.txt.
*/
public function testDeleteDir()
{
$this->assertTrue($this->filesystem->deleteDir('test'));
$this->assertFalse($this->filesystem->has('test/'));
}