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


PHP S3Client::deleteObject方法代码示例

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


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

示例1: delete

 /**
  * {@inheritdoc}
  */
 public function delete($path)
 {
     try {
         $this->s3->deleteObject(['Bucket' => $this->bucket, 'Key' => $path]);
     } catch (AwsExceptionInterface $e) {
         throw Exception\StorageException::deleteError($path, $e);
     }
 }
开发者ID:e-ruiz,项目名称:brick,代码行数:11,代码来源:S3Storage.php

示例2: remove

 /**
  * @param $filename
  * @return \Aws\Result|null
  */
 public function remove($filename)
 {
     $result = null;
     try {
         $result = $this->s3->deleteObject(['Bucket' => $this->bucket, 'Key' => $filename]);
     } catch (\Exception $e) {
     }
     return $result;
 }
开发者ID:Etheriq,项目名称:testSymfoPr,代码行数:13,代码来源:S3.php

示例3: delete

 /**
  * @param $path
  *
  * @return bool
  * @throws FileException
  */
 public function delete($path)
 {
     try {
         $this->s3->deleteObject(['Bucket' => $this->bucket, 'Key' => $path]);
     } catch (\Exception $e) {
         throw new FileException('File was not removed from filesystem', $e->getCode(), $e);
     }
     return true;
 }
开发者ID:synapsestudios,项目名称:synapse-files,代码行数:15,代码来源:S3FileService.php

示例4: delete

 /**
  * Delete remote file
  *
  * @param string $path Remote Path
  *
  * @return bool
  * @throws
  */
 public function delete($path)
 {
     $path = trim($path, '/');
     if (!$this->isFile($path)) {
         $path = $this->bucket . "/" . $path;
         throw new ExceptionStorage("File {$path} Not found or Not Is File", static::E_NOT_IS_FILE);
     }
     $response = $this->clientS3->deleteObject(array('Bucket' => $this->bucket, 'Key' => $path));
     return (bool) $response;
 }
开发者ID:naturalweb,项目名称:filestorage,代码行数:18,代码来源:S3Storage.php

示例5: remove

 /**
  * {@inheritDoc}
  */
 public function remove(array $paths, array $filters)
 {
     if (empty($paths) && empty($filters)) {
         return;
     }
     if (empty($paths)) {
         try {
             $this->storage->deleteMatchingObjects($this->bucket, null, sprintf('/%s/i', implode('|', $filters)));
         } catch (\Exception $e) {
             $this->logError('The objects could not be deleted from Amazon S3.', array('filter' => implode(', ', $filters), 'bucket' => $this->bucket, 'exception' => $e));
         }
         return;
     }
     foreach ($filters as $filter) {
         foreach ($paths as $path) {
             $objectPath = $this->getObjectPath($path, $filter);
             if (!$this->objectExists($objectPath)) {
                 continue;
             }
             try {
                 $this->storage->deleteObject(array('Bucket' => $this->bucket, 'Key' => $objectPath));
             } catch (\Exception $e) {
                 $this->logError('The object could not be deleted from Amazon S3.', array('objectPath' => $objectPath, 'filter' => $filter, 'bucket' => $this->bucket, 'exception' => $e));
             }
         }
     }
 }
开发者ID:sanchojaf,项目名称:oldmytriptocuba,代码行数:30,代码来源:AwsS3Resolver.php

示例6: rename

 /**
  * rename file/directory
  *
  * @return string
  */
 public function rename()
 {
     $oldPath = $this->sanitizePath($this->get['old']);
     $isDir = $this->isDir($this->metadata("{$oldPath}"));
     $oldPath .= $isDir ? '/' : '';
     $contents = $isDir ? $this->s3->listObjects(['Bucket' => $this->bucket, 'Prefix' => $oldPath])['Contents'] : array();
     // NOTE: we do this instead of isDir as we only care if there are files under this prefix
     if (count($contents) > 1) {
         $this->error('Unfortunately, we are currently unable to rename a non-empty directory.', false);
     }
     $pathInfo = pathinfo($oldPath);
     $dirName = $pathInfo['dirname'];
     $baseName = $pathInfo['basename'];
     $newFile = $this->get['new'];
     $newPath = join('/', array($dirName, $newFile));
     if ($isDir) {
         $response = $this->createDirectory($newPath);
     } else {
         $response = $this->s3->copyObject(['Bucket' => $this->bucket, 'CopySource' => urlencode($this->bucket . '/' . $oldPath), 'Key' => $newPath]);
         //				array('bucket' => $this->bucket, 'filename' => $oldPath),
         //				array('bucket' => $this->bucket, 'filename' => $newPath),
         //				array('acl' => CannedAcl::PUBLIC_READ)
         //			);
     }
     if (!empty($response)) {
         $this->s3->deleteObject(['Bucket' => $this->bucket, 'Key' => $oldPath]);
         //$this->bucket, $oldPath);
     }
     return array('Error' => '', 'Code' => 0, 'Old Path' => $oldPath, 'Old Name' => $baseName, 'New Path' => $newPath, 'New Name' => $newFile);
 }
开发者ID:vovanmix,项目名称:filemanager-laravel4-s3,代码行数:35,代码来源:FilemanagerS3.php

示例7: _unlink

 /**
  * Remove file
  *
  * @param  string  $path  file path
  * @return Guzzle\Service\Resource\Model
  **/
 protected function _unlink($path)
 {
     $clear = new \Aws\S3\Model\ClearBucket($this->s3, $this->bucket);
     $iterator = $this->s3->getIterator('ListObjects', array('Bucket' => $this->bucket, 'Prefix' => $this->pathToKey($path)));
     $clear->setIterator($iterator);
     $clear->clear();
     return $this->s3->deleteObject(array("Bucket" => $this->bucket, "Key" => $this->pathToKey($path)));
 }
开发者ID:nguyentuansieu,项目名称:BioMedia,代码行数:14,代码来源:elFinderVolumeS3.class.php

示例8: deleteFile

 /**
  * Deletes an object given its key
  * @param $key Key name on S3 bucket
  * @return bool
  */
 public function deleteFile($key)
 {
     $res = $this->s3Client->deleteObject(array('Bucket' => $this->bucketName, 'Key' => $key));
     if ($res) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:stonedz,项目名称:pff2-s3,代码行数:14,代码来源:Pff2S3.php

示例9: unpublishResource

 /**
  * Unpublishes the given persistent resource
  *
  * @param \TYPO3\Flow\Resource\Resource $resource The resource to unpublish
  * @return void
  */
 public function unpublishResource(Resource $resource)
 {
     try {
         $objectName = $this->keyPrefix . $this->getRelativePublicationPathAndFilename($resource);
         $this->s3Client->deleteObject(array('Bucket' => $this->bucketName, 'Key' => $objectName));
         $this->systemLogger->log(sprintf('Successfully unpublished resource as object "%s" (MD5: %s) from bucket "%s"', $objectName, $resource->getMd5() ?: 'unknown', $this->bucketName), LOG_DEBUG);
     } catch (\Exception $e) {
     }
 }
开发者ID:sebids,项目名称:flow-aws-s3,代码行数:15,代码来源:S3Target.php

示例10: deleteBlob

 /**
  * @param string $container
  * @param string $name
  *
  * @throws DfException
  */
 public function deleteBlob($container = '', $name = '')
 {
     try {
         $this->checkConnection();
         $this->blobConn->deleteObject(['Bucket' => $container, 'Key' => $name]);
     } catch (\Exception $ex) {
         throw new DfException('Failed to delete blob "' . $name . '": ' . $ex->getMessage());
     }
 }
开发者ID:pkdevboxy,项目名称:df-aws,代码行数:15,代码来源:S3FileSystem.php

示例11: _rmdir

 /**
  * Remove dir
  *
  * @param  string  $path  dir path
  * @return bool
  * @author Dmitry (dio) Levashov
  **/
 protected function _rmdir($path)
 {
     $newkey = $this->_normpath($path) . '/';
     try {
         $obj = $this->s3->deleteObject(array('Bucket' => $this->options['bucket'], 'Key' => $newkey));
         return true;
     } catch (Exception $e) {
     }
     return false;
 }
开发者ID:hen-sen,项目名称:ElFinderPHP,代码行数:17,代码来源:ElFinderVolumeS3.php

示例12: delete

 /**
  * Deletes one or more files from DFS
  *
  * @param string|array $filePath
  *        Single local filename, or array of local filenames
  *
  * @return bool true if deletion was successful, false otherwise
  */
 public function delete($filePath)
 {
     try {
         $this->s3client->deleteObject(array('Bucket' => $this->bucket, 'Key' => $filePath));
         return true;
     } catch (S3Exception $e) {
         eZDebug::writeError($e->getMessage(), __METHOD__);
         return false;
     }
 }
开发者ID:ezsystems,项目名称:ezdfs-fsbackend-aws-s3,代码行数:18,代码来源:amazon.php

示例13: _unlink

 /**
  * Remove file
  *
  * @param  string  $path  file path
  * @return bool
  * @author Dmitry (dio) Levashov
  **/
 protected function _unlink($path)
 {
     $newkey = $this->_normpath($path);
     $newkey = preg_replace("/\\/\$/", "", $newkey);
     try {
         $obj = $this->s3->deleteObject(array('Bucket' => $this->options['bucket'], 'Key' => $newkey));
         return true;
     } catch (Exception $e) {
     }
     return false;
 }
开发者ID:quepasso,项目名称:dashboard,代码行数:18,代码来源:ElFinderVolumeS3.php

示例14: deleteObject

 /**
  * @param $awsPath aws file  to delete
  * @return mixed|null
  * @throws Exception
  */
 private function deleteObject($bucket, $awsPath)
 {
     $this->logger->debug('delete ' . $awsPath . ' from ' . $bucket . ' bucket ...');
     $result = $this->s3->deleteObject(array('Bucket' => $bucket, 'Key' => $awsPath));
     try {
         return $result;
         $this->logger->debug('delete ' . $awsPath . ' from ' . $bucket . ' bucket ! done');
     } catch (AwsException $e) {
         throw $e;
     }
 }
开发者ID:jordanaubert,项目名称:AmazonWebServicesBundle,代码行数:16,代码来源:StorageService.php

示例15: unlink

 public function unlink($path)
 {
     $path = $this->normalizePath($path);
     try {
         $result = $this->connection->deleteObject(array('Bucket' => $this->bucket, 'Key' => $path));
         $this->testTimeout();
     } catch (S3Exception $e) {
         \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
         return false;
     }
     return true;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:12,代码来源:amazons3.php


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