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


PHP Filesystem::delete方法代码示例

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


在下文中一共展示了Filesystem::delete方法的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);
     }
 }
开发者ID:karion,项目名称:mydrinks,代码行数:18,代码来源:FlySystemAdapter.php

示例2: remove

 /**
  * Removes a value from the cache.
  *
  * @param string $key A unique key
  *
  * @return bool True on success, false on failure.
  */
 public function remove($key)
 {
     try {
         return $this->filesystem->delete($key);
     } catch (FileNotFoundException $exception) {
         return false;
     }
 }
开发者ID:svycka,项目名称:sv-images,代码行数:15,代码来源:FlySystemStorage.php

示例3: write

 protected function write($data)
 {
     $destination = $this->composer->getClassPath($this->data['name']);
     if ($this->force && $this->external->has($destination)) {
         $this->external->delete($destination);
     }
     return $this->external->write($destination, $data);
 }
开发者ID:clarkeash,项目名称:machine,代码行数:8,代码来源:BaseGenerator.php

示例4: remove

 /**
  * {@inheritdoc}
  */
 public function remove(File $file) : bool
 {
     $key = $file->getKey();
     if ($this->filesystem->has($key)) {
         return $this->filesystem->delete($key);
     }
     return true;
 }
开发者ID:reskume,项目名称:file-bundle,代码行数:11,代码来源:FlysystemAdapter.php

示例5:

 function it_should_execute_the_delete_old_files_command(Filesystem $filesystem, DateTime $olderThan)
 {
     $filesystem->listWith(['timestamp'], '/dir', false)->willReturn([['path' => '/dir/file-new.gz', 'timestamp' => 2000], ['path' => '/dir/file-old.gz', 'timestamp' => 1000], ['path' => '/dir/file-older.gz', 'timestamp' => 500]]);
     $olderThan->getTimestamp()->willReturn(1500);
     $filesystem->delete('/dir/file-older.gz')->shouldBeCalled();
     $filesystem->delete('/dir/file-old.gz')->shouldBeCalled();
     $this->beConstructedWith($filesystem, '/dir', $olderThan);
     $this->execute();
 }
开发者ID:alibo,项目名称:backup-manager,代码行数:9,代码来源:DeleteOldFilesSpec.php

示例6: execute

 /**
  * @return bool
  */
 public function execute()
 {
     $files = $this->filesystem->listWith(['timestamp'], $this->directoryPath, false);
     foreach ($files as $file) {
         if ($file['timestamp'] < $this->olderThan->getTimestamp()) {
             $this->filesystem->delete($file['path']);
         }
     }
 }
开发者ID:alibo,项目名称:backup-manager,代码行数:12,代码来源:DeleteOldFiles.php

示例7: unpublish

 /**
  * @param File $file
  * @param Version $version
  * @param VersionProvider $versionProvider
  * @param Linker $linker
  * @return bool
  */
 public function unpublish(File $file, Version $version, VersionProvider $versionProvider, Linker $linker)
 {
     $path = $linker->getLink($file, $version, $versionProvider->getExtension($file, $version));
     if (!$this->filesystem->has($path)) {
         return false;
     }
     $this->filesystem->delete($path);
     return true;
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:16,代码来源:FlysystemPublisherAdapter.php

示例8: unlink

	/**
	 * {@inheritdoc}
	 */
	public function unlink($path) {
		if ($this->is_dir($path)) {
			return $this->rmdir($path);
		}
		try {
			return $this->flysystem->delete($this->buildPath($path));
		} catch (FileNotFoundException $e) {
			return false;
		}
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:13,代码来源:flysystem.php

示例9: 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);
     }
 }
开发者ID:sakalauskas,项目名称:backup-manager,代码行数:16,代码来源:DeleteFile.php

示例10: handleField

 protected function handleField(Request $request, $item, array $fields, $groupName, $fieldName)
 {
     $modelFolder = $this->slug . DIRECTORY_SEPARATOR;
     $basePath = base_path(DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . config('anavel-crud.uploads_path'));
     $modelPath = $basePath . $modelFolder;
     $skip = null;
     $requestValue = null;
     if (!empty($fields["{$fieldName}__delete"])) {
         //We never want to save this field, it doesn't exist in the DB
         $skip = "{$fieldName}__delete";
         //If user wants to delete the existing file
         if (!empty($request->input("{$groupName}.{$fieldName}__delete"))) {
             $adapter = new Local($basePath);
             $filesystem = new Filesystem($adapter);
             if ($filesystem->has($item->{$fieldName})) {
                 $filesystem->delete($item->{$fieldName});
             }
             $item->setAttribute($fieldName, null);
             return ['skip' => $skip];
         }
     }
     if ($request->hasFile($groupName . '.' . $fieldName)) {
         $fileName = uniqid() . '.' . $request->file($groupName . '.' . $fieldName)->getClientOriginalExtension();
         $request->file($groupName . '.' . $fieldName)->move($modelPath, $fileName);
         $requestValue = $modelFolder . $fileName;
     } elseif (!empty($request->file($groupName . '.' . $fieldName)) && !$request->file($groupName . '.' . $fieldName)->isValid()) {
         throw new \Exception($request->file($groupName . '.' . $fieldName)->getErrorMessage());
     }
     return ['requestValue' => $requestValue, 'skip' => $skip];
 }
开发者ID:ablunier,项目名称:crud,代码行数:30,代码来源:HandleFiles.php

示例11: generate

 public function generate()
 {
     if (PHP_SAPI != 'cli') {
         throw new \Exception("This script only can be used in CLI");
     }
     $config = $this->config->get('database');
     system(sprintf('/usr/bin/mysqldump -u %s -h %s -p%s -r /tmp/phosphorum.sql %s', $config->username, $config->host, $config->password, $config->dbname));
     system('bzip2 -f /tmp/phosphorum.sql');
     $config = $this->config->get('dropbox');
     if (!$config instanceof Config) {
         throw new \Exception("Unable to retrieve Dropbox credentials. Please check Forum Configuration");
     }
     if (!$config->get('appSecret') || !$config->get('accessToken')) {
         throw new \Exception("Please provide correct 'appSecret' and 'accessToken' config values");
     }
     $sourcePath = '/tmp/phosphorum.sql.bz2';
     if (!file_exists($sourcePath)) {
         throw new \Exception("Backup could not be created");
     }
     $client = new Client($config->get('accessToken'), $config->get('appSecret'));
     $adapter = new DropboxAdapter($client, $config->get('prefix', null));
     $filesystem = new Filesystem($adapter);
     $dropboxPath = '/phosphorum.sql.bz2';
     if ($filesystem->has($dropboxPath)) {
         $filesystem->delete($dropboxPath);
     }
     $fp = fopen($sourcePath, "rb");
     $filesystem->putStream($dropboxPath, $fp);
     fclose($fp);
     @unlink($sourcePath);
 }
开发者ID:phalcon,项目名称:forum,代码行数:31,代码来源:Backup.php

示例12: get

 /**
  * Get cached string from store.
  *
  * @param  string $key
  *
  * @return null|string
  */
 public function get($key)
 {
     if (!is_string($key)) {
         return;
     }
     try {
         $file = $this->get_file_name($key);
         // Expire the file if the expires time is not zero.
         if ($this->args['expires'] > 0) {
             $time = $this->filesystem->getTimestamp($file);
             // If time is bigger than expires and file timestamp
             // the file should be deleted and null should be returned
             // since the cache has expired.
             if (time() > $this->args['expires'] * $time) {
                 $this->filesystem->delete($file);
                 return;
             }
         }
         // Try to read the file.
         $content = $this->filesystem->read($file);
         // Delete the file if empty.
         if (empty($content)) {
             $this->filesystem->delete($file);
         }
         return $content;
     } catch (FileNotFoundException $e) {
         return;
     }
 }
开发者ID:isotopsweden,项目名称:wp-cachetop,代码行数:36,代码来源:class-filesystem.php

示例13: deleteVersion

 public function deleteVersion(Versionable $versionable, Version $version)
 {
     $ret = $this->filesystem->delete($this->getVersionPathName($versionable, $version));
     if (!$ret) {
         throw new FileIOException(sprintf("Failed to delete version '%s' of versionable %s;%s", $version->toString(), get_class($versionable), $versionable->getId()));
     }
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:7,代码来源:FlysystemStorageAdapter.php

示例14: tearDown

 /**
  * Cleanup output files after each test
  */
 public function tearDown()
 {
     $cleanup = ['sprite.jpg', 'sprite.vtt', 'blubber.jpg', 'blubber.vtt'];
     foreach ($cleanup as $file) {
         $this->outputFS->has($file) && $this->outputFS->delete($file);
     }
 }
开发者ID:emgag,项目名称:video-thumbnail-sprite,代码行数:10,代码来源:ThumbnailSpriteTest.php

示例15: process

 /**
  * Process give source file with given options
  *
  * @param array $options
  * @param $sourceFile
  * @return string
  */
 public function process($options, $sourceFile)
 {
     //check restricted_domains is enabled
     if ($this->params['restricted_domains'] && is_array($this->params['whitelist_domains']) && !in_array(parse_url($sourceFile, PHP_URL_HOST), $this->params['whitelist_domains'])) {
         throw new \Exception('Restricted domains enabled, the domain your fetching from is not allowed: ' . parse_url($sourceFile, PHP_URL_HOST));
     }
     $options = $this->parseOptions($options);
     $newFileName = md5(implode('.', $options) . $sourceFile);
     if ($this->filesystem->has($newFileName) && $options['refresh']) {
         $this->filesystem->delete($newFileName);
     }
     if (!$this->filesystem->has($newFileName)) {
         $this->saveNewFile($sourceFile, $newFileName, $options);
     }
     return $this->filesystem->read($newFileName);
 }
开发者ID:sadok-f,项目名称:fly-image,代码行数:23,代码来源:ImageManager.php


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