本文整理汇总了PHP中Aws\S3\S3Client::deleteMatchingObjects方法的典型用法代码示例。如果您正苦于以下问题:PHP S3Client::deleteMatchingObjects方法的具体用法?PHP S3Client::deleteMatchingObjects怎么用?PHP S3Client::deleteMatchingObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\S3\S3Client
的用法示例。
在下文中一共展示了S3Client::deleteMatchingObjects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
}
}
示例2: deleteDir
/**
* Delete a directory.
*
* @param string $dirname
*
* @return bool
*/
public function deleteDir($dirname)
{
try {
$prefix = $this->applyPathPrefix($dirname) . '/';
$this->s3Client->deleteMatchingObjects($this->bucket, $prefix);
} catch (DeleteMultipleObjectsException $exception) {
return false;
}
return true;
}
示例3: deleteFolder
/**
* Delete Folder
*
* @param string $folder Path folder
*
* @return bool
* @throws
*/
public function deleteFolder($folder)
{
$folder = trim($folder, '/') . '/';
// Fail if this pseudo directory key already exists
if (!$this->isDir($folder)) {
$path = $this->bucket . "/" . $folder;
throw new ExceptionStorage("Directory {$path} Not found or Not Is Diretory", static::E_NOT_IS_DIR);
}
return (bool) $this->clientS3->deleteMatchingObjects($this->bucket, $folder);
}
示例4: deleteMatchingObjects
/**
* Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you
* to do things like delete all objects that match a specific key prefix.
*
* @param string $bucket Bucket that contains the object keys
* @param string $prefix Optionally delete only objects under this key prefix
* @param string $regex Delete only objects that match this regex
* @param array $options Options used when deleting the object:
* - before_delete: Callback to invoke before each delete. The callback will receive a
* Guzzle\Common\Event object with context.
*
* @see Aws\S3\S3Client::listObjects
* @see Aws\S3\Model\ClearBucket For more options or customization
* @return int Returns the number of deleted keys
* @throws \RuntimeException if no prefix and no regex is given
*/
public function deleteMatchingObjects($bucket, $prefix = '', $regex = '', array $options = [])
{
return $this->instance->deleteMatchingObjects($bucket, $prefix, $regex, $options);
}
示例5: deleteDir
/**
* Delete a directory (recursive)
*
* @param string $path
* @return boolean delete result
*/
public function deleteDir($path)
{
return $this->client->deleteMatchingObjects($this->bucket, $this->prefix($path));
}
示例6: deleteMatchingObjects
/**
* deleteMatchingObjects
*
* @param string $prefix
* @param string $regex
* @param array $options
*
* @return integer
*/
public function deleteMatchingObjects($prefix = '', $regex = '', array $options = array())
{
return $this->client->deleteMatchingObjects($this->name, $prefix, $regex, $options);
}
示例7: deleteDir
/**
* Delete a directory (recursive)
*
* @param string $path
* @return boolean delete result
*/
public function deleteDir($path)
{
$prefix = rtrim($this->prefix($path), '/') . '/';
return $this->client->deleteMatchingObjects($this->bucket, $prefix);
}