Update sdk
parent
e91742b194
commit
47e1012b69
|
@ -8,16 +8,16 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aliyuncs/oss-sdk-php",
|
"name": "aliyuncs/oss-sdk-php",
|
||||||
"version": "v2.3.1",
|
"version": "v2.4.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
||||||
"reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a"
|
"reference": "492866331b7bafaac09506cf42f351b7e9e63766"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/053d7ba9e798e4c09b9c5c1edab153d25ea9643a",
|
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/492866331b7bafaac09506cf42f351b7e9e63766",
|
||||||
"reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a",
|
"reference": "492866331b7bafaac09506cf42f351b7e9e63766",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,11 @@
|
||||||
],
|
],
|
||||||
"description": "Aliyun OSS SDK for PHP",
|
"description": "Aliyun OSS SDK for PHP",
|
||||||
"homepage": "http://www.aliyun.com/product/oss/",
|
"homepage": "http://www.aliyun.com/product/oss/",
|
||||||
"time": "2019-11-15T11:05:42+00:00"
|
"support": {
|
||||||
|
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
||||||
|
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.1"
|
||||||
|
},
|
||||||
|
"time": "2020-09-29T06:23:57+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
|
@ -62,5 +66,5 @@
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "1.1.0"
|
"plugin-api-version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
# ChangeLog - Aliyun OSS SDK for PHP
|
# ChangeLog - Aliyun OSS SDK for PHP
|
||||||
|
|
||||||
## v2.3.1 / 2019-011-15
|
## v2.4.1 / 2020-09-29
|
||||||
|
* Fixed: the getBucketPolicy bug.
|
||||||
|
|
||||||
|
|
||||||
|
## v2.4.0 / 2020-08-31
|
||||||
|
|
||||||
|
* Added: disable Expect: 100-continue
|
||||||
|
* Added: support getBucketInfo
|
||||||
|
* Added: support getBucketStat
|
||||||
|
* Added: support bucket policy
|
||||||
|
* Added: support bucket encryption
|
||||||
|
* Added: support bucket tagging
|
||||||
|
* Added: support bucket worm
|
||||||
|
* Added: support versioning
|
||||||
|
* Added: support request payment
|
||||||
|
* Added: support object tagging
|
||||||
|
* Added: support code archive
|
||||||
|
* Added: support process object
|
||||||
|
* Added: support traffic limit paramter
|
||||||
|
* Added: support upload object from file handle
|
||||||
|
* Added: support getSimplifiedObjectMeta
|
||||||
|
* Fixed: the object name can not be '0' stirng.
|
||||||
|
* Update: endpoint validity check
|
||||||
|
* Update: add new pre-signed url api
|
||||||
|
|
||||||
|
|
||||||
|
## v2.3.1 / 2019-01-15
|
||||||
|
|
||||||
* translate chinese comments into english
|
* translate chinese comments into english
|
||||||
* Added: endpoint validity check
|
* Added: endpoint validity check
|
||||||
|
|
|
@ -111,7 +111,7 @@ OssClient提供的接口返回返回数据分为两种:
|
||||||
$bucketListInfo = $ossClient->listBuckets();
|
$bucketListInfo = $ossClient->listBuckets();
|
||||||
$bucketList = $bucketListInfo->getBucketList();
|
$bucketList = $bucketListInfo->getBucketList();
|
||||||
foreach($bucketList as $bucket) {
|
foreach($bucketList as $bucket) {
|
||||||
print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreatedate() . "\n");
|
print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreateDate() . "\n");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
上面代码中的$bucketListInfo的数据类型是 `OSS\Model\BucketListInfo`
|
上面代码中的$bucketListInfo的数据类型是 `OSS\Model\BucketListInfo`
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Alibaba Cloud OSS SDK for PHP
|
# Alibaba Cloud OSS SDK for PHP
|
||||||
|
|
||||||
[](https://packagist.org/packages/aliyuncs/oss-sdk-php)
|
[](https://packagist.org/packages/aliyuncs/oss-sdk-php)
|
||||||
[](https://travis-ci.org/aliyun/aliyun-oss-php-sdk)
|
[](https://travis-ci.org/aliyun/aliyun-oss-php-sdk)
|
||||||
|
@ -50,12 +50,12 @@ Tips:
|
||||||
|
|
||||||
| Class | Explanation |
|
| Class | Explanation |
|
||||||
|:------------------|:------------------------------------|
|
|:------------------|:------------------------------------|
|
||||||
|OSS\OSSClient | OSS client class. An OSSClient instance can be used to call the interface. |
|
|OSS\OssClient | OSS client class. An OssClient instance can be used to call the interface. |
|
||||||
|OSS\Core\OSSException |OSS Exception class . You only need to pay attention to this exception when you use the OSSClient. |
|
|OSS\Core\OssException |OSS Exception class . You only need to pay attention to this exception when you use the OssClient. |
|
||||||
|
|
||||||
### Initialize an OSSClient
|
### Initialize an OssClient
|
||||||
|
|
||||||
The SDK's operations for the OSS are performed through the OSSClient class. The code below creates an OSSClient object:
|
The SDK's operations for the OSS are performed through the OssClient class. The code below creates an OssClient object:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
|
@ -101,7 +101,7 @@ try {
|
||||||
|
|
||||||
### Handle returned results
|
### Handle returned results
|
||||||
|
|
||||||
The OSSClient provides the following two types of returned data from interfaces:
|
The OssClient provides the following two types of returned data from interfaces:
|
||||||
|
|
||||||
- Put and Delete interfaces: The *PUT* and *DELETE* operations are deemed successful if *null* is returned by the interfaces without *OSSException*.
|
- Put and Delete interfaces: The *PUT* and *DELETE* operations are deemed successful if *null* is returned by the interfaces without *OSSException*.
|
||||||
- Get and List interfaces: The *GET* and *LIST* operations are deemed successful if the desired data is returned by the interfaces without *OSSException*. For example,
|
- Get and List interfaces: The *GET* and *LIST* operations are deemed successful if the desired data is returned by the interfaces without *OSSException*. For example,
|
||||||
|
@ -111,7 +111,7 @@ The OSSClient provides the following two types of returned data from interfaces:
|
||||||
$bucketListInfo = $ossClient->listBuckets();
|
$bucketListInfo = $ossClient->listBuckets();
|
||||||
$bucketList = $bucketListInfo->getBucketList();
|
$bucketList = $bucketListInfo->getBucketList();
|
||||||
foreach($bucketList as $bucket) {
|
foreach($bucketList as $bucket) {
|
||||||
print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreatedate() . "\n");
|
print($bucket->getLocation() . "\t" . $bucket->getName() . "\t" . $bucket->getCreateDate() . "\n");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
In the above code, $bucketListInfo falls into the 'OSS\Model\BucketListInfo' data type.
|
In the above code, $bucketListInfo falls into the 'OSS\Model\BucketListInfo' data type.
|
||||||
|
|
|
@ -145,7 +145,7 @@ class OssUtil
|
||||||
public static function validateObject($object)
|
public static function validateObject($object)
|
||||||
{
|
{
|
||||||
$pattern = '/^.{1,1023}$/';
|
$pattern = '/^.{1,1023}$/';
|
||||||
if (empty($object) || !preg_match($pattern, $object) ||
|
if (!preg_match($pattern, $object) ||
|
||||||
self::startsWith($object, '/') || self::startsWith($object, '\\')
|
self::startsWith($object, '/') || self::startsWith($object, '\\')
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -223,6 +223,8 @@ class OssUtil
|
||||||
public static function throwOssExceptionWithMessageIfEmpty($name, $errMsg)
|
public static function throwOssExceptionWithMessageIfEmpty($name, $errMsg)
|
||||||
{
|
{
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
|
if (is_string($name) && $name == '0')
|
||||||
|
return;
|
||||||
throw new OssException($errMsg);
|
throw new OssException($errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,6 +398,10 @@ BBB;
|
||||||
$str = substr($str, $pos+1);
|
$str = substr($str, $pos+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/^[\w.-]+(:[0-9]+)?$/', $str)) {
|
||||||
|
throw new OssException("endpoint is invalid:" . $endpoint);
|
||||||
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,6 +424,28 @@ BBB;
|
||||||
return $xml->asXML();
|
return $xml->asXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the xml message of DeleteMultiObjects.
|
||||||
|
*
|
||||||
|
* @param DeleteObjectInfo[] $objects
|
||||||
|
* @param bool $quiet
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function createDeleteObjectVersionsXmlBody($objects, $quiet)
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Delete></Delete>');
|
||||||
|
$xml->addChild('Quiet', $quiet);
|
||||||
|
foreach ($objects as $object) {
|
||||||
|
$sub_object = $xml->addChild('Object');
|
||||||
|
$key = OssUtil::sReplace($object->getKey());
|
||||||
|
$sub_object->addChild('Key', $key);
|
||||||
|
if (!empty($object->getVersionId())) {
|
||||||
|
$sub_object->addChild('VersionId', $object->getVersionId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the xml message of CompleteMultipartUpload.
|
* Generate the xml message of CompleteMultipartUpload.
|
||||||
*
|
*
|
||||||
|
|
|
@ -713,6 +713,8 @@ class RequestCore
|
||||||
$temp_headers[] = $k . ': ' . $v;
|
$temp_headers[] = $k . ': ' . $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fix "Expect: 100-continue"
|
||||||
|
$temp_headers[] = 'Expect:';
|
||||||
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);
|
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,18 @@ namespace OSS\Model;
|
||||||
*/
|
*/
|
||||||
class BucketInfo
|
class BucketInfo
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* BucketInfo constructor.
|
* BucketInfo constructor.
|
||||||
*
|
*
|
||||||
* @param string $location
|
* @param string $location
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $createDate
|
* @param string $createDate
|
||||||
*/
|
*/
|
||||||
public function __construct($location, $name, $createDate)
|
public function __construct($location = '', $name = '', $createDate = '')
|
||||||
{
|
{
|
||||||
$this->location = $location;
|
$this->location = $location;
|
||||||
$this->name = $name;
|
|
||||||
$this->createDate = $createDate;
|
$this->createDate = $createDate;
|
||||||
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +55,82 @@ class BucketInfo
|
||||||
return $this->createDate;
|
return $this->createDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bucket storage class.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStorageClass()
|
||||||
|
{
|
||||||
|
return $this->storageClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bucket extranet endpoint.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getExtranetEndpoint()
|
||||||
|
{
|
||||||
|
return $this->extranetEndpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bucket intranet endpoint.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIntranetEndpoint()
|
||||||
|
{
|
||||||
|
return $this->intranetEndpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bucket intranet endpoint.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getRegion()
|
||||||
|
{
|
||||||
|
return $this->region;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse bucket information from node.
|
||||||
|
*
|
||||||
|
* @param xml $xml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXmlNode($xml)
|
||||||
|
{
|
||||||
|
if (isset($xml->Location)) {
|
||||||
|
$this->location = strval($xml->Location);
|
||||||
|
}
|
||||||
|
if (isset($xml->Name)) {
|
||||||
|
$this->name = strval($xml->Name);
|
||||||
|
}
|
||||||
|
if (isset($xml->CreationDate)) {
|
||||||
|
$this->createDate = strval($xml->CreationDate);
|
||||||
|
}
|
||||||
|
if (isset($xml->StorageClass)) {
|
||||||
|
$this->storageClass = strval($xml->StorageClass);
|
||||||
|
}
|
||||||
|
if (isset($xml->ExtranetEndpoint)) {
|
||||||
|
$this->extranetEndpoint = strval($xml->ExtranetEndpoint);
|
||||||
|
}
|
||||||
|
if (isset($xml->IntranetEndpoint)) {
|
||||||
|
$this->intranetEndpoint = strval($xml->IntranetEndpoint);
|
||||||
|
}
|
||||||
|
if (isset($xml->IntranetEndpoint)) {
|
||||||
|
$this->intranetEndpoint = strval($xml->IntranetEndpoint);
|
||||||
|
}
|
||||||
|
if (isset($xml->Region)) {
|
||||||
|
$this->region = strval($xml->Region);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bucket region
|
* bucket region
|
||||||
*
|
*
|
||||||
|
@ -75,4 +151,31 @@ class BucketInfo
|
||||||
*/
|
*/
|
||||||
private $createDate;
|
private $createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bucket storage class
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $storageClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bucket extranet endpoint
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $extranetEndpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bucket intranet endpoint
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $intranetEndpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bucket region
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $region;
|
||||||
}
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bucket stat class.
|
||||||
|
*
|
||||||
|
* Class BucketStat
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class BucketStat
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get storage
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getStorage()
|
||||||
|
{
|
||||||
|
return $this->storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get object count
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getObjectCount()
|
||||||
|
{
|
||||||
|
return $this->objectCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get multipart upload count.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMultipartUploadCount()
|
||||||
|
{
|
||||||
|
return $this->multipartUploadCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse stat from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (isset($xml->Storage) ) {
|
||||||
|
$this->storage = intval($xml->Storage);
|
||||||
|
}
|
||||||
|
if (isset($xml->ObjectCount) ) {
|
||||||
|
$this->objectCount = intval($xml->ObjectCount);
|
||||||
|
}
|
||||||
|
if (isset($xml->MultipartUploadCount) ) {
|
||||||
|
$this->multipartUploadCount = intval($xml->MultipartUploadCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* current storage
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $storage;
|
||||||
|
/**
|
||||||
|
* object count
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $objectCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* multipart upload count
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $multipartUploadCount;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Class DeleteMarkerInfo
|
||||||
|
*
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class DeleteMarkerInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* DeleteMarkerInfo constructor.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $versionId
|
||||||
|
* @param string $lastModified
|
||||||
|
* @param string $isLatest
|
||||||
|
*/
|
||||||
|
public function __construct($key, $versionId, $lastModified, $isLatest)
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
$this->versionId = $versionId;
|
||||||
|
$this->lastModified = $lastModified;
|
||||||
|
$this->isLatest = $isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionId()
|
||||||
|
{
|
||||||
|
return $this->versionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastModified()
|
||||||
|
{
|
||||||
|
return $this->lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIsLatest()
|
||||||
|
{
|
||||||
|
return $this->isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $key = "";
|
||||||
|
private $versionId = "";
|
||||||
|
private $lastModified = "";
|
||||||
|
private $isLatest = "";
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DeleteObjectInfo
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class DeleteObjectInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* DeleteObjectInfo constructor.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $versionId
|
||||||
|
*/
|
||||||
|
public function __construct($key, $versionId = '')
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
$this->versionId = $versionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionId()
|
||||||
|
{
|
||||||
|
return $this->versionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $key = "";
|
||||||
|
private $versionId = "";
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DeletedObjectInfo
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class DeletedObjectInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* DeletedObjectInfo constructor.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $versionId
|
||||||
|
* @param string $deleteMarker
|
||||||
|
* @param string $deleteMarkerVersionId
|
||||||
|
*/
|
||||||
|
public function __construct($key, $versionId, $deleteMarker, $deleteMarkerVersionId)
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
$this->versionId = $versionId;
|
||||||
|
$this->deleteMarker = $deleteMarker;
|
||||||
|
$this->deleteMarkerVersionId = $deleteMarkerVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionId()
|
||||||
|
{
|
||||||
|
return $this->versionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDeleteMarker()
|
||||||
|
{
|
||||||
|
return $this->deleteMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDeleteMarkerVersionId()
|
||||||
|
{
|
||||||
|
return $this->deleteMarkerVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $key = "";
|
||||||
|
private $versionId = "";
|
||||||
|
private $deleteMarker = "";
|
||||||
|
private $deleteMarkerVersionId = "";
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExtendWormConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class ExtendWormConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ExtendWormConfig constructor.
|
||||||
|
* @param null $day
|
||||||
|
*/
|
||||||
|
public function __construct($day = null)
|
||||||
|
{
|
||||||
|
$this->day = $day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse ExtendWormConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
throw new OssException("Not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><ExtendWormConfiguration></ExtendWormConfiguration>');
|
||||||
|
if (isset($this->day)) {
|
||||||
|
$xml->addChild('RetentionPeriodInDays', $this->day);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDay()
|
||||||
|
{
|
||||||
|
return $this->day;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $day = 0;
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace OSS\Model;
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class GetLiveChannelHistory
|
* Class GetLiveChannelHistory
|
||||||
* @package OSS\Model
|
* @package OSS\Model
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class InitiateWormConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class InitiateWormConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* InitiateWormConfig constructor.
|
||||||
|
* @param null $day
|
||||||
|
*/
|
||||||
|
public function __construct($day = null)
|
||||||
|
{
|
||||||
|
$this->day = $day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse InitiateWormConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
throw new OssException("Not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><InitiateWormConfiguration></InitiateWormConfiguration>');
|
||||||
|
if (isset($this->day)) {
|
||||||
|
$xml->addChild('RetentionPeriodInDays', $this->day);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDay()
|
||||||
|
{
|
||||||
|
return $this->day;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $day = 0;
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Class ObjectVersionInfo
|
||||||
|
*
|
||||||
|
* The element type of ObjectVersionListInfo, which is the return value type of listObjectVersions
|
||||||
|
*
|
||||||
|
* The return value of listObjectVersions includes three arrays
|
||||||
|
* One is the returned ObjectVersionListInfo, which is similar to a file list in a file system.
|
||||||
|
* The other is the returned prefix list, which is similar to a folder list in a file system.
|
||||||
|
*
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class ObjectVersionInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ObjectVersionInfo constructor.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $lastModified
|
||||||
|
* @param string $eTag
|
||||||
|
* @param string $type
|
||||||
|
* @param int $size
|
||||||
|
* @param string $storageClass
|
||||||
|
* @param string $isLatest
|
||||||
|
*/
|
||||||
|
public function __construct($key, $versionId, $lastModified, $eTag, $type, $size, $storageClass, $isLatest)
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
$this->versionId = $versionId;
|
||||||
|
$this->lastModified = $lastModified;
|
||||||
|
$this->eTag = $eTag;
|
||||||
|
$this->type = $type;
|
||||||
|
$this->size = $size;
|
||||||
|
$this->storageClass = $storageClass;
|
||||||
|
$this->isLatest = $isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionId()
|
||||||
|
{
|
||||||
|
return $this->versionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLastModified()
|
||||||
|
{
|
||||||
|
return $this->lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getETag()
|
||||||
|
{
|
||||||
|
return $this->eTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSize()
|
||||||
|
{
|
||||||
|
return $this->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStorageClass()
|
||||||
|
{
|
||||||
|
return $this->storageClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getIsLatest()
|
||||||
|
{
|
||||||
|
return $this->isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $key = "";
|
||||||
|
private $versionId = "";
|
||||||
|
private $lastModified = "";
|
||||||
|
private $eTag = "";
|
||||||
|
private $type = "";
|
||||||
|
private $size = 0;
|
||||||
|
private $storageClass = "";
|
||||||
|
private $isLatest = "";
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ObjectVersionListInfo
|
||||||
|
*
|
||||||
|
* The class of return value of ListObjectVersions
|
||||||
|
*
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class ObjectVersionListInfo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ObjectVersionListInfo constructor.
|
||||||
|
*
|
||||||
|
* @param string $bucketName
|
||||||
|
* @param string $prefix
|
||||||
|
* @param string $keyMarker
|
||||||
|
* @param string $nextKeyMarker
|
||||||
|
* @param string $versionIdMarker
|
||||||
|
* @param string $nextVersionIdMarker
|
||||||
|
* @param string $maxKeys
|
||||||
|
* @param string $delimiter
|
||||||
|
* @param null $isTruncated
|
||||||
|
* @param array $objectversionList
|
||||||
|
* @param array $deleteMarkerList
|
||||||
|
* @param array $prefixList
|
||||||
|
*/
|
||||||
|
public function __construct($bucketName, $prefix, $keyMarker, $nextKeyMarker, $versionIdMarker, $nextVersionIdMarker
|
||||||
|
, $maxKeys, $delimiter, $isTruncated
|
||||||
|
, array $objectversionList, array $deleteMarkerList, array $prefixList)
|
||||||
|
{
|
||||||
|
$this->bucketName = $bucketName;
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
$this->keyMarker = $keyMarker;
|
||||||
|
$this->nextKeyMarker = $nextKeyMarker;
|
||||||
|
$this->versionIdMarker = $versionIdMarker;
|
||||||
|
$this->nextVersionIdMarker = $nextVersionIdMarker;
|
||||||
|
$this->maxKeys = $maxKeys;
|
||||||
|
$this->delimiter = $delimiter;
|
||||||
|
$this->isTruncated = $isTruncated;
|
||||||
|
$this->objectVersionList = $objectversionList;
|
||||||
|
$this->deleteMarkerList = $deleteMarkerList;
|
||||||
|
$this->prefixList = $prefixList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBucketName()
|
||||||
|
{
|
||||||
|
return $this->bucketName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPrefix()
|
||||||
|
{
|
||||||
|
return $this->prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKeyMarker()
|
||||||
|
{
|
||||||
|
return $this->keyMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getNextKeyMarker()
|
||||||
|
{
|
||||||
|
return $this->nextKeyMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionIdMarker()
|
||||||
|
{
|
||||||
|
return $this->versionIdMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getNextVersionIdMarker()
|
||||||
|
{
|
||||||
|
return $this->nextVersionIdMarker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxKeys()
|
||||||
|
{
|
||||||
|
return $this->maxKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDelimiter()
|
||||||
|
{
|
||||||
|
return $this->delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getIsTruncated()
|
||||||
|
{
|
||||||
|
return $this->isTruncated;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ObjectVersionInfo list.
|
||||||
|
*
|
||||||
|
* @return ObjectVersionInfo[]
|
||||||
|
*/
|
||||||
|
public function getObjectVersionList()
|
||||||
|
{
|
||||||
|
return $this->objectVersionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the DeleteMarkerInfo list.
|
||||||
|
*
|
||||||
|
* @return DeleteMarkerInfo[]
|
||||||
|
*/
|
||||||
|
public function getDeleteMarkerList()
|
||||||
|
{
|
||||||
|
return $this->deleteMarkerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PrefixInfo list
|
||||||
|
*
|
||||||
|
* @return PrefixInfo[]
|
||||||
|
*/
|
||||||
|
public function getPrefixList()
|
||||||
|
{
|
||||||
|
return $this->prefixList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $bucketName = "";
|
||||||
|
private $prefix = "";
|
||||||
|
private $keyMarker = "";
|
||||||
|
private $nextKeyMarker = "";
|
||||||
|
private $versionIdmarker = "";
|
||||||
|
private $nextVersionIdMarker = "";
|
||||||
|
private $maxKeys = 0;
|
||||||
|
private $delimiter = "";
|
||||||
|
private $isTruncated = null;
|
||||||
|
private $objectVersionList = array();
|
||||||
|
private $deleteMarkerList = array();
|
||||||
|
private $prefixList = array();
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RequestPaymentConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
* @link https://help.aliyun.com/document_detail/117914.htm
|
||||||
|
*/
|
||||||
|
class RequestPaymentConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* RequestPaymentConfig constructor.
|
||||||
|
* @param null $payer
|
||||||
|
*/
|
||||||
|
public function __construct($payer = null)
|
||||||
|
{
|
||||||
|
$this->payer = $payer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse ServerSideEncryptionConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (isset($xml->Payer)) {
|
||||||
|
$this->payer = strval($xml->Payer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><RequestPaymentConfiguration></RequestPaymentConfiguration>');
|
||||||
|
if (isset($this->payer)) {
|
||||||
|
$xml->addChild('Payer', $this->payer);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPayer()
|
||||||
|
{
|
||||||
|
return $this->payer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $payer = "";
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RestoreConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class RestoreConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* RestoreConfig constructor.
|
||||||
|
* @param int $day
|
||||||
|
* @param null $tier
|
||||||
|
*/
|
||||||
|
public function __construct($day, $tier = null)
|
||||||
|
{
|
||||||
|
$this->day = $day;
|
||||||
|
$this->tier = $tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse RestoreConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
throw new OssException("Not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><RestoreRequest></RestoreRequest>');
|
||||||
|
$xml->addChild('Days', strval($this->day));
|
||||||
|
if (isset($this->tier)) {
|
||||||
|
$xml_param = $xml->addChild('JobParameters');
|
||||||
|
$xml_param->addChild('Tier', $this->tier);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDay()
|
||||||
|
{
|
||||||
|
return $this->day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTier()
|
||||||
|
{
|
||||||
|
return $this->tier;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $day = 1;
|
||||||
|
private $tier = 'Standard';
|
||||||
|
}
|
91
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ServerSideEncryptionConfig.php
vendored
Normal file
91
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ServerSideEncryptionConfig.php
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ServerSideEncryptionConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
* @link https://help.aliyun.com/document_detail/117914.htm
|
||||||
|
*/
|
||||||
|
class ServerSideEncryptionConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ServerSideEncryptionConfig constructor.
|
||||||
|
* @param null $sseAlgorithm
|
||||||
|
* @param null $kmsMasterKeyID
|
||||||
|
*/
|
||||||
|
public function __construct($sseAlgorithm = null, $kmsMasterKeyID = null)
|
||||||
|
{
|
||||||
|
$this->sseAlgorithm = $sseAlgorithm;
|
||||||
|
$this->kmsMasterKeyID = $kmsMasterKeyID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse ServerSideEncryptionConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (!isset($xml->ApplyServerSideEncryptionByDefault)) return;
|
||||||
|
foreach ($xml->ApplyServerSideEncryptionByDefault as $default) {
|
||||||
|
foreach ($default as $key => $value) {
|
||||||
|
if ($key === 'SSEAlgorithm') {
|
||||||
|
$this->sseAlgorithm = strval($value);
|
||||||
|
} elseif ($key === 'KMSMasterKeyID') {
|
||||||
|
$this->kmsMasterKeyID = strval($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><ServerSideEncryptionRule></ServerSideEncryptionRule>');
|
||||||
|
$default = $xml->addChild('ApplyServerSideEncryptionByDefault');
|
||||||
|
if (isset($this->sseAlgorithm)) {
|
||||||
|
$default->addChild('SSEAlgorithm', $this->sseAlgorithm);
|
||||||
|
}
|
||||||
|
if (isset($this->kmsMasterKeyID)) {
|
||||||
|
$default->addChild('KMSMasterKeyID', $this->kmsMasterKeyID);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSSEAlgorithm()
|
||||||
|
{
|
||||||
|
return $this->sseAlgorithm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKMSMasterKeyID()
|
||||||
|
{
|
||||||
|
return $this->kmsMasterKeyID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $sseAlgorithm = "";
|
||||||
|
private $kmsMasterKeyID = "";
|
||||||
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace OSS\Model;
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class StorageCapacityConfig
|
* Class StorageCapacityConfig
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Tag
|
||||||
|
* @package OSS\Model
|
||||||
|
*/
|
||||||
|
class Tag
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Tag constructor.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $value
|
||||||
|
*/
|
||||||
|
public function __construct($key, $value)
|
||||||
|
{
|
||||||
|
$this->key = $key;
|
||||||
|
$this->value = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return $this->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $key = "";
|
||||||
|
private $value = "";
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TaggingConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class TaggingConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* TaggingConfig constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->tags = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Tag list
|
||||||
|
*
|
||||||
|
* @return Tag[]
|
||||||
|
*/
|
||||||
|
public function getTags()
|
||||||
|
{
|
||||||
|
return $this->tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new Tag
|
||||||
|
*
|
||||||
|
* @param Tag $tag
|
||||||
|
* @throws OssException
|
||||||
|
*/
|
||||||
|
public function addTag($tag)
|
||||||
|
{
|
||||||
|
$this->tags[] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse TaggingConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (!isset($xml->TagSet) || !isset($xml->TagSet->Tag)) return;
|
||||||
|
foreach ($xml->TagSet->Tag as $tag) {
|
||||||
|
$this->addTag(new Tag($tag->Key, $tag->Value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><Tagging></Tagging>');
|
||||||
|
$xmlTagSet = $xml->addChild('TagSet');
|
||||||
|
foreach ($this->tags as $tag) {
|
||||||
|
$xmlTag = $xmlTagSet->addChild('Tag');
|
||||||
|
$xmlTag->addChild('Key', strval($tag->getKey()));
|
||||||
|
$xmlTag->addChild('Value', strval($tag->getValue()));
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tag list
|
||||||
|
*
|
||||||
|
* @var Tag[]
|
||||||
|
*/
|
||||||
|
private $tags = array();
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class VersioningConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class VersioningConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* VersioningConfig constructor.
|
||||||
|
* @param null $status
|
||||||
|
*/
|
||||||
|
public function __construct($status = null)
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse VersioningConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (isset($xml->Status)) {
|
||||||
|
$this->status = strval($xml->Status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><VersioningConfiguration></VersioningConfiguration>');
|
||||||
|
if (isset($this->status)) {
|
||||||
|
$xml->addChild('Status', $this->status);
|
||||||
|
}
|
||||||
|
return $xml->asXML();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStatus()
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $status = "";
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Model;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class WormConfig
|
||||||
|
* @package OSS\Model
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class WormConfig implements XmlConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse WormConfig from the xml.
|
||||||
|
*
|
||||||
|
* @param string $strXml
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function parseFromXml($strXml)
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($strXml);
|
||||||
|
if (isset($xml->WormId)) {
|
||||||
|
$this->wormId = strval($xml->WormId);
|
||||||
|
}
|
||||||
|
if (isset($xml->State)) {
|
||||||
|
$this->state = strval($xml->State);
|
||||||
|
}
|
||||||
|
if (isset($xml->RetentionPeriodInDays)) {
|
||||||
|
$this->day = intval($xml->RetentionPeriodInDays);
|
||||||
|
}
|
||||||
|
if (isset($xml->CreationDate)) {
|
||||||
|
$this->creationDate = strval($xml->CreationDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the object into xml string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function serializeToXml()
|
||||||
|
{
|
||||||
|
throw new OssException("Not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->serializeToXml();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWormId()
|
||||||
|
{
|
||||||
|
return $this->wormId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getState()
|
||||||
|
{
|
||||||
|
return $this->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getDay()
|
||||||
|
{
|
||||||
|
return $this->day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCreationDate()
|
||||||
|
{
|
||||||
|
return $this->creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $wormId = '';
|
||||||
|
private $state = '';
|
||||||
|
private $creationDate = '';
|
||||||
|
private $day = 0;
|
||||||
|
}
|
|
@ -50,6 +50,28 @@ use OSS\Model\RefererConfig;
|
||||||
use OSS\Model\WebsiteConfig;
|
use OSS\Model\WebsiteConfig;
|
||||||
use OSS\Core\OssUtil;
|
use OSS\Core\OssUtil;
|
||||||
use OSS\Model\ListPartsInfo;
|
use OSS\Model\ListPartsInfo;
|
||||||
|
use OSS\Result\GetBucketInfoResult;
|
||||||
|
use OSS\Model\BucketStat;
|
||||||
|
use OSS\Result\GetBucketStatResult;
|
||||||
|
use OSS\Model\ServerSideEncryptionConfig;
|
||||||
|
use OSS\Result\GetBucketEncryptionResult;
|
||||||
|
use OSS\Model\RequestPaymentConfig;
|
||||||
|
use OSS\Result\GetBucketRequestPaymentResult;
|
||||||
|
use OSS\Model\Tag;
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
use OSS\Result\GetBucketTagsResult;
|
||||||
|
use OSS\Model\VersioningConfig;
|
||||||
|
use OSS\Result\GetBucketVersioningResult;
|
||||||
|
use OSS\Model\InitiateWormConfig;
|
||||||
|
use OSS\Result\InitiateBucketWormResult;
|
||||||
|
use OSS\Model\ExtendWormConfig;
|
||||||
|
use OSS\Result\GetBucketWormResult;
|
||||||
|
use OSS\Model\RestoreConfig;
|
||||||
|
use OSS\Model\ObjectVersionListInfo;
|
||||||
|
use OSS\Result\ListObjectVersionsResult;
|
||||||
|
use OSS\Model\DeleteObjectInfo;
|
||||||
|
use OSS\Model\DeletedObjectInfo;
|
||||||
|
use OSS\Result\DeleteObjectVersionsResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OssClient
|
* Class OssClient
|
||||||
|
@ -273,12 +295,12 @@ class OssClient
|
||||||
*
|
*
|
||||||
* @param string $bucket
|
* @param string $bucket
|
||||||
* @param string $object
|
* @param string $object
|
||||||
|
* @param array $options
|
||||||
* @throws OssException
|
* @throws OssException
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getObjectAcl($bucket, $object)
|
public function getObjectAcl($bucket, $object, $options = NULL)
|
||||||
{
|
{
|
||||||
$options = array();
|
|
||||||
$this->precheckCommon($bucket, $object, $options, true);
|
$this->precheckCommon($bucket, $object, $options, true);
|
||||||
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
$options[self::OSS_BUCKET] = $bucket;
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
@ -295,10 +317,11 @@ class OssClient
|
||||||
* @param string $bucket bucket name
|
* @param string $bucket bucket name
|
||||||
* @param string $object object name
|
* @param string $object object name
|
||||||
* @param string $acl access permissions, valid values are ['default', 'private', 'public-read', 'public-read-write']
|
* @param string $acl access permissions, valid values are ['default', 'private', 'public-read', 'public-read-write']
|
||||||
|
* @param array $options
|
||||||
* @throws OssException
|
* @throws OssException
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function putObjectAcl($bucket, $object, $acl)
|
public function putObjectAcl($bucket, $object, $acl, $options = NULL)
|
||||||
{
|
{
|
||||||
$this->precheckCommon($bucket, $object, $options, true);
|
$this->precheckCommon($bucket, $object, $options, true);
|
||||||
$options[self::OSS_BUCKET] = $bucket;
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
@ -685,7 +708,7 @@ class OssClient
|
||||||
* @throws OssException
|
* @throws OssException
|
||||||
* @return GetLiveChannelHistory
|
* @return GetLiveChannelHistory
|
||||||
*/
|
*/
|
||||||
public function getLiveChannelHistory($bucket, $channelName, $options = NULL)
|
public function getLiveChannelHistory($bucket, $channelName, $options = NULL)
|
||||||
{
|
{
|
||||||
$this->precheckCommon($bucket, NULL, $options, false);
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
$options[self::OSS_BUCKET] = $bucket;
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
@ -810,6 +833,41 @@ class OssClient
|
||||||
return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
|
return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the signed pushing streaming url
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $channelName channel name
|
||||||
|
* @param int $expiration expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return The signed pushing streaming url
|
||||||
|
*/
|
||||||
|
public function generatePresignedRtmpUrl($bucket, $channelName, $expiration, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $channelName, $options, false);
|
||||||
|
$proto = 'rtmp://';
|
||||||
|
$hostname = $this->generateHostname($bucket);
|
||||||
|
$cano_params = '';
|
||||||
|
$query_items = array();
|
||||||
|
$params = isset($options['params']) ? $options['params'] : array();
|
||||||
|
uksort($params, 'strnatcasecmp');
|
||||||
|
foreach ($params as $key => $value) {
|
||||||
|
$cano_params = $cano_params . $key . ':' . $value . "\n";
|
||||||
|
$query_items[] = rawurlencode($key) . '=' . rawurlencode($value);
|
||||||
|
}
|
||||||
|
$resource = '/' . $bucket . '/' . $channelName;
|
||||||
|
|
||||||
|
$string_to_sign = $expiration . "\n" . $cano_params . $resource;
|
||||||
|
$signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));
|
||||||
|
|
||||||
|
$query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId);
|
||||||
|
$query_items[] = 'Expires=' . rawurlencode($expiration);
|
||||||
|
$query_items[] = 'Signature=' . rawurlencode($signature);
|
||||||
|
|
||||||
|
return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Precheck the CORS request. Before sending a CORS request, a preflight request (OPTIONS) is sent with the specific origin.
|
* Precheck the CORS request. Before sending a CORS request, a preflight request (OPTIONS) is sent with the specific origin.
|
||||||
* HTTP METHOD and headers information are sent to OSS as well for evaluating if the CORS request is allowed.
|
* HTTP METHOD and headers information are sent to OSS as well for evaluating if the CORS request is allowed.
|
||||||
|
@ -950,7 +1008,6 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of the bucket,the unit is GB
|
* Set the size of the bucket,the unit is GB
|
||||||
* When the capacity of the bucket is bigger than the set, it's forbidden to continue writing
|
* When the capacity of the bucket is bigger than the set, it's forbidden to continue writing
|
||||||
|
@ -996,6 +1053,445 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the information of the bucket
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return BucketInfo
|
||||||
|
*/
|
||||||
|
public function getBucketInfo($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'bucketInfo';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketInfoResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the stat of the bucket
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return BucketStat
|
||||||
|
*/
|
||||||
|
public function getBucketStat($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'stat';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketStatResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bucket's policy
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $policy policy json format content
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function putBucketPolicy($bucket, $policy, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'policy';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/json';
|
||||||
|
$options[self::OSS_CONTENT] = $policy;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bucket's policy
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string policy json content
|
||||||
|
*/
|
||||||
|
public function getBucketPolicy($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'policy';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new BodyResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the bucket's policy
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function deleteBucketPolicy($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'policy';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bucket's encryption
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param ServerSideEncryptionConfig $sseConfig
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function putBucketEncryption($bucket, $sseConfig, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'encryption';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$options[self::OSS_CONTENT] = $sseConfig->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bucket's encryption
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return ServerSideEncryptionConfig
|
||||||
|
*/
|
||||||
|
public function getBucketEncryption($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'encryption';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the bucket's encryption
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function deleteBucketEncryption($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'encryption';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the request playment of the bucket, Can be BucketOwner and Requester
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $payer
|
||||||
|
* @param array $options
|
||||||
|
* @return ResponseCore
|
||||||
|
* @throws null
|
||||||
|
*/
|
||||||
|
public function putBucketRequestPayment($bucket, $payer, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'requestPayment';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$config = new RequestPaymentConfig($payer);
|
||||||
|
$options[self::OSS_CONTENT] = $config->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the request playment of the bucket
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBucketRequestPayment($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'requestPayment';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketRequestPaymentResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bucket's tags
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param TaggingConfig $taggingConfig
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function putBucketTags($bucket, $taggingConfig, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$options[self::OSS_CONTENT] = $taggingConfig->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets bucket's tags
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return TaggingConfig
|
||||||
|
*/
|
||||||
|
public function getBucketTags($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the bucket's tags
|
||||||
|
* If want to delete specified tags for a bucket, please set the $tags
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param tag[] $tags (optional)
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function deleteBucketTags($bucket, $tags = NULL, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
if (empty($tags)) {
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
} else {
|
||||||
|
$value = '';
|
||||||
|
foreach ($tags as $tag ) {
|
||||||
|
$value .= $tag->getKey().',';
|
||||||
|
}
|
||||||
|
$value = rtrim($value, ',');
|
||||||
|
$options[self::OSS_TAGGING] = $value;
|
||||||
|
}
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the versioning of the bucket, Can be BucketOwner and Requester
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $status
|
||||||
|
* @param array $options
|
||||||
|
* @return ResponseCore
|
||||||
|
* @throws null
|
||||||
|
*/
|
||||||
|
public function putBucketVersioning($bucket, $status, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'versioning';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$config = new VersioningConfig($status);
|
||||||
|
$options[self::OSS_CONTENT] = $config->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the versioning of the bucket
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBucketVersioning($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'versioning';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketVersioningResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a bucket's worm
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param int $day
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string returns uploadid
|
||||||
|
*/
|
||||||
|
public function initiateBucketWorm($bucket, $day, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'worm';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$config = new InitiateWormConfig($day);
|
||||||
|
$options[self::OSS_CONTENT] = $config->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new InitiateBucketWormResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aborts the bucket's worm
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function abortBucketWorm($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'worm';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complete a bucket's worm
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $wormId
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string returns uploadid
|
||||||
|
*/
|
||||||
|
public function completeBucketWorm($bucket, $wormId, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_WORM_ID] = $wormId;
|
||||||
|
$options[self::OSS_CONTENT] = '';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend a bucket's worm
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $wormId
|
||||||
|
* @param int $day
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string returns uploadid
|
||||||
|
*/
|
||||||
|
public function extendBucketWorm($bucket, $wormId, $day, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_WORM_ID] = $wormId;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'wormExtend';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$config = new ExtendWormConfig($day);
|
||||||
|
$options[self::OSS_CONTENT] = $config->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a bucket's worm
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $options
|
||||||
|
* @throws OssException
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBucketWorm($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'worm';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketWormResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists the bucket's object list (in ObjectListInfo)
|
* Lists the bucket's object list (in ObjectListInfo)
|
||||||
|
@ -1018,16 +1514,14 @@ class OssClient
|
||||||
$options[self::OSS_BUCKET] = $bucket;
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
$options[self::OSS_OBJECT] = '/';
|
$options[self::OSS_OBJECT] = '/';
|
||||||
$options[self::OSS_HEADERS] = array(
|
|
||||||
self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/',
|
|
||||||
self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '',
|
|
||||||
self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE,
|
|
||||||
self::OSS_MARKER => isset($options[self::OSS_MARKER]) ? $options[self::OSS_MARKER] : '',
|
|
||||||
);
|
|
||||||
$query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
|
$query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
|
||||||
$options[self::OSS_QUERY_STRING] = array_merge(
|
$options[self::OSS_QUERY_STRING] = array_merge(
|
||||||
$query,
|
$query,
|
||||||
array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL)
|
array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL,
|
||||||
|
self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/',
|
||||||
|
self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '',
|
||||||
|
self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE,
|
||||||
|
self::OSS_MARKER => isset($options[self::OSS_MARKER]) ? $options[self::OSS_MARKER] : '')
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->auth($options);
|
$response = $this->auth($options);
|
||||||
|
@ -1035,6 +1529,45 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the bucket's object with version information (in ObjectListInfo)
|
||||||
|
*
|
||||||
|
* @param string $bucket
|
||||||
|
* @param array $options are defined below:
|
||||||
|
* $options = array(
|
||||||
|
* 'max-keys' => specifies max object count to return. By default is 100 and max value could be 1000.
|
||||||
|
* 'prefix' => specifies the key prefix the returned objects must have. Note that the returned keys still contain the prefix.
|
||||||
|
* 'delimiter' => The delimiter of object name for grouping object. When it's specified, listObjectVersions will differeniate the object and folder. And it will return subfolder's objects.
|
||||||
|
* 'key-marker' => The key of returned object must be greater than the 'key-marker'.
|
||||||
|
* 'version-id-marker' => The version id of returned object must be greater than the 'version-id-marker'.
|
||||||
|
*)
|
||||||
|
* Prefix and marker are for filtering and paging. Their length must be less than 256 bytes
|
||||||
|
* @throws OssException
|
||||||
|
* @return ObjectListInfo
|
||||||
|
*/
|
||||||
|
public function listObjectVersions($bucket, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'versions';
|
||||||
|
$query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
|
||||||
|
$options[self::OSS_QUERY_STRING] = array_merge(
|
||||||
|
$query,
|
||||||
|
array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL,
|
||||||
|
self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/',
|
||||||
|
self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '',
|
||||||
|
self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE,
|
||||||
|
self::OSS_KEY_MARKER => isset($options[self::OSS_KEY_MARKER]) ? $options[self::OSS_KEY_MARKER] : '',
|
||||||
|
self::OSS_VERSION_ID_MARKER => isset($options[self::OSS_VERSION_ID_MARKER]) ? $options[self::OSS_VERSION_ID_MARKER] : '')
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new ListObjectVersionsResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a virtual 'folder' in OSS. The name should not end with '/' because the method will append the name with a '/' anyway.
|
* Creates a virtual 'folder' in OSS. The name should not end with '/' because the method will append the name with a '/' anyway.
|
||||||
*
|
*
|
||||||
|
@ -1127,11 +1660,12 @@ class OssClient
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets symlink
|
* gets symlink
|
||||||
*@param string $bucket bucket name
|
* @param string $bucket bucket name
|
||||||
* @param string $symlink symlink name
|
* @param string $symlink symlink name
|
||||||
|
* @param array $options
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function getSymlink($bucket, $symlink)
|
public function getSymlink($bucket, $symlink, $options = NULL)
|
||||||
{
|
{
|
||||||
$this->precheckCommon($bucket, $symlink, $options);
|
$this->precheckCommon($bucket, $symlink, $options);
|
||||||
|
|
||||||
|
@ -1182,6 +1716,45 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads object from file handle
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $object object name
|
||||||
|
* @param resource $handle file handle
|
||||||
|
* @param array $options
|
||||||
|
* @return null
|
||||||
|
* @throws OssException
|
||||||
|
*/
|
||||||
|
public function uploadStream($bucket, $object, $handle, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options);
|
||||||
|
if (!is_resource($handle)) {
|
||||||
|
throw new OssException("The handle must be an opened stream");
|
||||||
|
}
|
||||||
|
$options[self::OSS_FILE_UPLOAD] = $handle;
|
||||||
|
if ($this->isCheckMD5($options)) {
|
||||||
|
rewind($handle);
|
||||||
|
$ctx = hash_init('md5');
|
||||||
|
hash_update_stream($ctx, $handle);
|
||||||
|
$content_md5 = base64_encode(hash_final($ctx, true));
|
||||||
|
rewind($handle);
|
||||||
|
$options[self::OSS_CONTENT_MD5] = $content_md5;
|
||||||
|
}
|
||||||
|
if (!isset($options[self::OSS_CONTENT_TYPE])) {
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object);
|
||||||
|
}
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
if (!isset($options[self::OSS_CONTENT_LENGTH])) {
|
||||||
|
$options[self::OSS_CONTENT_LENGTH] = fstat($handle)[self::OSS_SIZE];
|
||||||
|
}
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the object with the content at the specified position.
|
* Append the object with the content at the specified position.
|
||||||
* The specified position is typically the lengh of the current file.
|
* The specified position is typically the lengh of the current file.
|
||||||
|
@ -1283,10 +1856,15 @@ class OssClient
|
||||||
$options[self::OSS_BUCKET] = $toBucket;
|
$options[self::OSS_BUCKET] = $toBucket;
|
||||||
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
$options[self::OSS_OBJECT] = $toObject;
|
$options[self::OSS_OBJECT] = $toObject;
|
||||||
|
$param = '/' . $fromBucket . '/' . rawurlencode($fromObject);
|
||||||
|
if (isset($options[self::OSS_VERSION_ID])) {
|
||||||
|
$param = $param . '?versionId='.$options[self::OSS_VERSION_ID];
|
||||||
|
unset($options[self::OSS_VERSION_ID]);
|
||||||
|
}
|
||||||
if (isset($options[self::OSS_HEADERS])) {
|
if (isset($options[self::OSS_HEADERS])) {
|
||||||
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = '/' . $fromBucket . '/' . $fromObject;
|
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = $param;
|
||||||
} else {
|
} else {
|
||||||
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => '/' . $fromBucket . '/' . $fromObject);
|
$options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => $param);
|
||||||
}
|
}
|
||||||
$response = $this->auth($options);
|
$response = $this->auth($options);
|
||||||
$result = new CopyObjectResult($response);
|
$result = new CopyObjectResult($response);
|
||||||
|
@ -1312,6 +1890,27 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the simplified metadata of a object.
|
||||||
|
* Simplified metadata includes ETag, Size, LastModified.
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $object object name
|
||||||
|
* @param string $options Checks out the SDK document for the detail
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSimplifiedObjectMeta($bucket, $object, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'objectMeta';
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new HeaderResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a object
|
* Deletes a object
|
||||||
*
|
*
|
||||||
|
@ -1366,6 +1965,41 @@ class OssClient
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes multiple objects with version id in a bucket
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param array $objects DeleteObjectInfo list
|
||||||
|
* @param array $options
|
||||||
|
* @return ResponseCore
|
||||||
|
* @throws null
|
||||||
|
*/
|
||||||
|
public function deleteObjectVersions($bucket, $objects, $options = null)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, NULL, $options, false);
|
||||||
|
if (!is_array($objects) || !$objects) {
|
||||||
|
throw new OssException('objects must be array');
|
||||||
|
}
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = '/';
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'delete';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$quiet = 'false';
|
||||||
|
if (isset($options['quiet'])) {
|
||||||
|
if (is_bool($options['quiet'])) { //Boolean
|
||||||
|
$quiet = $options['quiet'] ? 'true' : 'false';
|
||||||
|
} elseif (is_string($options['quiet'])) { // string
|
||||||
|
$quiet = ($options['quiet'] === 'true') ? 'true' : 'false';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$xmlBody = OssUtil::createDeleteObjectVersionsXmlBody($objects, $quiet);
|
||||||
|
$options[self::OSS_CONTENT] = $xmlBody;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Object content
|
* Gets Object content
|
||||||
*
|
*
|
||||||
|
@ -1434,11 +2068,101 @@ class OssClient
|
||||||
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
$options[self::OSS_OBJECT] = $object;
|
$options[self::OSS_OBJECT] = $object;
|
||||||
$options[self::OSS_SUB_RESOURCE] = self::OSS_RESTORE;
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_RESTORE;
|
||||||
|
if (isset($options[self::OSS_RESTORE_CONFIG])) {
|
||||||
|
$config = $options[self::OSS_RESTORE_CONFIG];
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$options[self::OSS_CONTENT] = $config->serializeToXml();
|
||||||
|
}
|
||||||
$response = $this->auth($options);
|
$response = $this->auth($options);
|
||||||
$result = new PutSetDeleteResult($response);
|
$result = new PutSetDeleteResult($response);
|
||||||
return $result->getData();
|
return $result->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the object tagging
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $object object name
|
||||||
|
* @param TaggingConfig $taggingConfig
|
||||||
|
* @throws OssException
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function putObjectTagging($bucket, $object, $taggingConfig, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options, true);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/xml';
|
||||||
|
$options[self::OSS_CONTENT] = $taggingConfig->serializeToXml();
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the object tagging
|
||||||
|
*
|
||||||
|
* @param string $bucket
|
||||||
|
* @param string $object
|
||||||
|
* @throws OssException
|
||||||
|
* @return TaggingConfig
|
||||||
|
*/
|
||||||
|
public function getObjectTagging($bucket, $object, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options, true);
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_GET;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the object tagging
|
||||||
|
*
|
||||||
|
* @param string $bucket
|
||||||
|
* @param string $object
|
||||||
|
* @throws OssException
|
||||||
|
* @return TaggingConfig
|
||||||
|
*/
|
||||||
|
public function deleteObjectTagging($bucket, $object, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options, true);
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new PutSetDeleteResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the object
|
||||||
|
*
|
||||||
|
* @param string $bucket bucket name
|
||||||
|
* @param string $object object name
|
||||||
|
* @param string $process process script
|
||||||
|
* @return string process result, json format
|
||||||
|
*/
|
||||||
|
public function processObject($bucket, $object, $process, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options);
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_METHOD] = self::OSS_HTTP_POST;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_SUB_RESOURCE] = 'x-oss-process';
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = 'application/octet-stream';
|
||||||
|
$options[self::OSS_CONTENT] = 'x-oss-process='.$process;
|
||||||
|
$response = $this->auth($options);
|
||||||
|
$result = new BodyResult($response);
|
||||||
|
return $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the part size according to the preferred part size.
|
* Gets the part size according to the preferred part size.
|
||||||
* If the specified part size is too small or too big, it will return a min part or max part size instead.
|
* If the specified part size is too small or too big, it will return a min part or max part size instead.
|
||||||
|
@ -1693,7 +2417,13 @@ class OssClient
|
||||||
$options[self::OSS_HEADERS] = array();
|
$options[self::OSS_HEADERS] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = '/' . $fromBucket . '/' . $fromObject;
|
$param = '/' . $fromBucket . '/' . rawurlencode($fromObject);
|
||||||
|
if (isset($options[self::OSS_VERSION_ID])) {
|
||||||
|
$param = $param . '?versionId='.$options[self::OSS_VERSION_ID];
|
||||||
|
unset($options[self::OSS_VERSION_ID]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = $param;
|
||||||
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE_RANGE] = "bytes=" . $start_range . "-" . $end_range;
|
$options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE_RANGE] = "bytes=" . $start_range . "-" . $end_range;
|
||||||
$response = $this->auth($options);
|
$response = $this->auth($options);
|
||||||
$result = new UploadPartResult($response);
|
$result = new UploadPartResult($response);
|
||||||
|
@ -1787,7 +2517,16 @@ class OssClient
|
||||||
'ETag' => $etag,
|
'ETag' => $etag,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $this->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts);
|
|
||||||
|
//build complete options
|
||||||
|
$cmp_options = null;
|
||||||
|
if (isset($options[self::OSS_HEADERS]) && isset($options[self::OSS_HEADERS][self::OSS_REQUEST_PAYER])) {
|
||||||
|
$cmp_options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => $options[self::OSS_HEADERS][self::OSS_REQUEST_PAYER],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return $this->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts, $cmp_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1871,6 +2610,37 @@ class OssClient
|
||||||
return $this->auth($options);
|
return $this->auth($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign URL with specified expiration time in seconds and HTTP method.
|
||||||
|
* The signed URL could be used to access the object directly.
|
||||||
|
*
|
||||||
|
* @param string $bucket
|
||||||
|
* @param string $object
|
||||||
|
* @param int $expiration expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC
|
||||||
|
* @param string $method
|
||||||
|
* @param array $options Key-Value array
|
||||||
|
* @return string
|
||||||
|
* @throws OssException
|
||||||
|
*/
|
||||||
|
public function generatePresignedUrl($bucket, $object, $expiration, $method = self::OSS_HTTP_GET, $options = NULL)
|
||||||
|
{
|
||||||
|
$this->precheckCommon($bucket, $object, $options);
|
||||||
|
//method
|
||||||
|
if (self::OSS_HTTP_GET !== $method && self::OSS_HTTP_PUT !== $method) {
|
||||||
|
throw new OssException("method is invalid");
|
||||||
|
}
|
||||||
|
$options[self::OSS_BUCKET] = $bucket;
|
||||||
|
$options[self::OSS_OBJECT] = $object;
|
||||||
|
$options[self::OSS_METHOD] = $method;
|
||||||
|
if (!isset($options[self::OSS_CONTENT_TYPE])) {
|
||||||
|
$options[self::OSS_CONTENT_TYPE] = '';
|
||||||
|
}
|
||||||
|
$options[self::OSS_PREAUTH] = $expiration;
|
||||||
|
$options[self::OSS_DATE] = $expiration;
|
||||||
|
$this->setSignStsInUrl(true);
|
||||||
|
return $this->auth($options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* validates options. Create a empty array if it's NULL.
|
* validates options. Create a empty array if it's NULL.
|
||||||
*
|
*
|
||||||
|
@ -1924,6 +2694,8 @@ class OssClient
|
||||||
return;
|
return;
|
||||||
case self::OSS_STORAGE_STANDARD:
|
case self::OSS_STORAGE_STANDARD:
|
||||||
return;
|
return;
|
||||||
|
case self::OSS_STORAGE_COLDARCHIVE:
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2159,10 +2931,13 @@ class OssClient
|
||||||
}
|
}
|
||||||
// Generates the signable_resource
|
// Generates the signable_resource
|
||||||
$signable_resource = $this->generateSignableResource($options);
|
$signable_resource = $this->generateSignableResource($options);
|
||||||
$string_to_sign .= rawurldecode($signable_resource) . urldecode($signable_query_string);
|
$signable_resource = rawurldecode($signable_resource) . urldecode($signable_query_string);
|
||||||
|
$string_to_sign_ordered = $string_to_sign;
|
||||||
|
$string_to_sign .= $signable_resource;
|
||||||
|
|
||||||
// Sort the strings to be signed.
|
// Sort the strings to be signed.
|
||||||
$string_to_sign_ordered = $this->stringToSignSorted($string_to_sign);
|
$string_to_sign_ordered .= $this->stringToSignSorted($signable_resource);
|
||||||
|
|
||||||
|
|
||||||
$signature = base64_encode(hash_hmac('sha1', $string_to_sign_ordered, $this->accessKeySecret, true));
|
$signature = base64_encode(hash_hmac('sha1', $string_to_sign_ordered, $this->accessKeySecret, true));
|
||||||
$request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
|
$request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
|
||||||
|
@ -2400,6 +3175,10 @@ class OssClient
|
||||||
self::OSS_POSITION,
|
self::OSS_POSITION,
|
||||||
self::OSS_SYMLINK,
|
self::OSS_SYMLINK,
|
||||||
self::OSS_RESTORE,
|
self::OSS_RESTORE,
|
||||||
|
self::OSS_TAGGING,
|
||||||
|
self::OSS_WORM_ID,
|
||||||
|
self::OSS_TRAFFIC_LIMIT,
|
||||||
|
self::OSS_VERSION_ID,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($signableList as $item) {
|
foreach ($signableList as $item) {
|
||||||
|
@ -2670,6 +3449,14 @@ class OssClient
|
||||||
const OSS_STORAGE_STANDARD = 'Standard';
|
const OSS_STORAGE_STANDARD = 'Standard';
|
||||||
const OSS_STORAGE_IA = 'IA';
|
const OSS_STORAGE_IA = 'IA';
|
||||||
const OSS_STORAGE_ARCHIVE = 'Archive';
|
const OSS_STORAGE_ARCHIVE = 'Archive';
|
||||||
|
const OSS_STORAGE_COLDARCHIVE = 'ColdArchive';
|
||||||
|
const OSS_TAGGING = 'tagging';
|
||||||
|
const OSS_WORM_ID = 'wormId';
|
||||||
|
const OSS_RESTORE_CONFIG = 'restore-config';
|
||||||
|
const OSS_KEY_MARKER = 'key-marker';
|
||||||
|
const OSS_VERSION_ID_MARKER = 'version-id-marker';
|
||||||
|
const OSS_VERSION_ID = 'versionId';
|
||||||
|
const OSS_HEADER_VERSION_ID = 'x-oss-version-id';
|
||||||
|
|
||||||
//private URLs
|
//private URLs
|
||||||
const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId';
|
const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId';
|
||||||
|
@ -2693,6 +3480,8 @@ class OssClient
|
||||||
const OSS_PROCESS = "x-oss-process";
|
const OSS_PROCESS = "x-oss-process";
|
||||||
const OSS_CALLBACK = "x-oss-callback";
|
const OSS_CALLBACK = "x-oss-callback";
|
||||||
const OSS_CALLBACK_VAR = "x-oss-callback-var";
|
const OSS_CALLBACK_VAR = "x-oss-callback-var";
|
||||||
|
const OSS_REQUEST_PAYER = "x-oss-request-payer";
|
||||||
|
const OSS_TRAFFIC_LIMIT = "x-oss-traffic-limit";
|
||||||
//Constants for STS SecurityToken
|
//Constants for STS SecurityToken
|
||||||
const OSS_SECURITY_TOKEN = "x-oss-security-token";
|
const OSS_SECURITY_TOKEN = "x-oss-security-token";
|
||||||
const OSS_ACL_TYPE_PRIVATE = 'private';
|
const OSS_ACL_TYPE_PRIVATE = 'private';
|
||||||
|
@ -2714,8 +3503,8 @@ class OssClient
|
||||||
);
|
);
|
||||||
// OssClient version information
|
// OssClient version information
|
||||||
const OSS_NAME = "aliyun-sdk-php";
|
const OSS_NAME = "aliyun-sdk-php";
|
||||||
const OSS_VERSION = "2.3.1";
|
const OSS_VERSION = "2.4.1";
|
||||||
const OSS_BUILD = "20191115";
|
const OSS_BUILD = "20200929";
|
||||||
const OSS_AUTHOR = "";
|
const OSS_AUTHOR = "";
|
||||||
const OSS_OPTIONS_ORIGIN = 'Origin';
|
const OSS_OPTIONS_ORIGIN = 'Origin';
|
||||||
const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
|
const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
|
||||||
|
|
|
@ -25,6 +25,6 @@ class CopyObjectResult extends Result
|
||||||
$result[] = $xml->ETag;
|
$result[] = $xml->ETag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return array_merge($result, $this->rawResponse->header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
39
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectVersionsResult.php
vendored
Normal file
39
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectVersionsResult.php
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
use OSS\Core\OssUtil;
|
||||||
|
use OSS\Model\DeletedObjectInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DeleteObjectVersionsResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class DeleteObjectVersionsResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return DeletedObjectInfo[]
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($this->rawResponse->body);
|
||||||
|
$encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : "";
|
||||||
|
return $this->parseDeletedList($xml, $encodingType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseDeletedList($xml, $encodingType)
|
||||||
|
{
|
||||||
|
$retList = array();
|
||||||
|
if (isset($xml->Deleted)) {
|
||||||
|
foreach ($xml->Deleted as $content) {
|
||||||
|
$key = isset($content->Key) ? strval($content->Key) : "";
|
||||||
|
$key = OssUtil::decodeKey($key, $encodingType);
|
||||||
|
$versionId = isset($content->VersionId) ? strval($content->VersionId) : "";
|
||||||
|
$deleteMarker = isset($content->DeleteMarker) ? strval($content->DeleteMarker) : "";
|
||||||
|
$deleteMarkerVersionId = isset($content->DeleteMarkerVersionId) ? strval($content->DeleteMarkerVersionId) : "";
|
||||||
|
$retList[] = new DeletedObjectInfo($key, $versionId, $deleteMarker, $deleteMarkerVersionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retList;
|
||||||
|
}
|
||||||
|
}
|
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketEncryptionResult.php
vendored
Normal file
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketEncryptionResult.php
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\ServerSideEncryptionConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketEncryptionResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketEncryptionResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the ServerSideEncryptionConfig object from the response
|
||||||
|
*
|
||||||
|
* @return ServerSideEncryptionConfig
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$config = new ServerSideEncryptionConfig();
|
||||||
|
$config->parseFromXml($content);
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\BucketInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketResult interface returns the result class, encapsulated
|
||||||
|
* The returned xml data is parsed
|
||||||
|
*
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketInfoResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse data from response
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws OssException
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
if (empty($content)) {
|
||||||
|
throw new OssException("body is null");
|
||||||
|
}
|
||||||
|
$xml = simplexml_load_string($content);
|
||||||
|
if (isset($xml->Bucket)) {
|
||||||
|
$info = new BucketInfo();
|
||||||
|
$info->parseFromXmlNode($xml->Bucket);
|
||||||
|
return $info;
|
||||||
|
} else {
|
||||||
|
throw new OssException("xml format exception");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketRequestPaymentResult.php
vendored
Normal file
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketRequestPaymentResult.php
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\RequestPaymentConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketRequestPaymentResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketRequestPaymentResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the RequestPaymentConfig object from the response
|
||||||
|
*
|
||||||
|
* @return RequestPaymentConfig
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$config = new RequestPaymentConfig();
|
||||||
|
$config->parseFromXml($content);
|
||||||
|
return $config->getPayer();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\BucketStat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetRefererResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketStatResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse bucket stat data
|
||||||
|
*
|
||||||
|
* @return BucketStat
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$stat = new BucketStat();
|
||||||
|
$stat->parseFromXml($content);
|
||||||
|
return $stat;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketTagsResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketTagsResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the TaggingConfig object from the response
|
||||||
|
*
|
||||||
|
* @return TaggingConfig
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->parseFromXml($content);
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketVersioningResult.php
vendored
Normal file
26
sdk/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketVersioningResult.php
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\VersioningConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketVersioningResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketVersioningResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the VersioningConfig object from the response
|
||||||
|
*
|
||||||
|
* @return VersioningConfig
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$config = new VersioningConfig();
|
||||||
|
$config->parseFromXml($content);
|
||||||
|
return $config->getStatus();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
|
||||||
|
use OSS\Model\WormConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GetBucketWormResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class GetBucketWormResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse bucket stat data
|
||||||
|
*
|
||||||
|
* @return WormConfig
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$content = $this->rawResponse->body;
|
||||||
|
$config = new WormConfig();
|
||||||
|
$config->parseFromXml($content);
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class InitiateBucketWormResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class InitiateBucketWormResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the value of worm-id from response headers
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws OssException
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$header = $this->rawResponse->header;
|
||||||
|
if (isset($header["x-oss-worm-id"])) {
|
||||||
|
return strval($header["x-oss-worm-id"]);
|
||||||
|
}
|
||||||
|
throw new OssException("cannot get worm-id");
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,9 +22,8 @@ class ListBucketsResult extends Result
|
||||||
$xml = new \SimpleXMLElement($content);
|
$xml = new \SimpleXMLElement($content);
|
||||||
if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) {
|
if (isset($xml->Buckets) && isset($xml->Buckets->Bucket)) {
|
||||||
foreach ($xml->Buckets->Bucket as $bucket) {
|
foreach ($xml->Buckets->Bucket as $bucket) {
|
||||||
$bucketInfo = new BucketInfo(strval($bucket->Location),
|
$bucketInfo = new BucketInfo();
|
||||||
strval($bucket->Name),
|
$bucketInfo->parseFromXmlNode($bucket);
|
||||||
strval($bucket->CreationDate));
|
|
||||||
$bucketList[] = $bucketInfo;
|
$bucketList[] = $bucketInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Result;
|
||||||
|
|
||||||
|
use OSS\Core\OssUtil;
|
||||||
|
use OSS\Model\ObjectVersionInfo;
|
||||||
|
use OSS\Model\ObjectVersionListInfo;
|
||||||
|
use OSS\Model\DeleteMarkerInfo;
|
||||||
|
use OSS\Model\PrefixInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ListObjectVersionsResult
|
||||||
|
* @package OSS\Result
|
||||||
|
*/
|
||||||
|
class ListObjectVersionsResult extends Result
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the xml data returned by the ListObjectVersions interface
|
||||||
|
*
|
||||||
|
* return ObjectVersionListInfo
|
||||||
|
*/
|
||||||
|
protected function parseDataFromResponse()
|
||||||
|
{
|
||||||
|
$xml = simplexml_load_string($this->rawResponse->body);
|
||||||
|
$encodingType = isset($xml->EncodingType) ? strval($xml->EncodingType) : "";
|
||||||
|
$objectVersionList = $this->parseObjecVersionList($xml, $encodingType);
|
||||||
|
$deleteMarkerList = $this->parseDeleteMarkerList($xml, $encodingType);
|
||||||
|
$prefixList = $this->parsePrefixList($xml, $encodingType);
|
||||||
|
$bucketName = isset($xml->Name) ? strval($xml->Name) : "";
|
||||||
|
$prefix = isset($xml->Prefix) ? strval($xml->Prefix) : "";
|
||||||
|
$prefix = OssUtil::decodeKey($prefix, $encodingType);
|
||||||
|
$keyMarker = isset($xml->KeyMarker) ? strval($xml->KeyMarker) : "";
|
||||||
|
$keyMarker = OssUtil::decodeKey($keyMarker, $encodingType);
|
||||||
|
$nextKeyMarker = isset($xml->NextKeyMarker) ? strval($xml->NextKeyMarker) : "";
|
||||||
|
$nextKeyMarker = OssUtil::decodeKey($nextKeyMarker, $encodingType);
|
||||||
|
$versionIdMarker = isset($xml->VersionIdMarker) ? strval($xml->VersionIdMarker) : "";
|
||||||
|
$nextVersionIdMarker = isset($xml->NextVersionIdMarker) ? strval($xml->NextVersionIdMarker) : "";
|
||||||
|
$maxKeys = isset($xml->MaxKeys) ? intval($xml->MaxKeys) : 0;
|
||||||
|
$delimiter = isset($xml->Delimiter) ? strval($xml->Delimiter) : "";
|
||||||
|
$delimiter = OssUtil::decodeKey($delimiter, $encodingType);
|
||||||
|
$isTruncated = isset($xml->IsTruncated) ? strval($xml->IsTruncated) : "";
|
||||||
|
|
||||||
|
return new ObjectVersionListInfo($bucketName, $prefix, $keyMarker, $nextKeyMarker,
|
||||||
|
$versionIdMarker, $nextVersionIdMarker,$maxKeys, $delimiter, $isTruncated,
|
||||||
|
$objectVersionList, $deleteMarkerList, $prefixList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseObjecVersionList($xml, $encodingType)
|
||||||
|
{
|
||||||
|
$retList = array();
|
||||||
|
if (isset($xml->Version)) {
|
||||||
|
foreach ($xml->Version as $content) {
|
||||||
|
$key = isset($content->Key) ? strval($content->Key) : "";
|
||||||
|
$key = OssUtil::decodeKey($key, $encodingType);
|
||||||
|
$versionId = isset($content->VersionId) ? strval($content->VersionId) : "";
|
||||||
|
$lastModified = isset($content->LastModified) ? strval($content->LastModified) : "";
|
||||||
|
$eTag = isset($content->ETag) ? strval($content->ETag) : "";
|
||||||
|
$type = isset($content->Type) ? strval($content->Type) : "";
|
||||||
|
$size = isset($content->Size) ? intval($content->Size) : 0;
|
||||||
|
$storageClass = isset($content->StorageClass) ? strval($content->StorageClass) : "";
|
||||||
|
$isLatest = isset($content->IsLatest) ? strval($content->IsLatest) : "";
|
||||||
|
$retList[] = new ObjectVersionInfo($key, $versionId, $lastModified, $eTag, $type, $size, $storageClass, $isLatest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parseDeleteMarkerList($xml, $encodingType)
|
||||||
|
{
|
||||||
|
$retList = array();
|
||||||
|
if (isset($xml->DeleteMarker)) {
|
||||||
|
foreach ($xml->DeleteMarker as $content) {
|
||||||
|
$key = isset($content->Key) ? strval($content->Key) : "";
|
||||||
|
$key = OssUtil::decodeKey($key, $encodingType);
|
||||||
|
$versionId = isset($content->VersionId) ? strval($content->VersionId) : "";
|
||||||
|
$lastModified = isset($content->LastModified) ? strval($content->LastModified) : "";
|
||||||
|
$isLatest = isset($content->IsLatest) ? strval($content->IsLatest) : "";
|
||||||
|
$retList[] = new DeleteMarkerInfo($key, $versionId, $lastModified, $isLatest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function parsePrefixList($xml, $encodingType)
|
||||||
|
{
|
||||||
|
$retList = array();
|
||||||
|
if (isset($xml->CommonPrefixes)) {
|
||||||
|
foreach ($xml->CommonPrefixes as $commonPrefix) {
|
||||||
|
$prefix = isset($commonPrefix->Prefix) ? strval($commonPrefix->Prefix) : "";
|
||||||
|
$prefix = OssUtil::decodeKey($prefix, $encodingType);
|
||||||
|
$retList[] = new PrefixInfo($prefix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $retList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -195,6 +195,39 @@ class BucketLiveChannelTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals('playlist.m3u8', $query['playlistName']);
|
$this->assertEquals('playlist.m3u8', $query['playlistName']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetgenPreSignedRtmpUrlVsSignedRtmpUrl()
|
||||||
|
{
|
||||||
|
$channelName = '90475';
|
||||||
|
$bucket = 'douyu';
|
||||||
|
$url1 = '245';
|
||||||
|
$url2 = '123';
|
||||||
|
$expiration = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
$begin = time();
|
||||||
|
$expiration = time() + 900;
|
||||||
|
$url1 = $this->client->generatePresignedRtmpUrl($bucket, $channelName, $expiration, array(
|
||||||
|
'params' => array(
|
||||||
|
'playlistName' => 'playlist.m3u8'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$url2 = $this->client->signRtmpUrl($bucket, $channelName, 900, array(
|
||||||
|
'params' => array(
|
||||||
|
'playlistName' => 'playlist.m3u8'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$end = time();
|
||||||
|
|
||||||
|
if ($begin == $end)
|
||||||
|
break;
|
||||||
|
usleep(500000);
|
||||||
|
} while (true);
|
||||||
|
$this->assertEquals($url1, $url1);
|
||||||
|
$this->assertTrue(strpos($url1, 'Expires='.$expiration) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
public function testLiveChannelInfo()
|
public function testLiveChannelInfo()
|
||||||
{
|
{
|
||||||
$channelName = 'live-to-put-status';
|
$channelName = 'live-to-put-status';
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
require_once __DIR__ . '/Common.php';
|
require_once __DIR__ . '/Common.php';
|
||||||
|
|
||||||
class ContentTypeTest extends \PHPUnit_Framework_TestCase
|
class ContentTypeTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
private function runCmd($cmd)
|
private function runCmd($cmd)
|
||||||
{
|
{
|
||||||
|
@ -17,15 +17,15 @@ class ContentTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
private function getContentType($bucket, $object)
|
private function getContentType($bucket, $object)
|
||||||
{
|
{
|
||||||
$client = Common::getOssClient();
|
$client = $this->ossClient;
|
||||||
$headers = $client->getObjectMeta($bucket, $object);
|
$headers = $client->getObjectMeta($bucket, $object);
|
||||||
return $headers['content-type'];
|
return $headers['content-type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testByFileName()
|
public function testByFileName()
|
||||||
{
|
{
|
||||||
$client = Common::getOssClient();
|
$client = $this->ossClient;
|
||||||
$bucket = Common::getBucketName();
|
$bucket = $this->bucket;
|
||||||
|
|
||||||
$file = '/tmp/x.html';
|
$file = '/tmp/x.html';
|
||||||
$object = 'test/x';
|
$object = 'test/x';
|
||||||
|
@ -48,8 +48,8 @@ class ContentTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testByObjectKey()
|
public function testByObjectKey()
|
||||||
{
|
{
|
||||||
$client = Common::getOssClient();
|
$client = $this->ossClient;
|
||||||
$bucket = Common::getBucketName();
|
$bucket = $this->bucket;
|
||||||
|
|
||||||
$object = "test/x.txt";
|
$object = "test/x.txt";
|
||||||
$client->putObject($bucket, $object, "hello world");
|
$client->putObject($bucket, $object, "hello world");
|
||||||
|
@ -96,8 +96,8 @@ class ContentTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testByUser()
|
public function testByUser()
|
||||||
{
|
{
|
||||||
$client = Common::getOssClient();
|
$client = $this->ossClient;
|
||||||
$bucket = Common::getBucketName();
|
$bucket = $this->bucket;
|
||||||
|
|
||||||
$object = "test/x.txt";
|
$object = "test/x.txt";
|
||||||
$client->putObject($bucket, $object, "hello world", array(
|
$client->putObject($bucket, $object, "hello world", array(
|
||||||
|
|
187
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/DeleteObjectVersionsResultTest.php
vendored
Normal file
187
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/DeleteObjectVersionsResultTest.php
vendored
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\DeleteObjectVersionsResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class DeleteObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
<Deleted>
|
||||||
|
<Key>demo.jpg</Key>
|
||||||
|
<VersionId>CAEQNRiBgICEoPiC0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk****</VersionId>
|
||||||
|
<DeleteMarker>true</DeleteMarker>
|
||||||
|
<DeleteMarkerVersionId>111111</DeleteMarkerVersionId>
|
||||||
|
</Deleted>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml1 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
<Deleted>
|
||||||
|
<Key>multipart.data</Key>
|
||||||
|
<VersionId>CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4****</VersionId>
|
||||||
|
</Deleted>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml2 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
<Deleted>
|
||||||
|
<Key>multipart.data</Key>
|
||||||
|
<DeleteMarker>true</DeleteMarker>
|
||||||
|
<DeleteMarkerVersionId>CAEQMhiBgIDXiaaB0BYiIGQzYmRkZGUxMTM1ZDRjOTZhNjk4YjRjMTAyZjhl****</DeleteMarkerVersionId>
|
||||||
|
</Deleted>
|
||||||
|
<Deleted>
|
||||||
|
<Key>test.jpg</Key>
|
||||||
|
<DeleteMarker>true</DeleteMarker>
|
||||||
|
<DeleteMarkerVersionId>CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****</DeleteMarkerVersionId>
|
||||||
|
</Deleted>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml3 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
<Deleted>
|
||||||
|
<Key>multipart.data</Key>
|
||||||
|
</Deleted>
|
||||||
|
<Deleted>
|
||||||
|
<Key>test.jpg</Key>
|
||||||
|
</Deleted>
|
||||||
|
<Deleted>
|
||||||
|
<Key>demo.jpg</Key>
|
||||||
|
</Deleted>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml4 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
<EncodingType>url</EncodingType>
|
||||||
|
<Deleted>
|
||||||
|
<Key>multipart%2F.data</Key>
|
||||||
|
</Deleted>
|
||||||
|
<Deleted>
|
||||||
|
<Key>test%2F.jpg</Key>
|
||||||
|
</Deleted>
|
||||||
|
<Deleted>
|
||||||
|
<Key>demo%2F.jpg</Key>
|
||||||
|
</Deleted>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<DeleteResult>
|
||||||
|
</DeleteResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(1, count($list));
|
||||||
|
$this->assertEquals('demo.jpg', $list[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQNRiBgICEoPiC0BYiIGMxZWJmYmMzYjE0OTQ0ZmZhYjgzNzkzYjc2NjZk****', $list[0]->getVersionId());
|
||||||
|
$this->assertEquals('true', $list[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('111111', $list[0]->getDeleteMarkerVersionId());
|
||||||
|
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml1, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(1, count($list));
|
||||||
|
$this->assertEquals('multipart.data', $list[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4****', $list[0]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarkerVersionId());
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml2, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(2, count($list));
|
||||||
|
$this->assertEquals('multipart.data', $list[0]->getKey());
|
||||||
|
$this->assertEquals('', $list[0]->getVersionId());
|
||||||
|
$this->assertEquals('true', $list[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('CAEQMhiBgIDXiaaB0BYiIGQzYmRkZGUxMTM1ZDRjOTZhNjk4YjRjMTAyZjhl****', $list[0]->getDeleteMarkerVersionId());
|
||||||
|
$this->assertEquals('test.jpg', $list[1]->getKey());
|
||||||
|
$this->assertEquals('', $list[1]->getVersionId());
|
||||||
|
$this->assertEquals('true', $list[1]->getDeleteMarker());
|
||||||
|
$this->assertEquals('CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****', $list[1]->getDeleteMarkerVersionId());
|
||||||
|
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml3, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(3, count($list));
|
||||||
|
$this->assertEquals('multipart.data', $list[0]->getKey());
|
||||||
|
$this->assertEquals('', $list[0]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarkerVersionId());
|
||||||
|
$this->assertEquals('test.jpg', $list[1]->getKey());
|
||||||
|
$this->assertEquals('', $list[1]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[1]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[1]->getDeleteMarkerVersionId());
|
||||||
|
$this->assertEquals('demo.jpg', $list[2]->getKey());
|
||||||
|
$this->assertEquals('', $list[2]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[2]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[2]->getDeleteMarkerVersionId());
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml4, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(3, count($list));
|
||||||
|
$this->assertEquals('multipart/.data', $list[0]->getKey());
|
||||||
|
$this->assertEquals('', $list[0]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[0]->getDeleteMarkerVersionId());
|
||||||
|
$this->assertEquals('test/.jpg', $list[1]->getKey());
|
||||||
|
$this->assertEquals('', $list[1]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[1]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[1]->getDeleteMarkerVersionId());
|
||||||
|
$this->assertEquals('demo/.jpg', $list[2]->getKey());
|
||||||
|
$this->assertEquals('', $list[2]->getVersionId());
|
||||||
|
$this->assertEquals('', $list[2]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $list[2]->getDeleteMarkerVersionId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(0, count($list));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new DeleteObjectVersionsResult($response);
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(0, count($list));
|
||||||
|
}
|
||||||
|
}
|
95
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetBucketEncryptionResultTest.php
vendored
Normal file
95
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetBucketEncryptionResultTest.php
vendored
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\GetBucketEncryptionResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class GetBucketEncryptionResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ServerSideEncryptionRule>
|
||||||
|
<ApplyServerSideEncryptionByDefault>
|
||||||
|
<SSEAlgorithm>AES256</SSEAlgorithm>
|
||||||
|
<KMSMasterKeyID></KMSMasterKeyID>
|
||||||
|
</ApplyServerSideEncryptionByDefault>
|
||||||
|
</ServerSideEncryptionRule>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml1 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ServerSideEncryptionRule>
|
||||||
|
<ApplyServerSideEncryptionByDefault>
|
||||||
|
<SSEAlgorithm>KMS</SSEAlgorithm>
|
||||||
|
<KMSMasterKeyID>kms-id</KMSMasterKeyID>
|
||||||
|
</ApplyServerSideEncryptionByDefault>
|
||||||
|
</ServerSideEncryptionRule>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml2 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ServerSideEncryptionRule>
|
||||||
|
<ApplyServerSideEncryptionByDefault>
|
||||||
|
<SSEAlgorithm>KMS</SSEAlgorithm>
|
||||||
|
</ApplyServerSideEncryptionByDefault>
|
||||||
|
</ServerSideEncryptionRule>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ServerSideEncryptionRule>
|
||||||
|
</ServerSideEncryptionRule>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("AES256", $config->getSSEAlgorithm());
|
||||||
|
$this->assertEquals("", $config->getKMSMasterKeyID());
|
||||||
|
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml1, 200);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("KMS", $config->getSSEAlgorithm());
|
||||||
|
$this->assertEquals("kms-id", $config->getKMSMasterKeyID());
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml2, 200);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("KMS", $config->getSSEAlgorithm());
|
||||||
|
$this->assertEquals(null, $config->getKMSMasterKeyID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(null, $config->getSSEAlgorithm());
|
||||||
|
$this->assertEquals(null, $config->getKMSMasterKeyID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new GetBucketEncryptionResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(null, $config->getSSEAlgorithm());
|
||||||
|
$this->assertEquals(null, $config->getKMSMasterKeyID());
|
||||||
|
}
|
||||||
|
}
|
66
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetBucketRequestPaymentResultTest.php
vendored
Normal file
66
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/GetBucketRequestPaymentResultTest.php
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\GetBucketRequestPaymentResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class GetBucketRequestPaymentResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<RequestPaymentConfiguration>
|
||||||
|
<Payer>Requester</Payer>
|
||||||
|
</RequestPaymentConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml2 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<RequestPaymentConfiguration>
|
||||||
|
<Payer>BucketOwner</Payer>
|
||||||
|
</RequestPaymentConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<RequestPaymentConfiguration>
|
||||||
|
</RequestPaymentConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new GetBucketRequestPaymentResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$payer = $result->getData();
|
||||||
|
$this->assertEquals("Requester", $payer);
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml2, 200);
|
||||||
|
$result = new GetBucketRequestPaymentResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$payer = $result->getData();
|
||||||
|
$this->assertEquals("BucketOwner", $payer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new GetBucketRequestPaymentResult($response);
|
||||||
|
$payer = $result->getData();
|
||||||
|
$this->assertEquals(null, $payer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new GetBucketRequestPaymentResult($response);
|
||||||
|
$payer = $result->getData();
|
||||||
|
$this->assertEquals(null, $payer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\GetBucketStatResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class GetBucketStatResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<BucketStat>
|
||||||
|
<Storage>100</Storage>
|
||||||
|
<ObjectCount>200</ObjectCount>
|
||||||
|
<MultipartUploadCount>10</MultipartUploadCount>
|
||||||
|
</BucketStat>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<BucketStat>
|
||||||
|
</BucketStat>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new GetBucketStatResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$stat = $result->getData();
|
||||||
|
$this->assertEquals(100, $stat->getStorage());
|
||||||
|
$this->assertEquals(200, $stat->getObjectCount());
|
||||||
|
$this->assertEquals(10, $stat->getMultipartUploadCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new GetBucketStatResult($response);
|
||||||
|
$stat = $result->getData();
|
||||||
|
$this->assertEquals(0, $stat->getStorage());
|
||||||
|
$this->assertEquals(0, $stat->getObjectCount());
|
||||||
|
$this->assertEquals(0, $stat->getMultipartUploadCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new GetBucketStatResult($response);
|
||||||
|
$stat = $result->getData();
|
||||||
|
$this->assertEquals(0, $stat->getStorage());
|
||||||
|
$this->assertEquals(0, $stat->getObjectCount());
|
||||||
|
$this->assertEquals(0, $stat->getMultipartUploadCount());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\GetBucketTagsResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class GetBucketTagsResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<Tagging>
|
||||||
|
<TagSet>
|
||||||
|
<Tag>
|
||||||
|
<Key>testa</Key>
|
||||||
|
<Value>value1-test</Value>
|
||||||
|
</Tag>
|
||||||
|
<Tag>
|
||||||
|
<Key>testb</Key>
|
||||||
|
<Value>value2-test</Value>
|
||||||
|
</Tag>
|
||||||
|
</TagSet>
|
||||||
|
</Tagging>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<Tagging>
|
||||||
|
</Tagging>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml2 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<Tagging>
|
||||||
|
<TagSet>
|
||||||
|
</TagSet>
|
||||||
|
</Tagging>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(2, count($config->getTags()));
|
||||||
|
$this->assertEquals("testa", $config->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1-test", $config->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("testb", $config->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2-test", $config->getTags()[1]->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(0, count($config->getTags()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(0, count($config->getTags()));
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml2, 200);
|
||||||
|
$result = new GetBucketTagsResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals(0, count($config->getTags()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\GetBucketWormResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class GetBucketWormResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<WormConfiguration>
|
||||||
|
<WormId>ID1</WormId>
|
||||||
|
<State>Locked</State>
|
||||||
|
<RetentionPeriodInDays>1</RetentionPeriodInDays>
|
||||||
|
<CreationDate>2018-08-14T15:50:32</CreationDate>
|
||||||
|
</WormConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml2 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<WormConfiguration>
|
||||||
|
<WormId>ID2</WormId>
|
||||||
|
<State>InProgress</State>
|
||||||
|
<RetentionPeriodInDays>10</RetentionPeriodInDays>
|
||||||
|
<CreationDate>2018-09-14T15:50:32</CreationDate>
|
||||||
|
</WormConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<WormConfiguration>
|
||||||
|
</WormConfiguration>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new GetBucketWormResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("ID1", $config->getWormId());
|
||||||
|
$this->assertEquals("Locked", $config->getState());
|
||||||
|
$this->assertEquals(1, $config->getDay());
|
||||||
|
$this->assertEquals("2018-08-14T15:50:32", $config->getCreationDate());
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml2, 200);
|
||||||
|
$result = new GetBucketWormResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("ID2", $config->getWormId());
|
||||||
|
$this->assertEquals("InProgress", $config->getState());
|
||||||
|
$this->assertEquals(10, $config->getDay());
|
||||||
|
$this->assertEquals("2018-09-14T15:50:32", $config->getCreationDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new GetBucketWormResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("", $config->getWormId());
|
||||||
|
$this->assertEquals("", $config->getState());
|
||||||
|
$this->assertEquals(0, $config->getDay());
|
||||||
|
$this->assertEquals("", $config->getCreationDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new GetBucketWormResult($response);
|
||||||
|
$config = $result->getData();
|
||||||
|
$this->assertEquals("", $config->getWormId());
|
||||||
|
$this->assertEquals("", $config->getState());
|
||||||
|
$this->assertEquals(0, $config->getDay());
|
||||||
|
$this->assertEquals("", $config->getCreationDate());
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,15 +71,15 @@ BBBB;
|
||||||
);
|
);
|
||||||
|
|
||||||
$errorBody = <<< BBBB
|
$errorBody = <<< BBBB
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Error>
|
<Error>
|
||||||
<Code>NoSuchBucket</Code>
|
<Code>NoSuchBucket</Code>
|
||||||
<Message>The specified bucket does not exist.</Message>
|
<Message>The specified bucket does not exist.</Message>
|
||||||
<RequestId>566B870D207FB3044302EB0A</RequestId>
|
<RequestId>566B870D207FB3044302EB0A</RequestId>
|
||||||
<HostId>hello.oss-test.aliyun-inc.com</HostId>
|
<HostId>hello.oss-test.aliyun-inc.com</HostId>
|
||||||
<BucketName>hello</BucketName>
|
<BucketName>hello</BucketName>
|
||||||
</Error>
|
</Error>
|
||||||
BBBB;
|
BBBB;
|
||||||
$response = new ResponseCore($errorHeader, $errorBody, 403);
|
$response = new ResponseCore($errorHeader, $errorBody, 403);
|
||||||
try {
|
try {
|
||||||
new ListBucketsResult($response);
|
new ListBucketsResult($response);
|
||||||
|
@ -94,4 +94,74 @@ BBBB;
|
||||||
$this->assertEquals($e->getDetails(), $errorBody);
|
$this->assertEquals($e->getDetails(), $errorBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseXml2()
|
||||||
|
{
|
||||||
|
$xml = <<<BBBB
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ListAllMyBucketsResult>
|
||||||
|
<Owner>
|
||||||
|
<ID>ut_test_put_bucket</ID>
|
||||||
|
<DisplayName>ut_test_put_bucket</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
<Buckets>
|
||||||
|
<Bucket>
|
||||||
|
<CreationDate>2015-12-17T18:12:43.000Z</CreationDate>
|
||||||
|
<ExtranetEndpoint>oss-cn-shanghai.aliyuncs.com</ExtranetEndpoint>
|
||||||
|
<IntranetEndpoint>oss-cn-shanghai-internal.aliyuncs.com</IntranetEndpoint>
|
||||||
|
<Location>oss-cn-shanghai</Location>
|
||||||
|
<Name>app-base-oss</Name>
|
||||||
|
<Region>cn-shanghai</Region>
|
||||||
|
<StorageClass>Standard</StorageClass>
|
||||||
|
</Bucket>
|
||||||
|
<Bucket>
|
||||||
|
<CreationDate>2014-12-25T11:21:04.000Z</CreationDate>
|
||||||
|
<ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
|
||||||
|
<IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
|
||||||
|
<Location>oss-cn-hangzhou</Location>
|
||||||
|
<Name>atestleo23</Name>
|
||||||
|
<Region>cn-hangzhou</Region>
|
||||||
|
<StorageClass>IA</StorageClass>
|
||||||
|
</Bucket>
|
||||||
|
<Bucket>
|
||||||
|
<CreationDate>2014-12-25T11:21:04.000Z</CreationDate>
|
||||||
|
<Location>oss-cn-hangzhou</Location>
|
||||||
|
<Name>atestleo23</Name>
|
||||||
|
</Bucket>
|
||||||
|
</Buckets>
|
||||||
|
</ListAllMyBucketsResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $xml, 200);
|
||||||
|
$result = new ListBucketsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$bucketListInfo = $result->getData();
|
||||||
|
$this->assertEquals(3, count($bucketListInfo->getBucketList()));
|
||||||
|
$this->assertEquals("2015-12-17T18:12:43.000Z", $bucketListInfo->getBucketList()[0]->getCreateDate());
|
||||||
|
$this->assertEquals("oss-cn-shanghai", $bucketListInfo->getBucketList()[0]->getLocation());
|
||||||
|
$this->assertEquals("app-base-oss", $bucketListInfo->getBucketList()[0]->getName());
|
||||||
|
$this->assertEquals("oss-cn-shanghai.aliyuncs.com", $bucketListInfo->getBucketList()[0]->getExtranetEndpoint());
|
||||||
|
$this->assertEquals("oss-cn-shanghai-internal.aliyuncs.com", $bucketListInfo->getBucketList()[0]->getIntranetEndpoint());
|
||||||
|
$this->assertEquals("cn-shanghai", $bucketListInfo->getBucketList()[0]->getRegion());
|
||||||
|
$this->assertEquals("Standard", $bucketListInfo->getBucketList()[0]->getStorageClass());
|
||||||
|
|
||||||
|
$this->assertEquals("2014-12-25T11:21:04.000Z", $bucketListInfo->getBucketList()[1]->getCreateDate());
|
||||||
|
$this->assertEquals("oss-cn-hangzhou", $bucketListInfo->getBucketList()[1]->getLocation());
|
||||||
|
$this->assertEquals("atestleo23", $bucketListInfo->getBucketList()[1]->getName());
|
||||||
|
$this->assertEquals("oss-cn-hangzhou.aliyuncs.com", $bucketListInfo->getBucketList()[1]->getExtranetEndpoint());
|
||||||
|
$this->assertEquals("oss-cn-hangzhou-internal.aliyuncs.com", $bucketListInfo->getBucketList()[1]->getIntranetEndpoint());
|
||||||
|
$this->assertEquals("cn-hangzhou", $bucketListInfo->getBucketList()[1]->getRegion());
|
||||||
|
$this->assertEquals("IA", $bucketListInfo->getBucketList()[1]->getStorageClass());
|
||||||
|
|
||||||
|
$this->assertEquals("2014-12-25T11:21:04.000Z", $bucketListInfo->getBucketList()[2]->getCreateDate());
|
||||||
|
$this->assertEquals("oss-cn-hangzhou", $bucketListInfo->getBucketList()[2]->getLocation());
|
||||||
|
$this->assertEquals("atestleo23", $bucketListInfo->getBucketList()[2]->getName());
|
||||||
|
$this->assertEquals(null, $bucketListInfo->getBucketList()[2]->getExtranetEndpoint());
|
||||||
|
$this->assertEquals(null, $bucketListInfo->getBucketList()[2]->getIntranetEndpoint());
|
||||||
|
$this->assertEquals(null, $bucketListInfo->getBucketList()[2]->getRegion());
|
||||||
|
$this->assertEquals(null, $bucketListInfo->getBucketList()[2]->getStorageClass());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
213
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListObjectVersionsResultTest.php
vendored
Normal file
213
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/ListObjectVersionsResultTest.php
vendored
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Result\ListObjectVersionsResult;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
|
||||||
|
class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
private $validXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ListVersionsResult>
|
||||||
|
<Name>oss-example</Name>
|
||||||
|
<Prefix></Prefix>
|
||||||
|
<KeyMarker>example</KeyMarker>
|
||||||
|
<VersionIdMarker>CAEQMxiBgICbof2D0BYiIGRhZjgwMzJiMjA3MjQ0ODE5MWYxZDYwMzJlZjU1****</VersionIdMarker>
|
||||||
|
<MaxKeys>100</MaxKeys>
|
||||||
|
<Delimiter></Delimiter>
|
||||||
|
<IsTruncated>false</IsTruncated>
|
||||||
|
<DeleteMarker>
|
||||||
|
<Key>example</Key>
|
||||||
|
<VersionId>CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****</VersionId>
|
||||||
|
<IsLatest>false</IsLatest>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</DeleteMarker>
|
||||||
|
<Version>
|
||||||
|
<Key>example</Key>
|
||||||
|
<VersionId>CAEQMxiBgMDNoP2D0BYiIDE3MWUxNzgxZDQxNTRiODI5OGYwZGMwNGY3MzZjN****</VersionId>
|
||||||
|
<IsLatest>false</IsLatest>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<ETag>"250F8A0AE989679A22926A875F0A2****"</ETag>
|
||||||
|
<Type>Normal</Type>
|
||||||
|
<Size>93731</Size>
|
||||||
|
<StorageClass>Standard</StorageClass>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</Version>
|
||||||
|
<Version>
|
||||||
|
<Key>pic.jpg</Key>
|
||||||
|
<VersionId>CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx****</VersionId>
|
||||||
|
<IsLatest>true</IsLatest>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<ETag>"3663F7B0B9D3153F884C821E7CF4****"</ETag>
|
||||||
|
<Type>Normal</Type>
|
||||||
|
<Size>574768</Size>
|
||||||
|
<StorageClass>IA</StorageClass>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</Version>
|
||||||
|
</ListVersionsResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml1 = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ListVersionsResult>
|
||||||
|
<Name>oss-example</Name>
|
||||||
|
<Prefix></Prefix>
|
||||||
|
<KeyMarker>example</KeyMarker>
|
||||||
|
<VersionIdMarker>CAEQMxiBgICbof2D0BYiIGRhZjgwMzJiMjA3MjQ0ODE5MWYxZDYwMzJlZjU1****</VersionIdMarker>
|
||||||
|
<MaxKeys>100</MaxKeys>
|
||||||
|
<Delimiter></Delimiter>
|
||||||
|
<IsTruncated>false</IsTruncated>
|
||||||
|
<DeleteMarker>
|
||||||
|
<Key>example</Key>
|
||||||
|
<VersionId>CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****</VersionId>
|
||||||
|
<IsLatest>true</IsLatest>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</DeleteMarker>
|
||||||
|
<DeleteMarker>
|
||||||
|
<Key>example-1</Key>
|
||||||
|
<VersionId>CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****</VersionId>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</DeleteMarker>
|
||||||
|
<Version>
|
||||||
|
<Key>example-2</Key>
|
||||||
|
<VersionId>CAEQMxiBgMDNoP2D0BYiIDE3MWUxNzgxZDQxNTRiODI5OGYwZGMwNGY3MzZjN****</VersionId>
|
||||||
|
<LastModified>2019-04-09T07:27:28.000Z</LastModified>
|
||||||
|
<ETag>"250F8A0AE989679A22926A875F0A2****"</ETag>
|
||||||
|
<Type>Normal</Type>
|
||||||
|
<Size>93731</Size>
|
||||||
|
<StorageClass>Standard</StorageClass>
|
||||||
|
<Owner>
|
||||||
|
<ID>1234512528586****</ID>
|
||||||
|
<DisplayName>12345125285864390</DisplayName>
|
||||||
|
</Owner>
|
||||||
|
</Version>
|
||||||
|
</ListVersionsResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $invalidXml = <<<BBBB
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<ListVersionsResult>
|
||||||
|
</ListVersionsResult>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testParseValidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->validXml, 200);
|
||||||
|
$result = new ListObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(0, count($list->getPrefixList()));
|
||||||
|
$this->assertEquals(1, count($list->getDeleteMarkerList()));
|
||||||
|
$this->assertEquals(2, count($list->getObjectVersionList()));
|
||||||
|
|
||||||
|
$this->assertEquals('oss-example', $list->getBucketName());
|
||||||
|
$this->assertEquals('', $list->getPrefix());
|
||||||
|
$this->assertEquals('example', $list->getKeyMarker());
|
||||||
|
$this->assertEquals('CAEQMxiBgICbof2D0BYiIGRhZjgwMzJiMjA3MjQ0ODE5MWYxZDYwMzJlZjU1****', $list->getVersionIdMarker());
|
||||||
|
$this->assertEquals(100, $list->getMaxKeys());
|
||||||
|
$this->assertEquals('', $list->getDelimiter());
|
||||||
|
$this->assertEquals('false', $list->getIsTruncated());
|
||||||
|
|
||||||
|
$deleteMarkerList = $list->getDeleteMarkerList();
|
||||||
|
$this->assertEquals('example', $deleteMarkerList[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****', $deleteMarkerList[0]->getVersionId());
|
||||||
|
$this->assertEquals('false', $deleteMarkerList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $deleteMarkerList[0]->getLastModified());
|
||||||
|
|
||||||
|
$objectVersionList = $list->getObjectVersionList();
|
||||||
|
$this->assertEquals('example', $objectVersionList[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgMDNoP2D0BYiIDE3MWUxNzgxZDQxNTRiODI5OGYwZGMwNGY3MzZjN****', $objectVersionList[0]->getVersionId());
|
||||||
|
$this->assertEquals('false', $objectVersionList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $objectVersionList[0]->getLastModified());
|
||||||
|
$this->assertEquals('"250F8A0AE989679A22926A875F0A2****"', $objectVersionList[0]->getETag());
|
||||||
|
$this->assertEquals('Normal', $objectVersionList[0]->getType());
|
||||||
|
$this->assertEquals(93731, $objectVersionList[0]->getSize());
|
||||||
|
$this->assertEquals('Standard', $objectVersionList[0]->getStorageClass());
|
||||||
|
|
||||||
|
$this->assertEquals('pic.jpg', $objectVersionList[1]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgMCZov2D0BYiIDY4MDllOTc2YmY5MjQxMzdiOGI3OTlhNTU0ODIx****', $objectVersionList[1]->getVersionId());
|
||||||
|
$this->assertEquals('true', $objectVersionList[1]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $objectVersionList[1]->getLastModified());
|
||||||
|
$this->assertEquals('"3663F7B0B9D3153F884C821E7CF4****"', $objectVersionList[1]->getETag());
|
||||||
|
$this->assertEquals('Normal', $objectVersionList[1]->getType());
|
||||||
|
$this->assertEquals(574768, $objectVersionList[1]->getSize());
|
||||||
|
$this->assertEquals('IA', $objectVersionList[1]->getStorageClass());
|
||||||
|
|
||||||
|
|
||||||
|
$response = new ResponseCore(array(), $this->validXml1, 200);
|
||||||
|
$result = new ListObjectVersionsResult($response);
|
||||||
|
$this->assertTrue($result->isOK());
|
||||||
|
$this->assertNotNull($result->getData());
|
||||||
|
$this->assertNotNull($result->getRawResponse());
|
||||||
|
$list = $result->getData();
|
||||||
|
$this->assertEquals(0, count($list->getPrefixList()));
|
||||||
|
$this->assertEquals(2, count($list->getDeleteMarkerList()));
|
||||||
|
$this->assertEquals(1, count($list->getObjectVersionList()));
|
||||||
|
|
||||||
|
$this->assertEquals('oss-example', $list->getBucketName());
|
||||||
|
$this->assertEquals('', $list->getPrefix());
|
||||||
|
$this->assertEquals('example', $list->getKeyMarker());
|
||||||
|
$this->assertEquals('CAEQMxiBgICbof2D0BYiIGRhZjgwMzJiMjA3MjQ0ODE5MWYxZDYwMzJlZjU1****', $list->getVersionIdMarker());
|
||||||
|
$this->assertEquals(100, $list->getMaxKeys());
|
||||||
|
$this->assertEquals('', $list->getDelimiter());
|
||||||
|
$this->assertEquals('false', $list->getIsTruncated());
|
||||||
|
|
||||||
|
$deleteMarkerList = $list->getDeleteMarkerList();
|
||||||
|
$this->assertEquals('example', $deleteMarkerList[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****', $deleteMarkerList[0]->getVersionId());
|
||||||
|
$this->assertEquals('true', $deleteMarkerList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $deleteMarkerList[0]->getLastModified());
|
||||||
|
|
||||||
|
$this->assertEquals('example-1', $deleteMarkerList[1]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgICAof2D0BYiIDJhMGE3N2M1YTI1NDQzOGY5NTkyNTI3MGYyMzJm****', $deleteMarkerList[1]->getVersionId());
|
||||||
|
$this->assertEquals('', $deleteMarkerList[1]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $deleteMarkerList[1]->getLastModified());
|
||||||
|
|
||||||
|
$objectVersionList = $list->getObjectVersionList();
|
||||||
|
$this->assertEquals('example-2', $objectVersionList[0]->getKey());
|
||||||
|
$this->assertEquals('CAEQMxiBgMDNoP2D0BYiIDE3MWUxNzgxZDQxNTRiODI5OGYwZGMwNGY3MzZjN****', $objectVersionList[0]->getVersionId());
|
||||||
|
$this->assertEquals('', $objectVersionList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('2019-04-09T07:27:28.000Z', $objectVersionList[0]->getLastModified());
|
||||||
|
$this->assertEquals('"250F8A0AE989679A22926A875F0A2****"', $objectVersionList[0]->getETag());
|
||||||
|
$this->assertEquals('Normal', $objectVersionList[0]->getType());
|
||||||
|
$this->assertEquals(93731, $objectVersionList[0]->getSize());
|
||||||
|
$this->assertEquals('Standard', $objectVersionList[0]->getStorageClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseNullXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), "", 200);
|
||||||
|
$result = new ListObjectVersionsResult($response);
|
||||||
|
$list = $result->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseInvalidXml()
|
||||||
|
{
|
||||||
|
$response = new ResponseCore(array(), $this->invalidXml, 200);
|
||||||
|
$result = new ListObjectVersionsResult($response);
|
||||||
|
$stat = $result->getData();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,11 +4,13 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
require_once __DIR__ . '/Common.php';
|
require_once __DIR__ . '/Common.php';
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
use OSS\Model\LiveChannelInfo;
|
use OSS\Model\LiveChannelInfo;
|
||||||
use OSS\Model\LiveChannelListInfo;
|
use OSS\Model\LiveChannelListInfo;
|
||||||
use OSS\Model\LiveChannelConfig;
|
use OSS\Model\LiveChannelConfig;
|
||||||
use OSS\Model\GetLiveChannelStatus;
|
use OSS\Model\GetLiveChannelStatus;
|
||||||
use OSS\Model\GetLiveChannelHistory;
|
use OSS\Model\GetLiveChannelHistory;
|
||||||
|
use OSS\Model\LiveChannelHistory;
|
||||||
|
|
||||||
class LiveChannelXmlTest extends \PHPUnit_Framework_TestCase
|
class LiveChannelXmlTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -139,7 +141,7 @@ BBBB;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLiveChannelHistory()
|
public function testGetLiveChannelHistory()
|
||||||
{
|
{
|
||||||
$history = new GetLiveChannelHistory();
|
$history = new GetLiveChannelHistory();
|
||||||
$history->parseFromXml($this->history);
|
$history->parseFromXml($this->history);
|
||||||
|
@ -246,4 +248,30 @@ BBBB;
|
||||||
$this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/2/播放列表.m3u8', $plays[0]);
|
$this->assertEquals('http://bucket.oss-cn-hangzhou.aliyuncs.com/2/播放列表.m3u8', $plays[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLiveChannelHistory()
|
||||||
|
{
|
||||||
|
$xml = "<LiveRecord><StartTime>2013-11-24T14:25:31.000Z</StartTime><EndTime>2013-11-24T15:25:31.000Z</EndTime><RemoteAddr>10.101.194.148:56861</RemoteAddr></LiveRecord>";
|
||||||
|
$history = new LiveChannelHistory();
|
||||||
|
$history->parseFromXml($xml);
|
||||||
|
|
||||||
|
$this->assertEquals('2013-11-24T14:25:31.000Z', $history->getStartTime());
|
||||||
|
$this->assertEquals('2013-11-24T15:25:31.000Z', $history->getEndTime());
|
||||||
|
$this->assertEquals('10.101.194.148:56861', $history->getRemoteAddr());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetLiveChannelHistorySerializeToXml()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$history = new GetLiveChannelHistory ();
|
||||||
|
$history->serializeToXml();
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "Not implemented.") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,12 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
require_once __DIR__ . '/Common.php';
|
require_once __DIR__ . '/Common.php';
|
||||||
|
|
||||||
class ObjectAclTest extends \PHPUnit_Framework_TestCase
|
class ObjectAclTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
public function testGetSet()
|
public function testGetSet()
|
||||||
{
|
{
|
||||||
$client = Common::getOssClient();
|
$client = $this->ossClient;
|
||||||
$bucket = Common::getBucketName();
|
$bucket = $this->bucket;
|
||||||
|
|
||||||
$object = 'test/object-acl';
|
$object = 'test/object-acl';
|
||||||
$client->deleteObject($bucket, $object);
|
$client->deleteObject($bucket, $object);
|
||||||
|
|
63
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketEncryptionTest.php
vendored
Normal file
63
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketEncryptionTest.php
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\ServerSideEncryptionConfig;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientBucketEncryptionTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
$config = new ServerSideEncryptionConfig("AES256");
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketEncryption($this->bucket, $config);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$config2 = $this->ossClient->getBucketEncryption($this->bucket);
|
||||||
|
$this->assertEquals($config->serializeToXml(), $config2->serializeToXml());
|
||||||
|
$this->assertEquals("AES256", $config2->getSSEAlgorithm());
|
||||||
|
$this->assertEquals(null, $config2->getKMSMasterKeyID());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = new ServerSideEncryptionConfig("KMS", "kms-id");
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketEncryption($this->bucket, $config);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$config2 = $this->ossClient->getBucketEncryption($this->bucket);
|
||||||
|
$this->assertEquals($config->serializeToXml(), $config2->serializeToXml());
|
||||||
|
$this->assertEquals("KMS", $config2->getSSEAlgorithm());
|
||||||
|
$this->assertEquals("kms-id", $config2->getKMSMasterKeyID());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$this->ossClient->deleteBucketEncryption($this->bucket);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$config2 = $this->ossClient->getBucketEncryption($this->bucket);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals("NoSuchServerSideEncryptionRule", $e->getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
class OssClientBucketInfoTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucketInfo()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$info = $this->ossClient->getBucketInfo($this->bucket);
|
||||||
|
$this->assertEquals($this->bucket, $info->getName());
|
||||||
|
$this->assertEquals("Standard", $info->getStorageClass());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketPolicyTest.php
vendored
Normal file
47
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketPolicyTest.php
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
class OssClientBucketPolicyTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
$policy_str = <<< BBBB
|
||||||
|
{
|
||||||
|
"Version":"1",
|
||||||
|
"Statement":[
|
||||||
|
{
|
||||||
|
"Action":[
|
||||||
|
"oss:PutObject",
|
||||||
|
"oss:GetObject"
|
||||||
|
],
|
||||||
|
"Effect":"Deny",
|
||||||
|
"Principal":["1234567890"],
|
||||||
|
"Resource":["acs:oss:*:1234567890:*/*"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->deleteBucketPolicy($this->bucket);
|
||||||
|
$policy = $this->ossClient->getBucketPolicy($this->bucket);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
$this->assertEquals("NoSuchBucketPolicy", $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketPolicy($this->bucket, $policy_str);
|
||||||
|
$policy = $this->ossClient->getBucketPolicy($this->bucket);
|
||||||
|
$this->assertEquals($policy_str, $policy);
|
||||||
|
$this->ossClient->deleteBucketPolicy($this->bucket);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRequestPaymentTest.php
vendored
Normal file
51
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketRequestPaymentTest.php
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\RequestPaymentConfig;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientBucketRequestPaymentTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
|
||||||
|
$this->assertEquals("BucketOwner", $payer);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketRequestPayment($this->bucket, "Requester");
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
|
||||||
|
$this->assertEquals("Requester", $payer);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketRequestPayment($this->bucket, "BucketOwner");
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$payer = $this->ossClient->getBucketRequestPayment($this->bucket);
|
||||||
|
$this->assertEquals("BucketOwner", $payer);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketStatTestTest.php
vendored
Normal file
34
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketStatTestTest.php
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
class OssClientBucketStatTestTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucketStat()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$content = "hello";
|
||||||
|
$this->ossClient->putObject($this->bucket, "name-1.txt", $content);
|
||||||
|
$this->ossClient->putObject($this->bucket, "name-2.txt", $content);
|
||||||
|
$this->ossClient->putObject($this->bucket, "name-3.txt", $content);
|
||||||
|
|
||||||
|
$object = "multipart-test.txt";
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object);
|
||||||
|
|
||||||
|
Common::waitMetaSync();
|
||||||
|
Common::waitMetaSync();
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$stat = $this->ossClient->getBucketStat($this->bucket);
|
||||||
|
$this->assertEquals(3, $stat->getObjectCount());
|
||||||
|
$this->assertEquals(15, $stat->getStorage());
|
||||||
|
$this->assertEquals(1, $stat->getMultipartUploadCount());
|
||||||
|
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
use OSS\Model\Tag;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientBucketTagsTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$config = $this->ossClient->getBucketTags($this->bucket);
|
||||||
|
$this->assertEquals(0, count($config->getTags()));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->addTag(new Tag("key1", "value1"));
|
||||||
|
$config->addTag(new Tag("key2", "value2"));
|
||||||
|
$config->addTag(new Tag("key3", "value3"));
|
||||||
|
$this->ossClient->putBucketTags($this->bucket, $config);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$config2 = $this->ossClient->getBucketTags($this->bucket);
|
||||||
|
$this->assertEquals(3, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key1", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $config2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[1]->getValue());
|
||||||
|
$this->assertEquals("key3", $config2->getTags()[2]->getKey());
|
||||||
|
$this->assertEquals("value3", $config2->getTags()[2]->getValue());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
//del key1, key3
|
||||||
|
$tags = array();
|
||||||
|
$tags[] = new Tag("key1", "value1");
|
||||||
|
$tags[] = new Tag("key3", "value3");
|
||||||
|
|
||||||
|
$this->ossClient->deleteBucketTags($this->bucket, $tags);
|
||||||
|
$config2 = $this->ossClient->getBucketTags($this->bucket);
|
||||||
|
$this->assertEquals(1, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[0]->getValue());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
//del all
|
||||||
|
$this->ossClient->deleteBucketTags($this->bucket);
|
||||||
|
$config2 = $this->ossClient->getBucketTags($this->bucket);
|
||||||
|
$this->assertEquals(0, count($config2->getTags()));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
class OssClientBucketTest extends TestOssClientBase
|
class OssClientBucketTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
|
private $standardBucket;
|
||||||
private $iaBucket;
|
private $iaBucket;
|
||||||
private $archiveBucket;
|
private $archiveBucket;
|
||||||
|
|
||||||
|
@ -80,12 +81,31 @@ class OssClientBucketTest extends TestOssClientBase
|
||||||
$this->assertEquals($result, 'testcontent');
|
$this->assertEquals($result, 'testcontent');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCreateBucketWithInvalidStorageType()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_STORAGE => 'unknown'
|
||||||
|
);
|
||||||
|
$this->ossClient->createBucket('bucket-name', OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "storage name is invalid") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->iaBucket = 'ia-' . $this->bucket;
|
$this->iaBucket = 'ia-' . $this->bucket;
|
||||||
$this->archiveBucket = 'archive-' . $this->bucket;
|
$this->archiveBucket = 'archive-' . $this->bucket;
|
||||||
|
$this->standardBucket = 'standard-' . $this->bucket;
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_IA
|
OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_IA
|
||||||
);
|
);
|
||||||
|
@ -97,6 +117,12 @@ class OssClientBucketTest extends TestOssClientBase
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
$this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_STANDARD
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->ossClient->createBucket($this->standardBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
@ -109,5 +135,6 @@ class OssClientBucketTest extends TestOssClientBase
|
||||||
$this->ossClient->deleteObject($this->archiveBucket, $object);
|
$this->ossClient->deleteObject($this->archiveBucket, $object);
|
||||||
$this->ossClient->deleteBucket($this->iaBucket);
|
$this->ossClient->deleteBucket($this->iaBucket);
|
||||||
$this->ossClient->deleteBucket($this->archiveBucket);
|
$this->ossClient->deleteBucket($this->archiveBucket);
|
||||||
|
$this->ossClient->deleteBucket($this->standardBucket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
40
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketVersioningTest.php
vendored
Normal file
40
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketVersioningTest.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientBucketVersioningTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$status = $this->ossClient->getBucketVersioning($this->bucket);
|
||||||
|
$this->assertEquals(null, $status);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketVersioning($this->bucket, "Enabled");
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$status = $this->ossClient->getBucketVersioning($this->bucket);
|
||||||
|
$this->assertEquals("Enabled", $status);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putBucketVersioning($this->bucket, "Suspended");
|
||||||
|
Common::waitMetaSync();
|
||||||
|
$status = $this->ossClient->getBucketVersioning($this->bucket);
|
||||||
|
$this->assertEquals("Suspended", $status);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientBucketWormTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testBucket()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$wormId = $this->ossClient->initiateBucketWorm($this->bucket, 30);
|
||||||
|
$config = $this->ossClient->getBucketWorm($this->bucket);
|
||||||
|
$this->assertEquals($wormId, $config->getWormId());
|
||||||
|
$this->assertEquals("InProgress", $config->getState());
|
||||||
|
$this->assertEquals(30, $config->getDay());
|
||||||
|
$this->ossClient->abortBucketWorm($this->bucket);
|
||||||
|
|
||||||
|
$wormId = $this->ossClient->initiateBucketWorm($this->bucket, 60);
|
||||||
|
$this->ossClient->completeBucketWorm($this->bucket, $wormId);
|
||||||
|
$config = $this->ossClient->getBucketWorm($this->bucket);
|
||||||
|
|
||||||
|
$this->ossClient->ExtendBucketWorm($this->bucket, $wormId, 120);
|
||||||
|
$config = $this->ossClient->getBucketWorm($this->bucket);
|
||||||
|
$this->assertEquals($wormId, $config->getWormId());
|
||||||
|
$this->assertEquals("Locked", $config->getState());
|
||||||
|
$this->assertEquals(120, $config->getDay());
|
||||||
|
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ require_once __DIR__ . '/Common.php';
|
||||||
|
|
||||||
use OSS\OssClient;
|
use OSS\OssClient;
|
||||||
|
|
||||||
class OssClinetImageTest extends \PHPUnit_Framework_TestCase
|
class OssClinetImageTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
private $bucketName;
|
private $bucketName;
|
||||||
private $client;
|
private $client;
|
||||||
|
@ -16,21 +16,22 @@ class OssClinetImageTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->client = Common::getOssClient();
|
parent::setUp();
|
||||||
$this->bucketName = 'php-sdk-test-bucket-image-' . strval(rand(0, 10000));
|
|
||||||
$this->client->createBucket($this->bucketName);
|
$this->client = $this->ossClient;
|
||||||
Common::waitMetaSync();
|
$this->bucketName = $this->bucket;
|
||||||
$this->local_file = "example.jpg";
|
$this->local_file = "example.jpg";
|
||||||
$this->object = "oss-example.jpg";
|
$this->object = "oss-example.jpg";
|
||||||
$this->download_file = "image.jpg";
|
$this->download_file = "image.jpg";
|
||||||
|
|
||||||
|
Common::waitMetaSync();
|
||||||
$this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
|
$this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
$this->client->deleteObject($this->bucketName, $this->object);
|
parent::tearDown();
|
||||||
$this->client->deleteBucket($this->bucketName);
|
unlink($this->download_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testImageResize()
|
public function testImageResize()
|
||||||
|
@ -89,6 +90,47 @@ class OssClinetImageTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->check($options, 100, 100, 3267, 'jpg');
|
$this->check($options, 100, 100, 3267, 'jpg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testProcesObject()
|
||||||
|
{
|
||||||
|
$object = 'process-object.jpg';
|
||||||
|
$process = 'image/resize,m_fixed,w_100,h_100'.
|
||||||
|
'|sys/saveas'.
|
||||||
|
',o_'.$this->base64url_encode($object).
|
||||||
|
',b_'.$this->base64url_encode($this->bucketName);
|
||||||
|
$result = $this->client->processObject($this->bucketName, $this->object, $process);
|
||||||
|
$this->assertTrue(stripos($result, '"object": "process-object.jpg",') > 0);
|
||||||
|
$this->assertTrue(stripos($result, '"status": "OK"') > 0);
|
||||||
|
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_FILE_DOWNLOAD => $this->download_file,
|
||||||
|
);
|
||||||
|
$this->client->getObject($this->bucketName, $object, $options);
|
||||||
|
$array = getimagesize($this->download_file);
|
||||||
|
$this->assertEquals(100, $array[0]);
|
||||||
|
$this->assertEquals(100, $array[1]);
|
||||||
|
$this->assertEquals(2, $array[2]);
|
||||||
|
|
||||||
|
//without bucket
|
||||||
|
$object = 'process-object-1.jpg';
|
||||||
|
$process = 'image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ'.
|
||||||
|
'|sys/saveas'.
|
||||||
|
',o_'.$this->base64url_encode($object);
|
||||||
|
$result = $this->client->processObject($this->bucketName, $this->object, $process);
|
||||||
|
$this->assertTrue(stripos($result, '"object": "process-object-1.jpg",') > 0);
|
||||||
|
$this->assertTrue(stripos($result, '"status": "OK"') > 0);
|
||||||
|
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_FILE_DOWNLOAD => $this->download_file,
|
||||||
|
);
|
||||||
|
$this->client->getObject($this->bucketName, $object, $options);
|
||||||
|
$array = getimagesize($this->download_file);
|
||||||
|
$this->assertEquals(400, $array[0]);
|
||||||
|
$this->assertEquals(267, $array[1]);
|
||||||
|
$this->assertEquals(2, $array[2]);
|
||||||
|
}
|
||||||
|
|
||||||
private function check($options, $width, $height, $size, $type)
|
private function check($options, $width, $height, $size, $type)
|
||||||
{
|
{
|
||||||
$this->client->getObject($this->bucketName, $this->object, $options);
|
$this->client->getObject($this->bucketName, $this->object, $options);
|
||||||
|
@ -97,4 +139,9 @@ class OssClinetImageTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertEquals($height, $array[1]);
|
$this->assertEquals($height, $array[1]);
|
||||||
$this->assertEquals($type === 'jpg' ? 2 : 3, $array[2]);//2 <=> jpg
|
$this->assertEquals($type === 'jpg' ? 2 : 3, $array[2]);//2 <=> jpg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function base64url_encode($data)
|
||||||
|
{
|
||||||
|
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
184
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientListObjectsTest.php
vendored
Normal file
184
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientListObjectsTest.php
vendored
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\OssClient;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientListObjectsTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testListObjectsDefault()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$listObjectInfo = $this->ossClient->listObjects($this->bucket);
|
||||||
|
$objectList = $listObjectInfo->getObjectList();
|
||||||
|
$prefixList = $listObjectInfo->getPrefixList();
|
||||||
|
$this->assertNotNull($objectList);
|
||||||
|
$this->assertNotNull($prefixList);
|
||||||
|
$this->assertTrue(is_array($objectList));
|
||||||
|
$this->assertTrue(is_array($prefixList));
|
||||||
|
$this->assertEquals((2), count($objectList));
|
||||||
|
$this->assertEquals(4, count($prefixList));
|
||||||
|
|
||||||
|
$this->assertEquals('file++00', $objectList[0]->getKey());
|
||||||
|
$this->assertEquals('file++01', $objectList[1]->getKey());
|
||||||
|
|
||||||
|
$this->assertEquals('folder/', $prefixList[0]->getPrefix());
|
||||||
|
$this->assertEquals('sub++/', $prefixList[1]->getPrefix());
|
||||||
|
$this->assertEquals('test/', $prefixList[2]->getPrefix());
|
||||||
|
$this->assertEquals('work/', $prefixList[3]->getPrefix());
|
||||||
|
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testListObjectsWithPrefix()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* List the files in your bucket.
|
||||||
|
*/
|
||||||
|
$prefix = 'folder/';
|
||||||
|
$delimiter = '';
|
||||||
|
$next_marker = '';
|
||||||
|
$maxkeys = 1000;
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => $delimiter,
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'max-keys' => $maxkeys,
|
||||||
|
'marker' => $next_marker,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$listObjectInfo = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
$objectList = $listObjectInfo->getObjectList();
|
||||||
|
$prefixList = $listObjectInfo->getPrefixList();
|
||||||
|
$this->assertNotNull($objectList);
|
||||||
|
$this->assertNotNull($prefixList);
|
||||||
|
$this->assertTrue(is_array($objectList));
|
||||||
|
$this->assertTrue(is_array($prefixList));
|
||||||
|
$this->assertEquals(12, count($objectList));
|
||||||
|
$this->assertEquals(0, count($prefixList));
|
||||||
|
|
||||||
|
$this->assertEquals('folder/00', $objectList[0]->getKey());
|
||||||
|
$this->assertEquals('folder/01', $objectList[1]->getKey());
|
||||||
|
$this->assertEquals('folder/11', $objectList[11]->getKey());
|
||||||
|
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testListObjectsWithMaxKeysAndMarker()
|
||||||
|
{
|
||||||
|
$count = 0;
|
||||||
|
$nextMarker = '';
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => '',
|
||||||
|
'marker' => $nextMarker,
|
||||||
|
'max-keys' => 2,
|
||||||
|
);
|
||||||
|
$listObjectInfo = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
$nextMarker = $listObjectInfo->getNextMarker();
|
||||||
|
$listObject = $listObjectInfo->getObjectList();
|
||||||
|
$count += count($listObject);
|
||||||
|
$this->assertEquals(2, count($listObject));
|
||||||
|
if ($listObjectInfo->getIsTruncated() !== "true") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->assertEquals(12 + 8 + 5 + 3 + 2, $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testListObjectsWithMarker()
|
||||||
|
{
|
||||||
|
$count = 0;
|
||||||
|
$nextMarker = 'h';
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => '',
|
||||||
|
'marker' => $nextMarker,
|
||||||
|
'max-keys' => 1,
|
||||||
|
);
|
||||||
|
$listObjectInfo = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
$nextMarker = $listObjectInfo->getNextMarker();
|
||||||
|
$listObject = $listObjectInfo->getObjectList();
|
||||||
|
$count += count($listObject);
|
||||||
|
$this->assertEquals(1, count($listObject));
|
||||||
|
if ($listObjectInfo->getIsTruncated() !== "true") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->assertEquals(8 + 5 + 3, $count);
|
||||||
|
|
||||||
|
|
||||||
|
$nextMarker = 'h';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => '',
|
||||||
|
'marker' => $nextMarker,
|
||||||
|
'max-keys' => 5,
|
||||||
|
);
|
||||||
|
$listObjectInfo = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
$nextMarker = $listObjectInfo->getNextMarker();
|
||||||
|
$listObject = $listObjectInfo->getObjectList();
|
||||||
|
$this->assertEquals('test/01', $nextMarker);
|
||||||
|
$this->assertEquals(5, count($listObject));
|
||||||
|
$this->assertEquals("true", $listObjectInfo->getIsTruncated());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
//folder
|
||||||
|
for ($i = 0; $i < 12; $i++) {
|
||||||
|
$key = 'folder/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//test
|
||||||
|
for ($i = 0; $i < 8; $i++) {
|
||||||
|
$key = 'test/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//work
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$key = 'work/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//sub++
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
$key = 'sub++/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
|
||||||
|
//file++
|
||||||
|
for ($i = 0; $i < 2; $i++) {
|
||||||
|
$key = 'file++'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
}
|
|
@ -108,6 +108,54 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
$this->assertEquals($this->ossClient->getObject($this->bucket, $copiedObject), file_get_contents(__FILE__));
|
$this->assertEquals($this->ossClient->getObject($this->bucket, $copiedObject), file_get_contents(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCopyPartWithRange()
|
||||||
|
{
|
||||||
|
$object = "mpu/multipart-test.txt";
|
||||||
|
$copiedObject = "mpu/multipart-test.txt.range.copied";
|
||||||
|
$this->ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__));
|
||||||
|
/**
|
||||||
|
* step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* step 2. uploadPartCopy
|
||||||
|
*/
|
||||||
|
$copyId = 1;
|
||||||
|
$options = array(
|
||||||
|
'start' => 0,
|
||||||
|
'end' => 3,
|
||||||
|
);
|
||||||
|
$eTag = $this->ossClient->uploadPartCopy($this->bucket, $copiedObject, $this->bucket, $object, $copyId, $upload_id, $options);
|
||||||
|
$upload_parts[] = array(
|
||||||
|
'PartNumber' => $copyId,
|
||||||
|
'ETag' => $eTag,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id);
|
||||||
|
$this->assertNotNull($listPartsInfo);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* step 3.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($this->ossClient->getObject($this->bucket, $copiedObject), file_get_contents(__FILE__));
|
||||||
|
$this->assertEquals($this->ossClient->getObject($this->bucket, $object), '<?ph');
|
||||||
|
}
|
||||||
|
|
||||||
public function testAbortMultipartUpload()
|
public function testAbortMultipartUpload()
|
||||||
{
|
{
|
||||||
$object = "mpu/multipart-test.txt";
|
$object = "mpu/multipart-test.txt";
|
||||||
|
@ -159,7 +207,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id);
|
$listPartsInfo = $this->ossClient->listParts($this->bucket, $object, $upload_id, array('max-parts' => 100));
|
||||||
$this->assertNotNull($listPartsInfo);
|
$this->assertNotNull($listPartsInfo);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
|
@ -184,7 +232,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
|
|
||||||
$numOfMultipartUpload2 = 0;
|
$numOfMultipartUpload2 = 0;
|
||||||
try {
|
try {
|
||||||
$listMultipartUploadInfo = $listMultipartUploadInfo = $this->ossClient->listMultipartUploads($this->bucket, $options);
|
$listMultipartUploadInfo = $listMultipartUploadInfo = $this->ossClient->listMultipartUploads($this->bucket, array('max-uploads' => 1000));
|
||||||
$this->assertNotNull($listMultipartUploadInfo);
|
$this->assertNotNull($listMultipartUploadInfo);
|
||||||
$numOfMultipartUpload2 = count($listMultipartUploadInfo->getUploads());
|
$numOfMultipartUpload2 = count($listMultipartUploadInfo->getUploads());
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
@ -300,6 +348,52 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPutObjectByMultipartUploadWithOSS_LENGTH()
|
||||||
|
{
|
||||||
|
$object = "mpu/multipart-test-length.txt";
|
||||||
|
$file = __FILE__;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object);
|
||||||
|
$options = array(OssClient::OSS_LENGTH => 4, OssClient::OSS_UPLOAD_ID => $upload_id);
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
||||||
|
$this->assertEquals($this->ossClient->getObject($this->bucket, $object), '<?ph');
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPutObjectByMultipartUploadWithOSS_CONTENT_LENGTH()
|
||||||
|
{
|
||||||
|
$object = "mpu/multipart-test-content-length.txt";
|
||||||
|
$file = __FILE__;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object);
|
||||||
|
$options = array(OssClient::OSS_CONTENT_LENGTH => 4, OssClient::OSS_UPLOAD_ID => $upload_id);
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
||||||
|
$this->assertEquals($this->ossClient->getObject($this->bucket, $object), '<?ph');
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPutObjectByMultipartUploadWithException()
|
||||||
|
{
|
||||||
|
$object = "mpu/multipart-test-exception.txt";
|
||||||
|
$file = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "parameter invalid, file is empty") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testListMultipartUploads()
|
public function testListMultipartUploads()
|
||||||
{
|
{
|
||||||
$options = null;
|
$options = null;
|
||||||
|
@ -310,4 +404,20 @@ class OssClientMultipartUploadTest extends TestOssClientBase
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCompleteMultipartUploadWithException()
|
||||||
|
{
|
||||||
|
$object = "mpu/multipart-test-complete.txt";
|
||||||
|
$uploadId = "uploadId";
|
||||||
|
try {
|
||||||
|
$listMultipartUploadInfo = $this->ossClient->completeMultipartUpload($this->bucket, $object, $uploadId, null);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "listParts must be array type") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
471
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectRequestPaymentTest.php
vendored
Normal file
471
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectRequestPaymentTest.php
vendored
Normal file
|
@ -0,0 +1,471 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\OssClient;
|
||||||
|
use OSS\Model\RestoreConfig;
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
use OSS\Model\Tag;
|
||||||
|
use OSS\Core\OssUtil;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientObjectRequestPaymentTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
private $payerClient;
|
||||||
|
|
||||||
|
public function testPayerClientWithoutRequester()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->payerClient->listObjects($this->bucket);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->createObjectDir($this->bucket, 'folder/');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->putObject($this->bucket, 'object', 'content');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->putSymlink($this->bucket, 'symlink', 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getSymlink($this->bucket, 'default-symlink');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->uploadFile($this->bucket, 'file-object', __FILE__);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->appendObject($this->bucket, 'append-object', 'content', 0);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->appendObject($this->bucket, 'append-file', __FILE__, 0);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->copyObject($this->bucket, 'default-object', $this->bucket, 'copy-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObjectMeta($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getSimplifiedObjectMeta($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->deleteObject($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObject($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->doesObjectExist($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->restoreObject($this->bucket, 'default-ia-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->addTag(new Tag("key1", "value1"));
|
||||||
|
$this->payerClient->putObjectTagging($this->bucket, 'default-object', $config);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObjectTagging($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->deleteObjectTagging($this->bucket, 'default-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->initiateMultipartUpload($this->bucket, 'mup-object');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
$uploadId= $this->ossClient->initiateMultipartUpload($this->bucket, 'mup-object');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->listParts($this->bucket, 'mup-object', $uploadId);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->abortMultipartUpload($this->bucket, 'mup-object', $uploadId);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->listMultipartUploads($this->bucket);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->multiuploadFile($this->bucket, 'mup-file', __FILE__);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('AccessDenied', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectOperationsWithRequester()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => 'requester',
|
||||||
|
));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->listObjects($this->bucket, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->createObjectDir($this->bucket, 'folder/', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->putObject($this->bucket, 'object', 'content', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->putSymlink($this->bucket, 'symlink', 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getSymlink($this->bucket, 'default-symlink', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->uploadFile($this->bucket, 'file-object', __FILE__, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->appendObject($this->bucket, 'append-object', 'content', 0, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->appendObject($this->bucket, 'append-file', __FILE__, 0, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->copyObject($this->bucket, 'default-object', $this->bucket, 'copy-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObjectMeta($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getSimplifiedObjectMeta($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObject($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->putObject($this->bucket, 'test-object', 'content', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->deleteObject($this->bucket, 'test-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->doesObjectExist($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ia_options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
'x-oss-storage-class' => 'Archive',
|
||||||
|
));
|
||||||
|
$this->ossClient->putObject($this->bucket, 'default-Archive-object', 'content', $ia_options);
|
||||||
|
try {
|
||||||
|
$this->payerClient->restoreObject($this->bucket, 'default-Archive-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->addTag(new Tag("key1", "value1"));
|
||||||
|
$this->payerClient->putObjectTagging($this->bucket, 'default-object', $config, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->getObjectTagging($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->payerClient->deleteObjectTagging($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMultipartOperationsWithRequester()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => 'requester',
|
||||||
|
));
|
||||||
|
|
||||||
|
$object = "mpu/multipart-test.txt";
|
||||||
|
/**
|
||||||
|
* step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$upload_id = $this->payerClient->initiateMultipartUpload($this->bucket, $object, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* step 2. 上传分片
|
||||||
|
*/
|
||||||
|
$part_size = 1 * 1024 * 1024;
|
||||||
|
$upload_file = __FILE__;
|
||||||
|
$upload_filesize = filesize($upload_file);
|
||||||
|
$pieces = $this->payerClient->generateMultiuploadParts($upload_filesize, $part_size);
|
||||||
|
$response_upload_part = array();
|
||||||
|
$upload_position = 0;
|
||||||
|
$is_check_md5 = false;
|
||||||
|
foreach ($pieces as $i => $piece) {
|
||||||
|
$from_pos = $upload_position + (integer)$piece[OssClient::OSS_SEEK_TO];
|
||||||
|
$to_pos = (integer)$piece[OssClient::OSS_LENGTH] + $from_pos - 1;
|
||||||
|
$up_options = array(
|
||||||
|
OssClient::OSS_FILE_UPLOAD => $upload_file,
|
||||||
|
OssClient::OSS_PART_NUM => ($i + 1),
|
||||||
|
OssClient::OSS_SEEK_TO => $from_pos,
|
||||||
|
OssClient::OSS_LENGTH => $to_pos - $from_pos + 1,
|
||||||
|
OssClient::OSS_CHECK_MD5 => $is_check_md5,
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => 'requester',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
//2. 将每一分片上传到OSS
|
||||||
|
try {
|
||||||
|
$response_upload_part[] = $this->ossClient->uploadPart($this->bucket, $object, $upload_id, $up_options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$upload_parts = array();
|
||||||
|
foreach ($response_upload_part as $i => $eTag) {
|
||||||
|
$upload_parts[] = array(
|
||||||
|
'PartNumber' => ($i + 1),
|
||||||
|
'ETag' => $eTag,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$listPartsInfo = $this->payerClient->listParts($this->bucket, $object, $upload_id, $options);
|
||||||
|
$this->assertNotNull($listPartsInfo);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$uploads = $this->payerClient->listMultipartUploads($this->bucket, $options);
|
||||||
|
$this->assertNotNull($uploads);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* step 3.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$this->payerClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMiscOperationsWithRequester()
|
||||||
|
{
|
||||||
|
//use multipart
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_PART_SIZE => 1,
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => 'requester',
|
||||||
|
));
|
||||||
|
|
||||||
|
$bigFileName = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile.tmp";
|
||||||
|
OssUtil::generateFile($bigFileName, 256 * 1024);
|
||||||
|
$object = 'mpu/multipart-bigfile-test.tmp';
|
||||||
|
try {
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//use uploadfile
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_PART_SIZE => 1024*1024,
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_REQUEST_PAYER => 'requester',
|
||||||
|
));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink($bigFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->payerClient = new OssClient(
|
||||||
|
getenv('OSS_PAYER_ACCESS_KEY_ID'),
|
||||||
|
getenv('OSS_PAYER_ACCESS_KEY_SECRET'),
|
||||||
|
getenv('OSS_ENDPOINT'), false);
|
||||||
|
|
||||||
|
$policy = '{"Version":"1","Statement":[{"Action":["oss:*"],"Effect": "Allow",'.
|
||||||
|
'"Principal":["' . getenv('OSS_PAYER_UID') . '"],'.
|
||||||
|
'"Resource": ["acs:oss:*:*:' . $this->bucket . '","acs:oss:*:*:' . $this->bucket . '/*"]}]}';
|
||||||
|
|
||||||
|
$this->ossClient->putBucketPolicy($this->bucket, $policy);
|
||||||
|
$this->ossClient->putBucketRequestPayment($this->bucket, 'Requester');
|
||||||
|
$this->ossClient->putObject($this->bucket, "default-object", "");
|
||||||
|
$this->ossClient->putSymlink($this->bucket, "default-symlink", "default-object");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
}
|
160
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTaggingTest.php
vendored
Normal file
160
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTaggingTest.php
vendored
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\OssClient;
|
||||||
|
use OSS\Core\OssUtil;
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
use OSS\Model\Tag;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientObjectTaggingTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testObjectTagging()
|
||||||
|
{
|
||||||
|
$object = "object-tagging.txt";
|
||||||
|
$content = "hello world";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(0, count($config->getTags()));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->addTag(new Tag("key1", "value1"));
|
||||||
|
$config->addTag(new Tag("key2", "value2"));
|
||||||
|
$config->addTag(new Tag("key3", "value3"));
|
||||||
|
$this->ossClient->putObjectTagging($this->bucket, $object, $config);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$config2 = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(3, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key1", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $config2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[1]->getValue());
|
||||||
|
$this->assertEquals("key3", $config2->getTags()[2]->getKey());
|
||||||
|
$this->assertEquals("value3", $config2->getTags()[2]->getValue());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->ossClient->deleteObjectTagging($this->bucket, $object);
|
||||||
|
$config2 = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(0, count($config2->getTags()));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPutObjectTaggingFromHeader()
|
||||||
|
{
|
||||||
|
$object = "object-tagging-header.txt";
|
||||||
|
$content = "hello world";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
'x-oss-tagging' => 'key1=value1&key2=value2&key3=value3',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$config2 = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(3, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key1", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $config2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[1]->getValue());
|
||||||
|
$this->assertEquals("key3", $config2->getTags()[2]->getKey());
|
||||||
|
$this->assertEquals("value3", $config2->getTags()[2]->getValue());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAppendObjectTaggingFromHeader()
|
||||||
|
{
|
||||||
|
$object = "append-object-tagging-header.txt";
|
||||||
|
$content_array = array('Hello OSS', 'Hi OSS', 'OSS OK');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
'x-oss-tagging' => 'key1=value1&key2=value2&key3=value3',
|
||||||
|
));
|
||||||
|
|
||||||
|
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[0], 0, $options);
|
||||||
|
$this->assertEquals($position, strlen($content_array[0]));
|
||||||
|
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[1], $position);
|
||||||
|
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]));
|
||||||
|
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[2], $position, array(OssClient::OSS_LENGTH => strlen($content_array[2])));
|
||||||
|
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]) + strlen($content_array[2]));
|
||||||
|
|
||||||
|
$config2 = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(3, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key1", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $config2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[1]->getValue());
|
||||||
|
$this->assertEquals("key3", $config2->getTags()[2]->getKey());
|
||||||
|
$this->assertEquals("value3", $config2->getTags()[2]->getValue());
|
||||||
|
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMultipartUploadTaggingFromHeader()
|
||||||
|
{
|
||||||
|
$file = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile.tmp";
|
||||||
|
OssUtil::generateFile($file, 110 * 1024);
|
||||||
|
|
||||||
|
$object = "mpu-object-tagging-header.txt";
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_CHECK_MD5 => true,
|
||||||
|
OssClient::OSS_PART_SIZE => 1,
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
'x-oss-tagging' => 'key1=value1&key2=value2&key3=value3',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
|
||||||
|
|
||||||
|
$config2 = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$this->assertEquals(3, count($config2->getTags()));
|
||||||
|
$this->assertEquals("key1", $config2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $config2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals("key2", $config2->getTags()[1]->getKey());
|
||||||
|
$this->assertEquals("value2", $config2->getTags()[1]->getValue());
|
||||||
|
$this->assertEquals("key3", $config2->getTags()[2]->getKey());
|
||||||
|
$this->assertEquals("value3", $config2->getTags()[2]->getValue());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -88,7 +88,6 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT',
|
'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT',
|
||||||
'Cache-Control' => 'no-cache',
|
'Cache-Control' => 'no-cache',
|
||||||
'Content-Disposition' => 'attachment;filename=oss_download.log',
|
'Content-Disposition' => 'attachment;filename=oss_download.log',
|
||||||
'Content-Encoding' => 'utf-8',
|
|
||||||
'Content-Language' => 'zh-CN',
|
'Content-Language' => 'zh-CN',
|
||||||
'x-oss-server-side-encryption' => 'AES256',
|
'x-oss-server-side-encryption' => 'AES256',
|
||||||
'x-oss-meta-self-define-title' => 'user define meta info',
|
'x-oss-meta-self-define-title' => 'user define meta info',
|
||||||
|
@ -328,12 +327,18 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object2));
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object2));
|
||||||
|
|
||||||
$result = $this->ossClient->deleteObjects($this->bucket, $list);
|
$result = $this->ossClient->deleteObjects($this->bucket, $list);
|
||||||
$this->assertEquals($list[1], $result[0]);
|
$this->assertEquals($list[0], $result[0]);
|
||||||
$this->assertEquals($list[0], $result[1]);
|
$this->assertEquals($list[1], $result[1]);
|
||||||
|
|
||||||
$result = $this->ossClient->deleteObjects($this->bucket, $list, array('quiet' => 'true'));
|
$result = $this->ossClient->deleteObjects($this->bucket, $list, array('quiet' => 'true'));
|
||||||
$this->assertEquals(array(), $result);
|
$this->assertEquals(array(), $result);
|
||||||
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object2));
|
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object2));
|
||||||
|
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content);
|
||||||
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
|
$result = $this->ossClient->deleteObjects($this->bucket, $list, array('quiet' => true));
|
||||||
|
$this->assertEquals(array(), $result);
|
||||||
|
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -352,8 +357,8 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
$this->assertEquals($position, strlen($content_array[0]));
|
$this->assertEquals($position, strlen($content_array[0]));
|
||||||
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[1], $position);
|
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[1], $position);
|
||||||
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]));
|
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]));
|
||||||
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[2], $position);
|
$position = $this->ossClient->appendObject($this->bucket, $object, $content_array[2], $position, array(OssClient::OSS_LENGTH => strlen($content_array[2])));
|
||||||
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]) + strlen($content_array[1]));
|
$this->assertEquals($position, strlen($content_array[0]) + strlen($content_array[1]) + strlen($content_array[2]));
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
@ -378,6 +383,16 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the upload of invalid local files
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$position = $this->ossClient->appendFile($this->bucket, $object, "invalid-file-path", 0);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the upload of local files
|
* Append the upload of local files
|
||||||
*/
|
*/
|
||||||
|
@ -590,6 +605,65 @@ class OssClientObjectTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetSimplifiedObjectMeta()
|
||||||
|
{
|
||||||
|
$object = "oss-php-sdk-test/upload-test-object-name.txt";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$objectMeta = $this->ossClient->getSimplifiedObjectMeta($this->bucket, $object);
|
||||||
|
$this->assertEquals(false, array_key_exists(strtolower('Content-Disposition'), $objectMeta));
|
||||||
|
$this->assertEquals(strlen(file_get_contents(__FILE__)), $objectMeta[strtolower('Content-Length')]);
|
||||||
|
$this->assertEquals(true, array_key_exists(strtolower('ETag'), $objectMeta));
|
||||||
|
$this->assertEquals(true, array_key_exists(strtolower('Last-Modified'), $objectMeta));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUploadStream()
|
||||||
|
{
|
||||||
|
$object = "oss-php-sdk-test/put-from-stream.txt";
|
||||||
|
$options = array(OssClient::OSS_CHECK_MD5 => true);
|
||||||
|
$handle = fopen(__FILE__, 'rb');
|
||||||
|
/**
|
||||||
|
* Upload data to start MD5
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$this->ossClient->uploadStream($this->bucket, $object, $handle, $options);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the replication is the same
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$this->assertEquals($content, file_get_contents(__FILE__));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = "oss-php-sdk-test/put-from-stream-without-md5.txt";
|
||||||
|
$handle = fopen(__FILE__, 'rb');
|
||||||
|
try {
|
||||||
|
$this->ossClient->uploadStream($this->bucket, $object, $handle);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the replication is the same
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
$content = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$this->assertEquals($content, file_get_contents(__FILE__));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
610
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectVersioningTest.php
vendored
Normal file
610
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectVersioningTest.php
vendored
Normal file
|
@ -0,0 +1,610 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\OssClient;
|
||||||
|
use OSS\Model\TaggingConfig;
|
||||||
|
use OSS\Model\Tag;
|
||||||
|
use OSS\Model\DeleteObjectInfo;
|
||||||
|
use OSS\Core\OssUtil;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssClientObjectVersioningTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
public function testObjectBasic()
|
||||||
|
{
|
||||||
|
$object = 'object';
|
||||||
|
$content1 = 'hello';
|
||||||
|
$content2 = 'hello world';
|
||||||
|
$ret1 = $this->ossClient->putObject($this->bucket, $object, $content1, array(OssClient::OSS_HEADERS => array('x-oss-object-acl' => 'public-read', 'x-oss-tagging' => 'key1=value1')));
|
||||||
|
$ret2 = $this->ossClient->putObject($this->bucket, $object, $content2, array(OssClient::OSS_HEADERS => array('x-oss-object-acl' => 'private', 'x-oss-tagging' => 'key2=value2')));
|
||||||
|
|
||||||
|
$this->assertTrue(isset($ret1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($ret2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
|
||||||
|
$versionId1 = $ret1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$versionId2 = $ret2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
//get object
|
||||||
|
$res = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$res1 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$res2 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
$this->assertEquals($content1, $res1);
|
||||||
|
$this->assertEquals($content2, $res2);
|
||||||
|
$this->assertEquals($content2, $res);
|
||||||
|
|
||||||
|
//meta
|
||||||
|
$headers = $this->ossClient->getObjectMeta($this->bucket, $object);
|
||||||
|
$headers1 = $this->ossClient->getObjectMeta($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$headers2 = $this->ossClient->getObjectMeta($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
|
||||||
|
$this->assertTrue(isset($headers[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($headers1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($headers2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertEquals($versionId1, $headers1[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
$this->assertEquals($versionId2, $headers2[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
$this->assertEquals($versionId2, $headers[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
|
||||||
|
|
||||||
|
$sheaders = $this->ossClient->getSimplifiedObjectMeta($this->bucket, $object);
|
||||||
|
$sheaders1 = $this->ossClient->getSimplifiedObjectMeta($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$sheaders2 = $this->ossClient->getSimplifiedObjectMeta($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
|
||||||
|
$this->assertTrue(isset($sheaders[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($sheaders1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($sheaders2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertEquals($versionId1, $sheaders1[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
$this->assertEquals($versionId2, $sheaders2[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
$this->assertEquals($versionId2, $sheaders[OssClient::OSS_HEADER_VERSION_ID]);
|
||||||
|
|
||||||
|
//acl
|
||||||
|
$acl = $this->ossClient->getObjectAcl($this->bucket, $object);
|
||||||
|
$acl1 = $this->ossClient->getObjectAcl($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$acl2 = $this->ossClient->getObjectAcl($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
|
||||||
|
$this->assertEquals('public-read', $acl1);
|
||||||
|
$this->assertEquals('private', $acl2);
|
||||||
|
$this->assertEquals('private', $acl);
|
||||||
|
|
||||||
|
$this->ossClient->putObjectAcl($this->bucket, $object, 'public-read-write', array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$acl = $this->ossClient->getObjectAcl($this->bucket, $object);
|
||||||
|
$acl1 = $this->ossClient->getObjectAcl($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$this->assertEquals('public-read-write', $acl1);
|
||||||
|
$this->assertEquals('private', $acl);
|
||||||
|
|
||||||
|
//tagging
|
||||||
|
$tag = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$tag1 = $this->ossClient->getObjectTagging($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$tag2 = $this->ossClient->getObjectTagging($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
$this->assertEquals(1, count($tag1->getTags()));
|
||||||
|
$this->assertEquals("key1", $tag1->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value1", $tag1->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals(1, count($tag2->getTags()));
|
||||||
|
$this->assertEquals("key2", $tag2->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value2", $tag2->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals(1, count($tag->getTags()));
|
||||||
|
$this->assertEquals("key2", $tag->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value2", $tag->getTags()[0]->getValue());
|
||||||
|
|
||||||
|
$config = new TaggingConfig();
|
||||||
|
$config->addTag(new Tag("key11", "value11"));
|
||||||
|
$this->ossClient->putObjectTagging($this->bucket, $object, $config, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$tag = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$tag1 = $this->ossClient->getObjectTagging($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$this->assertEquals(1, count($tag1->getTags()));
|
||||||
|
$this->assertEquals("key11", $tag1->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value11", $tag1->getTags()[0]->getValue());
|
||||||
|
$this->assertEquals(1, count($tag->getTags()));
|
||||||
|
$this->assertEquals("key2", $tag->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value2", $tag->getTags()[0]->getValue());
|
||||||
|
|
||||||
|
$this->ossClient->deleteObjectTagging($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$tag = $this->ossClient->getObjectTagging($this->bucket, $object);
|
||||||
|
$tag1 = $this->ossClient->getObjectTagging($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$this->assertEquals(0, count($tag1->getTags()));
|
||||||
|
$this->assertEquals(1, count($tag->getTags()));
|
||||||
|
$this->assertEquals("key2", $tag->getTags()[0]->getKey());
|
||||||
|
$this->assertEquals("value2", $tag->getTags()[0]->getValue());
|
||||||
|
|
||||||
|
//delete
|
||||||
|
$dret = $this->ossClient->deleteObject($this->bucket, $object);
|
||||||
|
$this->assertTrue(isset($dret['x-oss-delete-marker']));
|
||||||
|
$this->assertTrue(isset($dret['x-oss-version-id']));
|
||||||
|
$this->assertEquals("true", $dret['x-oss-delete-marker']);
|
||||||
|
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1)));
|
||||||
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId2)));
|
||||||
|
|
||||||
|
$dret1 = $this->ossClient->deleteObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$this->assertFalse(isset($dret1['x-oss-delete-marker']));
|
||||||
|
$this->assertTrue(isset($dret1['x-oss-version-id']));
|
||||||
|
$this->assertEquals($versionId1, $dret1['x-oss-version-id']);
|
||||||
|
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1)));
|
||||||
|
|
||||||
|
|
||||||
|
$dret_ = $this->ossClient->deleteObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $dret['x-oss-version-id']));
|
||||||
|
$this->assertTrue(isset($dret_['x-oss-delete-marker']));
|
||||||
|
$this->assertTrue(isset($dret_['x-oss-version-id']));
|
||||||
|
$this->assertEquals($dret['x-oss-version-id'], $dret_['x-oss-version-id']);
|
||||||
|
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectSymlink()
|
||||||
|
{
|
||||||
|
$object1 = 'object-target-1';
|
||||||
|
$object2 = 'object-target-2';
|
||||||
|
$symlink = 'object-symlink';
|
||||||
|
$content1 = 'hello';
|
||||||
|
$content2 = 'hello world';
|
||||||
|
|
||||||
|
|
||||||
|
$ret1 = $this->ossClient->putObject($this->bucket, $object1, $content1);
|
||||||
|
$sym1 = $this->ossClient->putSymlink($this->bucket, $symlink, $object1);
|
||||||
|
|
||||||
|
$ret2 = $this->ossClient->putObject($this->bucket, $object2, $content2);
|
||||||
|
$sym2 = $this->ossClient->putSymlink($this->bucket, $symlink, $object2);
|
||||||
|
|
||||||
|
$this->assertTrue(isset($ret1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($ret2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
|
||||||
|
$this->assertTrue(isset($sym1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($sym2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
|
||||||
|
$versionId1 = $ret1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$versionId2 = $ret2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
$sym_versionId1 = $sym1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$sym_versionId2 = $sym2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
|
||||||
|
$sym_ret = $this->ossClient->getSymlink($this->bucket, $symlink);
|
||||||
|
$sym_ret1 = $this->ossClient->getSymlink($this->bucket, $symlink, array(OssClient::OSS_VERSION_ID => $sym_versionId1));
|
||||||
|
$sym_ret2 = $this->ossClient->getSymlink($this->bucket, $symlink, array(OssClient::OSS_VERSION_ID => $sym_versionId2));
|
||||||
|
|
||||||
|
$this->assertTrue(isset($sym_ret['x-oss-version-id']));
|
||||||
|
$this->assertTrue(isset($sym_ret1['x-oss-version-id']));
|
||||||
|
$this->assertTrue(isset($sym_ret2['x-oss-version-id']));
|
||||||
|
|
||||||
|
$this->assertEquals($sym_versionId1, $sym_ret1['x-oss-version-id']);
|
||||||
|
$this->assertEquals($sym_versionId2, $sym_ret2['x-oss-version-id']);
|
||||||
|
$this->assertEquals($sym_versionId2, $sym_ret['x-oss-version-id']);
|
||||||
|
|
||||||
|
|
||||||
|
$res = $this->ossClient->getObject($this->bucket, $symlink);
|
||||||
|
$res1 = $this->ossClient->getObject($this->bucket, $symlink, array(OssClient::OSS_VERSION_ID => $sym_versionId1));
|
||||||
|
$res2 = $this->ossClient->getObject($this->bucket, $symlink, array(OssClient::OSS_VERSION_ID => $sym_versionId2));
|
||||||
|
$this->assertEquals($content1, $res1);
|
||||||
|
$this->assertEquals($content2, $res2);
|
||||||
|
$this->assertEquals($content2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectCopy()
|
||||||
|
{
|
||||||
|
$object = 'copy-= +object';
|
||||||
|
$content1 = 'hello';
|
||||||
|
$content2 = 'hello world';
|
||||||
|
$to_bucket = $this->bucket;
|
||||||
|
$to_object = $object . '.copy';
|
||||||
|
$to_object1 = $object . '.copy1';
|
||||||
|
$to_object2 = $object . '.copy2';
|
||||||
|
|
||||||
|
$ret1 = $this->ossClient->putObject($this->bucket, $object, $content1);
|
||||||
|
$ret2 = $this->ossClient->putObject($this->bucket, $object, $content2);
|
||||||
|
|
||||||
|
$versionId1 = $ret1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$versionId2 = $ret2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
$cret = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object);
|
||||||
|
$cret1 = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object1, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$cret2 = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object2, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
$this->assertFalse(empty($cret1));
|
||||||
|
$this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($cret1[0]));
|
||||||
|
$this->assertEquals(trim($ret1['etag'], '"'), trim($cret1[1], '"'));
|
||||||
|
$this->assertTrue(isset($cret1['x-oss-version-id']));
|
||||||
|
$this->assertEquals($versionId1, $cret1['x-oss-copy-source-version-id']);
|
||||||
|
|
||||||
|
$this->assertFalse(empty($cret2));
|
||||||
|
$this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($cret2[0]));
|
||||||
|
$this->assertEquals(trim($ret2['etag'], '"'), trim($cret2[1], '"'));
|
||||||
|
$this->assertTrue(isset($cret2['x-oss-version-id']));
|
||||||
|
$this->assertEquals($versionId2, $cret2['x-oss-copy-source-version-id']);
|
||||||
|
|
||||||
|
$this->assertFalse(empty($cret));
|
||||||
|
$this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($cret[0]));
|
||||||
|
$this->assertEquals(trim($ret2['etag'], '"'), trim($cret[1], '"'));
|
||||||
|
$this->assertTrue(isset($cret2['x-oss-version-id']));
|
||||||
|
$this->assertEquals($versionId2, $cret['x-oss-copy-source-version-id']);
|
||||||
|
|
||||||
|
$res = $this->ossClient->getObject($this->bucket, $to_object);
|
||||||
|
$res1 = $this->ossClient->getObject($this->bucket, $to_object1);
|
||||||
|
$res2 = $this->ossClient->getObject($this->bucket, $to_object2);
|
||||||
|
$this->assertEquals($content1, $res1);
|
||||||
|
$this->assertEquals($content2, $res2);
|
||||||
|
$this->assertEquals($content2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectRestore()
|
||||||
|
{
|
||||||
|
$object = 'retore-object';
|
||||||
|
$content1 = 'hello';
|
||||||
|
$content2 = 'hello world';
|
||||||
|
$ret1 = $this->ossClient->putObject($this->bucket, $object, $content1, array(OssClient::OSS_HEADERS => array('x-oss-storage-class' => 'Archive')));
|
||||||
|
$ret2 = $this->ossClient->putObject($this->bucket, $object, $content2);
|
||||||
|
|
||||||
|
$versionId1 = $ret1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$versionId2 = $ret2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
try{
|
||||||
|
$this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}catch (OssException $e){
|
||||||
|
$this->assertEquals('403', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('InvalidObjectState', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$this->ossClient->restoreObject($this->bucket, $object);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertEquals('400', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('OperationNotSupported', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->ossClient->restoreObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
common::waitMetaSync();
|
||||||
|
$this->assertEquals('202', $result['info']['http_code']);
|
||||||
|
|
||||||
|
try{
|
||||||
|
$this->ossClient->restoreObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertEquals('409', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('RestoreAlreadyInProgress', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectMultiPart()
|
||||||
|
{
|
||||||
|
$object_src = 'multi-= +object.src';
|
||||||
|
$content1 = 'hello';
|
||||||
|
$content2 = 'hello world';
|
||||||
|
$ret1 = $this->ossClient->putObject($this->bucket, $object_src, $content1);
|
||||||
|
$ret2 = $this->ossClient->putObject($this->bucket, $object_src, $content2);
|
||||||
|
|
||||||
|
$this->assertTrue(isset($ret1[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
$this->assertTrue(isset($ret2[OssClient::OSS_HEADER_VERSION_ID]));
|
||||||
|
|
||||||
|
$versionId1 = $ret1[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
$versionId2 = $ret2[OssClient::OSS_HEADER_VERSION_ID];
|
||||||
|
|
||||||
|
//object
|
||||||
|
$object = "multi-object";
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object);
|
||||||
|
$copyId = 1;
|
||||||
|
$eTag = $this->ossClient->uploadPartCopy($this->bucket, $object_src, $this->bucket, $object, $copyId, $upload_id);
|
||||||
|
$upload_parts[] = array(
|
||||||
|
'PartNumber' => $copyId,
|
||||||
|
'ETag' => $eTag,
|
||||||
|
);
|
||||||
|
$ret = $this->ossClient->completeMultipartUpload($this->bucket, $object, $upload_id, $upload_parts);
|
||||||
|
|
||||||
|
//object-1
|
||||||
|
$object1 = "multi-object-1";
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object1);
|
||||||
|
$copyId = 1;
|
||||||
|
$eTag = $this->ossClient->uploadPartCopy($this->bucket, $object_src, $this->bucket, $object1, $copyId, $upload_id, array(OssClient::OSS_VERSION_ID => $versionId1));
|
||||||
|
$upload_parts1[] = array(
|
||||||
|
'PartNumber' => $copyId,
|
||||||
|
'ETag' => $eTag,
|
||||||
|
);
|
||||||
|
$ret1 = $this->ossClient->completeMultipartUpload($this->bucket, $object1, $upload_id, $upload_parts1);
|
||||||
|
|
||||||
|
//object-2
|
||||||
|
$object2 = "multi-object-2";
|
||||||
|
$upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object2);
|
||||||
|
$copyId = 1;
|
||||||
|
$eTag = $this->ossClient->uploadPartCopy($this->bucket, $object_src, $this->bucket, $object2, $copyId, $upload_id, array(OssClient::OSS_VERSION_ID => $versionId2));
|
||||||
|
$upload_parts2[] = array(
|
||||||
|
'PartNumber' => $copyId,
|
||||||
|
'ETag' => $eTag,
|
||||||
|
);
|
||||||
|
$ret2 = $this->ossClient->completeMultipartUpload($this->bucket, $object2, $upload_id, $upload_parts2);
|
||||||
|
|
||||||
|
$res = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$res1 = $this->ossClient->getObject($this->bucket, $object1);
|
||||||
|
$res2 = $this->ossClient->getObject($this->bucket, $object2);
|
||||||
|
|
||||||
|
$this->assertEquals($content1, $res1);
|
||||||
|
$this->assertEquals($content2, $res2);
|
||||||
|
$this->assertEquals($content2, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testObjectMisc()
|
||||||
|
{
|
||||||
|
//use multipart
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_PART_SIZE => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
$object = 'misc-object';
|
||||||
|
|
||||||
|
$smallFile1 = __DIR__ . DIRECTORY_SEPARATOR . "/smallfile1.tmp";
|
||||||
|
$smallFile2 = __DIR__ . DIRECTORY_SEPARATOR . "/smallfile2.tmp";
|
||||||
|
$bigFile1 = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile1.tmp";
|
||||||
|
$bigFile2 = __DIR__ . DIRECTORY_SEPARATOR . "/bigfile2.tmp";
|
||||||
|
|
||||||
|
OssUtil::generateFile($smallFile1, 5);
|
||||||
|
OssUtil::generateFile($smallFile2, 10);
|
||||||
|
OssUtil::generateFile($bigFile1, 128 * 1024);
|
||||||
|
OssUtil::generateFile($bigFile2, 256 * 1024);
|
||||||
|
|
||||||
|
$sret1 = $this->ossClient->multiuploadFile($this->bucket, $object, $smallFile1, $options);
|
||||||
|
$sret2 = $this->ossClient->multiuploadFile($this->bucket, $object, $smallFile2, $options);
|
||||||
|
$bret1 = $this->ossClient->multiuploadFile($this->bucket, $object, $bigFile1, $options);
|
||||||
|
$bret2 = $this->ossClient->multiuploadFile($this->bucket, $object, $bigFile2, $options);
|
||||||
|
|
||||||
|
|
||||||
|
$res = $this->ossClient->getObject($this->bucket, $object);
|
||||||
|
$sres1 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $sret1['x-oss-version-id']));
|
||||||
|
$sres2 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $sret2['x-oss-version-id']));
|
||||||
|
$bres1 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $bret1['x-oss-version-id']));
|
||||||
|
$bres2 = $this->ossClient->getObject($this->bucket, $object, array(OssClient::OSS_VERSION_ID => $bret2['x-oss-version-id']));
|
||||||
|
|
||||||
|
|
||||||
|
$this->assertEquals(file_get_contents($smallFile1), $sres1);
|
||||||
|
$this->assertEquals(file_get_contents($smallFile2), $sres2);
|
||||||
|
$this->assertEquals(file_get_contents($bigFile1), $bres1);
|
||||||
|
$this->assertEquals(file_get_contents($bigFile2), $bres2);
|
||||||
|
$this->assertEquals(file_get_contents($bigFile2), $res);
|
||||||
|
|
||||||
|
|
||||||
|
unlink($smallFile1);
|
||||||
|
unlink($smallFile2);
|
||||||
|
unlink($bigFile1);
|
||||||
|
unlink($bigFile2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testListObjects()
|
||||||
|
{
|
||||||
|
//folder
|
||||||
|
for ($i = 0; $i < 12; $i++) {
|
||||||
|
$key = 'folder/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
//test
|
||||||
|
for ($i = 0; $i < 8; $i++) {
|
||||||
|
$key = 'test/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $key);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//work
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$key = 'work/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//sub++
|
||||||
|
for ($i = 0; $i < 3; $i++) {
|
||||||
|
$key = 'sub++/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
//file++
|
||||||
|
for ($i = 0; $i < 2; $i++) {
|
||||||
|
$key = 'file++'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
//list default
|
||||||
|
$result = $this->ossClient->listObjectVersions($this->bucket);
|
||||||
|
$versionList = $result->getObjectVersionList();
|
||||||
|
$deleteMarkerList = $result->getDeleteMarkerList();
|
||||||
|
$prefixList = $result->getPrefixList();
|
||||||
|
|
||||||
|
$this->assertNotNull($versionList);
|
||||||
|
$this->assertNotNull($deleteMarkerList);
|
||||||
|
$this->assertNotNull($prefixList);
|
||||||
|
$this->assertTrue(is_array($versionList));
|
||||||
|
$this->assertTrue(is_array($deleteMarkerList));
|
||||||
|
$this->assertTrue(is_array($prefixList));
|
||||||
|
$this->assertEquals(2, count($versionList));
|
||||||
|
$this->assertEquals(2, count($deleteMarkerList));
|
||||||
|
$this->assertEquals(4, count($prefixList));
|
||||||
|
|
||||||
|
$this->assertEquals('file++00', $versionList[0]->getKey());
|
||||||
|
$this->assertEquals('false', $versionList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('file++01', $versionList[1]->getKey());
|
||||||
|
$this->assertEquals('false', $versionList[1]->getIsLatest());
|
||||||
|
|
||||||
|
$this->assertEquals('file++00', $deleteMarkerList[0]->getKey());
|
||||||
|
$this->assertEquals('true', $deleteMarkerList[0]->getIsLatest());
|
||||||
|
$this->assertEquals('file++01', $deleteMarkerList[1]->getKey());
|
||||||
|
$this->assertEquals('true', $deleteMarkerList[1]->getIsLatest());
|
||||||
|
|
||||||
|
|
||||||
|
$this->assertEquals('folder/', $prefixList[0]->getPrefix());
|
||||||
|
$this->assertEquals('sub++/', $prefixList[1]->getPrefix());
|
||||||
|
$this->assertEquals('test/', $prefixList[2]->getPrefix());
|
||||||
|
$this->assertEquals('work/', $prefixList[3]->getPrefix());
|
||||||
|
|
||||||
|
//list by prefix
|
||||||
|
$prefix = 'folder/';
|
||||||
|
$delimiter = '';
|
||||||
|
$next_marker = '';
|
||||||
|
$maxkeys = 1000;
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => $delimiter,
|
||||||
|
'prefix' => $prefix,
|
||||||
|
'max-keys' => $maxkeys,
|
||||||
|
'key-marker' => $next_marker,
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = $this->ossClient->listObjectVersions($this->bucket, $options);
|
||||||
|
$versionList = $result->getObjectVersionList();
|
||||||
|
$deleteMarkerList = $result->getDeleteMarkerList();
|
||||||
|
$prefixList = $result->getPrefixList();
|
||||||
|
|
||||||
|
$this->assertEquals(24, count($versionList));
|
||||||
|
$this->assertEquals(12, count($deleteMarkerList));
|
||||||
|
$this->assertEquals(0, count($prefixList));
|
||||||
|
|
||||||
|
$this->assertEquals('folder/00', $versionList[0]->getKey());
|
||||||
|
$this->assertEquals('folder/00', $versionList[1]->getKey());
|
||||||
|
$this->assertEquals('folder/00', $deleteMarkerList[0]->getKey());
|
||||||
|
$this->assertEquals('folder/01', $deleteMarkerList[1]->getKey());
|
||||||
|
|
||||||
|
|
||||||
|
//max-key & key-marker & version-id-marker
|
||||||
|
$count = 0;
|
||||||
|
$markerCount = 0;
|
||||||
|
$nextMarker = '';
|
||||||
|
$nextVersionIdMarker = '';
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => '',
|
||||||
|
'key-marker' => $nextMarker,
|
||||||
|
'max-keys' => 1,
|
||||||
|
'version-id-marker' => $nextVersionIdMarker,
|
||||||
|
);
|
||||||
|
$result = $this->ossClient->listObjectVersions($this->bucket, $options);
|
||||||
|
|
||||||
|
$nextMarker = $result->getNextKeyMarker();
|
||||||
|
$nextVersionIdMarker = $result->getNextVersionIdMarker();
|
||||||
|
$count += count($result->getObjectVersionList());
|
||||||
|
$markerCount += count($result->getDeleteMarkerList());
|
||||||
|
$this->assertEquals(1, count($result->getObjectVersionList()) + count($result->getDeleteMarkerList()));
|
||||||
|
if ($result->getIsTruncated() !== "true") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->assertEquals(12*3 + 8*3 + 5 + 3*3 + 2*2, $count + $markerCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDeleteObjects()
|
||||||
|
{
|
||||||
|
//deletes
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$key = 'deletes/'. sprintf("%02d",$i);
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
$this->ossClient->putObject($this->bucket, $key, "content");
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'delimiter' => '',
|
||||||
|
'prefix' => 'deletes/',
|
||||||
|
'max-keys' => 1000,
|
||||||
|
);
|
||||||
|
$result = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
$this->assertEquals(5, count($result->getObjectList()));
|
||||||
|
|
||||||
|
//delete without version-id
|
||||||
|
$objects = array();
|
||||||
|
for ($i = 0; $i < 5; $i++) {
|
||||||
|
$key = 'deletes/'. sprintf("%02d",$i);
|
||||||
|
$objects[] = new DeleteObjectInfo($key);
|
||||||
|
}
|
||||||
|
$dresult = $this->ossClient->deleteObjectVersions($this->bucket, $objects);
|
||||||
|
$this->assertEquals(5, count($dresult));
|
||||||
|
$this->assertEquals('deletes/00', $dresult[0]->getKey());
|
||||||
|
$this->assertEquals('true', $dresult[0]->getDeleteMarker());
|
||||||
|
$this->assertEquals('', $dresult[0]->getVersionId());
|
||||||
|
$this->assertFalse(empty($dresult[0]->getDeleteMarkerVersionId()));
|
||||||
|
|
||||||
|
$result = $this->ossClient->listObjects($this->bucket, $options);
|
||||||
|
$this->assertEquals(0, count($result->getObjectList()));
|
||||||
|
|
||||||
|
//delete by version-id
|
||||||
|
$vresult = $this->ossClient->listObjectVersions($this->bucket, $options);
|
||||||
|
$versions = $vresult->getObjectVersionList();
|
||||||
|
$deleteMarkerList = $vresult->getDeleteMarkerList();
|
||||||
|
$this->assertEquals(10, count($versions));
|
||||||
|
$this->assertEquals(5, count($deleteMarkerList));
|
||||||
|
|
||||||
|
$objects = array();
|
||||||
|
foreach ($versions as $obj) {
|
||||||
|
$objects[] = new DeleteObjectInfo($obj->getKey(), $obj->getVersionId());
|
||||||
|
}
|
||||||
|
$dresult = $this->ossClient->deleteObjectVersions($this->bucket, $objects);
|
||||||
|
$this->assertEquals(10, count($dresult));
|
||||||
|
$this->assertEquals('deletes/00', $dresult[0]->getKey());
|
||||||
|
$this->assertEquals('', $dresult[0]->getDeleteMarker());
|
||||||
|
$this->assertFalse(empty($dresult[0]->getVersionId()));
|
||||||
|
$this->assertTrue(empty($dresult[0]->getDeleteMarkerVersionId()));
|
||||||
|
$this->assertEquals('deletes/00', $dresult[1]->getKey());
|
||||||
|
$this->assertEquals('', $dresult[1]->getDeleteMarker());
|
||||||
|
$this->assertFalse(empty($dresult[1]->getVersionId()));
|
||||||
|
$this->assertTrue(empty($dresult[1]->getDeleteMarkerVersionId()));
|
||||||
|
|
||||||
|
|
||||||
|
$vresult = $this->ossClient->listObjectVersions($this->bucket, $options);
|
||||||
|
$versions = $vresult->getObjectVersionList();
|
||||||
|
$deleteMarkerList = $vresult->getDeleteMarkerList();
|
||||||
|
$this->assertEquals(0, count($versions));
|
||||||
|
$this->assertEquals(5, count($deleteMarkerList));
|
||||||
|
|
||||||
|
$objects = array();
|
||||||
|
foreach ($deleteMarkerList as $obj) {
|
||||||
|
$objects[] = new DeleteObjectInfo($obj->getKey(), $obj->getVersionId());
|
||||||
|
}
|
||||||
|
$dresult = $this->ossClient->deleteObjectVersions($this->bucket, $objects);
|
||||||
|
$this->assertEquals(5, count($dresult));
|
||||||
|
$this->assertEquals('deletes/00', $dresult[0]->getKey());
|
||||||
|
$this->assertEquals('true', $dresult[0]->getDeleteMarker());
|
||||||
|
$this->assertFalse(empty($dresult[1]->getVersionId()));
|
||||||
|
$this->assertFalse(empty($dresult[1]->getDeleteMarkerVersionId()));
|
||||||
|
|
||||||
|
$vresult = $this->ossClient->listObjectVersions($this->bucket, $options);
|
||||||
|
$versions = $vresult->getObjectVersionList();
|
||||||
|
$deleteMarkerList = $vresult->getDeleteMarkerList();
|
||||||
|
$this->assertEquals(0, count($versions));
|
||||||
|
$this->assertEquals(0, count($deleteMarkerList));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->ossClient->putBucketVersioning($this->bucket, "Enabled");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
if (!$this->ossClient->doesBucketExist($this->bucket)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ossClient->putBucketVersioning($this->bucket, "Suspended");
|
||||||
|
|
||||||
|
$result = $this->ossClient->listObjectVersions(
|
||||||
|
$this->bucket, array('max-keys' => 1000, 'delimiter' => ''));
|
||||||
|
|
||||||
|
$versions = $result->getObjectVersionList();
|
||||||
|
$deleteMarkers = $result->getDeleteMarkerList();
|
||||||
|
|
||||||
|
foreach ($versions as $obj) {
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_VERSION_ID => $obj->getVersionId(),
|
||||||
|
);
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $obj->getKey(), $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($deleteMarkers as $del) {
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_VERSION_ID => $del->getVersionId(),
|
||||||
|
);
|
||||||
|
$this->ossClient->deleteObject($this->bucket, $del->getKey(), $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ namespace OSS\Tests;
|
||||||
|
|
||||||
use OSS\Core\OssException;
|
use OSS\Core\OssException;
|
||||||
use OSS\OssClient;
|
use OSS\OssClient;
|
||||||
|
use OSS\Model\RestoreConfig;
|
||||||
|
|
||||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
@ -63,6 +64,83 @@ class OssClientRestoreObjectTest extends TestOssClientBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testColdArchiveRestoreObject()
|
||||||
|
{
|
||||||
|
$client = new OssClient(
|
||||||
|
getenv('OSS_ACCESS_KEY_ID'),
|
||||||
|
getenv('OSS_ACCESS_KEY_SECRET'),
|
||||||
|
'oss-ap-southeast-1.aliyuncs.com', false);
|
||||||
|
|
||||||
|
$bucket = $this->bucket . 'cold-archive';
|
||||||
|
$object = 'storage-object';
|
||||||
|
|
||||||
|
//create bucket
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_STORAGE => OssClient::OSS_STORAGE_COLDARCHIVE
|
||||||
|
);
|
||||||
|
$client->createBucket($bucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
|
||||||
|
|
||||||
|
//test with days
|
||||||
|
$client->putObject($bucket, $object,'testcontent');
|
||||||
|
|
||||||
|
try{
|
||||||
|
$client->getObject($bucket, $object);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}catch (OssException $e){
|
||||||
|
$this->assertEquals('403', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('InvalidObjectState', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = new RestoreConfig(5);
|
||||||
|
$resoptions = array(
|
||||||
|
OssClient::OSS_RESTORE_CONFIG => $config
|
||||||
|
);
|
||||||
|
try{
|
||||||
|
$client->restoreObject($bucket, $object, $resoptions);
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$client->restoreObject($bucket, $object, $resoptions);
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertEquals('409', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('RestoreAlreadyInProgress', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
//test with days & tier
|
||||||
|
$client->putObject($bucket, $object,'testcontent');
|
||||||
|
|
||||||
|
try{
|
||||||
|
$client->getObject($bucket, $object);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}catch (OssException $e){
|
||||||
|
$this->assertEquals('403', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('InvalidObjectState', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = new RestoreConfig(5, "Expedited");
|
||||||
|
$resoptions = array(
|
||||||
|
OssClient::OSS_RESTORE_CONFIG => $config
|
||||||
|
);
|
||||||
|
try{
|
||||||
|
$client->restoreObject($bucket, $object, $resoptions);
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
$client->restoreObject($bucket, $object, $resoptions);
|
||||||
|
}catch(OssException $e){
|
||||||
|
$this->assertEquals('409', $e->getHTTPStatus());
|
||||||
|
$this->assertEquals('RestoreAlreadyInProgress', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
$client->deleteObject($bucket, $object);
|
||||||
|
$client->deleteBucket($bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
|
@ -75,6 +75,62 @@ class OssClientSignatureTest extends TestOssClientBase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSignedUrlWithException()
|
||||||
|
{
|
||||||
|
$file = __FILE__;
|
||||||
|
$object = "a.file";
|
||||||
|
$timeout = 3600;
|
||||||
|
$options = array('Content-Type' => 'txt');
|
||||||
|
try {
|
||||||
|
$signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "POST", $options);
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "method is invalid") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGetgenPreSignedUrlForGettingObject()
|
||||||
|
{
|
||||||
|
$object = "a.file";
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, file_get_contents(__FILE__));
|
||||||
|
$expires = time() + 3600;
|
||||||
|
try {
|
||||||
|
$signedUrl = $this->ossClient->generatePresignedUrl($this->bucket, $object, $expires);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = new RequestCore($signedUrl);
|
||||||
|
$request->set_method('GET');
|
||||||
|
$request->add_header('Content-Type', '');
|
||||||
|
$request->send_request();
|
||||||
|
$res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
|
||||||
|
$this->assertEquals(file_get_contents(__FILE__), $res->body);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testGetgenPreSignedUrlVsSignedUrl()
|
||||||
|
{
|
||||||
|
$object = "object-vs.file";
|
||||||
|
$signedUrl1 = '245';
|
||||||
|
$signedUrl2 = '123';
|
||||||
|
$expiration = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
usleep(500000);
|
||||||
|
$begin = time();
|
||||||
|
$expiration = time() + 3600;
|
||||||
|
$signedUrl1 = $this->ossClient->generatePresignedUrl($this->bucket, $object, $expiration);
|
||||||
|
$signedUrl2 = $this->ossClient->signUrl($this->bucket, $object, 3600);
|
||||||
|
$end = time();
|
||||||
|
} while ($begin != $end);
|
||||||
|
$this->assertEquals($signedUrl1, $signedUrl2);
|
||||||
|
$this->assertTrue(strpos($signedUrl1, 'Expires='.$expiration) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
$this->ossClient->deleteObject($this->bucket, "a.file");
|
$this->ossClient->deleteObject($this->bucket, "a.file");
|
||||||
|
|
|
@ -6,7 +6,7 @@ use OSS\Core\OssException;
|
||||||
use OSS\OssClient;
|
use OSS\OssClient;
|
||||||
|
|
||||||
|
|
||||||
class OssClientTest extends \PHPUnit_Framework_TestCase
|
class OssClientTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
public function testConstrunct()
|
public function testConstrunct()
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$ossClient = new OssClient('id', 'key', "123.123.123.1");
|
$ossClient = new OssClient('id', 'key', "123.123.123.1");
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -70,6 +71,15 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
try {
|
try {
|
||||||
$ossClient = new OssClient('id', 'key', "https://123.123.123.1");
|
$ossClient = new OssClient('id', 'key', "https://123.123.123.1");
|
||||||
$this->assertTrue($ossClient->isUseSSL());
|
$this->assertTrue($ossClient->isUseSSL());
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ossClient = new OssClient('id', 'key', "https://123.123.123.1:3128");
|
||||||
|
$this->assertTrue($ossClient->isUseSSL());
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -80,6 +90,15 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
try {
|
try {
|
||||||
$ossClient = new OssClient('id', 'key', "http://123.123.123.1");
|
$ossClient = new OssClient('id', 'key', "http://123.123.123.1");
|
||||||
$this->assertFalse($ossClient->isUseSSL());
|
$this->assertFalse($ossClient->isUseSSL());
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ossClient = new OssClient('id', 'key', "http://123.123.123.1:3128");
|
||||||
|
$this->assertFalse($ossClient->isUseSSL());
|
||||||
|
$this->assertTrue(true);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
}
|
}
|
||||||
|
@ -109,33 +128,86 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testConstrunct10()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$ossClient = new OssClient('id', 'key', "http://ABC-COM.TEST.123.cn", true);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstrunct11()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$ossClient = new OssClient('id', 'key', "oss-test.com\\aliyuncs.com");
|
||||||
|
$this->assertFalse(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('endpoint is invalid:'."oss-test.com\\aliyuncs.com", $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstrunct12()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$ossClient = new OssClient('id', 'key', "192.168.1.0:abc123");
|
||||||
|
$this->assertFalse(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('endpoint is invalid:'."192.168.1.0:abc123", $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testSupportPutEmptyObject()
|
public function testSupportPutEmptyObject()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret , $endpoint, false);
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret , $endpoint, false);
|
||||||
$ossClient->putObject($bucket,'test_emptybody','');
|
$ossClient->putObject($bucket,'test_emptybody','');
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function testCreateObjectDir()
|
//use invalid sts-token, should fail.
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret , $endpoint, false, "invalid-sts-token");
|
||||||
|
$ossClient->putObject($bucket,'test_emptybody','');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertEquals('InvalidAccessKeyId', $e->getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCreateObjectDir()
|
||||||
|
{
|
||||||
|
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
|
$bucket = $this->bucket;
|
||||||
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
|
|
||||||
|
try {
|
||||||
$object='test-dir';
|
$object='test-dir';
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
|
||||||
$ossClient->createObjectDir($bucket,$object);
|
$ossClient->createObjectDir($bucket,$object);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
$this->assertFalse(true);
|
$this->assertFalse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$object='0';
|
||||||
|
$ossClient->createObjectDir($bucket,$object);
|
||||||
|
$ossClient->putObject($bucket,$object, '');
|
||||||
|
} catch (OssException $e) {
|
||||||
|
var_dump($e);
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetBucketCors()
|
public function testGetBucketCors()
|
||||||
|
@ -158,7 +230,7 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
$accessKeyId = ' ' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
$ossClient->getBucketCname($bucket);
|
$ossClient->getBucketCname($bucket);
|
||||||
} catch (OssException $e) {
|
} catch (OssException $e) {
|
||||||
|
@ -213,4 +285,57 @@ class OssClientTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertTrue(array_key_exists('via', $result));
|
$this->assertTrue(array_key_exists('via', $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testIpEndpoint()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$accessKeyId = 'sk' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
|
$endpoint = '192.168.1.1';
|
||||||
|
$bucket = getenv('OSS_BUCKET');
|
||||||
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
|
||||||
|
$object = "a.file";
|
||||||
|
$timeout = 3600;
|
||||||
|
$options = array('Content-Type' => 'txt');
|
||||||
|
$signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "PUT", $options);
|
||||||
|
$this->assertTrue(strpos($signedUrl, '192.168.1.1/skyranch-php-test/a.file?') != false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCnameEndpoint()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$accessKeyId = 'sk' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
|
$endpoint = 'cname.endpoint';
|
||||||
|
$bucket = getenv('OSS_BUCKET');
|
||||||
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, true);
|
||||||
|
$object = "a.file";
|
||||||
|
$timeout = 3600;
|
||||||
|
$options = array('Content-Type' => 'txt');
|
||||||
|
$signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "PUT", $options);
|
||||||
|
$this->assertTrue(strpos($signedUrl, 'cname.endpoint/a.file?') != false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testStsToken()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$accessKeyId = 'sk' . getenv('OSS_ACCESS_KEY_ID') . ' ';
|
||||||
|
$accessKeySecret = ' ' . getenv('OSS_ACCESS_KEY_SECRET') . ' ';
|
||||||
|
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
|
||||||
|
$bucket = getenv('OSS_BUCKET');
|
||||||
|
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false, "test-token");
|
||||||
|
$object = "a.file";
|
||||||
|
$timeout = 3600;
|
||||||
|
$options = array('Content-Type' => 'txt');
|
||||||
|
$signedUrl = $ossClient->signUrl($bucket, $object, $timeout, "PUT", $options);
|
||||||
|
$this->assertTrue(strpos($signedUrl, 'security-token=test-token') != false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Http\RequestCore;
|
||||||
|
use OSS\Http\ResponseCore;
|
||||||
|
use OSS\OssClient;
|
||||||
|
|
||||||
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestOssClientBase.php';
|
||||||
|
|
||||||
|
|
||||||
|
class OssTrafficLimitTest extends TestOssClientBase
|
||||||
|
{
|
||||||
|
function testTrafficLimitInHeader()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_HEADERS => array(
|
||||||
|
OssClient::OSS_TRAFFIC_LIMIT => 819200,
|
||||||
|
));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $this->ossClient->putObject($this->bucket, 'default-object', 'content', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
$this->assertTrue(isset($result["x-oss-qos-delay-time"]));
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $this->ossClient->appendObject($this->bucket, 'append-object', 'content', 0, $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $this->ossClient->copyObject($this->bucket, 'default-object', $this->bucket, 'copy-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $this->ossClient->getObject($this->bucket, 'default-object', $options);
|
||||||
|
$this->assertTrue(true);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function testTrafficLimitInQuery()
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
OssClient::OSS_TRAFFIC_LIMIT => 819200,
|
||||||
|
);
|
||||||
|
|
||||||
|
$object = "get.file";
|
||||||
|
$content = 'hello world';
|
||||||
|
$this->ossClient->putObject($this->bucket, $object, $content);
|
||||||
|
$timeout = 3600;
|
||||||
|
try {
|
||||||
|
$signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "GET", $options);
|
||||||
|
$this->assertTrue(stripos($signedUrl, 'x-oss-traffic-limit=819200') > 0);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = new RequestCore($signedUrl);
|
||||||
|
$request->set_method('GET');
|
||||||
|
$request->add_header('Content-Type', '');
|
||||||
|
$request->send_request();
|
||||||
|
$res = new ResponseCore($request->get_response_header(), $request->get_response_body(), $request->get_response_code());
|
||||||
|
$this->assertEquals($content, $res->body);
|
||||||
|
|
||||||
|
|
||||||
|
$object = "put.file";
|
||||||
|
$timeout = 3600;
|
||||||
|
try {
|
||||||
|
$signedUrl = $this->ossClient->signUrl($this->bucket, $object, $timeout, "PUT", $options);
|
||||||
|
$this->assertTrue(stripos($signedUrl, 'x-oss-traffic-limit=819200') > 0);
|
||||||
|
|
||||||
|
$request = new RequestCore($signedUrl);
|
||||||
|
$request->set_method('PUT');
|
||||||
|
$request->add_header('Content-Type', '');
|
||||||
|
$request->add_header('Content-Length', strlen($content));
|
||||||
|
$request->set_body($content);
|
||||||
|
$request->send_request();
|
||||||
|
$res = new ResponseCore($request->get_response_header(),
|
||||||
|
$request->get_response_body(), $request->get_response_code());
|
||||||
|
$this->assertTrue($res->isOK());
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertFalse(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -155,6 +155,10 @@ BBBB;
|
||||||
public function testGetMd5SumForFile()
|
public function testGetMd5SumForFile()
|
||||||
{
|
{
|
||||||
$this->assertEquals(OssUtil::getMd5SumForFile(__FILE__, 0, filesize(__FILE__) - 1), base64_encode(md5(file_get_contents(__FILE__), true)));
|
$this->assertEquals(OssUtil::getMd5SumForFile(__FILE__, 0, filesize(__FILE__) - 1), base64_encode(md5(file_get_contents(__FILE__), true)));
|
||||||
|
// false case
|
||||||
|
$this->assertEquals(OssUtil::getMd5SumForFile(__FILE__, 0, OssClient::OSS_MAX_PART_SIZE + 1), "");
|
||||||
|
$this->assertEquals(OssUtil::getMd5SumForFile(__FILE__, 0, filesize(__FILE__) + 1), "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGenerateFile()
|
public function testGenerateFile()
|
||||||
|
@ -242,10 +246,55 @@ BBBB;
|
||||||
$str = OssUtil::getHostPortFromEndpoint('192.168.1.10:8080');
|
$str = OssUtil::getHostPortFromEndpoint('192.168.1.10:8080');
|
||||||
$this->assertEquals('192.168.1.10:8080', $str);
|
$this->assertEquals('192.168.1.10:8080', $str);
|
||||||
|
|
||||||
$str = OssUtil::getHostPortFromEndpoint('http:///path?arg=value#anchor');
|
|
||||||
$this->assertEquals('', $str);
|
|
||||||
|
|
||||||
$str = OssUtil::getHostPortFromEndpoint('file://username:password@hostname:80/path?arg=value#anchor');
|
$str = OssUtil::getHostPortFromEndpoint('file://username:password@hostname:80/path?arg=value#anchor');
|
||||||
$this->assertEquals('hostname:80', $str);
|
$this->assertEquals('hostname:80', $str);
|
||||||
|
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('https://WWW.hostname.com-_www.test.com');
|
||||||
|
$this->assertEquals('WWW.hostname.com-_www.test.com', $str);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('http:///path?arg=value#anchor');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('https://www.hostname.com\www.test.com');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('www.hostname.com-_*www.test.com');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('www.hostname.com:ab123');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$str = OssUtil::getHostPortFromEndpoint('www.hostname.com:');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDecodeKey()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
OssUtil::decodeKey("key", "unknown");
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
58
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/StorageCapacityConfigTest.php
vendored
Normal file
58
sdk/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/StorageCapacityConfigTest.php
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OSS\Tests;
|
||||||
|
|
||||||
|
use OSS\Core\OssException;
|
||||||
|
use OSS\Model\StorageCapacityConfig;
|
||||||
|
|
||||||
|
class StorageCapacityConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
private $validXml_10 = <<<BBBB
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<BucketUserQos>
|
||||||
|
<StorageCapacity>10</StorageCapacity>
|
||||||
|
</BucketUserQos>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
private $validXml_20 = <<<BBBB
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<BucketUserQos>
|
||||||
|
<StorageCapacity>20</StorageCapacity>
|
||||||
|
</BucketUserQos>
|
||||||
|
BBBB;
|
||||||
|
|
||||||
|
public function testConstruct()
|
||||||
|
{
|
||||||
|
$config = new StorageCapacityConfig(10);
|
||||||
|
$this->assertEquals($config->getStorageCapacity(), 10);
|
||||||
|
$this->assertEquals($this->cleanXml($this->validXml_10), $this->cleanXml($config->serializeToXml()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetStorageCapacity()
|
||||||
|
{
|
||||||
|
$config = new StorageCapacityConfig(2);
|
||||||
|
$config->setStorageCapacity(20);
|
||||||
|
$this->assertEquals($this->cleanXml($this->validXml_20), $this->cleanXml($config->serializeToXml()));
|
||||||
|
$this->assertEquals($this->cleanXml($this->validXml_20), $this->cleanXml($config->__toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseFromXml()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$config = new StorageCapacityConfig(10);
|
||||||
|
$config->parseFromXml('invaide xml');
|
||||||
|
$this->assertTrue(false);
|
||||||
|
} catch (OssException $e) {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
if (strpos($e, "Not implemented.") == false)
|
||||||
|
{
|
||||||
|
$this->assertTrue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cleanXml($xml)
|
||||||
|
{
|
||||||
|
return str_replace("\n", "", str_replace("\r", "", $xml));
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ class SymlinkTest extends TestOssClientBase
|
||||||
{
|
{
|
||||||
public function testPutSymlink()
|
public function testPutSymlink()
|
||||||
{
|
{
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$symlink = 'test-link';
|
$symlink = 'test-link';
|
||||||
$special_object = 'exist_object^$#!~';
|
$special_object = 'exist_object^$#!~';
|
||||||
$object = 'exist_object';
|
$object = 'exist_object';
|
||||||
|
@ -31,10 +31,13 @@ class SymlinkTest extends TestOssClientBase
|
||||||
|
|
||||||
public function testGetSymlink()
|
public function testGetSymlink()
|
||||||
{
|
{
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$symlink = 'test-link';
|
$symlink = 'test-link';
|
||||||
$object = 'exist_object^$#!~';
|
$object = 'exist_object^$#!~';
|
||||||
|
|
||||||
|
$this->ossClient ->putObject($bucket, $object, 'test_content');
|
||||||
|
$this->ossClient->putSymlink($bucket, $symlink, $object);
|
||||||
|
|
||||||
$result = $this->ossClient->getSymlink($bucket, $symlink);
|
$result = $this->ossClient->getSymlink($bucket, $symlink);
|
||||||
$this->assertEquals($result[OssClient::OSS_SYMLINK_TARGET], $object);
|
$this->assertEquals($result[OssClient::OSS_SYMLINK_TARGET], $object);
|
||||||
$this->assertEquals('200', $result[OssClient::OSS_INFO][OssClient::OSS_HTTP_CODE]);
|
$this->assertEquals('200', $result[OssClient::OSS_INFO][OssClient::OSS_HTTP_CODE]);
|
||||||
|
@ -44,7 +47,7 @@ class SymlinkTest extends TestOssClientBase
|
||||||
|
|
||||||
public function testPutNullSymlink()
|
public function testPutNullSymlink()
|
||||||
{
|
{
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$symlink = 'null-link';
|
$symlink = 'null-link';
|
||||||
$object_not_exist = 'not_exist_object+$#!b不';
|
$object_not_exist = 'not_exist_object+$#!b不';
|
||||||
$this->ossClient->putSymlink($bucket, $symlink, $object_not_exist);
|
$this->ossClient->putSymlink($bucket, $symlink, $object_not_exist);
|
||||||
|
@ -53,13 +56,13 @@ class SymlinkTest extends TestOssClientBase
|
||||||
$this->ossClient->getObject($bucket, $symlink);
|
$this->ossClient->getObject($bucket, $symlink);
|
||||||
$this->assertTrue(false);
|
$this->assertTrue(false);
|
||||||
}catch (OssException $e){
|
}catch (OssException $e){
|
||||||
$this->assertEquals('The specified key does not exist.', $e->getErrorMessage());
|
$this->assertEquals('The symlink target object does not exist', $e->getErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNullSymlink()
|
public function testGetNullSymlink()
|
||||||
{
|
{
|
||||||
$bucket = getenv('OSS_BUCKET');
|
$bucket = $this->bucket;
|
||||||
$symlink = 'null-link-new';
|
$symlink = 'null-link-new';
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -20,10 +20,10 @@ class TestOssClientBase extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->bucket = Common::getBucketName() . rand(100000, 999999);
|
$this->bucket = Common::getBucketName() .'-'. time();
|
||||||
$this->ossClient = Common::getOssClient();
|
$this->ossClient = Common::getOssClient();
|
||||||
$this->ossClient->createBucket($this->bucket);
|
$this->ossClient->createBucket($this->bucket);
|
||||||
Common::waitMetaSync();
|
Common::waitMetaSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace Composer\Autoload;
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
* @see http://www.php-fig.org/psr/psr-0/
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
* @see http://www.php-fig.org/psr/psr-4/
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
*/
|
*/
|
||||||
class ClassLoader
|
class ClassLoader
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ class ClassLoader
|
||||||
public function getPrefixes()
|
public function getPrefixes()
|
||||||
{
|
{
|
||||||
if (!empty($this->prefixesPsr0)) {
|
if (!empty($this->prefixesPsr0)) {
|
||||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
|
|
|
@ -0,0 +1,218 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
private static $installed = array (
|
||||||
|
'root' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
||||||
|
'name' => '__root__',
|
||||||
|
),
|
||||||
|
'versions' =>
|
||||||
|
array (
|
||||||
|
'__root__' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
||||||
|
),
|
||||||
|
'aliyuncs/oss-sdk-php' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v2.4.1',
|
||||||
|
'version' => '2.4.1.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '492866331b7bafaac09506cf42f351b7e9e63766',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
return array_keys(self::$installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function isInstalled($packageName)
|
||||||
|
{
|
||||||
|
return isset(self::$installed['versions'][$packageName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||||
|
{
|
||||||
|
$constraint = $parser->parseConstraints($constraint);
|
||||||
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||||
|
|
||||||
|
return $provided->matches($constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getVersionRanges($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
if (!isset(self::$installed['versions'][$packageName])) {
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
return self::$installed['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||||
$baseDir = dirname($vendorDir);
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
'OSS\\Core\\MimeTypes' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php',
|
'OSS\\Core\\MimeTypes' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php',
|
||||||
'OSS\\Core\\OssException' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php',
|
'OSS\\Core\\OssException' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php',
|
||||||
'OSS\\Core\\OssUtil' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php',
|
'OSS\\Core\\OssUtil' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php',
|
||||||
|
@ -14,12 +15,18 @@ return array(
|
||||||
'OSS\\Http\\ResponseCore' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php',
|
'OSS\\Http\\ResponseCore' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php',
|
||||||
'OSS\\Model\\BucketInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php',
|
'OSS\\Model\\BucketInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php',
|
||||||
'OSS\\Model\\BucketListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php',
|
'OSS\\Model\\BucketListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php',
|
||||||
|
'OSS\\Model\\BucketStat' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketStat.php',
|
||||||
'OSS\\Model\\CnameConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php',
|
'OSS\\Model\\CnameConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php',
|
||||||
'OSS\\Model\\CorsConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php',
|
'OSS\\Model\\CorsConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php',
|
||||||
'OSS\\Model\\CorsRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php',
|
'OSS\\Model\\CorsRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php',
|
||||||
|
'OSS\\Model\\DeleteMarkerInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeleteMarkerInfo.php',
|
||||||
|
'OSS\\Model\\DeleteObjectInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeleteObjectInfo.php',
|
||||||
|
'OSS\\Model\\DeletedObjectInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeletedObjectInfo.php',
|
||||||
|
'OSS\\Model\\ExtendWormConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ExtendWormConfig.php',
|
||||||
'OSS\\Model\\GetLiveChannelHistory' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php',
|
'OSS\\Model\\GetLiveChannelHistory' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php',
|
||||||
'OSS\\Model\\GetLiveChannelInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php',
|
'OSS\\Model\\GetLiveChannelInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php',
|
||||||
'OSS\\Model\\GetLiveChannelStatus' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php',
|
'OSS\\Model\\GetLiveChannelStatus' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php',
|
||||||
|
'OSS\\Model\\InitiateWormConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/InitiateWormConfig.php',
|
||||||
'OSS\\Model\\LifecycleAction' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php',
|
'OSS\\Model\\LifecycleAction' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php',
|
||||||
'OSS\\Model\\LifecycleConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php',
|
'OSS\\Model\\LifecycleConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php',
|
||||||
'OSS\\Model\\LifecycleRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php',
|
'OSS\\Model\\LifecycleRule' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php',
|
||||||
|
@ -32,12 +39,21 @@ return array(
|
||||||
'OSS\\Model\\LoggingConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php',
|
'OSS\\Model\\LoggingConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php',
|
||||||
'OSS\\Model\\ObjectInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php',
|
'OSS\\Model\\ObjectInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php',
|
||||||
'OSS\\Model\\ObjectListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php',
|
'OSS\\Model\\ObjectListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php',
|
||||||
|
'OSS\\Model\\ObjectVersionInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectVersionInfo.php',
|
||||||
|
'OSS\\Model\\ObjectVersionListInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectVersionListInfo.php',
|
||||||
'OSS\\Model\\PartInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php',
|
'OSS\\Model\\PartInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php',
|
||||||
'OSS\\Model\\PrefixInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php',
|
'OSS\\Model\\PrefixInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php',
|
||||||
'OSS\\Model\\RefererConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php',
|
'OSS\\Model\\RefererConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php',
|
||||||
|
'OSS\\Model\\RequestPaymentConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/RequestPaymentConfig.php',
|
||||||
|
'OSS\\Model\\RestoreConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/RestoreConfig.php',
|
||||||
|
'OSS\\Model\\ServerSideEncryptionConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/ServerSideEncryptionConfig.php',
|
||||||
'OSS\\Model\\StorageCapacityConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php',
|
'OSS\\Model\\StorageCapacityConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php',
|
||||||
|
'OSS\\Model\\Tag' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/Tag.php',
|
||||||
|
'OSS\\Model\\TaggingConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/TaggingConfig.php',
|
||||||
'OSS\\Model\\UploadInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php',
|
'OSS\\Model\\UploadInfo' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php',
|
||||||
|
'OSS\\Model\\VersioningConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/VersioningConfig.php',
|
||||||
'OSS\\Model\\WebsiteConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php',
|
'OSS\\Model\\WebsiteConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php',
|
||||||
|
'OSS\\Model\\WormConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/WormConfig.php',
|
||||||
'OSS\\Model\\XmlConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php',
|
'OSS\\Model\\XmlConfig' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php',
|
||||||
'OSS\\OssClient' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php',
|
'OSS\\OssClient' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php',
|
||||||
'OSS\\Result\\AclResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php',
|
'OSS\\Result\\AclResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php',
|
||||||
|
@ -45,8 +61,16 @@ return array(
|
||||||
'OSS\\Result\\BodyResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php',
|
'OSS\\Result\\BodyResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php',
|
||||||
'OSS\\Result\\CallbackResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php',
|
'OSS\\Result\\CallbackResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php',
|
||||||
'OSS\\Result\\CopyObjectResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php',
|
'OSS\\Result\\CopyObjectResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php',
|
||||||
|
'OSS\\Result\\DeleteObjectVersionsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectVersionsResult.php',
|
||||||
'OSS\\Result\\DeleteObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php',
|
'OSS\\Result\\DeleteObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php',
|
||||||
'OSS\\Result\\ExistResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php',
|
'OSS\\Result\\ExistResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php',
|
||||||
|
'OSS\\Result\\GetBucketEncryptionResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketEncryptionResult.php',
|
||||||
|
'OSS\\Result\\GetBucketInfoResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketInfoResult.php',
|
||||||
|
'OSS\\Result\\GetBucketRequestPaymentResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketRequestPaymentResult.php',
|
||||||
|
'OSS\\Result\\GetBucketStatResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketStatResult.php',
|
||||||
|
'OSS\\Result\\GetBucketTagsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketTagsResult.php',
|
||||||
|
'OSS\\Result\\GetBucketVersioningResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketVersioningResult.php',
|
||||||
|
'OSS\\Result\\GetBucketWormResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketWormResult.php',
|
||||||
'OSS\\Result\\GetCnameResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php',
|
'OSS\\Result\\GetCnameResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php',
|
||||||
'OSS\\Result\\GetCorsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php',
|
'OSS\\Result\\GetCorsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php',
|
||||||
'OSS\\Result\\GetLifecycleResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php',
|
'OSS\\Result\\GetLifecycleResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php',
|
||||||
|
@ -59,10 +83,12 @@ return array(
|
||||||
'OSS\\Result\\GetStorageCapacityResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php',
|
'OSS\\Result\\GetStorageCapacityResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php',
|
||||||
'OSS\\Result\\GetWebsiteResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php',
|
'OSS\\Result\\GetWebsiteResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php',
|
||||||
'OSS\\Result\\HeaderResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php',
|
'OSS\\Result\\HeaderResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php',
|
||||||
|
'OSS\\Result\\InitiateBucketWormResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateBucketWormResult.php',
|
||||||
'OSS\\Result\\InitiateMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php',
|
'OSS\\Result\\InitiateMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php',
|
||||||
'OSS\\Result\\ListBucketsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php',
|
'OSS\\Result\\ListBucketsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php',
|
||||||
'OSS\\Result\\ListLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php',
|
'OSS\\Result\\ListLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php',
|
||||||
'OSS\\Result\\ListMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php',
|
'OSS\\Result\\ListMultipartUploadResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php',
|
||||||
|
'OSS\\Result\\ListObjectVersionsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectVersionsResult.php',
|
||||||
'OSS\\Result\\ListObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php',
|
'OSS\\Result\\ListObjectsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php',
|
||||||
'OSS\\Result\\ListPartsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php',
|
'OSS\\Result\\ListPartsResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php',
|
||||||
'OSS\\Result\\PutLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php',
|
'OSS\\Result\\PutLiveChannelResult' => $vendorDir . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php',
|
||||||
|
|
|
@ -22,13 +22,15 @@ class ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitc01f83c61c7df694fdf929c88fea6382', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
require_once __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInitc01f83c61c7df694fdf929c88fea6382::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInitc01f83c61c7df694fdf929c88fea6382::getInitializer($loader));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,6 +21,7 @@ class ComposerStaticInitc01f83c61c7df694fdf929c88fea6382
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
'OSS\\Core\\MimeTypes' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php',
|
'OSS\\Core\\MimeTypes' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php',
|
||||||
'OSS\\Core\\OssException' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php',
|
'OSS\\Core\\OssException' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php',
|
||||||
'OSS\\Core\\OssUtil' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php',
|
'OSS\\Core\\OssUtil' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php',
|
||||||
|
@ -29,12 +30,18 @@ class ComposerStaticInitc01f83c61c7df694fdf929c88fea6382
|
||||||
'OSS\\Http\\ResponseCore' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php',
|
'OSS\\Http\\ResponseCore' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php',
|
||||||
'OSS\\Model\\BucketInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php',
|
'OSS\\Model\\BucketInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php',
|
||||||
'OSS\\Model\\BucketListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php',
|
'OSS\\Model\\BucketListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php',
|
||||||
|
'OSS\\Model\\BucketStat' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/BucketStat.php',
|
||||||
'OSS\\Model\\CnameConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php',
|
'OSS\\Model\\CnameConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CnameConfig.php',
|
||||||
'OSS\\Model\\CorsConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php',
|
'OSS\\Model\\CorsConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php',
|
||||||
'OSS\\Model\\CorsRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php',
|
'OSS\\Model\\CorsRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php',
|
||||||
|
'OSS\\Model\\DeleteMarkerInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeleteMarkerInfo.php',
|
||||||
|
'OSS\\Model\\DeleteObjectInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeleteObjectInfo.php',
|
||||||
|
'OSS\\Model\\DeletedObjectInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/DeletedObjectInfo.php',
|
||||||
|
'OSS\\Model\\ExtendWormConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ExtendWormConfig.php',
|
||||||
'OSS\\Model\\GetLiveChannelHistory' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php',
|
'OSS\\Model\\GetLiveChannelHistory' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelHistory.php',
|
||||||
'OSS\\Model\\GetLiveChannelInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php',
|
'OSS\\Model\\GetLiveChannelInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelInfo.php',
|
||||||
'OSS\\Model\\GetLiveChannelStatus' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php',
|
'OSS\\Model\\GetLiveChannelStatus' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/GetLiveChannelStatus.php',
|
||||||
|
'OSS\\Model\\InitiateWormConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/InitiateWormConfig.php',
|
||||||
'OSS\\Model\\LifecycleAction' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php',
|
'OSS\\Model\\LifecycleAction' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php',
|
||||||
'OSS\\Model\\LifecycleConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php',
|
'OSS\\Model\\LifecycleConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php',
|
||||||
'OSS\\Model\\LifecycleRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php',
|
'OSS\\Model\\LifecycleRule' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php',
|
||||||
|
@ -47,12 +54,21 @@ class ComposerStaticInitc01f83c61c7df694fdf929c88fea6382
|
||||||
'OSS\\Model\\LoggingConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php',
|
'OSS\\Model\\LoggingConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php',
|
||||||
'OSS\\Model\\ObjectInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php',
|
'OSS\\Model\\ObjectInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php',
|
||||||
'OSS\\Model\\ObjectListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php',
|
'OSS\\Model\\ObjectListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php',
|
||||||
|
'OSS\\Model\\ObjectVersionInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectVersionInfo.php',
|
||||||
|
'OSS\\Model\\ObjectVersionListInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectVersionListInfo.php',
|
||||||
'OSS\\Model\\PartInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php',
|
'OSS\\Model\\PartInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PartInfo.php',
|
||||||
'OSS\\Model\\PrefixInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php',
|
'OSS\\Model\\PrefixInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php',
|
||||||
'OSS\\Model\\RefererConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php',
|
'OSS\\Model\\RefererConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php',
|
||||||
|
'OSS\\Model\\RequestPaymentConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/RequestPaymentConfig.php',
|
||||||
|
'OSS\\Model\\RestoreConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/RestoreConfig.php',
|
||||||
|
'OSS\\Model\\ServerSideEncryptionConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/ServerSideEncryptionConfig.php',
|
||||||
'OSS\\Model\\StorageCapacityConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php',
|
'OSS\\Model\\StorageCapacityConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php',
|
||||||
|
'OSS\\Model\\Tag' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/Tag.php',
|
||||||
|
'OSS\\Model\\TaggingConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/TaggingConfig.php',
|
||||||
'OSS\\Model\\UploadInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php',
|
'OSS\\Model\\UploadInfo' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php',
|
||||||
|
'OSS\\Model\\VersioningConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/VersioningConfig.php',
|
||||||
'OSS\\Model\\WebsiteConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php',
|
'OSS\\Model\\WebsiteConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php',
|
||||||
|
'OSS\\Model\\WormConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/WormConfig.php',
|
||||||
'OSS\\Model\\XmlConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php',
|
'OSS\\Model\\XmlConfig' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php',
|
||||||
'OSS\\OssClient' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php',
|
'OSS\\OssClient' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/OssClient.php',
|
||||||
'OSS\\Result\\AclResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php',
|
'OSS\\Result\\AclResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php',
|
||||||
|
@ -60,8 +76,16 @@ class ComposerStaticInitc01f83c61c7df694fdf929c88fea6382
|
||||||
'OSS\\Result\\BodyResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php',
|
'OSS\\Result\\BodyResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/BodyResult.php',
|
||||||
'OSS\\Result\\CallbackResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php',
|
'OSS\\Result\\CallbackResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CallbackResult.php',
|
||||||
'OSS\\Result\\CopyObjectResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php',
|
'OSS\\Result\\CopyObjectResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/CopyObjectResult.php',
|
||||||
|
'OSS\\Result\\DeleteObjectVersionsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectVersionsResult.php',
|
||||||
'OSS\\Result\\DeleteObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php',
|
'OSS\\Result\\DeleteObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/DeleteObjectsResult.php',
|
||||||
'OSS\\Result\\ExistResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php',
|
'OSS\\Result\\ExistResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php',
|
||||||
|
'OSS\\Result\\GetBucketEncryptionResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketEncryptionResult.php',
|
||||||
|
'OSS\\Result\\GetBucketInfoResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketInfoResult.php',
|
||||||
|
'OSS\\Result\\GetBucketRequestPaymentResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketRequestPaymentResult.php',
|
||||||
|
'OSS\\Result\\GetBucketStatResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketStatResult.php',
|
||||||
|
'OSS\\Result\\GetBucketTagsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketTagsResult.php',
|
||||||
|
'OSS\\Result\\GetBucketVersioningResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketVersioningResult.php',
|
||||||
|
'OSS\\Result\\GetBucketWormResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetBucketWormResult.php',
|
||||||
'OSS\\Result\\GetCnameResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php',
|
'OSS\\Result\\GetCnameResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCnameResult.php',
|
||||||
'OSS\\Result\\GetCorsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php',
|
'OSS\\Result\\GetCorsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php',
|
||||||
'OSS\\Result\\GetLifecycleResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php',
|
'OSS\\Result\\GetLifecycleResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php',
|
||||||
|
@ -74,10 +98,12 @@ class ComposerStaticInitc01f83c61c7df694fdf929c88fea6382
|
||||||
'OSS\\Result\\GetStorageCapacityResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php',
|
'OSS\\Result\\GetStorageCapacityResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php',
|
||||||
'OSS\\Result\\GetWebsiteResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php',
|
'OSS\\Result\\GetWebsiteResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php',
|
||||||
'OSS\\Result\\HeaderResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php',
|
'OSS\\Result\\HeaderResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php',
|
||||||
|
'OSS\\Result\\InitiateBucketWormResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateBucketWormResult.php',
|
||||||
'OSS\\Result\\InitiateMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php',
|
'OSS\\Result\\InitiateMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php',
|
||||||
'OSS\\Result\\ListBucketsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php',
|
'OSS\\Result\\ListBucketsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListBucketsResult.php',
|
||||||
'OSS\\Result\\ListLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php',
|
'OSS\\Result\\ListLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListLiveChannelResult.php',
|
||||||
'OSS\\Result\\ListMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php',
|
'OSS\\Result\\ListMultipartUploadResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php',
|
||||||
|
'OSS\\Result\\ListObjectVersionsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectVersionsResult.php',
|
||||||
'OSS\\Result\\ListObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php',
|
'OSS\\Result\\ListObjectsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php',
|
||||||
'OSS\\Result\\ListPartsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php',
|
'OSS\\Result\\ListPartsResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php',
|
||||||
'OSS\\Result\\PutLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php',
|
'OSS\\Result\\PutLiveChannelResult' => __DIR__ . '/..' . '/aliyuncs/oss-sdk-php/src/OSS/Result/PutLiveChannelResult.php',
|
||||||
|
|
|
@ -1,51 +1,60 @@
|
||||||
[
|
{
|
||||||
{
|
"packages": [
|
||||||
"name": "aliyuncs/oss-sdk-php",
|
{
|
||||||
"version": "v2.3.1",
|
"name": "aliyuncs/oss-sdk-php",
|
||||||
"version_normalized": "2.3.1.0",
|
"version": "v2.4.1",
|
||||||
"source": {
|
"version_normalized": "2.4.1.0",
|
||||||
"type": "git",
|
"source": {
|
||||||
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
"type": "git",
|
||||||
"reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a"
|
"url": "https://github.com/aliyun/aliyun-oss-php-sdk.git",
|
||||||
},
|
"reference": "492866331b7bafaac09506cf42f351b7e9e63766"
|
||||||
"dist": {
|
},
|
||||||
"type": "zip",
|
"dist": {
|
||||||
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/053d7ba9e798e4c09b9c5c1edab153d25ea9643a",
|
"type": "zip",
|
||||||
"reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a",
|
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/492866331b7bafaac09506cf42f351b7e9e63766",
|
||||||
"shasum": "",
|
"reference": "492866331b7bafaac09506cf42f351b7e9e63766",
|
||||||
"mirrors": [
|
"shasum": "",
|
||||||
{
|
"mirrors": [
|
||||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
{
|
||||||
"preferred": true
|
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||||
|
"preferred": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.0",
|
||||||
|
"satooshi/php-coveralls": "~1.0"
|
||||||
|
},
|
||||||
|
"time": "2020-09-29T06:23:57+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"OSS\\": "src/OSS"
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
},
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"require": {
|
"license": [
|
||||||
"php": ">=5.3"
|
"MIT"
|
||||||
},
|
],
|
||||||
"require-dev": {
|
"authors": [
|
||||||
"phpunit/phpunit": "~4.0",
|
{
|
||||||
"satooshi/php-coveralls": "~1.0"
|
"name": "Aliyuncs",
|
||||||
},
|
"homepage": "http://www.aliyun.com"
|
||||||
"time": "2019-11-15T11:05:42+00:00",
|
}
|
||||||
"type": "library",
|
],
|
||||||
"installation-source": "dist",
|
"description": "Aliyun OSS SDK for PHP",
|
||||||
"autoload": {
|
"homepage": "http://www.aliyun.com/product/oss/",
|
||||||
"psr-4": {
|
"support": {
|
||||||
"OSS\\": "src/OSS"
|
"issues": "https://github.com/aliyun/aliyun-oss-php-sdk/issues",
|
||||||
}
|
"source": "https://github.com/aliyun/aliyun-oss-php-sdk/tree/v2.4.1"
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"install-path": "../aliyuncs/oss-sdk-php"
|
||||||
"license": [
|
}
|
||||||
"MIT"
|
],
|
||||||
],
|
"dev": true,
|
||||||
"authors": [
|
"dev-package-names": []
|
||||||
{
|
}
|
||||||
"name": "Aliyuncs",
|
|
||||||
"homepage": "http://www.aliyun.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Aliyun OSS SDK for PHP",
|
|
||||||
"homepage": "http://www.aliyun.com/product/oss/"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php return array (
|
||||||
|
'root' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
||||||
|
'name' => '__root__',
|
||||||
|
),
|
||||||
|
'versions' =>
|
||||||
|
array (
|
||||||
|
'__root__' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'dev-master',
|
||||||
|
'version' => 'dev-master',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => 'e91742b194ff46741075d52a4ea0fc1148659407',
|
||||||
|
),
|
||||||
|
'aliyuncs/oss-sdk-php' =>
|
||||||
|
array (
|
||||||
|
'pretty_version' => 'v2.4.1',
|
||||||
|
'version' => '2.4.1.0',
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'reference' => '492866331b7bafaac09506cf42f351b7e9e63766',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// platform_check.php @generated by Composer
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
if (!(PHP_VERSION_ID >= 50300)) {
|
||||||
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.0". You are running ' . PHP_VERSION . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($issues) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue