diff --git a/build.cmd b/build.cmd index cc596ae4f..bfc3d5480 100644 --- a/build.cmd +++ b/build.cmd @@ -1,4 +1,3 @@ @echo off -@rmdir /s/q vendor thinkphp -composer update --profile --prefer-dist --optimize-autoloader -composer dump-autoload --optimize \ No newline at end of file +@rmdir /s/q vendor +composer update --profile --prefer-dist --no-dev --optimize-autoloader \ No newline at end of file diff --git a/composer.json b/composer.json index 77b5ef4b7..ccc060ec0 100644 --- a/composer.json +++ b/composer.json @@ -1,36 +1,36 @@ { - "name": "topthink/think", - "description": "the new thinkphp framework", - "type": "project", - "keywords": [ - "framework", - "thinkphp", - "ORM" - ], - "homepage": "http://thinkphp.cn/", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=5.4.0", - "qiniu/php-sdk": "^7.0", - "zoujingli/wechat-php-sdk": "dev-master", - "zoujingli/ip2region": "^1.0", - "topthink/framework": "5.0.*", - "topthink/think-captcha": "^1.0", - "topthink/think-mongo": "^1.1", - "topthink/think-queue": "^1.0", - "endroid/qr-code": "^1.9", - "aliyuncs/oss-sdk-php": "^2.2" - }, - "extra": { - "think-path": "thinkphp" - }, - "config": { - "preferred-install": "dist" + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" } + ], + "require": { + "php": ">=5.4.0", + "qiniu/php-sdk": "^7.0", + "zoujingli/wechat-php-sdk": "dev-master", + "zoujingli/ip2region": "^1.0", + "topthink/framework": "5.0.*", + "topthink/think-captcha": "1.0.*", + "topthink/think-mongo": "1.1.*", + "topthink/think-queue": "1.0.*", + "endroid/qr-code": "^1.9", + "aliyuncs/oss-sdk-php": "^2.2" + }, + "extra": { + "think-path": "thinkphp" + }, + "config": { + "preferred-install": "dist" + } } diff --git a/vendor/aliyuncs/oss-sdk-php/CHANGELOG.md b/vendor/aliyuncs/oss-sdk-php/CHANGELOG.md index 042a72a0b..d349d907b 100644 --- a/vendor/aliyuncs/oss-sdk-php/CHANGELOG.md +++ b/vendor/aliyuncs/oss-sdk-php/CHANGELOG.md @@ -1,39 +1,44 @@ # ChangeLog - Aliyun OSS SDK for PHP +## v2.3.1 / 2019-011-15 + +* translate chinese comments into english +* Added: endpoint validity check + ## v2.3.0 / 2018-01-05 -* 修复:putObject支持创建空文件 -* 修复:createBucket支持IA/Archive -* 增加:支持restoreObject -* 增加:支持Symlink功能 -* 增加:支持getBucketLocation -* 增加:支持getBucketMeta -* 增加:支持代理服务器Proxy +* Fixed: putObject support creating empty files +* Fixed: createBucket support IA/Archive +* Added: support restoreObject +* Added: support the Symlink feature +* Added: support getBucketLocation +* Added: support getBucketMeta +* Added: support proxy server Proxy ## v2.2.4 / 2017-04-25 -* fix getObject to local file bug +* Fixed getObject to local file bug ## v2.2.3 / 2017-04-14 -* fix md5 check +* Fixed md5 check ## v2.2.2 / 2017-01-18 -* 解决在php7上运行连接数和内存bug +* Resolve to run the connection number and memory bug on php7 ## v2.2.1 / 2016-12-01 -* 禁止http curl自动填充Accept-Encoding +* No HTTP curl is allowed to automatically populate accept-encoding ## v2.2.0 / 2016-11-22 -* 修复PutObject/CompleteMultipartUpload的返回值问题(#26) +* Fixed PutObject/CompleteMultipartUpload return values(#26) ## v2.1.0 / 2016-11-12 -* 增加[RTMP](https://help.aliyun.com/document_detail/44297.html)接口 -* 增加支持[图片服务](https://help.aliyun.com/document_detail/44686.html) +* Added[RTMP](https://help.aliyun.com/document_detail/44297.html)interface +* Add support[image service](https://help.aliyun.com/document_detail/44686.html) ## v2.0.7 / 2016-06-17 @@ -46,47 +51,47 @@ ## v2.0.5 -* 增加Add/Delete/Get BucketCname接口 +* Added Add/Delete/Get BucketCname interface ## v2.0.4 -* 增加Put/Get Object Acl接口 +* Added Put/Get Object Acl interface ## v2.0.3 -* 修复Util中的常量定义在低于5.6的PHP版本中报错的问题 +* Fixing the constants in Util is defined in a PHP version that is less than 5.6. ## v2.0.2 -* 修复multipart上传时无法指定Content-Type的问题 +* The problem of content-type cannot be specified when restoring multipart uploads ## v2.0.1 -* 增加对ListObjects/ListMultipartUploads时特殊字符的处理 -* 提供接口获取OssException中的详细信息 +* Increase the ListObjects/ListMultipartUploads special characters +* Provides the interface to get the details of the OssException ## 2015.11.25 -* **大版本升级,不再兼容以前接口,新版本对易用性做了很大的改进,建议用户迁移到新版本。** +* **Large version upgrade, no longer compatible with previous interface, new version has made great improvements to ease of use, suggesting that users migrate to a new version.** -## 修改内容 +## Modify the content -* 不再支持PHP 5.2版本 +* PHP 5.2 is no longer supported -### 新增内容 +### Add the cotent -* 引入命名空间 -* 接口命名修正,采用驼峰式命名 -* 接口入参修改,把常用参数从Options参数中提出来 -* 接口返回结果修改,对返回结果进行处理,用户可以直接得到容易处理的数据结构  -* OssClient的构造函数变更 -* 支持CNAME和IP格式的Endpoint地址 -* 重新整理sample文件组织结构,使用function组织功能点 -* 增加设置连接超时,请求超时的接口 -* 去掉Object Group相关的已经过时的接口 -* OssException中的message改为英文 +* Introduce namespace +* Interface naming and modification, using hump naming +* The interface is modified, and the common parameters are extracted from the Options parameter. +* The interface returns the result modification, processing the return result, and the user can directly get the data structure easily processed  +* OssClient's constructor changes +* The Endpoint address that support CNAME and IP formats +* Rearrange the sample file organization structure and use function to organize the function points +* Add an interface that sets the connection timeout and requests timeout +* Remove the outdated interface associated with the Object Group +* The message in the OssException is changed to English -### 问题修复 +### Repair problem -* object名称校验不完备 +* The object name is not complete diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php b/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php index bd16e6556..7dc50b894 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Bucket.php @@ -8,28 +8,28 @@ $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); $bucket = Common::getBucketName(); -//******************************* 简单使用 **************************************************************** +//******************************* Simple Usage**************************************************************** -//创建bucket +// Create a bucket $ossClient->createBucket($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); Common::println("bucket $bucket created"); -// 判断Bucket是否存在 +// Check whether a bucket exists $doesExist = $ossClient->doesBucketExist($bucket); Common::println("bucket $bucket exist? " . ($doesExist ? "yes" : "no")); -// 获取Bucket列表 +// Get the bucket list $bucketListInfo = $ossClient->listBuckets(); -// 设置bucket的ACL +// Set bucket ACL $ossClient->putBucketAcl($bucket, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE); Common::println("bucket $bucket acl put"); -// 获取bucket的ACL +// Get bucket ACL $acl = $ossClient->getBucketAcl($bucket); Common::println("bucket $bucket acl get: " . $acl); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** createBucket($ossClient, $bucket); doesBucketExist($ossClient, $bucket); @@ -39,13 +39,13 @@ getBucketAcl($ossClient, $bucket); listBuckets($ossClient); /** - * 创建一个存储空间 - * acl 指的是bucket的访问控制权限,有三种,私有读写,公共读私有写,公共读写。 - * 私有读写就是只有bucket的拥有者或授权用户才有权限操作 - * 三种权限分别对应 (OssClient::OSS_ACL_TYPE_PRIVATE,OssClient::OSS_ACL_TYPE_PUBLIC_READ, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE) + * Create a new bucket + * acl indicates the access permission of a bucket, including: private, public-read-only/private-read-write, and public read-write. + * Private indicates that only the bucket owner or authorized users can access the data.. + * The three permissions are separately defined by (OssClient::OSS_ACL_TYPE_PRIVATE,OssClient::OSS_ACL_TYPE_PUBLIC_READ, OssClient::OSS_ACL_TYPE_PUBLIC_READ_WRITE) * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 要创建的存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket Name of the bucket to create * @return null */ function createBucket($ossClient, $bucket) @@ -61,10 +61,10 @@ function createBucket($ossClient, $bucket) } /** - * 判断Bucket是否存在 + * Check whether a bucket exists. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name */ function doesBucketExist($ossClient, $bucket) { @@ -83,10 +83,11 @@ function doesBucketExist($ossClient, $bucket) } /** - * 删除bucket,如果bucket不为空则bucket无法删除成功, 不为空表示bucket既没有object,也没有未完成的multipart上传时的parts + * Delete a bucket. If the bucket is not empty, the deletion fails. + * A bucket which is not empty indicates that it does not contain any objects or parts that are not completely uploaded during multipart upload * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 待删除的存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket Name of the bucket to delete * @return null */ function deleteBucket($ossClient, $bucket) @@ -102,10 +103,10 @@ function deleteBucket($ossClient, $bucket) } /** - * 设置bucket的acl配置 + * Set bucket ACL * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putBucketAcl($ossClient, $bucket) @@ -123,10 +124,10 @@ function putBucketAcl($ossClient, $bucket) /** - * 获取bucket的acl配置 + * Get bucket ACL * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketAcl($ossClient, $bucket) @@ -144,9 +145,9 @@ function getBucketAcl($ossClient, $bucket) /** - * 列出用户所有的Bucket + * List all buckets * - * @param OssClient $ossClient OssClient实例 + * @param OssClient $ossClient OssClient instance * @return null */ function listBuckets($ossClient) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php index cc5c0b9c5..dfa42d323 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/BucketCors.php @@ -11,9 +11,9 @@ if (is_null($ossClient)) exit(1); $bucket = Common::getBucketName(); -//******************************* 简单使用 **************************************************************** +//******************************* Simple usage**************************************************************** -// 设置cors配置 +// Set cors configuration $corsConfig = new CorsConfig(); $rule = new CorsRule(); $rule->addAllowedHeader("x-oss-header"); @@ -24,15 +24,15 @@ $corsConfig->addRule($rule); $ossClient->putBucketCors($bucket, $corsConfig); Common::println("bucket $bucket corsConfig created:" . $corsConfig->serializeToXml()); -// 获取cors配置 +// Get cors configuration $corsConfig = $ossClient->getBucketCors($bucket); Common::println("bucket $bucket corsConfig fetched:" . $corsConfig->serializeToXml()); -// 删除cors配置 +// Delete cors configuration $ossClient->deleteBucketCors($bucket); Common::println("bucket $bucket corsConfig deleted"); -//******************************* 完整用法参考下面函数 ***************************************************** +//******************************* For complete usage, see the following functions ***************************************************** putBucketCors($ossClient, $bucket); getBucketCors($ossClient, $bucket); @@ -40,10 +40,10 @@ deleteBucketCors($ossClient, $bucket); getBucketCors($ossClient, $bucket); /** - * 设置bucket的cors配置 + * Set bucket cores * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putBucketCors($ossClient, $bucket) @@ -67,10 +67,10 @@ function putBucketCors($ossClient, $bucket) } /** - * 获取并打印bucket的cors配置 + * Get and print the cors configuration of a bucket * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketCors($ossClient, $bucket) @@ -88,10 +88,10 @@ function getBucketCors($ossClient, $bucket) } /** - * 删除bucket的所有的cors配置 + * Delete all cors configuraiton of a bucket * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteBucketCors($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php index ec0c37f8f..04d2edd64 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/BucketLifecycle.php @@ -11,9 +11,9 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//******************************* 简单使用 ******************************************************* +//******************************* Simple Usage ******************************************************* -//设置lifecycle规则 +// Set lifecycle configuration $lifecycleConfig = new LifecycleConfig(); $actions = array(); $actions[] = new LifecycleAction("Expiration", "Days", 3); @@ -22,16 +22,16 @@ $lifecycleConfig->addRule($lifecycleRule); $ossClient->putBucketLifecycle($bucket, $lifecycleConfig); Common::println("bucket $bucket lifecycleConfig created:" . $lifecycleConfig->serializeToXml()); -//获取lifecycle规则 +// Get lifecycle configuration $lifecycleConfig = $ossClient->getBucketLifecycle($bucket); Common::println("bucket $bucket lifecycleConfig fetched:" . $lifecycleConfig->serializeToXml()); -//删除bucket的lifecycle配置 +// Delete bucket lifecycle configuration $ossClient->deleteBucketLifecycle($bucket); Common::println("bucket $bucket lifecycleConfig deleted"); -//***************************** 完整用法参考下面函数 *********************************************** +//***************************** For complete usage, see the following functions *********************************************** putBucketLifecycle($ossClient, $bucket); getBucketLifecycle($ossClient, $bucket); @@ -39,10 +39,10 @@ deleteBucketLifecycle($ossClient, $bucket); getBucketLifecycle($ossClient, $bucket); /** - * 设置bucket的生命周期配置 + * Set bucket lifecycle configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putBucketLifecycle($ossClient, $bucket) @@ -67,10 +67,10 @@ function putBucketLifecycle($ossClient, $bucket) } /** - * 获取bucket的生命周期配置 + * Get bucket lifecycle configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketLifecycle($ossClient, $bucket) @@ -88,10 +88,10 @@ function getBucketLifecycle($ossClient, $bucket) } /** - * 删除bucket的生命周期配置 + * Delete bucket lifecycle configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteBucketLifecycle($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php index 406e1d472..eef71f221 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/BucketLogging.php @@ -8,21 +8,21 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//*******************************Simple Usage *************************************************************** -// 设置Bucket访问日志记录规则, 访问日志文件的存放位置是同bucket下的access.log前缀的文件 +// Set bucket access logging rules. Access logs are stored under the same bucket with a 'access.log' prefix. $ossClient->putBucketLogging($bucket, $bucket, "access.log", array()); Common::println("bucket $bucket lifecycleConfig created"); -// 获取Bucket访问日志记录规则 +// Get bucket access logging rules $loggingConfig = $ossClient->getBucketLogging($bucket, array()); Common::println("bucket $bucket lifecycleConfig fetched:" . $loggingConfig->serializeToXml()); -// 删除Bucket访问日志记录规则 +// Delete bucket access logging rules $loggingConfig = $ossClient->getBucketLogging($bucket, array()); Common::println("bucket $bucket lifecycleConfig deleted"); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** putBucketLogging($ossClient, $bucket); getBucketLogging($ossClient, $bucket); @@ -30,16 +30,16 @@ deleteBucketLogging($ossClient, $bucket); getBucketLogging($ossClient, $bucket); /** - * 设置bucket的Logging配置 + * Set bucket logging configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putBucketLogging($ossClient, $bucket) { $option = array(); - //访问日志存放在本bucket下 + // Access logs are stored in the same bucket. $targetBucket = $bucket; $targetPrefix = "access.log"; @@ -54,10 +54,10 @@ function putBucketLogging($ossClient, $bucket) } /** - * 获取bucket的Logging配置 + * Get bucket logging configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketLogging($ossClient, $bucket) @@ -76,10 +76,10 @@ function getBucketLogging($ossClient, $bucket) } /** - * 删除bucket的Logging配置 + * Delete bucket logging configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteBucketLogging($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php index 3828df696..628f7846b 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/BucketReferer.php @@ -9,26 +9,26 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//******************************* 简单使用 **************************************************************** +//******************************* Simple Usage **************************************************************** -//设置referer白名单 +// Set referer whitelist $refererConfig = new RefererConfig(); $refererConfig->setAllowEmptyReferer(true); $refererConfig->addReferer("www.aliiyun.com"); $refererConfig->addReferer("www.aliiyuncs.com"); $ossClient->putBucketReferer($bucket, $refererConfig); Common::println("bucket $bucket refererConfig created:" . $refererConfig->serializeToXml()); -//获取Referer白名单 +// Get referer whitelist $refererConfig = $ossClient->getBucketReferer($bucket); Common::println("bucket $bucket refererConfig fetched:" . $refererConfig->serializeToXml()); -//删除referer白名单 +// Delete referrer whitelist $refererConfig = new RefererConfig(); $ossClient->putBucketReferer($bucket, $refererConfig); Common::println("bucket $bucket refererConfig deleted"); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** putBucketReferer($ossClient, $bucket); getBucketReferer($ossClient, $bucket); @@ -36,10 +36,10 @@ deleteBucketReferer($ossClient, $bucket); getBucketReferer($ossClient, $bucket); /** - * 设置bucket的防盗链配置 + * Set bucket referer configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putBucketReferer($ossClient, $bucket) @@ -59,10 +59,10 @@ function putBucketReferer($ossClient, $bucket) } /** - * 获取bucket的防盗链配置 + * Get bucket referer configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketReferer($ossClient, $bucket) @@ -80,11 +80,11 @@ function getBucketReferer($ossClient, $bucket) } /** - * 删除bucket的防盗链配置 - * Referer白名单不能直接清空,只能通过重新设置来覆盖之前的规则。 + * Delete bucket referer configuration + * Referer whitelist cannot be directly deleted. So use a empty one to overwrite it. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteBucketReferer($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php b/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php index 54706f834..6c387e68f 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/BucketWebsite.php @@ -9,22 +9,22 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//******************************* Simple Usage *************************************************************** -// 设置Bucket的静态网站托管模式 +// Set bucket static website configuration $websiteConfig = new WebsiteConfig("index.html", "error.html"); $ossClient->putBucketWebsite($bucket, $websiteConfig); Common::println("bucket $bucket websiteConfig created:" . $websiteConfig->serializeToXml()); -// 查看Bucket的静态网站托管状态 +// Get bucket static website configuration $websiteConfig = $ossClient->getBucketWebsite($bucket); Common::println("bucket $bucket websiteConfig fetched:" . $websiteConfig->serializeToXml()); -// 删除Bucket的静态网站托管模式 +// Delete bucket static website configuration $ossClient->deleteBucketWebsite($bucket); Common::println("bucket $bucket websiteConfig deleted"); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** putBucketWebsite($ossClient, $bucket); getBucketWebsite($ossClient, $bucket); @@ -32,10 +32,10 @@ deleteBucketWebsite($ossClient, $bucket); getBucketWebsite($ossClient, $bucket); /** - * 设置bucket的静态网站托管模式配置 + * Sets bucket static website configuration * * @param $ossClient OssClient - * @param $bucket string 存储空间名称 + * @param $bucket string bucket name * @return null */ function putBucketWebsite($ossClient, $bucket) @@ -52,10 +52,10 @@ function putBucketWebsite($ossClient, $bucket) } /** - * 获取bucket的静态网站托管状态 + * Get bucket static website configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getBucketWebsite($ossClient, $bucket) @@ -73,10 +73,10 @@ function getBucketWebsite($ossClient, $bucket) } /** - * 删除bucket的静态网站托管模式配置 + * Delete bucket static website configuration * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteBucketWebsite($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Callback.php b/vendor/aliyuncs/oss-sdk-php/samples/Callback.php index 8612a1c54..4b7bc41ca 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Callback.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Callback.php @@ -7,14 +7,14 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//******************************* Simple Usage *************************************************************** -/** putObject 使用callback上传内容到oss文件 - * callbackurl参数指定请求回调的服务器url - * callbackbodytype参数可为application/json或application/x-www-form-urlencoded, 可选参数,默认为application/x-www-form-urlencoded - * OSS_CALLBACK_VAR参数可以不设置 +/** putObject Upload content to an OSS file using callback. + * The callbackurl specifies the server url for the request callback. + * The callbackbodytype can be application/json or application/x-www-form-urlencoded,the optional parameters,the default for the application/x - WWW - form - urlencoded + * Users can choose not to set OSS_BACK_VAR */ -$url = +$url = '{ "callbackUrl":"callback.oss-demo.com:23450", "callbackHost":"oss-cn-hangzhou.aliyuncs.com", @@ -35,17 +35,17 @@ Common::println($result['body']); Common::println($result['info']['http_code']); /** - * completeMultipartUpload 使用callback上传内容到oss文件 - * callbackurl参数指定请求回调的服务器url - * callbackbodytype参数可为application/json或application/x-www-form-urlencoded, 可选参数,默认为application/x-www-form-urlencoded - * OSS_CALLBACK_VAR参数可以不设置 - */ + * completeMultipartUpload Upload content to an OSS file using callback. + * callbackurl specifies the server url for the request callback + * The callbackbodytype can be application/json or application/x-www-form-urlencoded,the optional parameters,the default for the application/x - WWW - form - urlencoded + * Users can choose not to set OSS_BACK_VAR. + */ $object = "multipart-callback-test.txt"; $copiedObject = "multipart-callback-test.txt.copied"; $ossClient->putObject($bucket, $copiedObject, file_get_contents(__FILE__)); /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id + * step 1. Initialize a block upload event, that is, a multipart upload process to get an upload id */ $upload_id = $ossClient->initiateMultipartUpload($bucket, $object); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Common.php b/vendor/aliyuncs/oss-sdk-php/samples/Common.php index f419d1782..49bd49318 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Common.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Common.php @@ -14,7 +14,7 @@ use OSS\Core\OssException; /** * Class Common * - * 示例程序【Samples/*.php】 的Common类,用于获取OssClient实例和其他公用方法 + * The Common class for 【Samples/*.php】 used to obtain OssClient instance and other common functions */ class Common { @@ -24,9 +24,9 @@ class Common const bucket = Config::OSS_TEST_BUCKET; /** - * 根据Config配置,得到一个OssClient实例 + * Get an OSSClient instance according to config. * - * @return OssClient 一个OssClient实例 + * @return OssClient An OssClient instance */ public static function getOssClient() { @@ -46,7 +46,7 @@ class Common } /** - * 工具方法,创建一个存储空间,如果发生异常直接exit + * A tool function which creates a bucket and exists the process if there are exceptions */ public static function createBucket() { @@ -81,4 +81,4 @@ class Common } } -Common::createBucket(); +# Common::createBucket(); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Config.php b/vendor/aliyuncs/oss-sdk-php/samples/Config.php index 35c0dc7c4..fc3a1673a 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Config.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Config.php @@ -3,13 +3,13 @@ /** * Class Config * - * 执行Sample示例所需要的配置,用户在这里配置好Endpoint,AccessId, AccessKey和Sample示例操作的 - * bucket后,便可以直接运行RunAll.php, 运行所有的samples + * Make configurations required by the sample. + * Users can run RunAll.php which runs all the samples after configuring Endpoint, AccessId, and AccessKey. */ final class Config { - const OSS_ACCESS_ID = ''; - const OSS_ACCESS_KEY = ''; - const OSS_ENDPOINT = ''; - const OSS_TEST_BUCKET = ''; + const OSS_ACCESS_ID = 'update me'; + const OSS_ACCESS_KEY = 'update me'; + const OSS_ENDPOINT = 'update me'; + const OSS_TEST_BUCKET = 'update me'; } diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Image.php b/vendor/aliyuncs/oss-sdk-php/samples/Image.php index 53ec04758..6e51d06d2 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Image.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Image.php @@ -9,54 +9,54 @@ $ossClient = Common::getOssClient(); $download_file = "download.jpg"; if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//******************************* Simple Usage *************************************************************** -// 先把本地的example.jpg上传到指定$bucket, 命名为$object +// Upload example.jpg to the specified bucket and rename it to $object. $ossClient->uploadFile($bucketName, $object, "example.jpg"); -// 图片缩放 +// Image resize $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/resize,m_fixed,h_100,w_100", ); $ossClient->getObject($bucketName, $object, $options); printImage("imageResize",$download_file); -// 图片裁剪 +// Image crop $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/crop,w_100,h_100,x_100,y_100,r_1", ); $ossClient->getObject($bucketName, $object, $options); printImage("iamgeCrop", $download_file); -// 图片旋转 +// Image rotate $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/rotate,90", ); $ossClient->getObject($bucketName, $object, $options); printImage("imageRotate", $download_file); -// 图片锐化 +// Image sharpen $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/sharpen,100", ); $ossClient->getObject($bucketName, $object, $options); printImage("imageSharpen", $download_file); -// 图片水印 +// Add watermark into a image $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/watermark,text_SGVsbG8g5Zu-54mH5pyN5YqhIQ", ); $ossClient->getObject($bucketName, $object, $options); printImage("imageWatermark", $download_file); -// 图片格式转换 +// Image format convertion $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/format,png", ); $ossClient->getObject($bucketName, $object, $options); printImage("imageFormat", $download_file); -// 获取图片信息 +// Get image information $options = array( OssClient::OSS_FILE_DOWNLOAD => $download_file, OssClient::OSS_PROCESS => "image/info", ); @@ -65,7 +65,7 @@ printImage("imageInfo", $download_file); /** - * 生成一个带签名的可用于浏览器直接打开的url, URL的有效期是3600秒 + * Generate a signed url which could be used in browser to access the object. The expiration time is 1 hour. */ $timeout = 3600; $options = array( @@ -74,7 +74,7 @@ $options = array( $signedUrl = $ossClient->signUrl($bucketName, $object, $timeout, "GET", $options); Common::println("rtmp url: \n" . $signedUrl); -//最后删除上传的$object +// Finally delete the $object uploaded. $ossClient->deleteObject($bucketName, $object); function printImage($func, $imageFile) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php b/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php index 2f7d3a8b9..67bb5415e 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/LiveChannel.php @@ -8,11 +8,14 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//******************************* 简单使用 ******************************************************* +//******************************* Simple Usage ******************************************************* /** - 创建一个直播频道 - 频道的名称是test_rtmp_live。直播生成的m3u8文件叫做test.m3u8,该索引文件包含3片ts文件,每片ts文件的时长为5秒(这只是一个建议值,具体的时长取决于关键帧)。 + * Create a Live Channel + * The live channel's name is test_rtmp_live. + * The play url file is named as test.m3u8, which includes 3 ts files. + * The time period of each file is 5 seconds.(It is recommneded value only for demo purpose, the actual period depends on the key frame.) + * */ $config = new LiveChannelConfig(array( 'description' => 'live channel test', @@ -29,9 +32,9 @@ Common::println("bucket $bucket liveChannel created:\n" . "playurls: ". $info->getPlayUrls()[0] . "\n"); /** - 对创建好的频道,可以使用listBucketLiveChannels来进行列举已达到管理的目的。 - prefix可以按照前缀过滤list出来的频道。 - max_keys表示迭代器内部一次list出来的频道的最大数量,这个值最大不能超过1000,不填写的话默认为100。 + * You can use listBucketLiveChannels to list and manage all existing live channels. + * Prefix can be used to filter listed live channels by prefix. + * Max_keys indicates the maximum numbers of live channels that can be listed in an iterator at one time. Its value is 1000 in maximum and 100 by default. */ $list = $ossClient->listBucketLiveChannels($bucket); Common::println("bucket $bucket listLiveChannel:\n" . @@ -50,7 +53,9 @@ foreach($list->getChannelList() as $list) "list live channel getNextMarker: ". $list->getLastModified() . "\n"); } /** - 创建直播频道之后拿到推流用的play_url(rtmp推流的url,如果Bucket不是公共读写权限那么还需要带上签名,见下文示例)和推流用的publish_url(推流产生的m3u8文件的url) + * Obtain the play_url (url used for rtmp stream pushing. + * If the the bucket is not globally readable and writable, + * the url must be signed as shown in the following.) and pulish_url (the url included in the m3u8 file generated in stream pushing) used to push streams. */ $play_url = $ossClient->signRtmpUrl($bucket, "test_rtmp_live", 3600, array('params' => array('playlistName' => 'playlist.m3u8'))); Common::println("bucket $bucket rtmp url: \n" . $play_url); @@ -58,12 +63,13 @@ $play_url = $ossClient->signRtmpUrl($bucket, "test_rtmp_live", 3600); Common::println("bucket $bucket rtmp url: \n" . $play_url); /** - 创建好直播频道,如果想把这个频道禁用掉(断掉正在推的流或者不再允许向一个地址推流),应该使用putLiveChannelStatus接口,将频道的status改成“Disabled”,如果要将一个禁用状态的频道启用,那么也是调用这个接口,将status改成“Enabled” + * If you want to disable a created live channel (disable the pushing streaming or do not allow stream pushing to an IP address), call putLiveChannelStatus to change the channel status to "Disabled". + * If you want to enable a disabled live channel, call PutLiveChannelStatus to chanage the channel status to "Enabled". */ $resp = $ossClient->putLiveChannelStatus($bucket, "test_rtmp_live", "enabled"); /** - 创建好直播频道之后调用getLiveChannelInfo可以得到频道相关的信息 + * You can callLiveChannelInfo to get the information about a live channel. */ $info = $ossClient->getLiveChannelInfo($bucket, 'test_rtmp_live'); Common::println("bucket $bucket LiveChannelInfo:\n" . @@ -75,7 +81,7 @@ Common::println("bucket $bucket LiveChannelInfo:\n" . "live channel info playListName: ". $info->getPlayListName() . "\n"); /** - 如果想查看一个频道历史推流记录,可以调用getLiveChannelHistory。目前最多可以看到10次推流的记录 + * Gets the historical pushing streaming records by calling getLiveChannelHistory. Now the max records to return is 10. */ $history = $ossClient->getLiveChannelHistory($bucket, "test_rtmp_live"); if (count($history->getLiveRecordList()) != 0) @@ -90,9 +96,9 @@ if (count($history->getLiveRecordList()) != 0) } /** - 对于正在推流的频道调用get_live_channel_stat可以获得流的状态信息。 - 如果频道正在推流,那么stat_result中的所有字段都有意义。 - 如果频道闲置或者处于“Disabled”状态,那么status为“Idle”或“Disabled”,其他字段无意义。 + * Get the live channel's status by calling getLiveChannelStatus. + * If the live channel is receiving the pushing stream, all attributes in stat_result are valid. + * If the live channel is idle or disabled, then the status is idle or Disabled and other attributes have no meaning. */ $status = $ossClient->getLiveChannelStatus($bucket, "test_rtmp_live"); Common::println("bucket $bucket listLiveChannel:\n" . @@ -108,9 +114,9 @@ Common::println("bucket $bucket listLiveChannel:\n" . "live channel status AdioCodec: ". $status->getAudioCodec() . "\n"); /** - * 如果希望利用直播推流产生的ts文件生成一个点播列表,可以使用postVodPlaylist方法。 - * 指定起始时间为当前时间减去60秒,结束时间为当前时间,这意味着将生成一个长度为60秒的点播视频。 - * 播放列表指定为“vod_playlist.m3u8”,也就是说这个接口调用成功之后会在OSS上生成一个名叫“vod_playlist.m3u8”的播放列表文件。 + * If you want to generate a play url from the ts files generated from pushing streaming, call postVodPlayList. + * Specify the start time to 60 seconds before the current time and the end time to the current time, which means that a video of 60 seconds is generated. + * The playlist file is specified to “vod_playlist.m3u8”, which means that a palylist file named vod_playlist.m3u8 is created after the interface is called. */ $current_time = time(); $ossClient->postVodPlaylist($bucket, @@ -120,6 +126,6 @@ $ossClient->postVodPlaylist($bucket, ); /** - * 如果一个直播频道已经不打算再使用了,那么可以调用delete_live_channel来删除频道。 + * Call delete_live_channel to delete a live channel if it will no longer be in used. */ $ossClient->deleteBucketLiveChannel($bucket, "test_rtmp_live"); diff --git a/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php b/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php index e8d69a3ee..21756b7cd 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/MultipartUpload.php @@ -9,27 +9,27 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//******************************* Simple usage *************************************************************** /** - * 查看完整用法中的 "putObjectByRawApis"函数,查看使用基础的分片上传api进行文件上传,用户可以基于这个自行实现断点续传等功能 + * See the putObjectByRawAPis usage in complete example to check out basic multipart upload APIs which can be used as resumable upload. */ -// 使用分片上传接口上传文件, 接口会根据文件大小决定是使用普通上传还是分片上传 +// Upload a file using the multipart upload interface, which determines to use simple upload or multipart upload based on the file size. $ossClient->multiuploadFile($bucket, "file.php", __FILE__, array()); Common::println("local file " . __FILE__ . " is uploaded to the bucket $bucket, file.php"); -// 上传本地目录到bucket内的targetdir子目录中 +// Upload local directory's data into target dir $ossClient->uploadDir($bucket, "targetdir", __DIR__); Common::println("local dir " . __DIR__ . " is uploaded to the bucket $bucket, targetdir/"); -// 列出当前未完成的分片上传 +// List the incomplete multipart uploads $listMultipartUploadInfo = $ossClient->listMultipartUploads($bucket, array()); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** multiuploadFile($ossClient, $bucket); putObjectByRawApis($ossClient, $bucket); @@ -37,10 +37,10 @@ uploadDir($ossClient, $bucket); listMultipartUploads($ossClient, $bucket); /** - * 通过multipart上传文件 + * Upload files using multipart upload * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function multiuploadFile($ossClient, $bucket) @@ -60,17 +60,17 @@ function multiuploadFile($ossClient, $bucket) } /** - * 使用基本的api分阶段进行分片上传 + * Use basic multipart upload for file upload. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @throws OssException */ function putObjectByRawApis($ossClient, $bucket) { $object = "test/multipart-test.txt"; /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id + * step 1. Initialize a block upload event, that is, a multipart upload process to get an upload id */ try { $uploadId = $ossClient->initiateMultipartUpload($bucket, $object); @@ -81,7 +81,7 @@ function putObjectByRawApis($ossClient, $bucket) } print(__FUNCTION__ . ": initiateMultipartUpload OK" . "\n"); /* - * step 2. 上传分片 + * step 2. Upload parts */ $partSize = 10 * 1024 * 1024; $uploadFile = __FILE__; @@ -104,7 +104,7 @@ function putObjectByRawApis($ossClient, $bucket) $contentMd5 = OssUtil::getMd5SumForFile($uploadFile, $fromPos, $toPos); $upOptions[$ossClient::OSS_CONTENT_MD5] = $contentMd5; } - //2. 将每一分片上传到OSS + //2. Upload each part to OSS try { $responseUploadPart[] = $ossClient->uploadPart($bucket, $object, $uploadId, $upOptions); } catch (OssException $e) { @@ -122,7 +122,7 @@ function putObjectByRawApis($ossClient, $bucket) ); } /** - * step 3. 完成上传 + * step 3. Complete the upload */ try { $ossClient->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts); @@ -135,10 +135,10 @@ function putObjectByRawApis($ossClient, $bucket) } /** - * 按照目录上传文件 + * Upload by directories * * @param OssClient $ossClient OssClient - * @param string $bucket 存储空间名称 + * @param string $bucket bucket name * */ function uploadDir($ossClient, $bucket) @@ -156,7 +156,7 @@ function uploadDir($ossClient, $bucket) } /** - * 获取当前未完成的分片上传列表 + * Get ongoing multipart uploads * * @param $ossClient OssClient * @param $bucket string diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Object.php b/vendor/aliyuncs/oss-sdk-php/samples/Object.php index 3bf024b02..ae6eb839a 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Object.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Object.php @@ -7,9 +7,9 @@ use OSS\Core\OssException; $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//*******************************简单使用*************************************************************** +//******************************* Simple usage *************************************************************** -// 简单上传变量的内容到oss文件 +// Upload the in-memory string (hi, oss) to an OSS file $result = $ossClient->putObject($bucket, "b.file", "hi, oss"); Common::println("b.file is created"); Common::println($result['x-oss-request-id']); @@ -17,7 +17,7 @@ Common::println($result['etag']); Common::println($result['content-md5']); Common::println($result['body']); -// 上传本地文件 +// Uploads a local file to an OSS file $result = $ossClient->uploadFile($bucket, "c.file", __FILE__); Common::println("c.file is created"); Common::println("b.file is created"); @@ -26,21 +26,21 @@ Common::println($result['etag']); Common::println($result['content-md5']); Common::println($result['body']); -// 下载object到本地变量 +// Download an oss object as an in-memory variable $content = $ossClient->getObject($bucket, "b.file"); Common::println("b.file is fetched, the content is: " . $content); -// 给object添加symlink +// Add a symlink to an object $content = $ossClient->putSymlink($bucket, "test-symlink", "b.file"); Common::println("test-symlink is created"); Common::println($result['x-oss-request-id']); Common::println($result['etag']); -// 获取symlink +// Get a symlink $content = $ossClient->getSymlink($bucket, "test-symlink"); Common::println("test-symlink refer to : " . $content[OssClient::OSS_SYMLINK_TARGET]); -// 下载object到本地文件 +// Download an object to a local file. $options = array( OssClient::OSS_FILE_DOWNLOAD => "./c.file.localcopy", ); @@ -48,26 +48,26 @@ $ossClient->getObject($bucket, "c.file", $options); Common::println("b.file is fetched to the local file: c.file.localcopy"); Common::println("b.file is created"); -// 拷贝object +// Copy an object $result = $ossClient->copyObject($bucket, "c.file", $bucket, "c.file.copy"); Common::println("lastModifiedTime: " . $result[0]); Common::println("ETag: " . $result[1]); -// 判断object是否存在 +// Check whether an object exists $doesExist = $ossClient->doesObjectExist($bucket, "c.file.copy"); Common::println("file c.file.copy exist? " . ($doesExist ? "yes" : "no")); -// 删除object +// Delete an object $result = $ossClient->deleteObject($bucket, "c.file.copy"); Common::println("c.file.copy is deleted"); Common::println("b.file is created"); Common::println($result['x-oss-request-id']); -// 判断object是否存在 +// Check whether an object exists $doesExist = $ossClient->doesObjectExist($bucket, "c.file.copy"); Common::println("file c.file.copy exist? " . ($doesExist ? "yes" : "no")); -// 批量删除object +// Delete multiple objects in batch $result = $ossClient->deleteObjects($bucket, array("b.file", "c.file")); foreach($result as $object) Common::println($object); @@ -75,7 +75,7 @@ foreach($result as $object) sleep(2); unlink("c.file.localcopy"); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** listObjects($ossClient, $bucket); listAllObjects($ossClient, $bucket); @@ -93,10 +93,10 @@ doesObjectExist($ossClient, $bucket); getSymlink($ossClient, $bucket); putSymlink($ossClient, $bucket); /** - * 创建虚拟目录 + * Create a 'virtual' folder * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function createObjectDir($ossClient, $bucket) @@ -112,12 +112,12 @@ function createObjectDir($ossClient, $bucket) } /** - * 把本地变量的内容到文件 + * Upload in-memory data to oss * - * 简单上传,上传指定变量的内存值作为object的内容 + * Simple upload---upload specified in-memory data to an OSS object * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function putObject($ossClient, $bucket) @@ -137,10 +137,10 @@ function putObject($ossClient, $bucket) /** - * 上传指定的本地文件内容 + * Uploads a local file to OSS * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function uploadFile($ossClient, $bucket) @@ -160,11 +160,12 @@ function uploadFile($ossClient, $bucket) } /** - * 列出Bucket内所有目录和文件, 注意如果符合条件的文件数目超过设置的max-keys, 用户需要使用返回的nextMarker作为入参,通过 - * 循环调用ListObjects得到所有的文件,具体操作见下面的 listAllObjects 示例 + * Lists all files and folders in the bucket. + * Note if there's more items than the max-keys specified, the caller needs to use the nextMarker returned as the value for the next call's maker paramter. + * Loop through all the items returned from ListObjects. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function listObjects($ossClient, $bucket) @@ -187,8 +188,8 @@ function listObjects($ossClient, $bucket) return; } print(__FUNCTION__ . ": OK" . "\n"); - $objectList = $listObjectInfo->getObjectList(); // 文件列表 - $prefixList = $listObjectInfo->getPrefixList(); // 目录列表 + $objectList = $listObjectInfo->getObjectList(); // object list + $prefixList = $listObjectInfo->getPrefixList(); // directory list if (!empty($objectList)) { print("objectList:\n"); foreach ($objectList as $objectInfo) { @@ -204,15 +205,15 @@ function listObjects($ossClient, $bucket) } /** - * 列出Bucket内所有目录和文件, 根据返回的nextMarker循环得到所有Objects + * Lists all folders and files under the bucket. Use nextMarker repeatedly to get all objects. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function listAllObjects($ossClient, $bucket) { - //构造dir下的文件和虚拟目录 + // Create dir/obj 'folder' and put some files into it. for ($i = 0; $i < 100; $i += 1) { $ossClient->putObject($bucket, "dir/obj" . strval($i), "hi"); $ossClient->createObjectDir($bucket, "dir/obj" . strval($i)); @@ -238,7 +239,7 @@ function listAllObjects($ossClient, $bucket) printf($e->getMessage() . "\n"); return; } - // 得到nextMarker,从上一次listObjects读到的最后一个文件的下一个文件开始继续获取文件列表 + // Get the nextMarker, and it would be used as the next call's marker parameter to resume from the last call $nextMarker = $listObjectInfo->getNextMarker(); $listObject = $listObjectInfo->getObjectList(); $listPrefix = $listObjectInfo->getPrefixList(); @@ -251,10 +252,10 @@ function listAllObjects($ossClient, $bucket) } /** - * 获取object的内容 + * Get the content of an object. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getObject($ossClient, $bucket) @@ -277,10 +278,10 @@ function getObject($ossClient, $bucket) } /** - * put symlink + * Put symlink * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient The Instance of OssClient + * @param string $bucket bucket name * @return null */ function putSymlink($ossClient, $bucket) @@ -305,10 +306,10 @@ function putSymlink($ossClient, $bucket) } /** - * 获取symlink + * Get symlink * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getSymlink($ossClient, $bucket) @@ -333,13 +334,13 @@ function getSymlink($ossClient, $bucket) } /** - * get_object_to_local_file + * Get_object_to_local_file * - * 获取object - * 将object下载到指定的文件 + * Get object + * Download object to a specified file. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getObjectToLocalFile($ossClient, $bucket) @@ -369,11 +370,11 @@ function getObjectToLocalFile($ossClient, $bucket) } /** - * 拷贝object - * 当目的object和源object完全相同时,表示修改object的meta信息 + * Copy object + * When the source object is same as the target one, copy operation will just update the metadata. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function copyObject($ossClient, $bucket) @@ -395,11 +396,11 @@ function copyObject($ossClient, $bucket) } /** - * 修改Object Meta - * 利用copyObject接口的特性:当目的object和源object完全相同时,表示修改object的meta信息 + * Update Object Meta + * it leverages the feature of copyObject: when the source object is just the target object, the metadata could be updated via copy * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function modifyMetaForObject($ossClient, $bucket) @@ -425,10 +426,10 @@ function modifyMetaForObject($ossClient, $bucket) } /** - * 获取object meta, 也就是getObjectMeta接口 + * Get object meta, that is, getObjectMeta * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function getObjectMeta($ossClient, $bucket) @@ -452,10 +453,10 @@ function getObjectMeta($ossClient, $bucket) } /** - * 删除object + * Delete an object * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteObject($ossClient, $bucket) @@ -473,10 +474,10 @@ function deleteObject($ossClient, $bucket) /** - * 批量删除object + * Delete multiple objects in batch * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function deleteObjects($ossClient, $bucket) @@ -495,10 +496,10 @@ function deleteObjects($ossClient, $bucket) } /** - * 判断object是否存在 + * Check whether an object exists * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null */ function doesObjectExist($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php b/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php index a4d6d9b9c..0cd7ec163 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/RunAll.php @@ -9,5 +9,5 @@ require_once __DIR__ . '/BucketReferer.php'; require_once __DIR__ . '/BucketLogging.php'; require_once __DIR__ . '/BucketWebsite.php'; require_once __DIR__ . '/Signature.php'; -require_once __DIR__ . '/Object.php'; +require_once __DIR__ . '/Object1.php'; require_once __DIR__ . '/MultipartUpload.php'; \ No newline at end of file diff --git a/vendor/aliyuncs/oss-sdk-php/samples/Signature.php b/vendor/aliyuncs/oss-sdk-php/samples/Signature.php index 5ef2b7dde..eef598122 100644 --- a/vendor/aliyuncs/oss-sdk-php/samples/Signature.php +++ b/vendor/aliyuncs/oss-sdk-php/samples/Signature.php @@ -10,33 +10,33 @@ $bucket = Common::getBucketName(); $ossClient = Common::getOssClient(); if (is_null($ossClient)) exit(1); -//******************************* 简单使用 *************************************************************** +//******************************* Simple Usage *************************************************************** $ossClient->uploadFile($bucket, "a.file", __FILE__); -// 生成GetObject的签名url,用户可以使用这个url直接在浏览器下载 +// Generate a signed url for getting an object. The URL can be used in browser directly to download the file. $signedUrl = $ossClient->signUrl($bucket, "a.file", 3600); Common::println($signedUrl); -// 生成用于putObject的签名URL,用户可以直接用put方法使用这个url上传文件到 "a.file" +// Generate the signed url for putting an object. User can use put method with this url to upload a file to "a.file". $signedUrl = $ossClient->signUrl($bucket, "a.file", "3600", "PUT"); Common::println($signedUrl); -// 生成从本地文件上传PutObject的签名url, 用户可以直接使用这个url把本地文件上传到 "a.file" +// Generate the signed url for putting an object from local file. The url can be used directly to upload the file to "a.file". $signedUrl = $ossClient->signUrl($bucket, "a.file", 3600, "PUT", array('Content-Type' => 'txt')); Common::println($signedUrl); -//******************************* 完整用法参考下面函数 **************************************************** +//******************************* For complete usage, see the following functions **************************************************** getSignedUrlForPuttingObject($ossClient, $bucket); getSignedUrlForPuttingObjectFromFile($ossClient, $bucket); getSignedUrlForGettingObject($ossClient, $bucket); /** - * 生成GetObject的签名url,主要用于私有权限下的读访问控制 + * Generate the signed url for getObject() to control read accesses under private privilege * - * @param $ossClient OssClient OssClient实例 - * @param $bucket string 存储空间名称 + * @param $ossClient OssClient OssClient instance + * @param $bucket string bucket name * @return null */ function getSignedUrlForGettingObject($ossClient, $bucket) @@ -52,7 +52,7 @@ function getSignedUrlForGettingObject($ossClient, $bucket) } print(__FUNCTION__ . ": signedUrl: " . $signedUrl . "\n"); /** - * 可以类似的代码来访问签名的URL,也可以输入到浏览器中去访问 + * Use similar code to access the object by url, or use browser to access the object. */ $request = new RequestCore($signedUrl); $request->set_method('GET'); @@ -67,10 +67,10 @@ function getSignedUrlForGettingObject($ossClient, $bucket) } /** - * 生成PutObject的签名url,主要用于私有权限下的写访问控制 + * Generate the signed url for PutObject to control write accesses under private privilege. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @return null * @throws OssException */ @@ -105,11 +105,10 @@ function getSignedUrlForPuttingObject($ossClient, $bucket) } /** - * 生成PutObject的签名url,主要用于私有权限下的写访问控制, 用户可以利用生成的signedUrl - * 从文件上传文件 + * Generate the signed url for PutObject's signed url. User could use the signed url to upload file directly. * - * @param OssClient $ossClient OssClient实例 - * @param string $bucket 存储空间名称 + * @param OssClient $ossClient OssClient instance + * @param string $bucket bucket name * @throws OssException */ function getSignedUrlForPuttingObjectFromFile($ossClient, $bucket) diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php index e9b88ffa8..17685c31f 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/MimeTypes.php @@ -5,16 +5,17 @@ namespace OSS\Core; /** * Class MimeTypes * - * 在上传文件的时候,根据文件的缺省名,得到其对应的Content-type + * The map of a file's extention name to its corresponding Content-Type value in the file upload request. + * If the file extention name is not predefined in this class, getMimetype() returns null. * * @package OSS\Core */ class MimeTypes { /** - * 根据文件名,获取http协议header中的content-type应该填写的数据 + * Get the content-type value of http header from the file's extension name. * - * @param string $name 缺省名 + * @param string $name Default file extension name. * @return string content-type */ public static function getMimetype($name) diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php index b0e9e8b0d..2320c9e8a 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssException.php @@ -5,8 +5,8 @@ namespace OSS\Core; /** * Class OssException * - * OssClient在使用的时候,所抛出的异常,用户在使用OssClient的时候,要Try住相关代码, - * try的Exception应该是OssException,其中会得到相关异常原因 + * This is the class that OSSClient is expected to thrown, which the caller needs to handle properly. + * It has the OSS specific errors which is useful for troubleshooting. * * @package OSS\Core */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php index 6e5d4133d..541d2c344 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Core/OssUtil.php @@ -5,7 +5,7 @@ namespace OSS\Core; /** * Class OssUtil * - * Oss工具类,主要供OssClient使用,用户也可以使用本类进行返回结果的格式化 + * Oss Util class for OssClient. The caller could use it for formating the result from OssClient. * * @package OSS */ @@ -20,10 +20,10 @@ class OssUtil const OSS_MIN_PART_SIZE = 102400; // 100KB /** - * 生成query params + * Generate query params * - * @param array $options 关联数组 - * @return string 返回诸如 key1=value1&key2=value2 + * @param array $options: a key-value pair array. + * @return string: the key-value list in the format such as key1=value1&key2=value2 */ public static function toQueryString($options = array()) { @@ -38,7 +38,7 @@ class OssUtil } /** - * 转义字符替换 + * Html encoding '<', '>', '&', '\', '"' in subject parameter. * * @param string $subject * @return string @@ -51,7 +51,7 @@ class OssUtil } /** - * 检查是否是中文编码 + * Check whether the string includes any chinese character * * @param $str * @return int @@ -62,10 +62,10 @@ class OssUtil } /** - * 检测是否GB2312编码 + * Checks if the string is encoded by GB2312. * * @param string $str - * @return boolean false UTF-8编码 TRUE GB2312编码 + * @return boolean false UTF-8 encoding TRUE GB2312 encoding */ public static function isGb2312($str) { @@ -87,7 +87,7 @@ class OssUtil } /** - * 检测是否GBK编码 + * Checks if the string is encoded by GBK * * @param string $str * @param boolean $gbk @@ -114,13 +114,13 @@ class OssUtil } /** - * 检验bucket名称是否合法 - * bucket的命名规范: - * 1. 只能包括小写字母,数字 - * 2. 必须以小写字母或者数字开头 - * 3. 长度必须在3-63字节之间 + * Checks if the bucket name is valid + * bucket naming rules + * 1. Can only include lowercase letters, numbers, or dashes + * 2. Must start and end with lowercase letters or numbers + * 3. Must be within a length from 3 to 63 bytes. * - * @param string $bucket Bucket名称 + * @param string $bucket Bucket name * @return boolean */ public static function validateBucket($bucket) @@ -133,11 +133,11 @@ class OssUtil } /** - * 检验object名称是否合法 - * object命名规范: - * 1. 规则长度必须在1-1023字节之间 - * 2. 使用UTF-8编码 - * 3. 不能以 "/" "\\"开头 + * Checks if object name is valid + * object naming rules: + * 1. Must be within a length from 1 to 1023 bytes + * 2. Cannot start with '/' or '\\'. + * 3. Must be encoded in UTF-8. * * @param string $object Object名称 * @return boolean @@ -155,7 +155,7 @@ class OssUtil /** - * 判断字符串$str是不是以$findMe开始 + * Checks if $str starts with $findMe * * @param string $str * @param string $findMe @@ -170,8 +170,9 @@ class OssUtil } } + /** - * 生成createBucketXmlBody接口的xml消息 + * Generate the xml message of createBucketXmlBody. * * @param string $storageClass * @return string @@ -184,7 +185,7 @@ class OssUtil } /** - * 检验$options + * validate $options * * @param array $options * @throws OssException @@ -199,7 +200,7 @@ class OssUtil } /** - * 检查上传文件的内容是否合法 + * check whether the Content is valid. * * @param $content string * @throws OssException @@ -212,7 +213,7 @@ class OssUtil } /** - * 校验BUCKET/OBJECT/OBJECT GROUP是否为空 + * Check if BUCKET/OBJECT/OBJECT GROUP is empty. * * @param string $name * @param string $errMsg @@ -227,7 +228,7 @@ class OssUtil } /** - * 仅供测试使用的接口,请勿使用 + * This is a method for test only. DO NOT USE. * * @param $filename * @param $size @@ -268,7 +269,7 @@ BBB; } /** - * 得到文件的md5编码 + * Get MD5 of the file. * * @param $filename * @param $from_pos @@ -318,7 +319,7 @@ BBB; } /** - * 检测是否windows系统,因为windows系统默认编码为GBK + * Check if the OS is Windows. The default encoding in Windows is GBK. * * @return bool */ @@ -328,7 +329,9 @@ BBB; } /** - * 主要是由于windows系统编码是gbk,遇到中文时候,如果不进行转换处理会出现找不到文件的问题 + * Encodes the file path from GBK to UTF-8. + * The default encoding in Windows is GBK. + * And if the file path is in Chinese, the file would not be found without the transcoding to UTF-8. * * @param $file_path * @return string @@ -342,9 +345,9 @@ BBB; } /** - * 判断用户输入的endpoint是否是 xxx.xxx.xxx.xxx:port 或者 xxx.xxx.xxx.xxx的ip格式 + * Check if the endpoint is in the IPv4 format, such as xxx.xxx.xxx.xxx:port or xxx.xxx.xxx.xxx. * - * @param string $endpoint 需要做判断的endpoint + * @param string $endpoint The endpoint to check. * @return boolean */ public static function isIPFormat($endpoint) @@ -360,7 +363,44 @@ BBB; } /** - * 生成DeleteMultiObjects接口的xml消息 + * Get the host:port from endpoint. + * + * @param string $endpoint the endpoint. + * @return boolean + */ + public static function getHostPortFromEndpoint($endpoint) + { + $str = $endpoint; + $pos = strpos($str, "://"); + if ($pos !== false) { + $str = substr($str, $pos+3); + } + + $pos = strpos($str, '#'); + if ($pos !== false) { + $str = substr($str, 0, $pos); + } + + $pos = strpos($str, '?'); + if ($pos !== false) { + $str = substr($str, 0, $pos); + } + + $pos = strpos($str, '/'); + if ($pos !== false) { + $str = substr($str, 0, $pos); + } + + $pos = strpos($str, '@'); + if ($pos !== false) { + $str = substr($str, $pos+1); + } + + return $str; + } + + /** + * Generate the xml message of DeleteMultiObjects. * * @param string[] $objects * @param bool $quiet @@ -379,7 +419,7 @@ BBB; } /** - * 生成CompleteMultipartUpload接口的xml消息 + * Generate the xml message of CompleteMultipartUpload. * * @param array[] $listParts * @return string @@ -396,7 +436,7 @@ BBB; } /** - * 读取目录 + * Read the directory, return a associative array in which the MD5 is the named key and the is the value. * * @param string $dir * @param string $exclude diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php index 06d0f8783..e1d221e25 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/RequestCore.php @@ -3,7 +3,7 @@ namespace OSS\Http; /** - * Handles all HTTP requests using cURL and manages the responses. + * Handle all HTTP requests using cURL and manages the responses. * * @version 2011.06.07 * @copyright 2006-2011 Ryan Parman @@ -75,7 +75,7 @@ class RequestCore public $method; /** - * Stores the proxy settings to use for the request. + * Store the proxy settings to use for the request. */ public $proxy = null; @@ -170,14 +170,14 @@ class RequestCore public $registered_streaming_write_callback = null; /** - * 请求超时时间, 默认是5184000秒,6天 + * The request timeout time, which is 5,184,000 seconds,that is, 6 days by default * * @var int */ public $timeout = 5184000; /** - * 连接超时时间,默认是10秒 + * The connection timeout time, which is 10 seconds by default * * @var int */ @@ -216,7 +216,7 @@ class RequestCore // CONSTRUCTOR/DESTRUCTOR /** - * Constructs a new instance of this class. + * Construct a new instance of this class. * * @param string $url (Optional) The URL to request or service endpoint to query. * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port` @@ -249,7 +249,7 @@ class RequestCore } /** - * Destructs the instance. Closes opened file handles. + * Destruct the instance. Closes opened file handles. * * @return $this A reference to the current instance. */ @@ -271,7 +271,7 @@ class RequestCore // REQUEST METHODS /** - * Sets the credentials to use for authentication. + * Set the credentials to use for authentication. * * @param string $user (Required) The username to authenticate with. * @param string $pass (Required) The password to authenticate with. @@ -285,7 +285,7 @@ class RequestCore } /** - * Adds a custom HTTP header to the cURL request. + * Add a custom HTTP header to the cURL request. * * @param string $key (Required) The custom HTTP header to set. * @param mixed $value (Required) The value to assign to the custom HTTP header. @@ -298,7 +298,7 @@ class RequestCore } /** - * Removes an HTTP header from the cURL request. + * Remove an HTTP header from the cURL request. * * @param string $key (Required) The custom HTTP header to set. * @return $this A reference to the current instance. @@ -324,7 +324,7 @@ class RequestCore } /** - * Sets a custom useragent string for the class. + * Set a custom useragent string for the class. * * @param string $ua (Required) The useragent string to use. * @return $this A reference to the current instance. @@ -373,7 +373,7 @@ class RequestCore } /** - * Sets the length in bytes to read from the stream while streaming up. + * Set the length in bytes to read from the stream while streaming up. * * @param integer $size (Required) The length in bytes to read from the stream. * @return $this A reference to the current instance. @@ -386,7 +386,7 @@ class RequestCore } /** - * Sets the resource to read from while streaming up. Reads the stream from its current position until + * Set the resource to read from while streaming up. Reads the stream from its current position until * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by and * . * @@ -414,7 +414,7 @@ class RequestCore } /** - * Sets the file to read from while streaming up. + * Set the file to read from while streaming up. * * @param string $location (Required) The readable location to read from. * @return $this A reference to the current instance. @@ -428,7 +428,7 @@ class RequestCore } /** - * Sets the resource to write to while streaming down. + * Set the resource to write to while streaming down. * * @param resource $resource (Required) The writeable resource to write to. * @return $this A reference to the current instance. @@ -441,7 +441,7 @@ class RequestCore } /** - * Sets the file to write to while streaming down. + * Set the file to write to while streaming down. * * @param string $location (Required) The writeable location to write to. * @return $this A reference to the current instance. @@ -631,7 +631,7 @@ class RequestCore } /** - * Prepares and adds the details of the cURL request. This can be passed along to a + * Prepare and adds the details of the cURL request. This can be passed along to a * function. * * @return resource The handle for the cURL object. @@ -685,7 +685,6 @@ class RequestCore // Enable a proxy connection if requested. if ($this->proxy) { - $host = $this->proxy['host']; $host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : ''; curl_setopt($curl_handle, CURLOPT_PROXY, $host); @@ -830,7 +829,7 @@ class RequestCore } /** - * Sends the request, calling necessary utility functions to update built-in properties. + * Send the request, calling necessary utility functions to update built-in properties. * * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not. * @return string The resulting unparsed data from the request. diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php index 106d181cf..909356159 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Http/ResponseCore.php @@ -8,25 +8,25 @@ namespace OSS\Http; class ResponseCore { /** - * Stores the HTTP header information. + * Store the HTTP header information. */ public $header; /** - * Stores the SimpleXML response. + * Store the SimpleXML response. */ public $body; /** - * Stores the HTTP response code. + * Store the HTTP response code. */ public $status; /** - * Constructs a new instance of this class. + * Construct a new instance of this class. * * @param array $header (Required) Associative array of HTTP headers (typically returned by ). - * @param string $body (Required) XML-formatted response from AWS. + * @param string $body (Required) XML-formatted response from OSS. * @param integer $status (Optional) HTTP response status code from the request. * @return Mixed Contains an `header` property (HTTP headers as an associative array), a or `body` property, and an `status` code. */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php index 9b89674f9..09e7deafb 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketInfo.php @@ -4,7 +4,7 @@ namespace OSS\Model; /** - * Bucket信息,ListBuckets接口返回数据 + * Bucket information class. This is the type of element in BucketListInfo's * * Class BucketInfo * @package OSS\Model @@ -26,7 +26,7 @@ class BucketInfo } /** - * 得到bucket所在的region + * Get bucket location * * @return string */ @@ -36,7 +36,7 @@ class BucketInfo } /** - * 得到bucket的名称 + * Get bucket name * * @return string */ @@ -46,7 +46,7 @@ class BucketInfo } /** - * 得到bucket的创建时间 + * Get bucket creation time. * * @return string */ @@ -56,20 +56,20 @@ class BucketInfo } /** - * bucket所在的region + * bucket region * * @var string */ private $location; /** - * bucket的名称 + * bucket name * * @var string */ private $name; /** - * bucket的创建事件 + * bucket creation time * * @var string */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php index 910717f92..ce03a0d7e 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/BucketListInfo.php @@ -5,7 +5,7 @@ namespace OSS\Model; /** * Class BucketListInfo * - * ListBuckets接口返回的数据类型 + * It's the type of return value of ListBuckets. * * @package OSS\Model */ @@ -21,7 +21,7 @@ class BucketListInfo } /** - * 得到BucketInfo列表 + * Get the BucketInfo list * * @return BucketInfo[] */ @@ -31,7 +31,7 @@ class BucketListInfo } /** - * BucketInfo信息列表 + * BucketInfo list * * @var array */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php index c44c10a1a..62a0d7103 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsConfig.php @@ -22,7 +22,7 @@ class CorsConfig implements XmlConfig } /** - * 得到CorsRule列表 + * Get CorsRule list * * @return CorsRule[] */ @@ -33,7 +33,7 @@ class CorsConfig implements XmlConfig /** - * 添加一条CorsRule + * Add a new CorsRule * * @param CorsRule $rule * @throws OssException @@ -47,7 +47,7 @@ class CorsConfig implements XmlConfig } /** - * 从xml数据中解析出CorsConfig + * Parse CorsConfig from the xml. * * @param string $strXml * @throws OssException @@ -78,7 +78,7 @@ class CorsConfig implements XmlConfig } /** - * 生成xml字符串 + * Serialize the object into xml string. * * @return string */ @@ -105,7 +105,7 @@ class CorsConfig implements XmlConfig const OSS_MAX_RULES = 10; /** - * orsRule列表 + * CorsRule list * * @var CorsRule[] */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php index 2cbe1c17b..08353a0c0 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/CorsRule.php @@ -13,7 +13,7 @@ use OSS\Core\OssException; class CorsRule { /** - * Rule中增加一条allowedOrigin + * Add an allowedOrigin rule * * @param string $allowedOrigin */ @@ -25,7 +25,7 @@ class CorsRule } /** - * Rule中增加一条allowedMethod + * Add an allowedMethod rule * * @param string $allowedMethod */ @@ -37,7 +37,7 @@ class CorsRule } /** - * Rule中增加一条allowedHeader + * Add an allowedHeader rule * * @param string $allowedHeader */ @@ -49,7 +49,7 @@ class CorsRule } /** - * Rule中增加一条exposeHeader + * Add an exposeHeader rule * * @param string $exposeHeader */ @@ -77,7 +77,7 @@ class CorsRule } /** - * 得到AllowedHeaders列表 + * Get the AllowedHeaders list * * @return string[] */ @@ -87,7 +87,7 @@ class CorsRule } /** - * 得到AllowedOrigins列表 + * Get the AllowedOrigins list * * @return string[] */ @@ -97,7 +97,7 @@ class CorsRule } /** - * 得到AllowedMethods列表 + * Get the AllowedMethods list * * @return string[] */ @@ -107,7 +107,7 @@ class CorsRule } /** - * 得到ExposeHeaders列表 + * Get the ExposeHeaders list * * @return string[] */ @@ -117,7 +117,7 @@ class CorsRule } /** - * 根据提供的xmlRule, 把this按照一定的规则插入到$xmlRule中 + * Serialize all the rules into the xml represented by parameter $xmlRule * * @param \SimpleXMLElement $xmlRule * @throws OssException diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php index 5abd825d0..a0e212692 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleAction.php @@ -71,7 +71,7 @@ class LifecycleAction } /** - * appendToXml 把actions插入到xml中 + * Use appendToXml to insert actions into xml. * * @param \SimpleXMLElement $xmlRule */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php index fc4f5755a..f2d2dc33c 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleConfig.php @@ -13,7 +13,7 @@ use OSS\Core\OssException; class LifecycleConfig implements XmlConfig { /** - * 从xml数据中解析出LifecycleConfig + * Parse the xml into this object. * * @param string $strXml * @throws OssException @@ -48,7 +48,7 @@ class LifecycleConfig implements XmlConfig /** - * 生成xml字符串 + * Serialize the object to xml * * @return string */ @@ -65,7 +65,7 @@ class LifecycleConfig implements XmlConfig /** * - * 添加LifecycleRule + * Add a LifecycleRule * * @param LifecycleRule $lifecycleRule * @throws OssException @@ -79,7 +79,7 @@ class LifecycleConfig implements XmlConfig } /** - * 将配置转换成字符串,便于用户查看 + * Serialize the object into xml string. * * @return string */ @@ -89,7 +89,7 @@ class LifecycleConfig implements XmlConfig } /** - * 得到所有的生命周期规则 + * Get all lifecycle rules. * * @return LifecycleRule[] */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php index ec615b9af..73c6cc353 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LifecycleRule.php @@ -12,7 +12,7 @@ namespace OSS\Model; class LifecycleRule { /** - * 得到规则ID + * Get Id * * @return string */ @@ -22,7 +22,7 @@ class LifecycleRule } /** - * @param string $id 规则ID + * @param string $id Rule Id */ public function setId($id) { @@ -30,7 +30,7 @@ class LifecycleRule } /** - * 得到文件前缀 + * Get a file prefix * * @return string */ @@ -40,9 +40,9 @@ class LifecycleRule } /** - * 设置文件前缀 + * Set a file prefix * - * @param string $prefix 文件前缀 + * @param string $prefix The file prefix */ public function setPrefix($prefix) { @@ -50,7 +50,7 @@ class LifecycleRule } /** - * Lifecycle规则的状态 + * Get Lifecycle status * * @return string */ @@ -60,7 +60,7 @@ class LifecycleRule } /** - * 设置Lifecycle规则状态 + * Set Lifecycle status * * @param string $status */ @@ -90,9 +90,9 @@ class LifecycleRule /** * LifecycleRule constructor. * - * @param string $id 规则ID - * @param string $prefix 文件前缀 - * @param string $status 规则状态,可选[self::LIFECYCLE_STATUS_ENABLED, self::LIFECYCLE_STATUS_DISABLED] + * @param string $id rule Id + * @param string $prefix File prefix + * @param string $status Rule status, which has the following valid values: [self::LIFECYCLE_STATUS_ENABLED, self::LIFECYCLE_STATUS_DISABLED] * @param LifecycleAction[] $actions */ public function __construct($id, $prefix, $status, $actions) diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php index bb5093aa8..f4ee02f64 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LiveChannelListInfo.php @@ -5,7 +5,7 @@ namespace OSS\Model; /** * Class LiveChannelListInfo * - * ListBucketLiveChannels接口返回数据 + * The data returned by ListBucketLiveChannels * * @package OSS\Model * @link http://help.aliyun.com/document_detail/oss/api-reference/bucket/GetBucket.html diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php index 978421a25..ed9fb1dbb 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/LoggingConfig.php @@ -42,7 +42,7 @@ class LoggingConfig implements XmlConfig } /** - * 序列化成xml字符串 + * Serialize to xml string * */ public function serializeToXml() diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php index 2ae6c99bd..891f8625d 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectInfo.php @@ -6,11 +6,11 @@ namespace OSS\Model; * * Class ObjectInfo * - * listObjects接口中返回的Object列表中的类 + * The element type of ObjectListInfo, which is the return value type of listObjects * - * listObjects接口返回数据中包含两个Array - * 一个是拿到的Object列表【可以理解成对应文件系统中的文件列表】 - * 一个是拿到的Prefix列表【可以理解成对应文件系统中的目录列表】 + * The return value of listObjects includes two arrays + * One is the returned ObjectListInfo, 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 */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php index dbe7c7a76..81c5d27b9 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/ObjectListInfo.php @@ -5,7 +5,7 @@ namespace OSS\Model; /** * Class ObjectListInfo * - * ListObjects接口返回数据 + * The class of return value of ListObjects * * @package OSS\Model * @link http://help.aliyun.com/document_detail/oss/api-reference/bucket/GetBucket.html @@ -87,7 +87,7 @@ class ObjectListInfo } /** - * 返回ListObjects接口返回数据中的ObjectInfo列表 + * Get the ObjectInfo list. * * @return ObjectInfo[] */ @@ -97,7 +97,7 @@ class ObjectListInfo } /** - * 返回ListObjects接口返回数据中的PrefixInfo列表 + * Get the PrefixInfo list * * @return PrefixInfo[] */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php index e61eac449..27920b9f6 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/PrefixInfo.php @@ -5,10 +5,10 @@ namespace OSS\Model; /** * Class PrefixInfo * - * listObjects接口中返回的Prefix列表中的类 - * listObjects接口返回数据中包含两个Array: - * 一个是拿到的Object列表【可以理解成对应文件系统中的文件列表】 - * 一个是拿到的Prefix列表【可以理解成对应文件系统中的目录列表】 + * ListObjects return Prefix list of classes + * The returned data contains two arrays + * One is to get the list of objects【Can be understood as the corresponding file system file list】 + * One is to get Prefix list【Can be understood as the corresponding file system directory list】 * * @package OSS\Model * @link http://help.aliyun.com/document_detail/oss/api-reference/bucket/GetBucket.html diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php index 1d7d975c5..083014396 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/RefererConfig.php @@ -29,7 +29,7 @@ class RefererConfig implements XmlConfig /** - * 把RefererConfig序列化成xml + * serialize the RefererConfig object into xml string * * @return string */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php index 05e6332c2..024b5c951 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/StorageCapacityConfig.php @@ -29,7 +29,7 @@ class StorageCapacityConfig implements XmlConfig } /** - * 把StorageCapacityConfig序列化成xml + * Serialize StorageCapacityConfig into xml * * @return string */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php index 8eaa3639f..49aa414e9 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/UploadInfo.php @@ -5,7 +5,7 @@ namespace OSS\Model; /** * Class UploadInfo * - * ListMultipartUpload接口得到的UploadInfo + * The return value of ListMultipartUpload * * @package OSS\Model */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php index 8ea08a030..e298eb460 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/WebsiteConfig.php @@ -40,7 +40,7 @@ class WebsiteConfig implements XmlConfig } /** - * 把WebsiteConfig序列化成xml + * Serialize the WebsiteConfig object into xml string. * * @return string * @throws OssException diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php index d353a2221..8c0a0db1c 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Model/XmlConfig.php @@ -10,7 +10,7 @@ interface XmlConfig { /** - * 接口定义,实现此接口的类都需要实现从xml数据解析的函数 + * Interface method: Parse the object from the xml. * * @param string $strXml * @return null @@ -18,7 +18,7 @@ interface XmlConfig public function parseFromXml($strXml); /** - * 接口定义,实现此接口的类,都需要实现把子类序列化成xml字符串的接口 + * Interface method: Serialize the object into xml. * * @return string */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/OssClient.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/OssClient.php index 1c090d3d1..daae42c70 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/OssClient.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/OssClient.php @@ -17,11 +17,12 @@ use OSS\Result\AclResult; use OSS\Result\BodyResult; use OSS\Result\GetCorsResult; use OSS\Result\GetLifecycleResult; +use OSS\Result\GetLocationResult; use OSS\Result\GetLoggingResult; use OSS\Result\GetRefererResult; +use OSS\Result\GetStorageCapacityResult; use OSS\Result\GetWebsiteResult; use OSS\Result\GetCnameResult; -use OSS\Result\GetLocationResult; use OSS\Result\HeaderResult; use OSS\Result\InitiateMultipartUploadResult; use OSS\Result\ListBucketsResult; @@ -39,9 +40,9 @@ use OSS\Result\GetLiveChannelHistoryResult; use OSS\Result\GetLiveChannelInfoResult; use OSS\Result\GetLiveChannelStatusResult; use OSS\Result\ListLiveChannelResult; -use OSS\Result\GetStorageCapacityResult; use OSS\Result\AppendResult; use OSS\Model\ObjectListInfo; +use OSS\Result\SymlinkResult; use OSS\Result\UploadPartResult; use OSS\Model\BucketListInfo; use OSS\Model\LifecycleConfig; @@ -49,35 +50,33 @@ use OSS\Model\RefererConfig; use OSS\Model\WebsiteConfig; use OSS\Core\OssUtil; use OSS\Model\ListPartsInfo; -use OSS\Result\SymlinkResult; /** * Class OssClient * - * Object Storage Service(OSS) 的客户端类,封装了用户通过OSS API对OSS服务的各种操作, - * 用户通过OssClient实例可以进行Bucket,Object,MultipartUpload, ACL等操作,具体 - * 的接口规则可以参考官方OSS API文档 + * Object Storage Service(OSS)'s client class, which wraps all OSS APIs user could call to talk to OSS. + * Users could do operations on bucket, object, including MultipartUpload or setting ACL via an OSSClient instance. + * For more details, please check out the OSS API document:https://www.alibabacloud.com/help/doc-detail/31947.htm */ class OssClient { /** - * 构造函数 + * Constructor * - * 构造函数有几种情况: - * 1. 一般的时候初始化使用 $ossClient = new OssClient($id, $key, $endpoint) - * 2. 如果使用CNAME的,比如使用的是www.testoss.com,在控制台上做了CNAME的绑定, - * 初始化使用 $ossClient = new OssClient($id, $key, $endpoint, true) - * 3. 如果使用了阿里云SecurityTokenService(STS),获得了AccessKeyID, AccessKeySecret, Token - * 初始化使用 $ossClient = new OssClient($id, $key, $endpoint, false, $token) - * 4. 如果用户使用的endpoint是ip - * 初始化使用 $ossClient = new OssClient($id, $key, “1.2.3.4:8900”) + * There're a few different ways to create an OssClient object: + * 1. Most common one from access Id, access Key and the endpoint: $ossClient = new OssClient($id, $key, $endpoint) + * 2. If the endpoint is the CName (such as www.testoss.com, make sure it's CName binded in the OSS console), + * uses $ossClient = new OssClient($id, $key, $endpoint, true) + * 3. If using Alicloud's security token service (STS), then the AccessKeyId, AccessKeySecret and STS token are all got from STS. + * Use this: $ossClient = new OssClient($id, $key, $endpoint, false, $token) + * 4. If the endpoint is in IP format, you could use this: $ossClient = new OssClient($id, $key, “1.2.3.4:8900”) * - * @param string $accessKeyId 从OSS获得的AccessKeyId - * @param string $accessKeySecret 从OSS获得的AccessKeySecret - * @param string $endpoint 您选定的OSS数据中心访问域名,例如oss-cn-hangzhou.aliyuncs.com - * @param boolean $isCName 是否对Bucket做了域名绑定,并且Endpoint参数填写的是自己的域名 - * @param string $securityToken - * @param string $requestProxy 添加代理支持 + * @param string $accessKeyId The AccessKeyId from OSS or STS + * @param string $accessKeySecret The AccessKeySecret from OSS or STS + * @param string $endpoint The domain name of the datacenter,For example: oss-cn-hangzhou.aliyuncs.com + * @param boolean $isCName If this is the CName and binded in the bucket. + * @param string $securityToken from STS. + * @param string $requestProxy * @throws OssException */ public function __construct($accessKeyId, $accessKeySecret, $endpoint, $isCName = false, $securityToken = NULL, $requestProxy = NULL) @@ -100,12 +99,11 @@ class OssClient $this->accessKeySecret = $accessKeySecret; $this->securityToken = $securityToken; $this->requestProxy = $requestProxy; - self::checkEnv(); } /** - * 列举用户所有的Bucket[GetService], Endpoint类型为cname不能进行此操作 + * Lists the Bucket [GetService]. Not applicable if the endpoint is CName (because CName must be binded to a specific bucket). * * @param array $options * @throws OssException @@ -126,7 +124,7 @@ class OssClient } /** - * 创建bucket,默认创建的bucket的ACL是OssClient::OSS_ACL_TYPE_PRIVATE + * Creates bucket,The ACL of the bucket created by default is OssClient::OSS_ACL_TYPE_PRIVATE * * @param string $bucket * @param string $acl @@ -152,9 +150,9 @@ class OssClient } /** - * 删除bucket - * 如果Bucket不为空(Bucket中有Object,或者有分块上传的碎片),则Bucket无法删除, - * 必须删除Bucket中的所有Object以及碎片后,Bucket才能成功删除。 + * Deletes bucket + * The deletion will not succeed if the bucket is not empty (either has objects or parts) + * To delete a bucket, all its objects and parts must be deleted first. * * @param string $bucket * @param array $options @@ -172,7 +170,7 @@ class OssClient } /** - * 判断bucket是否存在 + * Checks if a bucket exists * * @param string $bucket * @return bool @@ -189,9 +187,9 @@ class OssClient $result = new ExistResult($response); return $result->getData(); } - + /** - * 获取bucket所属的数据中心位置信息 + * Get the data center location information for the bucket * * @param string $bucket * @param array $options @@ -209,27 +207,27 @@ class OssClient $result = new GetLocationResult($response); return $result->getData(); } - + /** - * 获取Bucket的Meta信息 + * Get the Meta information for the Bucket * * @param string $bucket - * @param array $options 具体参考SDK文档 + * @param array $options Refer to the SDK documentation * @return array */ public function getBucketMeta($bucket, $options = NULL) { - $this->precheckCommon($bucket, NULL, $options, false); - $options[self::OSS_BUCKET] = $bucket; - $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD; - $options[self::OSS_OBJECT] = '/'; - $response = $this->auth($options); - $result = new HeaderResult($response); - return $result->getData(); + $this->precheckCommon($bucket, NULL, $options, false); + $options[self::OSS_BUCKET] = $bucket; + $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD; + $options[self::OSS_OBJECT] = '/'; + $response = $this->auth($options); + $result = new HeaderResult($response); + return $result->getData(); } /** - * 获取bucket的ACL配置情况 + * Gets the bucket ACL * * @param string $bucket * @param array $options @@ -249,11 +247,11 @@ class OssClient } /** - * 设置bucket的ACL配置情况 + * Sets the bucket ACL * - * @param string $bucket bucket名称 - * @param string $acl 读写权限,可选值 ['private', 'public-read', 'public-read-write'] - * @param array $options 可以为空 + * @param string $bucket bucket name + * @param string $acl access permissions, valid values are ['private', 'public-read', 'public-read-write'] + * @param array $options by default is empty * @throws OssException * @return null */ @@ -271,7 +269,7 @@ class OssClient } /** - * 获取object的ACL属性 + * Gets object ACL * * @param string $bucket * @param string $object @@ -292,11 +290,11 @@ class OssClient } /** - * 设置object的ACL属性 + * Sets the object ACL * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $acl 读写权限,可选值 ['default', 'private', 'public-read', 'public-read-write'] + * @param string $bucket bucket name + * @param string $object object name + * @param string $acl access permissions, valid values are ['default', 'private', 'public-read', 'public-read-write'] * @throws OssException * @return null */ @@ -314,10 +312,10 @@ class OssClient } /** - * 获取Bucket的访问日志配置情况 + * Gets the bucket logging config * - * @param string $bucket bucket名称 - * @param array $options 可以为空 + * @param string $bucket bucket name + * @param array $options by default is empty * @throws OssException * @return LoggingConfig */ @@ -334,12 +332,12 @@ class OssClient } /** - * 开启Bucket访问日志记录功能,只有Bucket的所有者才能更改 + * Sets the bycket logging config. Only owner can call this API. * - * @param string $bucket bucket名称 - * @param string $targetBucket 日志文件存放的bucket - * @param string $targetPrefix 日志的文件前缀 - * @param array $options 可以为空 + * @param string $bucket bucket name + * @param string $targetBucket The logging file's bucket + * @param string $targetPrefix The logging file's prefix + * @param array $options By default is empty. * @throws OssException * @return null */ @@ -361,10 +359,10 @@ class OssClient } /** - * 关闭bucket访问日志记录功能 + * Deletes the bucket logging config * - * @param string $bucket bucket名称 - * @param array $options 可以为空 + * @param string $bucket bucket name + * @param array $options * @throws OssException * @return null */ @@ -381,11 +379,11 @@ class OssClient } /** - * 将bucket设置成静态网站托管模式 + * Sets the website config in bucket---that is could make the bucket as a static website once the CName is binded. * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param WebsiteConfig $websiteConfig - * @param array $options 可以为空 + * @param array $options * @throws OssException * @return null */ @@ -404,9 +402,9 @@ class OssClient } /** - * 获取bucket的静态网站托管状态 + * Gets the website config in the bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return WebsiteConfig @@ -424,9 +422,9 @@ class OssClient } /** - * 关闭bucket的静态网站托管模式 + * Deletes the website config in the bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return null @@ -444,10 +442,10 @@ class OssClient } /** - * 在指定的bucket上设定一个跨域资源共享(CORS)的规则,如果原规则存在则覆盖原规则 + * Sets the cross-origin-resource-sharing (CORS) rule. It would overwrite the originl one. * - * @param string $bucket bucket名称 - * @param CorsConfig $corsConfig 跨域资源共享配置,具体规则参见SDK文档 + * @param string $bucket bucket name + * @param CorsConfig $corsConfig CORS config. Check out the details from OSS API document * @param array $options array * @throws OssException * @return null @@ -467,10 +465,10 @@ class OssClient } /** - * 获取Bucket的CORS配置情况 + * Gets the bucket CORS config * - * @param string $bucket bucket名称 - * @param array $options 可以为空 + * @param string $bucket bucket name + * @param array $options * @throws OssException * @return CorsConfig */ @@ -487,9 +485,9 @@ class OssClient } /** - * 关闭指定Bucket对应的CORS功能并清空所有规则 + * Deletes the bucket's CORS config and disable the CORS on the bucket. * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return null @@ -507,9 +505,9 @@ class OssClient } /** - * 为指定Bucket增加CNAME绑定 + * Bind a CName for the bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string $cname * @param array $options * @throws OssException @@ -534,9 +532,9 @@ class OssClient } /** - * 获取指定Bucket已绑定的CNAME列表 + * Gets the binded CName list of the bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return CnameConfig @@ -554,9 +552,9 @@ class OssClient } /** - * 解除指定Bucket的CNAME绑定 + * Remove a CName binding from the bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param CnameConfig $cnameConfig * @param array $options * @throws OssException @@ -581,9 +579,9 @@ class OssClient } /** - * 为指定Bucket创建LiveChannel + * Creates a Live Channel under a bucket * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName * @param LiveChannelConfig $channelConfig * @param array $options @@ -610,11 +608,11 @@ class OssClient } /** - * 设置LiveChannel的status + * Sets the LiveChannel status * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName - * @param string channelStatus $channelStatus 为enabled或disabled + * @param string channelStatus $channelStatus enabled or disabled * @param array $options * @throws OssException * @return null @@ -634,9 +632,9 @@ class OssClient } /** - * 获取LiveChannel信息 + * Gets the LiveChannel information by the channel name * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName * @param array $options * @throws OssException @@ -656,9 +654,9 @@ class OssClient } /** - * 获取LiveChannel状态信息 + * Gets the status of LiveChannel * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName * @param array $options * @throws OssException @@ -679,9 +677,9 @@ class OssClient } /** - *获取LiveChannel推流记录 + * Gets the LiveChannel pushing streaming record * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName * @param array $options * @throws OssException @@ -702,9 +700,9 @@ class OssClient } /** - *获取指定Bucket下的live channel列表 + *Gets the live channel list under a bucket. * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return LiveChannelListInfo @@ -730,12 +728,12 @@ class OssClient } /** - * 为指定LiveChannel生成播放列表 + * Creates a play list file for the LiveChannel * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName - * @param string $playlistName 指定生成的点播播放列表的名称,必须以“.m3u8”结尾 - * @param array $setTime startTime和EndTime以unix时间戳格式给定,跨度不能超过一天 + * @param string $playlistName The playlist name, must end with ".m3u8". + * @param array $setTime startTime and EndTime in unix time. No more than 1 day. * @throws OssException * @return null */ @@ -755,9 +753,9 @@ class OssClient } /** - * 删除指定Bucket的LiveChannel + * Deletes the Bucket LiveChannel * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName * @param array $options * @throws OssException @@ -777,14 +775,14 @@ class OssClient } /** - * 生成带签名的推流地址 + * Generates the signed pushing streaming url * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param string channelName $channelName - * @param int timeout 设置超时时间,单位为秒 + * @param int timeout timeout value in seconds * @param array $options * @throws OssException - * @return 推流地址 + * @return The signed pushing streaming url */ public function signRtmpUrl($bucket, $channelName, $timeout = 60, $options = NULL) { @@ -813,16 +811,16 @@ class OssClient } /** - * 检验跨域资源请求, 发送跨域请求之前会发送一个preflight请求(OPTIONS)并带上特定的来源域, - * HTTP方法和header信息等给OSS以决定是否发送真正的请求。 OSS可以通过putBucketCors接口 - * 来开启Bucket的CORS支持,开启CORS功能之后,OSS在收到浏览器preflight请求时会根据设定的 - * 规则评估是否允许本次请求 + * 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. + * + * Note: OSS could enable the CORS on the bucket by calling putBucketCors. Once CORS is enabled, the OSS could evaluate accordingto the preflight request. * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $origin 请求来源域 - * @param string $request_method 表明实际请求中会使用的HTTP方法 - * @param string $request_headers 表明实际请求中会使用的除了简单头部之外的headers + * @param string $bucket bucket name + * @param string $object object name + * @param string $origin the origin of the request + * @param string $request_method The actual HTTP method which will be used in CORS request + * @param string $request_headers The actual HTTP headers which will be used in CORS request * @param array $options * @return array * @throws OssException @@ -845,10 +843,10 @@ class OssClient } /** - * 设置Bucket的Lifecycle配置 + * Sets the bucket's lifecycle config * - * @param string $bucket bucket名称 - * @param LifecycleConfig $lifecycleConfig Lifecycle配置类 + * @param string $bucket bucket name + * @param LifecycleConfig $lifecycleConfig LifecycleConfig instance * @param array $options * @throws OssException * @return null @@ -868,9 +866,9 @@ class OssClient } /** - * 获取Bucket的Lifecycle配置情况 + * Gets bucket's lifecycle config * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return LifecycleConfig @@ -888,9 +886,9 @@ class OssClient } /** - * 删除指定Bucket的生命周期配置 + * Deletes the bucket's lifecycle config * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return null @@ -908,10 +906,10 @@ class OssClient } /** - * 设置一个bucket的referer访问白名单和是否允许referer字段为空的请求访问 - * Bucket Referer防盗链具体见OSS防盗链 + * Sets a bucket's referer, which has a whitelist of referrer and specifies if empty referer is allowed. + * Checks out API document for more details about "Bucket Referer" * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param RefererConfig $refererConfig * @param array $options * @return ResponseCore @@ -932,10 +930,10 @@ class OssClient } /** - * 获取Bucket的Referer配置情况 - * Bucket Referer防盗链具体见OSS防盗链 + * Gets the bucket's Referer + * Checks out API document for more details about "Bucket Referer" * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return RefererConfig @@ -951,12 +949,13 @@ class OssClient $result = new GetRefererResult($response); return $result->getData(); } - + + /** - * 设置bucket的容量大小,单位GB - * 当bucket的容量大于设置的容量时,禁止继续写入 + * 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 * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param int $storageCapacity * @param array $options * @return ResponseCore @@ -976,11 +975,11 @@ class OssClient $result = new PutSetDeleteResult($response); return $result->getData(); } - + /** - * 获取bucket的容量大小,单位GB + * Get the capacity of the bucket, the unit is GB * - * @param string $bucket bucket名称 + * @param string $bucket bucket name * @param array $options * @throws OssException * @return int @@ -997,19 +996,19 @@ class OssClient return $result->getData(); } + /** - * 获取bucket下的object列表 + * Lists the bucket's object list (in ObjectListInfo) * * @param string $bucket - * @param array $options - * 其中options中的参数如下 + * @param array $options are defined below: * $options = array( - * 'max-keys' => max-keys用于限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 - * 'prefix' => 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 - * 'delimiter' => 是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素 - * 'marker' => 用户设定结果从marker之后按字母排序的第一个开始返回。 + * '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, listObjects will differeniate the object and folder. And it will return subfolder's objects. + * 'marker' => The key of returned object must be greater than the 'marker'. *) - * 其中 prefix,marker用来实现分页显示效果,参数的长度必须小于256字节。 + * Prefix and marker are for filtering and paging. Their length must be less than 256 bytes * @throws OssException * @return ObjectListInfo */ @@ -1037,12 +1036,12 @@ class OssClient } /** - * 创建虚拟目录 (本函数会在object名称后增加'/', 所以创建目录的object名称不需要'/'结尾,否则,目录名称会变成'//') + * Creates a virtual 'folder' in OSS. The name should not end with '/' because the method will append the name with a '/' anyway. * - * 暂不开放此接口 + * Internal use only. * - * @param string $bucket bucket名称 - * @param string $object object名称 + * @param string $bucket bucket name + * @param string $object object name * @param array $options * @return null */ @@ -1059,11 +1058,11 @@ class OssClient } /** - * 上传内存中的内容 + * Uploads the $content object to OSS. * - * @param string $bucket bucket名称 - * @param string $object objcet名称 - * @param string $content 上传的内容 + * @param string $bucket bucket name + * @param string $object objcet name + * @param string $content The content object * @param array $options * @return null */ @@ -1102,11 +1101,12 @@ class OssClient return $result->getData(); } + /** - * 创建symlink - * @param string $bucket bucket名称 - * @param string $symlink symlink名称 - * @param string $targetObject 目标object名称 + * creates symlink + * @param string $bucket bucket name + * @param string $symlink symlink name + * @param string $targetObject targetObject name * @param array $options * @return null */ @@ -1126,9 +1126,9 @@ class OssClient } /** - * 获取symlink - *@param string $bucket bucket名称 - * @param string $symlink symlink名称 + * gets symlink + *@param string $bucket bucket name + * @param string $symlink symlink name * @return null */ public function getSymlink($bucket, $symlink) @@ -1146,11 +1146,11 @@ class OssClient } /** - * 上传本地文件 + * Uploads a local file * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 本地文件路径 + * @param string $bucket bucket name + * @param string $object object name + * @param string $file local file path * @param array $options * @return null * @throws OssException @@ -1183,11 +1183,11 @@ class OssClient } /** - * 追加上传内存中的内容 - * - * @param string $bucket bucket名称 - * @param string $object objcet名称 - * @param string $content 本次追加上传的内容 + * Append the object with the content at the specified position. + * The specified position is typically the lengh of the current file. + * @param string $bucket bucket name + * @param string $object objcet name + * @param string $content content to append * @param array $options * @return int next append position * @throws OssException @@ -1224,11 +1224,11 @@ class OssClient } /** - * 追加上传本地文件 + * Append the object with a local file * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 追加上传的本地文件路径 + * @param string $bucket bucket name + * @param string $object object name + * @param string $file The local file path to append with * @param array $options * @return int next append position * @throws OssException @@ -1266,12 +1266,12 @@ class OssClient } /** - * 拷贝一个在OSS上已经存在的object成另外一个object + * Copy from an existing OSS object to another OSS object. If the target object exists already, it will be overwritten. * - * @param string $fromBucket 源bucket名称 - * @param string $fromObject 源object名称 - * @param string $toBucket 目标bucket名称 - * @param string $toObject 目标object名称 + * @param string $fromBucket Source bucket name + * @param string $fromObject Source object name + * @param string $toBucket Target bucket name + * @param string $toObject Target object name * @param array $options * @return null * @throws OssException @@ -1294,11 +1294,11 @@ class OssClient } /** - * 获取Object的Meta信息 + * Gets Object metadata * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $options 具体参考SDK文档 + * @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 getObjectMeta($bucket, $object, $options = NULL) @@ -1313,10 +1313,10 @@ class OssClient } /** - * 删除某个Object + * Deletes a object * - * @param string $bucket bucket名称 - * @param string $object object名称 + * @param string $bucket bucket name + * @param string $object object name * @param array $options * @return null */ @@ -1332,10 +1332,10 @@ class OssClient } /** - * 删除同一个Bucket中的多个Object + * Deletes multiple objects in a bucket * - * @param string $bucket bucket名称 - * @param array $objects object列表 + * @param string $bucket bucket name + * @param array $objects object list * @param array $options * @return ResponseCore * @throws null @@ -1367,11 +1367,11 @@ class OssClient } /** - * 获得Object内容 + * Gets Object content * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param array $options 该参数中必须设置ALIOSS::OSS_FILE_DOWNLOAD,ALIOSS::OSS_RANGE可选,可以根据实际情况设置;如果不设置,默认会下载全部内容 + * @param string $bucket bucket name + * @param string $object object name + * @param array $options It must contain ALIOSS::OSS_FILE_DOWNLOAD. And ALIOSS::OSS_RANGE is optional and empty means to download the whole file. * @return string */ public function getObject($bucket, $object, $options = NULL) @@ -1399,13 +1399,13 @@ class OssClient } /** - * 检测Object是否存在 - * 通过获取Object的Meta信息来判断Object是否存在, 用户需要自行解析ResponseCore判断object是否存在 + * Checks if the object exists + * It's implemented by getObjectMeta(). * - * @param string $bucket bucket名称 - * @param string $object object名称 + * @param string $bucket bucket name + * @param string $object object name * @param array $options - * @return bool + * @return bool True:object exists; False:object does not exist */ public function doesObjectExist($bucket, $object, $options = NULL) { @@ -1419,11 +1419,11 @@ class OssClient } /** - * 针对Archive类型的Object读取 - * 需要使用Restore操作让服务端执行解冻任务 + * Object reading for Archive type + * Use Restore to enable the server to perform the thawing task * - * @param string $bucket bucket名称 - * @param string $object object名称 + * @param string $bucket bucket name + * @param string $object object name * @return null * @throws OssException */ @@ -1440,8 +1440,9 @@ class OssClient } /** - * 获取分片大小,根据用户提供的part_size,重新计算一个更合理的partsize - * + * 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. + * Otherwise returns the specified part size. * @param int $partSize * @return int */ @@ -1457,12 +1458,12 @@ class OssClient } /** - * 计算文件可以分成多少个part,以及每个part的长度以及起始位置 - * 方法必须在 中调用 + * Computes the parts count, size and start position according to the file size and the part size. + * It must be only called by upload_Part(). * - * @param integer $file_size 文件大小 - * @param integer $partSize part大小,默认5M - * @return array An array 包含 key-value 键值对. Key 为 `seekTo` 和 `length`. + * @param integer $file_size File size + * @param integer $partSize part大小,part size. Default is 5MB + * @return array An array contains key-value pairs--the key is `seekTo`and value is `length`. */ public function generateMultiuploadParts($file_size, $partSize = 5242880) { @@ -1482,13 +1483,13 @@ class OssClient } /** - * 初始化multi-part upload + * Initialize a multi-part upload * - * @param string $bucket Bucket名称 - * @param string $object Object名称 - * @param array $options Key-Value数组 + * @param string $bucket bucket name + * @param string $object object name + * @param array $options Key-Value array * @throws OssException - * @return string 返回uploadid + * @return string returns uploadid */ public function initiateMultipartUpload($bucket, $object, $options = NULL) { @@ -1511,12 +1512,12 @@ class OssClient } /** - * 分片上传的块上传接口 + * Upload a part in a multiparts upload. * - * @param string $bucket Bucket名称 - * @param string $object Object名称 + * @param string $bucket bucket name + * @param string $object object name * @param string $uploadId - * @param array $options Key-Value数组 + * @param array $options Key-Value array * @return string eTag * @throws OssException */ @@ -1540,12 +1541,12 @@ class OssClient } /** - * 获取已成功上传的part + * Gets the uploaded parts. * - * @param string $bucket Bucket名称 - * @param string $object Object名称 + * @param string $bucket bucket name + * @param string $object object name * @param string $uploadId uploadId - * @param array $options Key-Value数组 + * @param array $options Key-Value array * @return ListPartsInfo * @throws OssException */ @@ -1569,12 +1570,12 @@ class OssClient } /** - * 中止进行一半的分片上传操作 + * Abort a multiparts upload * - * @param string $bucket Bucket名称 - * @param string $object Object名称 + * @param string $bucket bucket name + * @param string $object object name * @param string $uploadId uploadId - * @param array $options Key-Value数组 + * @param array $options Key-Value name * @return null * @throws OssException */ @@ -1591,13 +1592,13 @@ class OssClient } /** - * 在将所有数据Part都上传完成后,调用此接口完成本次分块上传 + * Completes a multiparts upload, after all parts are uploaded. * - * @param string $bucket Bucket名称 - * @param string $object Object名称 + * @param string $bucket bucket name + * @param string $object object name * @param string $uploadId uploadId * @param array $listParts array( array("PartNumber"=> int, "ETag"=>string)) - * @param array $options Key-Value数组 + * @param array $options Key-Value array * @throws OssException * @return null */ @@ -1623,11 +1624,10 @@ class OssClient } /** - * 罗列出所有执行中的Multipart Upload事件,即已经被初始化的Multipart Upload但是未被 - * Complete或者Abort的Multipart Upload事件 + * Lists all ongoing multipart upload events, which means all initialized but not completed or aborted multipart uploads. * * @param string $bucket bucket - * @param array $options 关联数组 + * @param array $options key-value array--expected keys are 'delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker' * @throws OssException * @return ListMultipartUploadInfo */ @@ -1657,15 +1657,15 @@ class OssClient } /** - * 从一个已存在的Object中拷贝数据来上传一个Part + * Copy an existing file as a part * - * @param string $fromBucket 源bucket名称 - * @param string $fromObject 源object名称 - * @param string $toBucket 目标bucket名称 - * @param string $toObject 目标object名称 - * @param int $partNumber 分块上传的块id - * @param string $uploadId 初始化multipart upload返回的uploadid - * @param array $options Key-Value数组 + * @param string $fromBucket source bucket name + * @param string $fromObject source object name + * @param string $toBucket target bucket name + * @param string $toObject target object name + * @param int $partNumber Part number + * @param string $uploadId Upload Id + * @param array $options Key-Value array---it should have 'start' or 'end' key to specify the range of the source object to copy. If it's not specifed, the whole object is copied. * @return null * @throws OssException */ @@ -1674,7 +1674,7 @@ class OssClient $this->precheckCommon($fromBucket, $fromObject, $options); $this->precheckCommon($toBucket, $toObject, $options); - //如果没有设置$options['isFullCopy'],则需要强制判断copy的起止位置 + //If $options['isFullCopy'] is not set, copy from the beginning $start_range = "0"; if (isset($options['start'])) { $start_range = $options['start']; @@ -1701,12 +1701,12 @@ class OssClient } /** - * multipart上传统一封装,从初始化到完成multipart,以及出错后中止动作 + * A higher level API for uploading a file with multipart upload. It consists of initialization, parts upload and completion. * - * @param string $bucket bucket名称 - * @param string $object object名称 - * @param string $file 需要上传的本地文件的路径 - * @param array $options Key-Value数组 + * @param string $bucket bucket name + * @param string $object object name + * @param string $file The local file to upload + * @param array $options Key-Value array * @return null * @throws OssException */ @@ -1739,7 +1739,7 @@ class OssClient if ($upload_position === false || !isset($upload_file_size) || $upload_file_size === false || $upload_file_size < 0) { throw new OssException('The size of `fileUpload` cannot be determined in ' . __FUNCTION__ . '().'); } - // 处理partSize + // Computes the part size and assign it to options. if (isset($options[self::OSS_PART_SIZE])) { $options[self::OSS_PART_SIZE] = $this->computePartSize($options[self::OSS_PART_SIZE]); } else { @@ -1747,20 +1747,20 @@ class OssClient } $is_check_md5 = $this->isCheckMD5($options); - // 如果上传的文件小于partSize,则直接使用普通方式上传 + // if the file size is less than part size, use simple file upload. if ($upload_file_size < $options[self::OSS_PART_SIZE] && !isset($options[self::OSS_UPLOAD_ID])) { return $this->uploadFile($bucket, $object, $uploadFile, $options); } - // 初始化multipart + // Using multipart upload, initialize if no OSS_UPLOAD_ID is specified in options. if (isset($options[self::OSS_UPLOAD_ID])) { $uploadId = $options[self::OSS_UPLOAD_ID]; } else { - // 初始化 + // initialize $uploadId = $this->initiateMultipartUpload($bucket, $object, $options); } - // 获取的分片 + // generates the parts information and upload them one by one $pieces = $this->generateMultiuploadParts($upload_file_size, (integer)$options[self::OSS_PART_SIZE]); $response_upload_part = array(); foreach ($pieces as $i => $piece) { @@ -1791,15 +1791,15 @@ class OssClient } /** - * 上传本地目录内的文件或者目录到指定bucket的指定prefix的object中 + * Uploads the local directory to the specified bucket into specified folder (prefix) * - * @param string $bucket bucket名称 - * @param string $prefix 需要上传到的object的key前缀,可以理解成bucket中的子目录,结尾不能是'/',接口中会补充'/' - * @param string $localDirectory 需要上传的本地目录 - * @param string $exclude 需要排除的目录 - * @param bool $recursive 是否递归的上传localDirectory下的子目录内容 + * @param string $bucket bucket name + * @param string $prefix The object key prefix. Typically it's folder name. The name should not end with '/' as the API appends it automatically. + * @param string $localDirectory The local directory to upload + * @param string $exclude To excluded directories + * @param bool $recursive Recursive flag. True: Recursively upload all datas under the local directory; False: only upload first layer's files. * @param bool $checkMd5 - * @return array 返回两个列表 array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage")) + * @return array Returns two list: array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage")) * @throws OssException */ public function uploadDir($bucket, $prefix, $localDirectory, $exclude = '.|..|.svn|.git', $recursive = false, $checkMd5 = true) @@ -1810,7 +1810,7 @@ class OssClient if (empty($localDirectory)) throw new OssException("parameter error, localDirectory is empty"); $directory = $localDirectory; $directory = OssUtil::encodePath($directory); - //判断是否目录 + //If it's not the local directory, throw OSSException. if (!is_dir($directory)) { throw new OssException('parameter error: ' . $directory . ' is not a directory, please check it'); } @@ -1840,14 +1840,14 @@ class OssClient } /** - * 支持生成get和put签名, 用户可以生成一个具有一定有效期的 - * 签名过的url + * Sign URL with specified expiration time in seconds (timeout) and HTTP method. + * The signed URL could be used to access the object directly. * * @param string $bucket * @param string $object - * @param int $timeout + * @param int $timeout expiration time in seconds. * @param string $method - * @param array $options Key-Value数组 + * @param array $options Key-Value array * @return string * @throws OssException */ @@ -1872,7 +1872,7 @@ class OssClient } /** - * 检测options参数 + * validates options. Create a empty array if it's NULL. * * @param array $options * @throws OssException @@ -1886,7 +1886,7 @@ class OssClient } /** - * 校验bucket参数 + * Validates bucket parameter * * @param string $bucket * @param string $errMsg @@ -1898,7 +1898,7 @@ class OssClient } /** - * 校验object参数 + * validates object parameter * * @param string $object * @throws OssException @@ -1918,21 +1918,21 @@ class OssClient { if (is_string($storage)) { switch ($storage) { - case self::OSS_STORAGE_ARCHIVE: - return; - case self::OSS_STORAGE_IA: - return; - case self::OSS_STORAGE_STANDARD: - return; - default: - break; + case self::OSS_STORAGE_ARCHIVE: + return; + case self::OSS_STORAGE_IA: + return; + case self::OSS_STORAGE_STANDARD: + return; + default: + break; } } throw new OssException('storage name is invalid'); } /** - * 校验bucket,options参数 + * Validates bucket,options parameters and optionally validate object parameter. * * @param string $bucket * @param string $object @@ -1949,7 +1949,7 @@ class OssClient } /** - * 参数校验 + * checks parameters * * @param array $options * @param string $param @@ -1964,7 +1964,7 @@ class OssClient } /** - * 检测md5 + * Checks md5 * * @param array $options * @return bool|null @@ -1975,7 +1975,7 @@ class OssClient } /** - * 获取value + * Gets value of the specified key from the options * * @param array $options * @param string $key @@ -2006,7 +2006,7 @@ class OssClient } /** - * 获取mimetype类型 + * Gets mimetype * * @param string $object * @return string @@ -2029,7 +2029,7 @@ class OssClient } /** - * 验证并且执行请求,按照OSS Api协议,执行操作 + * Validates and executes the request according to OSS API protocol. * * @param array $options * @return ResponseCore @@ -2039,24 +2039,24 @@ class OssClient private function auth($options) { OssUtil::validateOptions($options); - //验证bucket,list_bucket时不需要验证 + //Validates bucket, not required for list_bucket $this->authPrecheckBucket($options); - //验证object + //Validates object $this->authPrecheckObject($options); - //Object名称的编码必须是utf8 + //object name encoding must be UTF-8 $this->authPrecheckObjectEncoding($options); - //验证ACL + //Validates ACL $this->authPrecheckAcl($options); - // 获得当次请求使用的协议头,是https还是http + // Should https or http be used? $scheme = $this->useSSL ? 'https://' : 'http://'; - // 获得当次请求使用的hostname,如果是公共域名或者专有域名,bucket拼在前面构成三级域名 + // gets the host name. If the host name is public domain or private domain, form a third level domain by prefixing the bucket name on the domain name. $hostname = $this->generateHostname($options[self::OSS_BUCKET]); $string_to_sign = ''; $headers = $this->generateHeaders($options, $hostname); $signable_query_string_params = $this->generateSignableQueryStringParam($options); $signable_query_string = OssUtil::toQueryString($signable_query_string_params); $resource_uri = $this->generateResourceUri($options); - //生成请求URL + //Generates the URL (add query parameters) $conjunction = '?'; $non_signable_resource = ''; if (isset($options[self::OSS_SUB_RESOURCE])) { @@ -2073,7 +2073,7 @@ class OssClient } $this->requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource; - //创建请求 + //Creates the request $request = new RequestCore($this->requestUrl, $this->requestProxy); $request->set_useragent($this->generateUserAgent()); // Streaming uploads @@ -2157,11 +2157,11 @@ class OssClient $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n"; } } - // 生成 signable_resource + // Generates the signable_resource $signable_resource = $this->generateSignableResource($options); $string_to_sign .= rawurldecode($signable_resource) . urldecode($signable_query_string); - //对?后面的要签名的string字母序排序 + // Sort the strings to be signed. $string_to_sign_ordered = $this->stringToSignSorted($string_to_sign); $signature = base64_encode(hash_hmac('sha1', $string_to_sign_ordered, $this->accessKeySecret, true)); @@ -2196,7 +2196,7 @@ class OssClient //retry if OSS Internal Error if ((integer)$request->get_response_code() === 500) { if ($this->redirects <= $this->maxRetries) { - //设置休眠 + //Sets the sleep time betwen each retry. $delay = (integer)(pow(4, $this->redirects) * 100000); usleep($delay); $this->redirects++; @@ -2209,7 +2209,7 @@ class OssClient } /** - * 设置最大尝试次数 + * Sets the max retry count * * @param int $maxRetries * @return void @@ -2220,7 +2220,7 @@ class OssClient } /** - * 获取最大尝试次数 + * Gets the max retry count * * @return int */ @@ -2230,7 +2230,7 @@ class OssClient } /** - * 打开sts enable标志,使用户构造函数中传入的$sts生效 + * Enaable/disable STS in the URL. This is to determine the $sts value passed from constructor take effect or not. * * @param boolean $enable */ @@ -2256,7 +2256,7 @@ class OssClient } /** - * 检查bucket名称格式是否正确,如果非法抛出异常 + * Validates bucket name--throw OssException if it's invalid * * @param $options * @throws OssException @@ -2270,7 +2270,7 @@ class OssClient /** * - * 检查object名称格式是否正确,如果非法抛出异常 + * Validates the object name--throw OssException if it's invalid. * * @param $options * @throws OssException @@ -2287,9 +2287,9 @@ class OssClient } /** - * 检查object的编码,如果是gbk或者gb2312则尝试将其转化为utf8编码 + * Checks the object's encoding. Convert it to UTF8 if it's in GBK or GB2312 * - * @param mixed $options 参数 + * @param mixed $options parameter */ private function authPrecheckObjectEncoding(&$options) { @@ -2310,7 +2310,7 @@ class OssClient } /** - * 检查ACL是否是预定义中三种之一,如果不是抛出异常 + * Checks if the ACL is one of the 3 predefined one. Throw OSSException if not. * * @param $options * @throws OssException @@ -2325,11 +2325,11 @@ class OssClient } /** - * 获得档次请求使用的域名 - * bucket在前的三级域名,或者二级域名,如果是cname或者ip的话,则是二级域名 + * Gets the host name for the current request. + * It could be either a third level domain (prefixed by bucket name) or second level domain if it's CName or IP * * @param $bucket - * @return string 剥掉协议头的域名 + * @return string The host name without the protocol scheem (e.g. https://) */ private function generateHostname($bucket) { @@ -2338,17 +2338,17 @@ class OssClient } elseif ($this->hostType === self::OSS_HOST_TYPE_CNAME) { $hostname = $this->hostname; } else { - // 专有域或者官网endpoint + // Private domain or public domain $hostname = ($bucket == '') ? $this->hostname : ($bucket . '.') . $this->hostname; } return $hostname; } /** - * 获得当次请求的资源定位字段 + * Gets the resource Uri in the current request * * @param $options - * @return string 资源定位字段 + * @return string return the resource uri. */ private function generateResourceUri($options) { @@ -2375,7 +2375,7 @@ class OssClient } /** - * 生成signalbe_query_string_param, array类型 + * Generates the signalbe query string parameters in array type * * @param array $options * @return array @@ -2416,7 +2416,7 @@ class OssClient } /** - * 生成用于签名resource段 + * Generates the resource uri for signing * * @param mixed $options * @return string @@ -2427,7 +2427,7 @@ class OssClient $signableResource .= '/'; if (isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET]) { $signableResource .= $options[self::OSS_BUCKET]; - // 如果操作没有Object操作的话,这里最后是否有斜线有个trick,ip的域名下,不需要加'/', 否则需要加'/' + // if there's no object in options, adding a '/' if the host type is not IP.\ if ($options[self::OSS_OBJECT] == '/') { if ($this->hostType !== self::OSS_HOST_TYPE_IP) { $signableResource .= "/"; @@ -2445,14 +2445,14 @@ class OssClient } /** - * 生成query_string + * generates query string * * @param mixed $options * @return string */ private function generateQueryString($options) { - //请求参数 + //query parameters $queryStringParams = array(); if (isset($options[self::OSS_QUERY_STRING])) { $queryStringParams = array_merge($queryStringParams, $options[self::OSS_QUERY_STRING]); @@ -2482,7 +2482,7 @@ class OssClient } /** - * 初始化headers + * Initialize headers * * @param mixed $options * @param string $hostname hostname @@ -2500,11 +2500,11 @@ class OssClient $headers[self::OSS_CONTENT_MD5] = $options[self::OSS_CONTENT_MD5]; } - //添加stsSecurityToken + //Add stsSecurityToken if ((!is_null($this->securityToken)) && (!$this->enableStsInUrl)) { $headers[self::OSS_SECURITY_TOKEN] = $this->securityToken; } - //合并HTTP headers + //Merge HTTP headers if (isset($options[self::OSS_HEADERS])) { $headers = array_merge($headers, $options[self::OSS_HEADERS]); } @@ -2512,7 +2512,7 @@ class OssClient } /** - * 生成请求用的UserAgent + * Generates UserAgent * * @return string */ @@ -2522,13 +2522,12 @@ class OssClient } /** - * 检查endpoint的种类 - * 如有有协议头,剥去协议头 - * 并且根据参数 is_cname 和endpoint本身,判定域名类型,是ip,cname,还是专有域或者官网域名 + * Checks endpoint type and returns the endpoint without the protocol schema. + * Figures out the domain's type (ip, cname or private/public domain). * * @param string $endpoint * @param boolean $isCName - * @return string 剥掉协议头的域名 + * @return string The domain name without the protocol schema. */ private function checkEndpoint($endpoint, $isCName) { @@ -2542,6 +2541,8 @@ class OssClient $ret_endpoint = $endpoint; } + $ret_endpoint = OssUtil::getHostPortFromEndpoint($ret_endpoint); + if ($isCName) { $this->hostType = self::OSS_HOST_TYPE_CNAME; } elseif (OssUtil::isIPFormat($ret_endpoint)) { @@ -2553,14 +2554,14 @@ class OssClient } /** - * 用来检查sdk所以来的扩展是否打开 - * + * Check if all dependent extensions are installed correctly. + * For now only "curl" is needed. * @throws OssException */ public static function checkEnv() { if (function_exists('get_loaded_extensions')) { - //检测curl扩展 + //Test curl extension $enabled_extension = array("curl"); $extensions = get_loaded_extensions(); if ($extensions) { @@ -2578,7 +2579,7 @@ class OssClient } /** - //* 设置http库的请求超时时间,单位秒 + * Sets the http's timeout (in seconds) * * @param int $timeout */ @@ -2588,7 +2589,7 @@ class OssClient } /** - * 设置http库的连接超时时间,单位秒 + * Sets the http's connection timeout (in seconds) * * @param int $connectTimeout */ @@ -2597,11 +2598,11 @@ class OssClient $this->connectTimeout = $connectTimeout; } - // 生命周期相关常量 + // Constants for Life cycle const OSS_LIFECYCLE_EXPIRATION = "Expiration"; const OSS_LIFECYCLE_TIMING_DAYS = "Days"; const OSS_LIFECYCLE_TIMING_DATE = "Date"; - //OSS 内部常量 + //OSS Internal constants const OSS_BUCKET = 'bucket'; const OSS_OBJECT = 'object'; const OSS_HEADERS = OssUtil::OSS_HEADERS; @@ -2670,18 +2671,18 @@ class OssClient const OSS_STORAGE_IA = 'IA'; const OSS_STORAGE_ARCHIVE = 'Archive'; - //私有URL变量 + //private URLs const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId'; const OSS_URL_EXPIRES = 'Expires'; const OSS_URL_SIGNATURE = 'Signature'; - //HTTP方法 + //HTTP METHOD const OSS_HTTP_GET = 'GET'; const OSS_HTTP_PUT = 'PUT'; const OSS_HTTP_HEAD = 'HEAD'; const OSS_HTTP_POST = 'POST'; const OSS_HTTP_DELETE = 'DELETE'; const OSS_HTTP_OPTIONS = 'OPTIONS'; - //其他常量 + //Others const OSS_ACL = 'x-oss-acl'; const OSS_OBJECT_ACL = 'x-oss-object-acl'; const OSS_OBJECT_GROUP = 'x-oss-file-group'; @@ -2692,7 +2693,7 @@ class OssClient const OSS_PROCESS = "x-oss-process"; const OSS_CALLBACK = "x-oss-callback"; const OSS_CALLBACK_VAR = "x-oss-callback-var"; - //支持STS SecurityToken + //Constants for STS SecurityToken const OSS_SECURITY_TOKEN = "x-oss-security-token"; const OSS_ACL_TYPE_PRIVATE = 'private'; const OSS_ACL_TYPE_PUBLIC_READ = 'public-read'; @@ -2700,39 +2701,39 @@ class OssClient const OSS_ENCODING_TYPE = "encoding-type"; const OSS_ENCODING_TYPE_URL = "url"; - // 域名类型 + // Domain Types const OSS_HOST_TYPE_NORMAL = "normal";//http://bucket.oss-cn-hangzhou.aliyuncs.com/object const OSS_HOST_TYPE_IP = "ip"; //http://1.1.1.1/bucket/object const OSS_HOST_TYPE_SPECIAL = 'special'; //http://bucket.guizhou.gov/object const OSS_HOST_TYPE_CNAME = "cname"; //http://mydomain.com/object - //OSS ACL数组 + //OSS ACL array static $OSS_ACL_TYPES = array( self::OSS_ACL_TYPE_PRIVATE, self::OSS_ACL_TYPE_PUBLIC_READ, self::OSS_ACL_TYPE_PUBLIC_READ_WRITE ); - // OssClient版本信息 + // OssClient version information const OSS_NAME = "aliyun-sdk-php"; - const OSS_VERSION = "2.3.0"; - const OSS_BUILD = "20180105"; + const OSS_VERSION = "2.3.1"; + const OSS_BUILD = "20191115"; const OSS_AUTHOR = ""; const OSS_OPTIONS_ORIGIN = 'Origin'; const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method'; const OSS_OPTIONS_REQUEST_HEADERS = 'Access-Control-Request-Headers'; - //是否使用ssl + //use ssl flag private $useSSL = false; private $maxRetries = 3; private $redirects = 0; - // 用户提供的域名类型,有四种 OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME + // user's domain type. It could be one of the four: OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME private $hostType = self::OSS_HOST_TYPE_NORMAL; private $requestUrl; + private $requestProxy = null; private $accessKeyId; private $accessKeySecret; private $hostname; private $securityToken; - private $requestProxy = null; private $enableStsInUrl = false; private $timeout = 0; private $connectTimeout = 0; diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php index 6da086042..7061ff090 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AclResult.php @@ -5,8 +5,7 @@ namespace OSS\Result; use OSS\Core\OssException; /** - * Class AclResult getBucketAcl接口返回结果类,封装了 - * 返回的xml数据的解析 + * The type of the return value of getBucketAcl, it wraps the data parsed from xml. * * @package OSS\Result */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php index 433c03eb1..d898d585e 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/AppendResult.php @@ -11,7 +11,7 @@ use OSS\Core\OssException; class AppendResult extends Result { /** - * 结果中part的next-append-position + * Get the value of next-append-position from append's response headers * * @return int * @throws OssException diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php index f7aa287c8..e9522d4f5 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ExistResult.php @@ -3,8 +3,7 @@ namespace OSS\Result; /** - * Class ExistResult 检查bucket和object是否存在的返回结果, - * 根据返回response的http status判断 + * Class ExistResult checks if bucket or object exists, according to the http status in response headers. * @package OSS\Result */ class ExistResult extends Result @@ -18,8 +17,8 @@ class ExistResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 判断是否存在的接口,404也认为是一种 - * 有效响应 + * Check if the response status is OK according to the http status code. + * [200-299]: OK; [404]: Not found. It means the object or bucket is not found--it's a valid response too. * * @return bool */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php index a51afe2a8..8fb10ea33 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetCorsResult.php @@ -18,8 +18,7 @@ class GetCorsResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 + * Check if the response is OK, according to the http status. [200-299]:OK, the Cors config could be got; [404]: not found--no Cors config. * * @return bool */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php index 6b440c352..e0a9595f2 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLifecycleResult.php @@ -12,7 +12,7 @@ use OSS\Model\LifecycleConfig; class GetLifecycleResult extends Result { /** - * 解析Lifestyle数据 + * Parse the LifecycleConfig object from the response * * @return LifecycleConfig */ @@ -25,8 +25,8 @@ class GetLifecycleResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 + * Check if the response is OK according to the http status. + * [200-299]: OK, and the LifecycleConfig could be got; [404] The Life cycle config is not found. * * @return bool */ @@ -38,4 +38,4 @@ class GetLifecycleResult extends Result } return false; } -} \ No newline at end of file +} diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php index 71c4c96e9..a0c512957 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLocationResult.php @@ -4,8 +4,8 @@ namespace OSS\Result; use OSS\Core\OssException; /** - * Class GetLocationResult getBucketLocation接口返回结果类,封装了 - * 返回的xml数据的解析 + * Class GetLocationResult getBucketLocation interface returns the result class, encapsulated + * The returned xml data is parsed * * @package OSS\Result */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php index 72fc3aeb1..eab8c645f 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetLoggingResult.php @@ -12,7 +12,7 @@ use OSS\Model\LoggingConfig; class GetLoggingResult extends Result { /** - * 解析LoggingConfig数据 + * Parse LoggingConfig data * * @return LoggingConfig */ @@ -25,8 +25,8 @@ class GetLoggingResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 + * Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface, + * 404 is also considered a valid response * * @return bool */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php index aee50d3ae..a8a649ebd 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetRefererResult.php @@ -12,7 +12,7 @@ use OSS\Model\RefererConfig; class GetRefererResult extends Result { /** - * 解析RefererConfig数据 + * Parse RefererConfig data * * @return RefererConfig */ @@ -25,8 +25,8 @@ class GetRefererResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 + * Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface, + * 404 is also considered a valid response * * @return bool */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php index 84e491606..2f4127b19 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetStorageCapacityResult.php @@ -5,8 +5,8 @@ namespace OSS\Result; use OSS\Core\OssException; /** - * Class AclResult getBucketAcl接口返回结果类,封装了 - * 返回的xml数据的解析 + * Class AclResult GetBucketAcl interface returns the result class, encapsulated + * The returned xml data is parsed * * @package OSS\Result */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php index 3099172cd..64d54facb 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/GetWebsiteResult.php @@ -11,7 +11,7 @@ use OSS\Model\WebsiteConfig; class GetWebsiteResult extends Result { /** - * 解析WebsiteConfig数据 + * Parse WebsiteConfig data * * @return WebsiteConfig */ @@ -24,8 +24,8 @@ class GetWebsiteResult extends Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK, 获取bucket相关配置的接口,404也认为是一种 - * 有效响应 + * Judged according to the return HTTP status code, [200-299] that is OK, get the bucket configuration interface, + * 404 is also considered a valid response * * @return bool */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php index c9aae561f..1ca4d1a28 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/HeaderResult.php @@ -11,7 +11,7 @@ namespace OSS\Result; class HeaderResult extends Result { /** - * 把返回的ResponseCore中的header作为返回数据 + * The returned ResponseCore header is used as the return data * * @return array */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php index af985f272..53a15da86 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/InitiateMultipartUploadResult.php @@ -12,7 +12,7 @@ use OSS\Core\OssException; class InitiateMultipartUploadResult extends Result { /** - * 结果中获取uploadId并返回 + * Get uploadId in result and return * * @throws OssException * @return string diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php index bcb20bf59..3220c8616 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListMultipartUploadResult.php @@ -14,7 +14,7 @@ use OSS\Model\UploadInfo; class ListMultipartUploadResult extends Result { /** - * 解析从ListMultipartUpload接口的返回数据 + * Parse the return data from the ListMultipartUpload interface * * @return ListMultipartUploadInfo */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php index fcf493d25..f44c66a05 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListObjectsResult.php @@ -14,7 +14,7 @@ use OSS\Model\PrefixInfo; class ListObjectsResult extends Result { /** - * 解析ListObjects接口返回的xml数据 + * Parse the xml data returned by the ListObjects interface * * return ObjectListInfo */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php index fd8a1b863..092d94e0f 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/ListPartsResult.php @@ -13,7 +13,7 @@ use OSS\Model\PartInfo; class ListPartsResult extends Result { /** - * 解析ListParts接口返回的xml数据 + * Parse the xml data returned by the ListParts interface * * @return ListPartsInfo */ diff --git a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php index 491256f00..e5d83d377 100644 --- a/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php +++ b/vendor/aliyuncs/oss-sdk-php/src/OSS/Result/Result.php @@ -7,8 +7,8 @@ use OSS\Http\ResponseCore; /** - * Class Result, 操作结果类的基类,不同的请求在处理返回数据的时候有不同的逻辑, - * 具体的解析逻辑推迟到子类实现 + * Class Result, The result class of The operation of the base class, different requests in dealing with the return of data have different logic, + * The specific parsing logic postponed to subclass implementation * * @package OSS\Model */ @@ -29,7 +29,7 @@ abstract class Result } /** - * 获取requestId + * Get requestId * * @return string */ @@ -46,7 +46,7 @@ abstract class Result } /** - * 得到返回数据,不同的请求返回数据格式不同 + * Get the returned data, different request returns the data format is different * * $return mixed */ @@ -56,14 +56,14 @@ abstract class Result } /** - * 由子类实现,不同的请求返回数据有不同的解析逻辑,由子类实现 + * Subclass implementation, different requests return data has different analytical logic, implemented by subclasses * * @return mixed */ abstract protected function parseDataFromResponse(); /** - * 操作是否成功 + * Whether the operation is successful * * @return mixed */ @@ -99,7 +99,7 @@ abstract class Result } /** - * 尝试从body中获取错误Message + * Try to get the error message from body * * @param $body * @return string @@ -117,7 +117,7 @@ abstract class Result } /** - * 尝试从body中获取错误Code + * Try to get the error Code from body * * @param $body * @return string @@ -135,7 +135,7 @@ abstract class Result } /** - * 根据返回http状态码判断,[200-299]即认为是OK + * Judging from the return http status code, [200-299] that is OK * * @return bool */ @@ -149,7 +149,7 @@ abstract class Result } /** - * 返回原始的返回数据 + * Return the original return data * * @return ResponseCore */ @@ -159,15 +159,15 @@ abstract class Result } /** - * 标示请求是否成功 + * Indicate whether the request is successful */ protected $isOk = false; /** - * 由子类解析过的数据 + * Data parsed by subclasses */ protected $parsedData = null; /** - * 存放auth函数返回的原始Response + * Store the original Response returned by the auth function * * @var ResponseCore */ diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php index a0db00379..337ea2435 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/CallbackTest.php @@ -17,7 +17,7 @@ class CallbackTest extends TestOssClientBase $this->ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__)); /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id + * step 1. Initialize a block upload event, which is initialized to upload Multipart, get the upload id */ try { $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); @@ -44,11 +44,10 @@ class CallbackTest extends TestOssClientBase /** * step 3. */ - $json = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", "callbackBodyType":"application/json" }'; @@ -78,7 +77,7 @@ class CallbackTest extends TestOssClientBase $this->ossClient->putObject($this->bucket, $copiedObject, file_get_contents(__FILE__)); /** - * step 1. 初始化一个分块上传事件, 也就是初始化上传Multipart, 获取upload id + * step 1. Initialize a block upload event, which is initialized to upload Multipart, get the upload id */ try { $upload_id = $this->ossClient->initiateMultipartUpload($this->bucket, $object); @@ -139,8 +138,8 @@ class CallbackTest extends TestOssClientBase { $json = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size}}", "callbackBodyType":"application/json" }'; @@ -151,8 +150,8 @@ class CallbackTest extends TestOssClientBase { $url = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}", "callbackBodyType":"application/x-www-form-urlencoded" }'; @@ -163,8 +162,8 @@ class CallbackTest extends TestOssClientBase { $url = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}" }'; $options = array(OssClient::OSS_CALLBACK => $url); @@ -174,8 +173,8 @@ class CallbackTest extends TestOssClientBase { $json = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"{\" 春水碧于天,画船听雨眠。\":\"垆边人似月,皓腕凝霜雪。\"}", "callbackBodyType":"application/json" }'; @@ -186,8 +185,8 @@ class CallbackTest extends TestOssClientBase { $url = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"春水碧于天,画船听雨眠。垆边人似月,皓腕凝霜雪", "callbackBodyType":"application/x-www-form-urlencoded" }'; @@ -198,8 +197,8 @@ class CallbackTest extends TestOssClientBase { $json = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"{\"mimeType\":${mimeType},\"size\":${size},\"x:var1\":${x:var1},\"x:var2\":${x:var2}}", "callbackBodyType":"application/json" }'; @@ -218,8 +217,8 @@ class CallbackTest extends TestOssClientBase { $url = '{ - "callbackUrl":"oss-demo.aliyuncs.com:23450", - "callbackHost":"oss-cn-hangzhou.aliyuncs.com", + "callbackUrl":"'.Common::getCallbackUrl().'",'. + ' "callbackHost":"oss-cn-hangzhou.aliyuncs.com", "callbackBody":"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&imageInfo.height=${imageInfo.height}&imageInfo.width=${imageInfo.width}&imageInfo.format=${imageInfo.format}&my_var1=${x:var1}&my_var2=${x:var2}", "callbackBodyType":"application/x-www-form-urlencoded" }'; diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php index 9d7190ccf..152894481 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/Common.php @@ -10,14 +10,14 @@ use OSS\Core\OssException; /** * Class Common * - * 示例程序【Samples/*.php】 的Common类,用于获取OssClient实例和其他公用方法 + * Sample program [Samples / *. Php] Common class, used to obtain OssClient instance and other public methods */ class Common { /** - * 根据Config配置,得到一个OssClient实例 + * According to the Config configuration, get an OssClient instance * - * @return OssClient 一个OssClient实例 + * @return OssClient An OssClient instance */ public static function getOssClient() { @@ -39,8 +39,18 @@ class Common return getenv('OSS_BUCKET'); } + public static function getRegion() + { + return getenv('OSS_REGION'); + } + + public static function getCallbackUrl() + { + return getenv('OSS_CALLBACK_URL'); + } + /** - * 工具方法,创建一个bucket + * Tool method, create a bucket */ public static function createBucket() { diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php index f207ca1ae..d0a2a225f 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientBucketTest.php @@ -51,11 +51,11 @@ class OssClientBucketTest extends TestOssClientBase $this->assertTrue($this->ossClient->doesBucketExist($this->bucket)); $this->assertFalse($this->ossClient->doesBucketExist($this->bucket . '-notexist')); - $this->assertEquals($this->ossClient->getBucketLocation($this->bucket), 'oss-us-west-1'); + $this->assertEquals($this->ossClient->getBucketLocation($this->bucket), Common::getRegion()); $res = $this->ossClient->getBucketMeta($this->bucket); $this->assertEquals('200', $res['info']['http_code']); - $this->assertEquals('oss-us-west-1', $res['x-oss-bucket-region']); + $this->assertEquals(Common::getRegion(), $res['x-oss-bucket-region']); } public function testCreateBucketWithStorageType() diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php index 34e3ded7d..2f1201bb5 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssClientObjectTest.php @@ -78,7 +78,7 @@ class OssClientObjectTest extends TestOssClientBase public function testObject() { /** - * 上传本地变量到bucket + * Upload the local variable to bucket */ $object = "oss-php-sdk-test/upload-test-object-name.txt"; $content = file_get_contents(__FILE__); @@ -129,7 +129,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * getObject到本地变量,检查是否match + * GetObject to the local variable and check for match */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -139,7 +139,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * getObject的前五个字节 + * GetObject first five bytes */ try { $options = array(OssClient::OSS_RANGE => '0-4'); @@ -151,7 +151,7 @@ class OssClientObjectTest extends TestOssClientBase /** - * 上传本地文件到object + * Upload the local file to object */ try { $this->ossClient->uploadFile($this->bucket, $object, __FILE__); @@ -160,7 +160,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 下载文件到本地变量,检查是否match + * Download the file to the local variable and check for match. */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -170,7 +170,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 下载文件到本地文件 + * Download the file to the local file */ $localfile = "upload-test-object-name.txt"; $options = array( @@ -188,7 +188,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 下载文件到本地文件 no such key + * Download the file to the local file. no such key */ $localfile = "upload-test-object-name-no-such-key.txt"; $options = array( @@ -208,7 +208,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 下载文件到内容 no such key + * Download the file to the content. no such key */ try { $result = $this->ossClient->getObject($this->bucket, $object . "no-such-key"); @@ -222,7 +222,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 复制object + * Copy object */ $to_bucket = $this->bucket; $to_object = $object . '.copy'; @@ -239,7 +239,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查复制的是否相同 + * Check if the replication is the same */ try { $content = $this->ossClient->getObject($this->bucket, $to_object); @@ -249,7 +249,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 列出bucket内的文件列表 + * List the files in your bucket. */ $prefix = ''; $delimiter = '/'; @@ -276,7 +276,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 设置文件的meta信息 + * Set the meta information for the file */ $from_bucket = $this->bucket; $from_object = "oss-php-sdk-test/upload-test-object-name.txt"; @@ -295,7 +295,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 获取文件的meta信息 + * Get the meta information for the file */ $object = "oss-php-sdk-test/upload-test-object-name.txt"; try { @@ -306,7 +306,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除单个文件 + * Delete single file */ $object = "oss-php-sdk-test/upload-test-object-name.txt"; @@ -319,7 +319,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除多个个文件 + * Delete multiple files */ $object1 = "oss-php-sdk-test/upload-test-object-name.txt"; $object2 = "oss-php-sdk-test/upload-test-object-name.txt.copy"; @@ -345,7 +345,7 @@ class OssClientObjectTest extends TestOssClientBase $content_array = array('Hello OSS', 'Hi OSS', 'OSS OK'); /** - * 追加上传字符串 + * Append the upload string */ try { $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[0], 0); @@ -359,7 +359,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查内容的是否相同 + * Check if the content is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -370,7 +370,7 @@ class OssClientObjectTest extends TestOssClientBase /** - * 删除测试object + * Delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -379,7 +379,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 追加上传本地文件 + * Append the upload of local files */ try { $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, 0); @@ -391,7 +391,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查复制的是否相同 + * Check if the replication is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -401,7 +401,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除测试object + * Delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -418,7 +418,7 @@ class OssClientObjectTest extends TestOssClientBase ); /** - * 带option的追加上传 + * Append upload with option */ try { $position = $this->ossClient->appendObject($this->bucket, $object, "Hello OSS, ", 0, $options); @@ -428,7 +428,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 获取文件的meta信息 + * Get the meta information for the file */ try { $objectMeta = $this->ossClient->getObjectMeta($this->bucket, $object); @@ -438,7 +438,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除测试object + * Delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -465,7 +465,7 @@ class OssClientObjectTest extends TestOssClientBase $options = array(OssClient::OSS_CHECK_MD5 => true); /** - * 上传数据开启MD5 + * Upload data to start MD5 */ try { $this->ossClient->putObject($this->bucket, $object, $content, $options); @@ -474,7 +474,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查复制的是否相同 + * Check if the replication is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -484,7 +484,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 上传文件开启MD5 + * Upload file to start MD5 */ try { $this->ossClient->uploadFile($this->bucket, $object, __FILE__, $options); @@ -493,7 +493,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查复制的是否相同 + * Check if the replication is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -503,7 +503,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除测试object + * Delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -516,7 +516,7 @@ class OssClientObjectTest extends TestOssClientBase $options = array(OssClient::OSS_CHECK_MD5 => true); /** - * 追加上传字符串 + * Append the upload string */ try { $position = $this->ossClient->appendObject($this->bucket, $object, $content_array[0], 0, $options); @@ -530,7 +530,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查内容的是否相同 + * Check if the content is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -540,7 +540,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除测试object + * Delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -549,7 +549,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 追加上传本地文件 + * Append upload of local files */ try { $position = $this->ossClient->appendFile($this->bucket, $object, __FILE__, 0, $options); @@ -561,7 +561,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 检查复制的是否相同 + * Check if the replication is the same */ try { $content = $this->ossClient->getObject($this->bucket, $object); @@ -571,7 +571,7 @@ class OssClientObjectTest extends TestOssClientBase } /** - * 删除测试object + * delete test object */ try { $this->ossClient->deleteObject($this->bucket, $object); @@ -580,6 +580,16 @@ class OssClientObjectTest extends TestOssClientBase } } + public function testWithInvalidBucketName() + { + try { + $this->ossClient->createBucket("abcefc/", "test-key"); + $this->assertFalse(true); + } catch (OssException $e) { + $this->assertEquals('"abcefc/"bucket name is invalid', $e->getMessage()); + } + } + public function setUp() { parent::setUp(); diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php index adf645719..c56524967 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/OssUtilTest.php @@ -222,4 +222,30 @@ BBBB; return str_replace("\n", "", str_replace("\r", "", $xml)); } + public function testGetHostPortFromEndpoint() + { + $str = OssUtil::getHostPortFromEndpoint('http://username:password@hostname:80/path?arg=value#anchor'); + $this->assertEquals('hostname:80', $str); + + $str = OssUtil::getHostPortFromEndpoint('hostname:80'); + $this->assertEquals('hostname:80', $str); + + $str = OssUtil::getHostPortFromEndpoint('www.hostname.com'); + $this->assertEquals('www.hostname.com', $str); + + $str = OssUtil::getHostPortFromEndpoint('http://www.hostname.com'); + $this->assertEquals('www.hostname.com', $str); + + $str = OssUtil::getHostPortFromEndpoint('https://www.hostname.com'); + $this->assertEquals('www.hostname.com', $str); + + $str = OssUtil::getHostPortFromEndpoint('192.168.1.10:8080'); + $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'); + $this->assertEquals('hostname:80', $str); + } } diff --git a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php index d257c9485..4a39dfa97 100644 --- a/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php +++ b/vendor/aliyuncs/oss-sdk-php/tests/OSS/Tests/SymlinkTest.php @@ -53,7 +53,7 @@ class SymlinkTest extends TestOssClientBase $this->ossClient->getObject($bucket, $symlink); $this->assertTrue(false); }catch (OssException $e){ - $this->assertEquals('The symlink target object does not exist', $e->getErrorMessage()); + $this->assertEquals('The specified key does not exist.', $e->getErrorMessage()); } } diff --git a/vendor/autoload.php b/vendor/autoload.php index 0b3127461..31c2da545 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0::getLoader(); +return ComposerAutoloaderInit70149920d09f8ca3335ec7e02d2d8da0::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 4a3945091..fabc09703 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -96,7 +96,9 @@ return array( 'Qiniu\\Processing\\ImageUrlBuilder' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\Operation' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\PersistentFop' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', + 'Qiniu\\Region' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Region.php', 'Qiniu\\Rtc\\AppClient' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php', + 'Qiniu\\Sms\\Sms' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Sms/Sms.php', 'Qiniu\\Storage\\ArgusManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php', 'Qiniu\\Storage\\BucketManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\FormUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', @@ -155,7 +157,6 @@ return array( 'think\\Model' => $baseDir . '/thinkphp/library/think/Model.php', 'think\\Paginator' => $baseDir . '/thinkphp/library/think/Paginator.php', 'think\\Process' => $baseDir . '/thinkphp/library/think/Process.php', - 'think\\Queue' => $vendorDir . '/topthink/think-queue/src/Queue.php', 'think\\Request' => $baseDir . '/thinkphp/library/think/Request.php', 'think\\Response' => $baseDir . '/thinkphp/library/think/Response.php', 'think\\Route' => $baseDir . '/thinkphp/library/think/Route.php', @@ -241,8 +242,6 @@ return array( 'think\\exception\\TemplateNotFoundException' => $baseDir . '/thinkphp/library/think/exception/TemplateNotFoundException.php', 'think\\exception\\ThrowableError' => $baseDir . '/thinkphp/library/think/exception/ThrowableError.php', 'think\\exception\\ValidateException' => $baseDir . '/thinkphp/library/think/exception/ValidateException.php', - 'think\\helper\\Arr' => $vendorDir . '/topthink/think-helper/src/Arr.php', - 'think\\helper\\Str' => $vendorDir . '/topthink/think-helper/src/Str.php', 'think\\log\\driver\\File' => $baseDir . '/thinkphp/library/think/log/driver/File.php', 'think\\log\\driver\\Socket' => $baseDir . '/thinkphp/library/think/log/driver/Socket.php', 'think\\log\\driver\\Test' => $baseDir . '/thinkphp/library/think/log/driver/Test.php', @@ -270,25 +269,22 @@ return array( 'think\\process\\pipes\\Pipes' => $baseDir . '/thinkphp/library/think/process/pipes/Pipes.php', 'think\\process\\pipes\\Unix' => $baseDir . '/thinkphp/library/think/process/pipes/Unix.php', 'think\\process\\pipes\\Windows' => $baseDir . '/thinkphp/library/think/process/pipes/Windows.php', - 'think\\queue\\CallQueuedHandler' => $vendorDir . '/topthink/think-queue/src/queue/CallQueuedHandler.php', - 'think\\queue\\Connector' => $vendorDir . '/topthink/think-queue/src/queue/Connector.php', - 'think\\queue\\Job' => $vendorDir . '/topthink/think-queue/src/queue/Job.php', - 'think\\queue\\Listener' => $vendorDir . '/topthink/think-queue/src/queue/Listener.php', - 'think\\queue\\Queueable' => $vendorDir . '/topthink/think-queue/src/queue/Queueable.php', - 'think\\queue\\ShouldQueue' => $vendorDir . '/topthink/think-queue/src/queue/ShouldQueue.php', - 'think\\queue\\Worker' => $vendorDir . '/topthink/think-queue/src/queue/Worker.php', - 'think\\queue\\command\\Listen' => $vendorDir . '/topthink/think-queue/src/queue/command/Listen.php', - 'think\\queue\\command\\Restart' => $vendorDir . '/topthink/think-queue/src/queue/command/Restart.php', - 'think\\queue\\command\\Subscribe' => $vendorDir . '/topthink/think-queue/src/queue/command/Subscribe.php', - 'think\\queue\\command\\Work' => $vendorDir . '/topthink/think-queue/src/queue/command/Work.php', - 'think\\queue\\connector\\Database' => $vendorDir . '/topthink/think-queue/src/queue/connector/Database.php', - 'think\\queue\\connector\\Redis' => $vendorDir . '/topthink/think-queue/src/queue/connector/Redis.php', - 'think\\queue\\connector\\Sync' => $vendorDir . '/topthink/think-queue/src/queue/connector/Sync.php', - 'think\\queue\\connector\\Topthink' => $vendorDir . '/topthink/think-queue/src/queue/connector/Topthink.php', - 'think\\queue\\job\\Database' => $vendorDir . '/topthink/think-queue/src/queue/job/Database.php', - 'think\\queue\\job\\Redis' => $vendorDir . '/topthink/think-queue/src/queue/job/Redis.php', - 'think\\queue\\job\\Sync' => $vendorDir . '/topthink/think-queue/src/queue/job/Sync.php', - 'think\\queue\\job\\Topthink' => $vendorDir . '/topthink/think-queue/src/queue/job/Topthink.php', + 'think\\queue\\Job' => $vendorDir . '/topthink/think-queue/src/Job.php', + 'think\\queue\\Listener' => $vendorDir . '/topthink/think-queue/src/Listener.php', + 'think\\queue\\Queue' => $vendorDir . '/topthink/think-queue/src/Queue.php', + 'think\\queue\\Worker' => $vendorDir . '/topthink/think-queue/src/Worker.php', + 'think\\queue\\command\\Listen' => $vendorDir . '/topthink/think-queue/src/command/Listen.php', + 'think\\queue\\command\\Restart' => $vendorDir . '/topthink/think-queue/src/command/Restart.php', + 'think\\queue\\command\\Subscribe' => $vendorDir . '/topthink/think-queue/src/command/Subscribe.php', + 'think\\queue\\command\\Work' => $vendorDir . '/topthink/think-queue/src/command/Work.php', + 'think\\queue\\driver\\Database' => $vendorDir . '/topthink/think-queue/src/driver/Database.php', + 'think\\queue\\driver\\Redis' => $vendorDir . '/topthink/think-queue/src/driver/Redis.php', + 'think\\queue\\driver\\Sync' => $vendorDir . '/topthink/think-queue/src/driver/Sync.php', + 'think\\queue\\driver\\Topthink' => $vendorDir . '/topthink/think-queue/src/driver/Topthink.php', + 'think\\queue\\job\\Database' => $vendorDir . '/topthink/think-queue/src/job/Database.php', + 'think\\queue\\job\\Redis' => $vendorDir . '/topthink/think-queue/src/job/Redis.php', + 'think\\queue\\job\\Sync' => $vendorDir . '/topthink/think-queue/src/job/Sync.php', + 'think\\queue\\job\\Topthink' => $vendorDir . '/topthink/think-queue/src/job/Topthink.php', 'think\\response\\Json' => $baseDir . '/thinkphp/library/think/response/Json.php', 'think\\response\\Jsonp' => $baseDir . '/thinkphp/library/think/response/Jsonp.php', 'think\\response\\Redirect' => $baseDir . '/thinkphp/library/think/response/Redirect.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 35feae109..fa92cbcb1 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,8 +6,7 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', '841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php', '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', - 'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php', + '9e05116ddaa5b1d244b68c3993908acd' => $vendorDir . '/topthink/think-queue/src/config.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 8ba25f6fb..3025938dd 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,11 +6,11 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'think\\queue\\' => array($vendorDir . '/topthink/think-queue/src'), 'think\\mongo\\' => array($vendorDir . '/topthink/think-mongo/src'), - 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), - 'think\\' => array($baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'), + 'think\\' => array($baseDir . '/thinkphp/library/think'), 'Wechat\\' => array($vendorDir . '/zoujingli/wechat-php-sdk/Wechat'), 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), 'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'), diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 4f288c239..60948e2c7 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0 +class ComposerAutoloaderInit70149920d09f8ca3335ec7e02d2d8da0 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit70149920d09f8ca3335ec7e02d2d8da0', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit70149920d09f8ca3335ec7e02d2d8da0', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInitd5e1dd6b5bff40c4a3f02a1f016b82a0 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequired5e1dd6b5bff40c4a3f02a1f016b82a0($fileIdentifier, $file); + composerRequire70149920d09f8ca3335ec7e02d2d8da0($fileIdentifier, $file); } return $loader; } } -function composerRequired5e1dd6b5bff40c4a3f02a1f016b82a0($fileIdentifier, $file) +function composerRequire70149920d09f8ca3335ec7e02d2d8da0($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index f65ed7cd0..613494db0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,20 +4,19 @@ namespace Composer\Autoload; -class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 +class ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0 { public static $files = array ( - '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php', '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', - 'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php', + '9e05116ddaa5b1d244b68c3993908acd' => __DIR__ . '/..' . '/topthink/think-queue/src/config.php', ); public static $prefixLengthsPsr4 = array ( 't' => array ( + 'think\\queue\\' => 12, 'think\\mongo\\' => 12, - 'think\\helper\\' => 13, 'think\\composer\\' => 15, 'think\\captcha\\' => 14, 'think\\' => 6, @@ -45,14 +44,14 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 ); public static $prefixDirsPsr4 = array ( + 'think\\queue\\' => + array ( + 0 => __DIR__ . '/..' . '/topthink/think-queue/src', + ), 'think\\mongo\\' => array ( 0 => __DIR__ . '/..' . '/topthink/think-mongo/src', ), - 'think\\helper\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-helper/src', - ), 'think\\composer\\' => array ( 0 => __DIR__ . '/..' . '/topthink/think-installer/src', @@ -64,7 +63,6 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 'think\\' => array ( 0 => __DIR__ . '/../..' . '/thinkphp/library/think', - 1 => __DIR__ . '/..' . '/topthink/think-queue/src', ), 'Wechat\\' => array ( @@ -179,7 +177,9 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 'Qiniu\\Processing\\ImageUrlBuilder' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php', 'Qiniu\\Processing\\Operation' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/Operation.php', 'Qiniu\\Processing\\PersistentFop' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php', + 'Qiniu\\Region' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Region.php', 'Qiniu\\Rtc\\AppClient' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php', + 'Qiniu\\Sms\\Sms' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Sms/Sms.php', 'Qiniu\\Storage\\ArgusManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php', 'Qiniu\\Storage\\BucketManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php', 'Qiniu\\Storage\\FormUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php', @@ -238,7 +238,6 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 'think\\Model' => __DIR__ . '/../..' . '/thinkphp/library/think/Model.php', 'think\\Paginator' => __DIR__ . '/../..' . '/thinkphp/library/think/Paginator.php', 'think\\Process' => __DIR__ . '/../..' . '/thinkphp/library/think/Process.php', - 'think\\Queue' => __DIR__ . '/..' . '/topthink/think-queue/src/Queue.php', 'think\\Request' => __DIR__ . '/../..' . '/thinkphp/library/think/Request.php', 'think\\Response' => __DIR__ . '/../..' . '/thinkphp/library/think/Response.php', 'think\\Route' => __DIR__ . '/../..' . '/thinkphp/library/think/Route.php', @@ -324,8 +323,6 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 'think\\exception\\TemplateNotFoundException' => __DIR__ . '/../..' . '/thinkphp/library/think/exception/TemplateNotFoundException.php', 'think\\exception\\ThrowableError' => __DIR__ . '/../..' . '/thinkphp/library/think/exception/ThrowableError.php', 'think\\exception\\ValidateException' => __DIR__ . '/../..' . '/thinkphp/library/think/exception/ValidateException.php', - 'think\\helper\\Arr' => __DIR__ . '/..' . '/topthink/think-helper/src/Arr.php', - 'think\\helper\\Str' => __DIR__ . '/..' . '/topthink/think-helper/src/Str.php', 'think\\log\\driver\\File' => __DIR__ . '/../..' . '/thinkphp/library/think/log/driver/File.php', 'think\\log\\driver\\Socket' => __DIR__ . '/../..' . '/thinkphp/library/think/log/driver/Socket.php', 'think\\log\\driver\\Test' => __DIR__ . '/../..' . '/thinkphp/library/think/log/driver/Test.php', @@ -353,25 +350,22 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 'think\\process\\pipes\\Pipes' => __DIR__ . '/../..' . '/thinkphp/library/think/process/pipes/Pipes.php', 'think\\process\\pipes\\Unix' => __DIR__ . '/../..' . '/thinkphp/library/think/process/pipes/Unix.php', 'think\\process\\pipes\\Windows' => __DIR__ . '/../..' . '/thinkphp/library/think/process/pipes/Windows.php', - 'think\\queue\\CallQueuedHandler' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/CallQueuedHandler.php', - 'think\\queue\\Connector' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Connector.php', - 'think\\queue\\Job' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Job.php', - 'think\\queue\\Listener' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Listener.php', - 'think\\queue\\Queueable' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Queueable.php', - 'think\\queue\\ShouldQueue' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/ShouldQueue.php', - 'think\\queue\\Worker' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/Worker.php', - 'think\\queue\\command\\Listen' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/command/Listen.php', - 'think\\queue\\command\\Restart' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/command/Restart.php', - 'think\\queue\\command\\Subscribe' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/command/Subscribe.php', - 'think\\queue\\command\\Work' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/command/Work.php', - 'think\\queue\\connector\\Database' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/connector/Database.php', - 'think\\queue\\connector\\Redis' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/connector/Redis.php', - 'think\\queue\\connector\\Sync' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/connector/Sync.php', - 'think\\queue\\connector\\Topthink' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/connector/Topthink.php', - 'think\\queue\\job\\Database' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/job/Database.php', - 'think\\queue\\job\\Redis' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/job/Redis.php', - 'think\\queue\\job\\Sync' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/job/Sync.php', - 'think\\queue\\job\\Topthink' => __DIR__ . '/..' . '/topthink/think-queue/src/queue/job/Topthink.php', + 'think\\queue\\Job' => __DIR__ . '/..' . '/topthink/think-queue/src/Job.php', + 'think\\queue\\Listener' => __DIR__ . '/..' . '/topthink/think-queue/src/Listener.php', + 'think\\queue\\Queue' => __DIR__ . '/..' . '/topthink/think-queue/src/Queue.php', + 'think\\queue\\Worker' => __DIR__ . '/..' . '/topthink/think-queue/src/Worker.php', + 'think\\queue\\command\\Listen' => __DIR__ . '/..' . '/topthink/think-queue/src/command/Listen.php', + 'think\\queue\\command\\Restart' => __DIR__ . '/..' . '/topthink/think-queue/src/command/Restart.php', + 'think\\queue\\command\\Subscribe' => __DIR__ . '/..' . '/topthink/think-queue/src/command/Subscribe.php', + 'think\\queue\\command\\Work' => __DIR__ . '/..' . '/topthink/think-queue/src/command/Work.php', + 'think\\queue\\driver\\Database' => __DIR__ . '/..' . '/topthink/think-queue/src/driver/Database.php', + 'think\\queue\\driver\\Redis' => __DIR__ . '/..' . '/topthink/think-queue/src/driver/Redis.php', + 'think\\queue\\driver\\Sync' => __DIR__ . '/..' . '/topthink/think-queue/src/driver/Sync.php', + 'think\\queue\\driver\\Topthink' => __DIR__ . '/..' . '/topthink/think-queue/src/driver/Topthink.php', + 'think\\queue\\job\\Database' => __DIR__ . '/..' . '/topthink/think-queue/src/job/Database.php', + 'think\\queue\\job\\Redis' => __DIR__ . '/..' . '/topthink/think-queue/src/job/Redis.php', + 'think\\queue\\job\\Sync' => __DIR__ . '/..' . '/topthink/think-queue/src/job/Sync.php', + 'think\\queue\\job\\Topthink' => __DIR__ . '/..' . '/topthink/think-queue/src/job/Topthink.php', 'think\\response\\Json' => __DIR__ . '/../..' . '/thinkphp/library/think/response/Json.php', 'think\\response\\Jsonp' => __DIR__ . '/../..' . '/thinkphp/library/think/response/Jsonp.php', 'think\\response\\Redirect' => __DIR__ . '/../..' . '/thinkphp/library/think/response/Redirect.php', @@ -390,9 +384,9 @@ class ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitd5e1dd6b5bff40c4a3f02a1f016b82a0::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit70149920d09f8ca3335ec7e02d2d8da0::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b53e9e00e..f0b2488b3 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,24 +1,18 @@ [ { "name": "aliyuncs/oss-sdk-php", - "version": "v2.3.0", - "version_normalized": "2.3.0.0", + "version": "v2.3.1", + "version_normalized": "2.3.1.0", "source": { "type": "git", "url": "https://github.com/aliyun/aliyun-oss-php-sdk.git", - "reference": "e69f57916678458642ac9d2fd341ae78a56996c8" + "reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/e69f57916678458642ac9d2fd341ae78a56996c8", - "reference": "e69f57916678458642ac9d2fd341ae78a56996c8", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/053d7ba9e798e4c09b9c5c1edab153d25ea9643a", + "reference": "053d7ba9e798e4c09b9c5c1edab153d25ea9643a", + "shasum": "" }, "require": { "php": ">=5.3" @@ -27,7 +21,7 @@ "phpunit/phpunit": "~4.0", "satooshi/php-coveralls": "~1.0" }, - "time": "2018-01-08T06:59:35+00:00", + "time": "2019-11-15T11:05:42+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -61,13 +55,7 @@ "type": "zip", "url": "https://api.github.com/repos/endroid/qr-code/zipball/c9644bec2a9cc9318e98d1437de3c628dcd1ef93", "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "ext-gd": "*", @@ -118,24 +106,18 @@ }, { "name": "qiniu/php-sdk", - "version": "v7.2.7", - "version_normalized": "7.2.7.0", + "version": "v7.2.10", + "version_normalized": "7.2.10.0", "source": { "type": "git", "url": "https://github.com/qiniu/php-sdk.git", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6" + "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/88d11a5857ebc6871204e9be6ceec54bf5f381e6", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8", + "reference": "d89987163f560ebf9dfa5bb25de9bd9b1a3b2bd8", + "shasum": "" }, "require": { "php": ">=5.3.3" @@ -144,7 +126,7 @@ "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.3" }, - "time": "2018-11-06T13:34:32+00:00", + "time": "2019-10-28T10:23:23+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -177,29 +159,23 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.24", - "version_normalized": "3.4.24.0", + "version": "v3.4.35", + "version_normalized": "3.4.35.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "926e3b797e6bb66c0e4d7da7eff3a174f7378bcf" + "reference": "b224d20be60e6f7b55cd66914379a13a0b28651a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/926e3b797e6bb66c0e4d7da7eff3a174f7378bcf", - "reference": "926e3b797e6bb66c0e4d7da7eff3a174f7378bcf", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b224d20be60e6f7b55cd66914379a13a0b28651a", + "reference": "b224d20be60e6f7b55cd66914379a13a0b28651a", + "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2019-02-23T15:06:07+00:00", + "time": "2019-10-26T11:02:01+00:00", "type": "library", "extra": { "branch-alias": { @@ -250,13 +226,7 @@ "type": "zip", "url": "https://api.github.com/repos/top-think/framework/zipball/c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be", "reference": "c255c22b2f5fa30f320ecf6c1d29f7740eb3e8be", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "php": ">=5.4.0", @@ -309,13 +279,7 @@ "type": "zip", "url": "https://api.github.com/repos/top-think/think-captcha/zipball/1d64363c814c92f6086c4fa5e3223fe7e23db09d", "reference": "1d64363c814c92f6086c4fa5e3223fe7e23db09d", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "topthink/framework": "~5.0.0", @@ -344,50 +308,6 @@ ], "description": "captcha package for thinkphp5" }, - { - "name": "topthink/think-helper", - "version": "v3.0.0", - "version_normalized": "3.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-helper.git", - "reference": "8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455", - "reference": "8ba5f66e68106369fcc3211e7d2dbaf7bc9ce455", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "time": "2019-03-14T09:28:59+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\helper\\": "src" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP5 Helper Package" - }, { "name": "topthink/think-installer", "version": "v1.0.12", @@ -401,13 +321,7 @@ "type": "zip", "url": "https://api.github.com/repos/top-think/think-installer/zipball/1be326e68f63de4e95977ed50f46ae75f017556d", "reference": "1be326e68f63de4e95977ed50f46ae75f017556d", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "require": { "composer-plugin-api": "^1.0" @@ -450,13 +364,7 @@ "type": "zip", "url": "https://api.github.com/repos/top-think/think-mongo/zipball/657cc79bd5f090a58b0cc83776073dd69c83a3d1", "reference": "657cc79bd5f090a58b0cc83776073dd69c83a3d1", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "shasum": "" }, "time": "2018-06-03T01:51:27+00:00", "type": "library", @@ -481,46 +389,28 @@ }, { "name": "topthink/think-queue", - "version": "v1.1.6", - "version_normalized": "1.1.6.0", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", "source": { "type": "git", "url": "https://github.com/top-think/think-queue.git", - "reference": "250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245" + "reference": "bd0cf0f18146fafd4314c30a26b105d8b71f72b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/think-queue/zipball/250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245", - "reference": "250650eb0e8ea5af4cfdc7ae46f3f4e0a24ac245", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/think-helper": ">=1.0.4", - "topthink/think-installer": ">=1.0.10" - }, - "require-dev": { - "topthink/framework": "~5.0.0" - }, - "time": "2018-10-15T10:16:55+00:00", - "type": "think-extend", - "extra": { - "think-config": { - "queue": "src/config.php" - } + "url": "https://api.github.com/repos/top-think/think-queue/zipball/bd0cf0f18146fafd4314c30a26b105d8b71f72b2", + "reference": "bd0cf0f18146fafd4314c30a26b105d8b71f72b2", + "shasum": "" }, + "time": "2016-11-25T03:41:00+00:00", + "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "think\\": "src" + "think\\queue\\": "src" }, "files": [ - "src/common.php" + "src/config.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -537,29 +427,23 @@ }, { "name": "zoujingli/ip2region", - "version": "v1.0.5", - "version_normalized": "1.0.5.0", + "version": "v1.0.7", + "version_normalized": "1.0.7.0", "source": { "type": "git", "url": "https://github.com/zoujingli/ip2region.git", - "reference": "944dc687304133027c4586a35ff78b57e56dd659" + "reference": "f898a7d90cfacd54433de4028190c336164f2ae4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ip2region/zipball/944dc687304133027c4586a35ff78b57e56dd659", - "reference": "944dc687304133027c4586a35ff78b57e56dd659", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/zoujingli/ip2region/zipball/f898a7d90cfacd54433de4028190c336164f2ae4", + "reference": "f898a7d90cfacd54433de4028190c336164f2ae4", + "shasum": "" }, "require": { "php": ">=5.3" }, - "time": "2019-01-23T06:23:53+00:00", + "time": "2019-10-29T09:03:57+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -591,24 +475,21 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/wechat-php-sdk.git", - "reference": "afb0dfd1a0fd71cfe58b6811d559b6b0fc8f9de0" + "reference": "d37d0c1919ede2ee54e65100ac3792e947b1e0ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/wechat-php-sdk/zipball/afb0dfd1a0fd71cfe58b6811d559b6b0fc8f9de0", - "reference": "afb0dfd1a0fd71cfe58b6811d559b6b0fc8f9de0", - "shasum": "", - "mirrors": [ - { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", - "preferred": true - } - ] + "url": "https://api.github.com/repos/zoujingli/wechat-php-sdk/zipball/d37d0c1919ede2ee54e65100ac3792e947b1e0ef", + "reference": "d37d0c1919ede2ee54e65100ac3792e947b1e0ef", + "shasum": "" }, "require": { + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", "php": ">=5.3.3" }, - "time": "2018-10-23T09:57:56+00:00", + "time": "2019-10-10T09:42:15+00:00", "type": "project", "installation-source": "dist", "autoload": { diff --git a/vendor/qiniu/php-sdk/.travis.yml b/vendor/qiniu/php-sdk/.travis.yml index 60951b15c..e4eee7bea 100644 --- a/vendor/qiniu/php-sdk/.travis.yml +++ b/vendor/qiniu/php-sdk/.travis.yml @@ -7,6 +7,8 @@ php: - 5.6 - 7.0 +dist: trusty + before_script: - export QINIU_TEST_ENV="travis" - travis_retry composer self-update @@ -21,3 +23,8 @@ script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + +env: + global: + - secure: "V9BsntXQZwvO9EOD6itzaae2uq+GemzyTUTxMTJx1/jFoUNpCU2O2UAgjA2XSEr5sgci0KWDV4Krbzv3EBB4uplOFLMI3w32256UHbT9E0x3YjhfPJZk68MH1iS1be7X81LDHON7yveavK8987s3qzjeUcbfLSPgccT+cvf7+dc=" + - QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5 \ No newline at end of file diff --git a/vendor/qiniu/php-sdk/docs/sms/example.php b/vendor/qiniu/php-sdk/docs/sms/example.php new file mode 100644 index 000000000..541c0d6c2 --- /dev/null +++ b/vendor/qiniu/php-sdk/docs/sms/example.php @@ -0,0 +1,70 @@ + 'code' ); +try { + //发送短信 + $resp = $client->sendMessage($template_id, $mobiles, $code); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +}exit; +//模板模块 +$name="tstest001"; +$template="tesy001 ${code}"; +$type="notification"; +$description="tstest001"; +$signature_id="1131464448834277376"; +$id="1131810682442883072"; + +try { + //创建模板 + $resp = $client->createTemplate($name, $template, $type, $description, $signature_id); + print_r($resp); + //查询模板 + $resp = $client->queryTemplate(); + print_r($resp); + //修改模板 + $resp = $client->updateTemplate($id, $name, $template, $description, $signature_id); + print_r($resp); + //删除模板 + $resp = $client->deleteTemplate($id); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +} +//签名模块 +$signature = 'lfxlive2'; +$source = 'enterprises_and_institutions'; +$pic="/Users/Desktop/sss.jpg"; +$audit_status="passed"; +$page=1; +$page_size=1; +$id="1131464448834277376"; + +try { + //创建签名 + $resp = $client->createSignature($signature, $source, $pic); + print_r($resp); + //查询签名 + $resp = $client->checkSignature($audit_status); + //修改签名 + $resp = $client->updateSignature($id, $signature, $source, $pic); + print_r($resp); + //删除ID + $resp = $client->deleteSignature($id); + print_r($resp); +} catch (\Exception $e) { + echo "Error:", $e, "\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php new file mode 100644 index 000000000..3f7fefd5b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php @@ -0,0 +1,30 @@ +bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days +); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucket.php b/vendor/qiniu/php-sdk/examples/delete_bucket.php new file mode 100644 index 000000000..dc2e30505 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucket.php @@ -0,0 +1,20 @@ +deleteBucket($name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php new file mode 100644 index 000000000..00df6cae2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php @@ -0,0 +1,21 @@ +deleteBucketEvent($bucket, $name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php new file mode 100644 index 000000000..a53699267 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php @@ -0,0 +1,21 @@ +deleteBucketLifecycleRule($bucket, $name); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketEvents.php b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php new file mode 100644 index 000000000..53a5c88d2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php @@ -0,0 +1,20 @@ +getBucketEvents($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php new file mode 100644 index 000000000..652bee8ce --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php @@ -0,0 +1,20 @@ +getBucketLifecycleRules($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketList.php b/vendor/qiniu/php-sdk/examples/get_bucketList.php new file mode 100644 index 000000000..74aaa65f3 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketList.php @@ -0,0 +1,20 @@ +listbuckets($region); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketQuota.php b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php new file mode 100644 index 000000000..563395d61 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php @@ -0,0 +1,20 @@ +getBucketQuota($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfo.php b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php new file mode 100644 index 000000000..ff052a436 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php @@ -0,0 +1,20 @@ +bucketInfo($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfos.php b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php new file mode 100644 index 000000000..0ad650325 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php @@ -0,0 +1,20 @@ +bucketInfos($region); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/get_corsRules.php b/vendor/qiniu/php-sdk/examples/get_corsRules.php new file mode 100644 index 000000000..fbfde2d21 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_corsRules.php @@ -0,0 +1,20 @@ +getCorsRules($bucket); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php new file mode 100644 index 000000000..b4539264a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php @@ -0,0 +1,21 @@ +putBucketAccessMode($bucket, $private); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php new file mode 100644 index 000000000..2f7c27f2b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php @@ -0,0 +1,21 @@ +putBucketAccessStyleMode($bucket, $mode); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketEvent.php b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php new file mode 100644 index 000000000..33dbb44c0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php @@ -0,0 +1,25 @@ +putBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php new file mode 100644 index 000000000..77092e90a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php @@ -0,0 +1,21 @@ +putBucketMaxAge($bucket, $maxAge); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketQuota.php b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php new file mode 100644 index 000000000..18082b631 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php @@ -0,0 +1,22 @@ +putBucketQuota($bucket, $size, $count); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php new file mode 100644 index 000000000..6828bc9ac --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php @@ -0,0 +1,23 @@ +putReferAntiLeech($bucket, $mode, $norefer, $pattern); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_pub_domain.php b/vendor/qiniu/php-sdk/examples/rs_pub_domain.php new file mode 100644 index 000000000..2e81922eb --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_pub_domain.php @@ -0,0 +1,19 @@ +publishDomain($bucket, $domain); +if ($err) { + print_r($err); +} diff --git a/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php new file mode 100644 index 000000000..4dcf27096 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php @@ -0,0 +1,33 @@ +listFilesv2($bucket, $prefix, $marker, $limit, $delimiter, true); + +if ($err) { + print_r($err); +} else { + print_r($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketEvent.php b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php new file mode 100644 index 000000000..26347ac41 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php @@ -0,0 +1,25 @@ +updateBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php new file mode 100644 index 000000000..85eb07a6b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php @@ -0,0 +1,30 @@ +updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days +); +if ($err) { + print_r($err); +} else { + print_r($Info); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_and_callback.php b/vendor/qiniu/php-sdk/examples/upload_and_callback.php index 4762bd330..1a7070557 100644 --- a/vendor/qiniu/php-sdk/examples/upload_and_callback.php +++ b/vendor/qiniu/php-sdk/examples/upload_and_callback.php @@ -1,6 +1,5 @@ 'filename=$(fname)&filesize=$(fsize)' ); $uptoken = $auth->uploadToken($bucket, null, 3600, $policy); - //上传文件的本地路径 $filePath = './php-logo.png'; - //指定 config // $uploadMgr = new UploadManager($config); $uploadMgr = new UploadManager(); - list($ret, $err) = $uploadMgr->putFile($uptoken, null, $filePath); echo "\n====> putFile result: \n"; if ($err !== null) { diff --git a/vendor/qiniu/php-sdk/phpunit.xml.dist b/vendor/qiniu/php-sdk/phpunit.xml.dist index 72ff67f97..840f6e568 100644 --- a/vendor/qiniu/php-sdk/phpunit.xml.dist +++ b/vendor/qiniu/php-sdk/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="true" > diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php index 0e6abac08..9b462f31a 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php @@ -169,23 +169,17 @@ final class CdnManager */ public static function createTimestampAntiLeechUrl($rawUrl, $encryptKey, $durationInSeconds) { - $parsedUrl = parse_url($rawUrl); - $deadline = time() + $durationInSeconds; $expireHex = dechex($deadline); $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; - $path = implode('/', array_map('rawurlencode', explode('/', $path))); - $strToSign = $encryptKey . $path . $expireHex; $signStr = md5($strToSign); - if (isset($parsedUrl['query'])) { $signedUrl = $rawUrl . '&sign=' . $signStr . '&t=' . $expireHex; } else { $signedUrl = $rawUrl . '?sign=' . $signStr . '&t=' . $expireHex; } - return $signedUrl; } } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Config.php b/vendor/qiniu/php-sdk/src/Qiniu/Config.php index b1f63674b..c80cd309f 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Config.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Config.php @@ -3,48 +3,51 @@ namespace Qiniu; final class Config { - const SDK_VER = '7.2.7'; + const SDK_VER = '7.2.10'; const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 const RSF_HOST = 'rsf.qiniu.com'; const API_HOST = 'api.qiniu.com'; const RS_HOST = 'rs.qiniu.com'; //RS Host - const UC_HOST = 'https://api.qiniu.com'; //UC Host + const UC_HOST = 'uc.qbox.me'; //UC Host const RTCAPI_HOST = 'http://rtc.qiniuapi.com'; const ARGUS_HOST = 'argus.atlab.ai'; + const CASTER_HOST = 'pili-caster.qiniuapi.com'; + const SMS_HOST="https://sms.qiniuapi.com"; const RTCAPI_VERSION = 'v3'; + const SMS_VERSION='v1'; - // Zone 空间对应的机房 - public $zone; + // Zone 空间对应的存储区域 + public $region; //BOOL 是否使用https域名 public $useHTTPS; //BOOL 是否使用CDN加速上传域名 public $useCdnDomains; // Zone Cache - private $zoneCache; + private $regionCache; // 构造函数 - public function __construct(Zone $z = null) + public function __construct(Region $z = null) { $this->zone = $z; $this->useHTTPS = false; $this->useCdnDomains = false; - $this->zoneCache = array(); + $this->regionCache = array(); } public function getUpHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; } else { $scheme = "http://"; } - $host = $zone->srcUpHosts[0]; + $host = $region->srcUpHosts[0]; if ($this->useCdnDomains === true) { - $host = $zone->cdnUpHosts[0]; + $host = $region->cdnUpHosts[0]; } return $scheme . $host; @@ -52,16 +55,16 @@ final class Config public function getUpBackupHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; } else { $scheme = "http://"; } - $host = $zone->cdnUpHosts[0]; + $host = $region->cdnUpHosts[0]; if ($this->useCdnDomains === true) { - $host = $zone->srcUpHosts[0]; + $host = $region->srcUpHosts[0]; } return $scheme . $host; @@ -69,7 +72,7 @@ final class Config public function getRsHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -77,12 +80,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->rsHost; + return $scheme . $region->rsHost; } public function getRsfHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -90,12 +93,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->rsfHost; + return $scheme . $region->rsfHost; } public function getIovipHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -103,12 +106,12 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->iovipHost; + return $scheme . $region->iovipHost; } public function getApiHost($accessKey, $bucket) { - $zone = $this->getZone($accessKey, $bucket); + $region = $this->getRegion($accessKey, $bucket); if ($this->useHTTPS === true) { $scheme = "https://"; @@ -116,22 +119,22 @@ final class Config $scheme = "http://"; } - return $scheme . $zone->apiHost; + return $scheme . $region->apiHost; } - private function getZone($accessKey, $bucket) + private function getRegion($accessKey, $bucket) { $cacheId = "$accessKey:$bucket"; - if (isset($this->zoneCache[$cacheId])) { - $zone = $this->zoneCache[$cacheId]; + if (isset($this->regionCache[$cacheId])) { + $region = $this->regionCache[$cacheId]; } elseif (isset($this->zone)) { - $zone = $this->zone; - $this->zoneCache[$cacheId] = $zone; + $region = $this->zone; + $this->regionCache[$cacheId] = $region; } else { - $zone = Zone::queryZone($accessKey, $bucket); - $this->zoneCache[$cacheId] = $zone; + $region = Zone::queryZone($accessKey, $bucket); + $this->regionCache[$cacheId] = $region; } - return $zone; + return $region; } } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php index 425c314cf..0fe03ceed 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php @@ -25,6 +25,12 @@ final class Client return self::sendRequest($request); } + public static function PUT($url, $body, array $headers = array()) + { + $request = new Request('PUT', $url, $headers, $body); + return self::sendRequest($request); + } + public static function multipartPost( $url, $fields, @@ -56,6 +62,7 @@ final class Client array_push($data, ''); $body = implode("\r\n", $data); + // var_dump($data);exit; $contentType = 'multipart/form-data; boundary=' . $mimeBoundary; $headers['Content-Type'] = $contentType; $request = new Request('POST', $url, $headers, $body); @@ -91,12 +98,10 @@ final class Client CURLOPT_CUSTOMREQUEST => $request->method, CURLOPT_URL => $request->url, ); - // Handle open_basedir & safe mode if (!ini_get('safe_mode') && !ini_get('open_basedir')) { $options[CURLOPT_FOLLOWLOCATION] = true; } - if (!empty($request->headers)) { $headers = array(); foreach ($request->headers as $key => $val) { @@ -105,7 +110,6 @@ final class Client $options[CURLOPT_HTTPHEADER] = $headers; } curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); - if (!empty($request->body)) { $options[CURLOPT_POSTFIELDS] = $request->body; } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Region.php b/vendor/qiniu/php-sdk/src/Qiniu/Region.php new file mode 100644 index 000000000..eae21d199 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Region.php @@ -0,0 +1,196 @@ +srcUpHosts = $srcUpHosts; + $this->cdnUpHosts = $cdnUpHosts; + $this->rsHost = $rsHost; + $this->rsfHost = $rsfHost; + $this->apiHost = $apiHost; + $this->iovipHost = $iovipHost; + } + + //华东机房 + public static function regionHuadong() + { + $regionHuadong = new Region( + array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), + array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $regionHuadong; + } + + //华东机房内网上传 + public static function qvmRegionHuadong() + { + $qvmRegionHuadong = new Region( + array("free-qvm-z0-xs.qiniup.com"), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $qvmRegionHuadong; + } + + //华北机房内网上传 + public static function qvmRegionHuabei() + { + $qvmRegionHuabei = new Region( + array("free-qvm-z1-zz.qiniup.com"), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + return $qvmRegionHuabei; + } + + //华北机房 + public static function regionHuabei() + { + $regionHuabei = new Region( + array('up-z1.qiniup.com'), + array('upload-z1.qiniup.com'), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + + return $regionHuabei; + } + + //华南机房 + public static function regionHuanan() + { + $regionHuanan = new Region( + array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), + array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), + "rs-z2.qbox.me", + "rsf-z2.qbox.me", + "api-z2.qiniu.com", + "iovip-z2.qbox.me" + ); + return $regionHuanan; + } + + //北美机房 + public static function regionNorthAmerica() + { + //北美机房 + $regionNorthAmerica = new Region( + array('up-na0.qiniup.com'), + array('upload-na0.qiniup.com'), + "rs-na0.qbox.me", + "rsf-na0.qbox.me", + "api-na0.qiniu.com", + "iovip-na0.qbox.me" + ); + return $regionNorthAmerica; + } + + //新加坡机房 + public static function regionSingapore() + { + //新加坡机房 + $regionSingapore = new Region( + array('up-as0.qiniup.com'), + array('upload-as0.qiniup.com'), + "rs-as0.qbox.me", + "rsf-as0.qbox.me", + "api-as0.qiniu.com", + "iovip-as0.qbox.me" + ); + return $regionSingapore; + } + + /* + * GET /v2/query?ak=&&bucket= + **/ + public static function queryRegion($ak, $bucket) + { + $Region = new Region(); + $url = Config::API_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket"; + $ret = Client::Get($url); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + //parse Region; + + $iovipHost = $r['io']['src']['main'][0]; + $Region->iovipHost = $iovipHost; + $accMain = $r['up']['acc']['main'][0]; + array_push($Region->cdnUpHosts, $accMain); + if (isset($r['up']['acc']['backup'])) { + foreach ($r['up']['acc']['backup'] as $key => $value) { + array_push($Region->cdnUpHosts, $value); + } + } + $srcMain = $r['up']['src']['main'][0]; + array_push($Region->srcUpHosts, $srcMain); + if (isset($r['up']['src']['backup'])) { + foreach ($r['up']['src']['backup'] as $key => $value) { + array_push($Region->srcUpHosts, $value); + } + } + + //set specific hosts + if (strstr($Region->iovipHost, "z1") !== false) { + $Region->rsHost = "rs-z1.qbox.me"; + $Region->rsfHost = "rsf-z1.qbox.me"; + $Region->apiHost = "api-z1.qiniu.com"; + } elseif (strstr($Region->iovipHost, "z2") !== false) { + $Region->rsHost = "rs-z2.qbox.me"; + $Region->rsfHost = "rsf-z2.qbox.me"; + $Region->apiHost = "api-z2.qiniu.com"; + } elseif (strstr($Region->iovipHost, "na0") !== false) { + $Region->rsHost = "rs-na0.qbox.me"; + $Region->rsfHost = "rsf-na0.qbox.me"; + $Region->apiHost = "api-na0.qiniu.com"; + } elseif (strstr($Region->iovipHost, "as0") !== false) { + $Region->rsHost = "rs-as0.qbox.me"; + $Region->rsfHost = "rsf-as0.qbox.me"; + $Region->apiHost = "api-as0.qiniu.com"; + } else { + $Region->rsHost = "rs.qbox.me"; + $Region->rsfHost = "rsf.qbox.me"; + $Region->apiHost = "api.qiniu.com"; + } + + return $Region; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php index c07ee72f3..a7dc11e1e 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php @@ -19,6 +19,7 @@ class AppClient } /* + * 创建应用 * hub: 直播空间名 * title: app 的名称 注意,Title 不是唯一标识,重复 create 动作将生成多个 app * maxUsers:人数限制 @@ -32,7 +33,7 @@ class AppClient if (!empty($maxUsers)) { $params['maxUsers'] = $maxUsers; } - if (!empty($noAutoKickUser)) { + if ($noAutoKickUser !== null) { $params['noAutoKickUser'] = $noAutoKickUser; } $body = json_encode($params); @@ -41,6 +42,7 @@ class AppClient } /* + * 更新应用 * appId: app 的唯一标识,创建的时候由系统生成。 * Title: app 的名称, 可选。 * Hub: 绑定的直播 hub,可选,用于合流后 rtmp 推流。 @@ -63,7 +65,7 @@ class AppClient if (!empty($maxUsers)) { $params['maxUsers'] = $maxUsers; } - if (!empty($noAutoKickUser)) { + if ($noAutoKickUser !== null) { $params['noAutoKickUser'] = $noAutoKickUser; } if (!empty($mergePublishRtmp)) { @@ -75,6 +77,7 @@ class AppClient } /* + * 获取应用信息 * appId: app 的唯一标识,创建的时候由系统生成。 */ public function getApp($appId) @@ -85,6 +88,7 @@ class AppClient } /* + * 删除应用 * appId: app 的唯一标识,创建的时候由系统生成 */ public function deleteApp($appId) @@ -95,7 +99,7 @@ class AppClient } /* - * 获取房间的人数 + * 获取房间内用户列表 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 操作所查询的连麦房间。 */ @@ -107,7 +111,7 @@ class AppClient } /* - * 踢出玩家 + * 踢出用户 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 连麦房间 * userId: 请求加入房间的用户ID @@ -120,7 +124,7 @@ class AppClient } /* - * 获取房间的人数 + * 获取应用中活跃房间 * appId: app 的唯一标识,创建的时候由系统生成。 * prefix: 所查询房间名的前缀索引,可以为空。 * offset: int 类型,分页查询的位移标记。 @@ -149,6 +153,7 @@ class AppClient } /* + * 生成加入房间的令牌 * appId: app 的唯一标识,创建的时候由系统生成。 * roomName: 房间名称,需满足规格 ^[a-zA-Z0-9_-]{3,64}$ * userId: 请求加入房间的用户 ID,需满足规格 ^[a-zA-Z0-9_-]{3,50}$ diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php new file mode 100644 index 000000000..f19a124fb --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php @@ -0,0 +1,337 @@ +auth = $auth; + + $this->baseURL = sprintf("%s/%s/", Config::SMS_HOST, Config::SMS_VERSION); + } + + /* + * 创建签名 + * signature: string 类型,必填,【长度限制8个字符内】超过长度会报错 + * source: string 类型,必填,申请签名时必须指定签名来源。取值范围为: + nterprises_and_institutions 企事业单位的全称或简称 + website 工信部备案网站的全称或简称 + app APP应用的全称或简称 + public_number_or_small_program 公众号或小程序的全称或简称 + store_name 电商平台店铺名的全称或简称 + trade_name 商标名的全称或简称, + * pics: 本地的图片路径 string 类型,可选 + *@return: 类型array { + "signature_id": + } + */ + public function createSignature($signature, $source, $pics = null) + { + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = $this->imgToBase64($pics); + } + $body = json_encode($params); + $url =$this->baseURL.'signature'; + $ret = $this->post($url, $body); + return $ret; + } + + /* + * 编辑签名 + * id 签名id : string 类型,必填, + * signature: string 类型,必填, + * source: string 类型,必填,申请签名时必须指定签名来源。取值范围为: + enterprises_and_institutions 企事业单位的全称或简称 + website 工信部备案网站的全称或简称 + app APP应用的全称或简称 + public_number_or_small_program 公众号或小程序的全称或简称 + store_name 电商平台店铺名的全称或简称 + trade_name 商标名的全称或简称, + * pics: 本地的图片路径 string 类型,可选, + * @return: 类型array { + "signature": string + } + */ + public function updateSignature($id, $signature, $source, $pics = null) + { + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = $this->imgToBase64($pics); + } + $body = json_encode($params); + $url =$this->baseURL.'signature/'.$id; + $ret = $this->PUT($url, $body); + return $ret; + } + + /* + * 查询签名 + * audit_status: 审核状态 string 类型,可选, + 取值范围为: "passed"(通过), "rejected"(未通过), "reviewing"(审核中) + * page:页码 int 类型, + * page_size: 分页大小 int 类型,可选, 默认为20 + *@return: 类型array { + "items": [{ + "id": string, + "signature": string, + "source": string, + "audit_status": string, + "reject_reason": string, + "created_at": int64, + "updated_at": int64 + }...], + "total": int, + "page": int, + "page_size": int, + } + */ + public function checkSignature($audit_status = null, $page = 1, $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL.'signature', + $audit_status, + $page, + $page_size + ); + $ret = $this->get($url); + return $ret; + } + + + /* + * 删除签名 + * id 签名id string 类型,必填, + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function deleteSignature($id) + { + $url = $this->baseURL . 'signature/' . $id; + list(, $err) = $this->delete($url); + return $err; + } + + + + + /* + * 创建模板 + * name : 模板名称 string 类型 ,必填 + * template: 模板内容 string 类型,必填 + * type: 模板类型 string 类型,必填, + 取值范围为: notification (通知类短信), verification (验证码短信), marketing (营销类短信) + * description: 申请理由简述 string 类型,必填 + * signature_id: 已经审核通过的签名 string 类型,必填 + * @return: 类型 array { + "template_id": string + } + */ + public function createTemplate( + $name, + $template, + $type, + $description, + $signture_id + ) { + $params['name'] = $name; + $params['template'] = $template; + $params['type'] = $type; + $params['description'] = $description; + $params['signature_id'] = $signture_id; + + $body = json_encode($params); + $url =$this->baseURL.'template'; + $ret = $this->post($url, $body); + return $ret; + } + + /* + * 查询模板 + * audit_status: 审核状态 string 类型 ,可选, + 取值范围为: passed (通过), rejected (未通过), reviewing (审核中) + * page: 页码 int 类型,可选,默认为 1 + * page_size: 分页大小 int 类型,可选,默认为 20 + * @return: 类型array{ + "items": [{ + "id": string, + "name": string, + "template": string, + "audit_status": string, + "reject_reason": string, + "type": string, + "signature_id": string, // 模版绑定的签名ID + "signature_text": string, // 模版绑定的签名内容 + "created_at": int64, + "updated_at": int64 + }...], + "total": int, + "page": int, + "page_size": int + } + */ + public function queryTemplate($audit_status = null, $page = 1, $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL.'template', + $audit_status, + $page, + $page_size + ); + $ret = $this->get($url); + return $ret; + } + + /* + * 编辑模板 + * id :模板id + * name : 模板名称 string 类型 ,必填 + * template: 模板内容 string 类型,必填 + * description: 申请理由简述 string 类型,必填 + * signature_id: 已经审核通过的签名 string 类型,必填 + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function updateTemplate( + $id, + $name, + $template, + $description, + $signature_id + ) { + $params['name'] = $name; + $params['template'] = $template; + $params['description'] = $description; + $params['signature_id'] = $signature_id; + $body = json_encode($params); + $url =$this->baseURL.'template/'.$id; + $ret = $this->PUT($url, $body); + return $ret; + } + + /* + * 删除模板 + * id :模板id string 类型,必填, + * @retrun : 请求成功 HTTP 状态码为 200 + */ + public function deleteTemplate($id) + { + $url = $this->baseURL . 'template/' . $id; + list(, $err) = $this->delete($url); + return $err; + } + + /* + * 发送短信 + * 编辑模板 + * template_id :模板id string类型,必填 + * mobiles : 手机号数组 []string 类型 ,必填 + * parameters: 模板内容 map[string]string 类型,可选 + * @return: 类型json { + "job_id": string + } + */ + public function sendMessage($template_id, $mobiles, $parameters = null) + { + $params['template_id'] = $template_id; + $params['mobiles'] = $mobiles; + if (!empty($parameters)) { + $params['parameters'] = $parameters; + } + $body = json_encode($params); + $url =$this->baseURL.'message'; + $ret = $this->post($url, $body); + return $ret; + } + + public function imgToBase64($img_file) + { + $img_base64 = ''; + if (file_exists($img_file)) { + $app_img_file = $img_file; // 图片路径 + $img_info = getimagesize($app_img_file); // 取得图片的大小,类型等 + $fp = fopen($app_img_file, "r"); // 图片是否可读权限 + if ($fp) { + $filesize = filesize($app_img_file); + if ($filesize > 5*1024*1024) { + die("pic size < 5M !"); + } + $content = fread($fp, $filesize); + $file_content = chunk_split(base64_encode($content)); // base64编码 + switch ($img_info[2]) { //判读图片类型 + case 1: + $img_type = 'gif'; + break; + case 2: + $img_type = 'jpg'; + break; + case 3: + $img_type = 'png'; + break; + } + //合成图片的base64编码 + $img_base64 = 'data:image/' . $img_type . ';base64,' . $file_content; + } + fclose($fp); + } + + return $img_base64; + } + + private function get($url, $cType = null) + { + $rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType); + $rtcToken['Content-Type'] = $cType; + $ret = Client::get($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function delete($url, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::delete($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function post($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::post($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + private function PUT($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "PUT", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::put($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php index 2e82a1477..0a2413dd4 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php @@ -41,6 +41,56 @@ final class BucketManager return $this->rsGet('/buckets?shared=' . $includeShared); } + /** + * 列举空间,返回bucket列表 + * region 指定区域,global 指定全局空间。 + * 在指定了 region 参数时, + * 如果指定 global 为 true,那么忽略 region 参数指定的区域,返回所有区域的全局空间。 + * 如果没有指定 global 为 true,那么返回指定区域中非全局空间。 + * 在没有指定 region 参数时(包括指定为空""), + * 如果指定 global 为 true,那么返回所有区域的全局空间。 + * 如果没有指定 global 为 true,那么返回指定区域中所有的空间,包括全局空间。 + * 在指定了line为 true 时,只返回 Line 空间;否则,只返回非 Line 空间。 + * share 参数用于指定共享空间。 + */ + + public function listbuckets( + $region = null, + $line = 'false', + $shared = 'false' + ) { + $path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $shared; + $info = $this->ucPost($path); + return $info; + } + + /** + * 创建空间 + * + * @param $name 创建的空间名 + * @param $region 创建的区域,默认华东 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function createBucket($name, $region = 'z0') + { + $path = '/mkbucketv2/'.$name.'/region/' . $region; + return $this->rsPost($path, null); + } + + /** + * 删除空间 + * + * @param $name 删除的空间名 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucket($name) + { + $path = '/drop/'.$name; + return $this->rsPost($path, null); + } + /** * 获取指定空间绑定的所有的域名 * @@ -51,6 +101,34 @@ final class BucketManager return $this->apiGet('/v6/domain/list?tbl=' . $bucket); } + /** + * 获取指定空间的相关信息 + * + * @return string[] 包含空间信息 + */ + public function bucketInfo($bucket) + { + $path = '/v2/bucketInfo?bucket=' . $bucket; + $info = $this->ucPost($path); + return $info; + } + + /** + * 获取指定zone的空间信息列表 + * 在Region 未指定且Global 不为 true 时(包含未指定的情况,下同),返回用户的所有空间。 + * 在指定了 region 参数且 global 不为 true 时,只列举非全局空间。 + * shared 不指定shared参数或指定shared为rw或false时,返回包含具有读写权限空间, + * 指定shared为rd或true时,返回包含具有读权限空间。 + * fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。 + * @return string[] 包含空间信息 + */ + public function bucketInfos($region = null, $shared = 'false', $fs = 'false') + { + $path = '/v2/bucketInfos?region=' . $region . '&shared=' . $shared . '&fs=' . $fs; + $info = $this->ucPost($path); + return $info; + } + /** * 获取空间绑定的域名列表 * @return string[] 包含空间绑定的所有域名 @@ -66,18 +144,23 @@ final class BucketManager * @param $delimiter 指定目录分隔符 * * @return array 包含文件信息的数组,类似:[ - * { - * "hash" => "", - * "key" => "", - * "fsize" => "", - * "putTime" => "" - * }, - * ... - * ] +* { +* "hash" => "", +* "key" => "", +* "fsize" => "", +* "putTime" => "" +* }, +* ... +* ] * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html */ - public function listFiles($bucket, $prefix = null, $marker = null, $limit = 1000, $delimiter = null) - { + public function listFiles( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null + ) { $query = array('bucket' => $bucket); \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); \Qiniu\setWithoutEmpty($query, 'marker', $marker); @@ -87,6 +170,493 @@ final class BucketManager return $this->get($url); } + /** + * 列取空间的文件列表 + * + * @param $bucket 空间名 + * @param $prefix 列举前缀 + * @param $marker 列举标识符 + * @param $limit 单次列举个数限制 + * @param $delimiter 指定目录分隔符 + * @param $skipconfirm 是否跳过已删除条目的确认机制 + * + * @return array 包含文件信息的数组,类似:[ +* { +* "hash" => "", +* "key" => "", +* "fsize" => "", +* "putTime" => "" +* }, +* ... +* ] + * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html + */ + public function listFilesv2( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null, + $skipconfirm = true + ) { + $query = array('bucket' => $bucket); + \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); + \Qiniu\setWithoutEmpty($query, 'marker', $marker); + \Qiniu\setWithoutEmpty($query, 'limit', $limit); + \Qiniu\setWithoutEmpty($query, 'delimiter', $delimiter); + \Qiniu\setWithoutEmpty($query, 'skipconfirm', $skipconfirm); + $path = '/v2/list?' . http_build_query($query); + $url = $this->getRsfHost() . $path; + $headers = $this->auth->authorization($url, null, 'application/x-www-form-urlencoded'); + $ret = Client::post($url, null, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = explode("\n", $ret->body); + $pop = array_pop($r); + return array($r, null); + } + + /** + * 设置Referer防盗链 + * + * @param $bucket 空间名 + * @param $mode 0: 表示关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); + * 1: 表示设置Referer白名单; 2:表示设置Referer黑名单 + * @param $norefer 0: 表示不允许空 Refer 访问; 1: 表示允许空 Refer 访问 + * @param $pattern 规则字符串, 当前允许格式分为三种: 一种为空主机头域名, + * 比如 foo.com; 一种是泛域名,比如 *.bar.com; 一种是完全通配符, + * 即一个 *; 多个规则之间用;隔开, 比如: foo.com;*.bar.com;sub.foo.com;*.sub.bar.com + * @param $source_enabled 源站是否支持,默认为0只给CDN配置, 设置为1表示开启源站防盗链 + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + // public function referAntiLeech(){ + + // } + + /** + * 增加bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为 + * 字母、数字、下划线 + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示 + * 不转低频存储,小于0表示上传的文件立即变低频存储 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days + ) { + $path = '/rules/add'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、 + * 数字、下划线 + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示不 + * 转低频存储,小于0表示上传的文件立即变低频存储 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days + ) { + $path = '/rules/update'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 获取bucket生命规则 + * + * @param $bucket 空间名 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function getBucketLifecycleRules($bucket) + { + $path = '/rules/get?bucket=' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 删除bucket生命规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucketLifecycleRule($bucket, $name) + { + $path = '/rules/delete'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 增加bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $suffix 可选,文件配置的后缀 + * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append, + * disable,enable,deleteMarkerCreate + * @param $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param $host 可选,通知请求的host + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function putBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/add'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($suffix) { + $params['suffix'] = $suffix; + } + if ($callbackURL) { + $params['callbackURL'] = $callbackURL; + } + if ($access_key) { + $params['access_key'] = $access_key; + } + if ($host) { + $params['host'] = $host; + } + $data = http_build_query($params); + if ($event) { + $eventpath = ""; + foreach ($event as $key => $value) { + $eventpath .= "&event=$value"; + } + $data .= $eventpath; + } + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param $prefix 同一个 bucket 里面前缀不能重复 + * @param $suffix 可选,文件配置的后缀 + * @param $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append,disable, + * enable,deleteMarkerCreate + * @param $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param $host 可选,通知请求的host + * + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function updateBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/update'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($suffix) { + $params['suffix'] = $suffix; + } + if ($event) { + $params['event'] = $event; + } + if ($callbackURL) { + $params['callbackURL'] = $callbackURL; + } + if ($access_key) { + $params['access_key'] = $access_key; + } + if ($host) { + $params['host'] = $host; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 获取bucket事件通知规则 + * + * @param $bucket 空间名 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function getBucketEvents($bucket) + { + $path = '/events/get?bucket=' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 删除bucket事件通知规则 + * + * @param $bucket 空间名 + * @param $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线 + * @return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error + */ + public function deleteBucketEvent($bucket, $name) + { + $path = '/events/delete'; + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 设置bucket的跨域信息,最多允许设置10条跨域规则。 + * 对于同一个域名如果设置了多条规则,那么按顺序使用第一条匹配的规则去生成返回值。 + * 对于简单跨域请求,只匹配 Origin; + * allowed_orgin: 允许的域名。必填;支持通配符*;*表示全部匹配;只有第一个*生效; + * 需要设置"Scheme";大小写敏感。例如 + * 规则:http://*.abc.*.com 请求:"http://test.abc.test.com" 结果:不通过 + * 规则:"http://abc.com" 请求:"https://abc.com"/"abc.com" 结果:不通过 + * 规则:"abc.com" 请求:"http://abc.com" 结果:不通过 + * allowed_method: 允许的方法。必填;不支持通配符;大小写不敏感; + * allowed_header: 允许的header。选填;支持通配符*, + * 但只能是单独的*,表示允许全部header,其他*不生效; + * 空则不允许任何header;大小写不敏感; + * exposed_header: 暴露的header。选填;不支持通配符; + * X-Log, X-Reqid是默认会暴露的两个header; + * 其他的header如果没有设置,则不会暴露;大小写不敏感; + * max_age: 结果可以缓存的时间。选填;空则不缓存; + * allowed_credentials:该配置不支持设置,默认为true。 + * 备注:如果没有设置任何corsRules,那么默认允许所有的跨域请求 + */ + // public function putCorsRules(string $bucket, array $params) + // { + // $path = '/corsRules/set/' . $bucket; + // $data = json_encode($params); + // $info = $this->ucPost($path, $data); + // return $info; + // } + + /** + * 获取bucket的跨域信息 + * $bucket 空间名 + */ + public function getCorsRules($bucket) + { + $path = '/corsRules/get/' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 设置回源规则 + * 使用该API设置源站优先级高于/image设置的源站,即IO优先读取source接口设置的源站配置, + * 如果存在会忽略/image设置的源站 + * Bucket 空间名 + * Host(可选)回源Host + * RetryCodes(可选),镜像回源时源站返回Code可以重试,最多指定3个,当前只支持4xx错误码重试 + * SourceQiniuAK,SourceQiniuSK(可选)如果存在将在回源时对URL进行签名,客户源站可以验证 + * 以保证请求来自Qiniu服务器 + * Expires(可选) 签名过期时间,如果不设置默认为1小时 + * Addr 回源地址,不可重复。 + * Weight 权重,范围限制1-100,不填默认为1,回源时会根据所有源的权重值进行源站选择, + * 主备源会分开计算. + * Backup 是否备用回源,回源优先尝试主源 + */ + // public function putBucktSourceConfig(array $params) + // { + // $path = '/mirrorConfig/set'; + // $data = json_encode($params); + // $info = $this->ucPostV2($path, $data); + // return $info; + // } + + /** + * 获取空间回源配置 + */ + public function getBucktSourceConfig(array $params) + { + $path = '/mirrorConfig/get'; + $data = json_encode($params); + $info = $this->ucPostV2($path, $data); + return $info; + } + + /** + * 开关原图保护 + * mode 为1表示开启原图保护,0表示关闭 + */ + public function putBucketAccessStyleMode($bucket, $mode) + { + $path = '/accessMode/' . $bucket . '/mode/' . $mode; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置私有属性 + * private为0表示公开,为1表示私有 + */ + public function putBucketAccessMode($bucket, $private) + { + $path = '/bucket/' . $bucket . '/private/' . $private; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置referer防盗链 + * bucket=: bucket 名 + * mode=: + * 0: 表示关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); + * 1: 表示设置Referer白名单; 2: 表示设置Referer黑名单 + * norefer=: 0: 表示不允许空 Refer 访问; + * 1: 表示允许空 Refer 访问 + * pattern=: 规则字符串, 当前允许格式分为三种: + * 一种为空主机头域名, 比如 foo.com; + * 一种是泛域名, 比如 *.bar.com; 一种是完全通配符, 即一个 *; + * 多个规则之间用;隔开, 比如: foo.com;*.bar.com;sub.foo.com;*.sub.bar.com + * 空主机头域名可以是多级域名,比如 foo.bar.com。 + * 多个域名之间不允许夹带空白字符。 + * source_enabled=:1 + */ + public function putReferAntiLeech($bucket, $mode, $norefer, $pattern, $enabled = 1) + { + $path = "/referAntiLeech?bucket=$bucket&mode=$mode&norefer=$norefer&pattern=$pattern&source_enabled=$enabled"; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置Bucket的maxAge + * maxAge为0或者负数表示为默认值(31536000) + */ + public function putBucketMaxAge($bucket, $maxAge) + { + $path = '/maxAge?bucket=' . $bucket . '&maxAge=' . $maxAge; + $info = $this->ucPost($path, null); + return $info; + } + + /** + * 设置配额 + * : 空间名称,不支持授权空间 + * : 空间存储量配额,参数传入0或不传表示不更改当前配置,传入-1表示取消限额, + * 新创建的空间默认没有限额。 + * : 空间文件数配额,参数含义同 + */ + public function putBucketQuota($bucket, $size, $count) + { + $path = '/setbucketquota/' . $bucket . '/size/' . $size . '/count/' . $count; + $info = $this->apiPost($path, null); + return $info; + } + + /** + * 获取配额 + * bucket 空间名称 + */ + public function getBucketQuota($bucket) + { + $path = '/getbucketquota/' . $bucket; + $info = $this->apiPost($path, null); + return $info; + } + /** * 获取资源的元信息,但不返回文件内容 * @@ -94,13 +664,13 @@ final class BucketManager * @param $key 待获取资源的文件名 * * @return array 包含文件信息的数组,类似: - * [ - * "hash" => "", - * "key" => "", - * "fsize" => , - * "putTime" => "" - * "fileType" => - * ] +* [ +* "hash" => "", +* "key" => "", +* "fsize" => , +* "putTime" => "" +* "fileType" => +* ] * * @link http://developer.qiniu.com/docs/v6/api/reference/rs/stat.html */ @@ -142,7 +712,7 @@ final class BucketManager } /** - * 给资源进行重命名,本质为move操作。 + * 对资源进行复制。 * * @param $from_bucket 待操作资源所在空间 * @param $from_key 待操作资源文件名 @@ -188,7 +758,7 @@ final class BucketManager } /** - * 主动修改指定资源的文件类型 + * 主动修改指定资源的文件元信息 * * @param $bucket 待操作资源所在空间 * @param $key 待操作资源文件名 @@ -368,12 +938,39 @@ final class BucketManager return $scheme . Config::API_HOST; } + private function getUcHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS == true) { + $scheme = "https://"; + } + return $scheme . Config::UC_HOST; + } + private function rsPost($path, $body = null) { $url = $this->getRsHost() . $path; return $this->post($url, $body); } + private function apiPost($path, $body = null) + { + $url = $this->getApiHost() . $path; + return $this->post($url, $body); + } + + private function ucPost($path, $body = null) + { + $url = $this->getUcHost() . $path; + return $this->post($url, $body); + } + + private function ucGet($path) + { + $url = $this->getUcHost() . $path; + return $this->get($url); + } + private function apiGet($path) { $url = $this->getApiHost() . $path; @@ -407,6 +1004,24 @@ final class BucketManager return array($r, null); } + private function ucPostV2($path, $body) + { + $url = $this->getUcHost() . $path; + return $this->postV2($url, $body); + } + + private function postV2($url, $body) + { + $headers = $this->auth->authorizationV2($url, 'POST', $body, 'application/json'); + $headers["Content-Type"] = 'application/json'; + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + public static function buildBatchCopy($source_bucket, $key_pairs, $target_bucket, $force) { return self::twoKeyBatch('/copy', $source_bucket, $key_pairs, $target_bucket, $force); diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php index 5c3361f96..d87756a02 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php @@ -33,10 +33,8 @@ final class FormUploader $mime, $fname ) { - $fields = array('token' => $upToken); if ($key === null) { - $fname='nullkey'; } else { $fields['key'] = $key; } diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php index 209df11ad..8fbd504ca 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php @@ -46,7 +46,7 @@ final class UploadManager $data, $params = null, $mime = 'application/octet-stream', - $fname = null + $fname = "default_filename" ) { $params = self::trimParams($params); diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Zone.php b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php index 9b142dcc7..7af0e3f54 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Zone.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php @@ -1,197 +1,47 @@ srcUpHosts = $srcUpHosts; - $this->cdnUpHosts = $cdnUpHosts; - $this->rsHost = $rsHost; - $this->rsfHost = $rsfHost; - $this->apiHost = $apiHost; - $this->iovipHost = $iovipHost; - } - - //华东机房 - public static function zone0() + public static function zonez0() { - $Zone_z0 = new Zone( - array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), - array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), - 'rs.qbox.me', - 'rsf.qbox.me', - 'api.qiniu.com', - 'iovip.qbox.me' - ); - return $Zone_z0; + return parent::regionHuadong(); } - //华东机房内网上传 - public static function zoneZ0() + public static function zonez1() { - $Zone_z01 = new Zone( - array("free-qvm-z0-xs.qiniup.com"), - 'rs.qbox.me', - 'rsf.qbox.me', - 'api.qiniu.com', - 'iovip.qbox.me' - ); - return $Zone_z01; + return parent::regionHuabei(); } - //华北机房内网上传 - public static function zoneZ1() + public static function zonez2() { - $Zone_z12 = new Zone( - array("free-qvm-z1-zz.qiniup.com"), - "rs-z1.qbox.me", - "rsf-z1.qbox.me", - "api-z1.qiniu.com", - "iovip-z1.qbox.me" - ); - return $Zone_z12; + return parent::regionHuanan(); } - //华北机房 - public static function zone1() - { - $Zone_z1 = new Zone( - array('up-z1.qiniup.com'), - array('upload-z1.qiniup.com'), - "rs-z1.qbox.me", - "rsf-z1.qbox.me", - "api-z1.qiniu.com", - "iovip-z1.qbox.me" - ); - - return $Zone_z1; - } - - //华南机房 - public static function zone2() - { - $Zone_z2 = new Zone( - array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), - array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), - "rs-z2.qbox.me", - "rsf-z2.qbox.me", - "api-z2.qiniu.com", - "iovip-z2.qbox.me" - ); - return $Zone_z2; - } - - //北美机房 - public static function zoneNa0() - { - //北美机房 - $Zone_na0 = new Zone( - array('up-na0.qiniup.com'), - array('upload-na0.qiniup.com'), - "rs-na0.qbox.me", - "rsf-na0.qbox.me", - "api-na0.qiniu.com", - "iovip-na0.qbox.me" - ); - return $Zone_na0; - } - - //新加坡机房 public static function zoneAs0() { - //新加坡机房 - $Zone_as0 = new Zone( - array('up-as0.qiniup.com'), - array('upload-as0.qiniup.com'), - "rs-as0.qbox.me", - "rsf-as0.qbox.me", - "api-as0.qiniu.com", - "iovip-as0.qbox.me" - ); - return $Zone_as0; + return parent::regionSingapore(); + } + + public static function zoneNa0() + { + return parent::regionNorthAmerica(); + } + + public static function qvmZonez0() + { + return parent::qvmRegionHuadong(); + } + + public static function qvmZonez1() + { + return parent::qvmRegionHuabei(); } - /* - * GET /v2/query?ak=&&bucket= - **/ public static function queryZone($ak, $bucket) { - $zone = new Zone(); - $url = Config::UC_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket"; - $ret = Client::Get($url); - if (!$ret->ok()) { - return array(null, new Error($url, $ret)); - } - $r = ($ret->body === null) ? array() : $ret->json(); - //print_r($ret); - //parse zone; - - $iovipHost = $r['io']['src']['main'][0]; - $zone->iovipHost = $iovipHost; - $accMain = $r['up']['acc']['main'][0]; - array_push($zone->cdnUpHosts, $accMain); - if (isset($r['up']['acc']['backup'])) { - foreach ($r['up']['acc']['backup'] as $key => $value) { - array_push($zone->cdnUpHosts, $value); - } - } - $srcMain = $r['up']['src']['main'][0]; - array_push($zone->srcUpHosts, $srcMain); - if (isset($r['up']['src']['backup'])) { - foreach ($r['up']['src']['backup'] as $key => $value) { - array_push($zone->srcUpHosts, $value); - } - } - - //set specific hosts - if (strstr($zone->iovipHost, "z1") !== false) { - $zone->rsHost = "rs-z1.qbox.me"; - $zone->rsfHost = "rsf-z1.qbox.me"; - $zone->apiHost = "api-z1.qiniu.com"; - } elseif (strstr($zone->iovipHost, "z2") !== false) { - $zone->rsHost = "rs-z2.qbox.me"; - $zone->rsfHost = "rsf-z2.qbox.me"; - $zone->apiHost = "api-z2.qiniu.com"; - } elseif (strstr($zone->iovipHost, "na0") !== false) { - $zone->rsHost = "rs-na0.qbox.me"; - $zone->rsfHost = "rsf-na0.qbox.me"; - $zone->apiHost = "api-na0.qiniu.com"; - } elseif (strstr($zone->iovipHost, "as0") !== false) { - $zone->rsHost = "rs-as0.qbox.me"; - $zone->rsfHost = "rsf-as0.qbox.me"; - $zone->apiHost = "api-as0.qiniu.com"; - } else { - $zone->rsHost = "rs.qbox.me"; - $zone->rsfHost = "rsf.qbox.me"; - $zone->apiHost = "api.qiniu.com"; - } - - return $zone; + return parent::queryRegion($ak, $bucket); } } diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php index 5a858dfa2..892197da7 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php @@ -25,7 +25,7 @@ class CdnManagerTest extends \PHPUnit_Framework_TestCase $this->cdnManager = new CdnManager($testAuth); $this->encryptKey = $timestampAntiLeechEncryptKey; - $this->imgUrl = $customDomain . '/24.jpg'; + $this->imgUrl = $customDomain . '/sdktest.png'; } public function testCreateTimestampAntiLeechUrl() @@ -34,17 +34,8 @@ class CdnManagerTest extends \PHPUnit_Framework_TestCase $signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->imgUrl, $this->encryptKey, 3600); $response = Client::get($signUrl); + $this->assertEquals($response->statusCode, 200); $this->assertNull($response->error); - - $url2 = $this->imgUrl . '?imageInfo'; - $signUrl2 = $this->cdnManager->createTimestampAntiLeechUrl($url2, $this->encryptKey, 3600); - - $response = Client::get($signUrl2); - $imgInfo = $response->json(); - - $this->assertEquals($response->statusCode, 200); - $this->assertEquals($imgInfo['size'], 2196145); - $this->assertNull($response->error); } } diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php index 82990f2a1..5373ab379 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php @@ -8,7 +8,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase public function test() { global $testAuth; - $base_url = 'http://private-res.qiniudn.com/gogopher.jpg'; + $base_url = 'http://sdk.peterpy.cn/gogopher.jpg'; $private_url = $testAuth->privateDownloadUrl($base_url); $response = Client::get($private_url); $this->assertEquals(200, $response->statusCode); @@ -17,7 +17,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase public function testFop() { global $testAuth; - $base_url = 'http://private-res.qiniudn.com/gogopher.jpg?exif'; + $base_url = 'http://sdk.peterpy.cn/gogopher.jpg?exif'; $private_url = $testAuth->privateDownloadUrl($base_url); $response = Client::get($private_url); $this->assertEquals(200, $response->statusCode); diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php index e1ea730e8..6cbdb7f76 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php @@ -8,7 +8,7 @@ class FopTest extends \PHPUnit_Framework_TestCase { public function testExifPub() { - $fop = new Operation('testres.qiniudn.com'); + $fop = new Operation('sdk.peterpy.cn'); list($exif, $error) = $fop->execute('gogopher.jpg', 'exif'); $this->assertNull($error); $this->assertNotNull($exif); diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php index 00008d457..41e6ea8ab 100644 --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php @@ -35,7 +35,7 @@ class ResumeUpTest extends \PHPUnit_Framework_TestCase public function test4ML2() { $key = 'resumePutFile4ML'; - $zone = new Zone(array('up.qiniup.com')); + $zone = new Zone(array('up.fake.qiniu.com'), array('up.qiniup.com')); $cfg = new Config($zone); $upManager = new UploadManager($cfg); $token = $this->auth->uploadToken($this->bucketName, $key); diff --git a/vendor/qiniu/php-sdk/tests/bootstrap.php b/vendor/qiniu/php-sdk/tests/bootstrap.php index 5bd8b0569..5cbce3570 100644 --- a/vendor/qiniu/php-sdk/tests/bootstrap.php +++ b/vendor/qiniu/php-sdk/tests/bootstrap.php @@ -21,7 +21,7 @@ $dummyAuth = new Auth($dummyAccessKey, $dummySecretKey); //cdn $timestampAntiLeechEncryptKey = getenv('QINIU_TIMESTAMP_ENCRPTKEY'); -$customDomain = "http://phpsdk.qiniuts.com"; +$customDomain = "http://sdk.peterpy.cn"; $tid = getenv('TRAVIS_JOB_NUMBER'); if (!empty($tid)) { diff --git a/vendor/symfony/options-resolver/OptionsResolver.php b/vendor/symfony/options-resolver/OptionsResolver.php index 8ed03c2af..fd8a603fe 100644 --- a/vendor/symfony/options-resolver/OptionsResolver.php +++ b/vendor/symfony/options-resolver/OptionsResolver.php @@ -734,7 +734,7 @@ class OptionsResolver implements Options // Validate the type of the resolved option if (isset($this->allowedTypes[$option])) { - $valid = false; + $valid = true; $invalidTypes = []; foreach ($this->allowedTypes[$option] as $type) { @@ -746,13 +746,22 @@ class OptionsResolver implements Options } if (!$valid) { - $keys = array_keys($invalidTypes); + $fmtActualValue = $this->formatValue($value); + $fmtAllowedTypes = implode('" or "', $this->allowedTypes[$option]); + $fmtProvidedTypes = implode('|', array_keys($invalidTypes)); - if (1 === \count($keys) && '[]' === substr($keys[0], -2)) { - throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $keys[0])); + $allowedContainsArrayType = \count(array_filter( + $this->allowedTypes[$option], + function ($item) { + return '[]' === substr(isset(self::$typeAliases[$item]) ? self::$typeAliases[$item] : $item, -2); + } + )) > 0; + + if (\is_array($value) && $allowedContainsArrayType) { + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $option, $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); } - throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), implode('|', array_keys($invalidTypes)))); + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes)); } } @@ -858,21 +867,14 @@ class OptionsResolver implements Options { $type = substr($type, 0, -2); - $suffix = '[]'; - while (\strlen($suffix) <= $level * 2) { - $suffix .= '[]'; - } - if ('[]' === substr($type, -2)) { $success = true; foreach ($value as $item) { if (!\is_array($item)) { - $invalidTypes[$this->formatTypeOf($item, null).$suffix] = true; + $invalidTypes[$this->formatTypeOf($item, null)] = true; - return false; - } - - if (!$this->verifyArrayType($type, $item, $invalidTypes, $level + 1)) { + $success = false; + } elseif (!$this->verifyArrayType($type, $item, $invalidTypes, $level + 1)) { $success = false; } } @@ -880,15 +882,17 @@ class OptionsResolver implements Options return $success; } + $valid = true; + foreach ($value as $item) { if (!self::isValueValidType($type, $item)) { - $invalidTypes[$this->formatTypeOf($item, $type).$suffix] = $value; + $invalidTypes[$this->formatTypeOf($item, $type)] = $value; - return false; + $valid = false; } } - return true; + return $valid; } /** diff --git a/vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php b/vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php index 8dd7997dd..8d6e9f63f 100644 --- a/vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php +++ b/vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php @@ -36,12 +36,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertNull($debug->getDefault($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException - * @expectedExceptionMessage No default value was set for the "foo" option. - */ public function testGetDefaultThrowsOnNoConfiguredValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException'); + $this->expectExceptionMessage('No default value was set for the "foo" option.'); $resolver = new OptionsResolver(); $resolver->setDefined($option = 'foo'); @@ -49,12 +47,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame('bar', $debug->getDefault($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. - */ public function testGetDefaultThrowsOnNotDefinedOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist.'); $resolver = new OptionsResolver(); $debug = new OptionsResolverIntrospector($resolver); @@ -71,12 +67,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame($closures, $debug->getLazyClosures($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException - * @expectedExceptionMessage No lazy closures were set for the "foo" option. - */ public function testGetLazyClosuresThrowsOnNoConfiguredValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException'); + $this->expectExceptionMessage('No lazy closures were set for the "foo" option.'); $resolver = new OptionsResolver(); $resolver->setDefined($option = 'foo'); @@ -84,12 +78,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame('bar', $debug->getLazyClosures($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. - */ public function testGetLazyClosuresThrowsOnNotDefinedOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist.'); $resolver = new OptionsResolver(); $debug = new OptionsResolverIntrospector($resolver); @@ -106,12 +98,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame($allowedTypes, $debug->getAllowedTypes($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException - * @expectedExceptionMessage No allowed types were set for the "foo" option. - */ public function testGetAllowedTypesThrowsOnNoConfiguredValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException'); + $this->expectExceptionMessage('No allowed types were set for the "foo" option.'); $resolver = new OptionsResolver(); $resolver->setDefined($option = 'foo'); @@ -119,12 +109,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame('bar', $debug->getAllowedTypes($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. - */ public function testGetAllowedTypesThrowsOnNotDefinedOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist.'); $resolver = new OptionsResolver(); $debug = new OptionsResolverIntrospector($resolver); @@ -141,12 +129,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame($allowedValues, $debug->getAllowedValues($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException - * @expectedExceptionMessage No allowed values were set for the "foo" option. - */ public function testGetAllowedValuesThrowsOnNoConfiguredValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException'); + $this->expectExceptionMessage('No allowed values were set for the "foo" option.'); $resolver = new OptionsResolver(); $resolver->setDefined($option = 'foo'); @@ -154,12 +140,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame('bar', $debug->getAllowedValues($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. - */ public function testGetAllowedValuesThrowsOnNotDefinedOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist.'); $resolver = new OptionsResolver(); $debug = new OptionsResolverIntrospector($resolver); @@ -176,12 +160,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame($normalizer, $debug->getNormalizer($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException - * @expectedExceptionMessage No normalizer was set for the "foo" option. - */ public function testGetNormalizerThrowsOnNoConfiguredValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoConfigurationException'); + $this->expectExceptionMessage('No normalizer was set for the "foo" option.'); $resolver = new OptionsResolver(); $resolver->setDefined($option = 'foo'); @@ -189,12 +171,10 @@ class OptionsResolverIntrospectorTest extends TestCase $this->assertSame('bar', $debug->getNormalizer($option)); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. - */ public function testGetNormalizerThrowsOnNotDefinedOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist.'); $resolver = new OptionsResolver(); $debug = new OptionsResolverIntrospector($resolver); diff --git a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php index abf0aa015..ce90f9379 100644 --- a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php +++ b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php @@ -29,35 +29,29 @@ class OptionsResolverTest extends TestCase $this->resolver = new OptionsResolver(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The option "foo" does not exist. Defined options are: "a", "z". - */ public function testResolveFailsIfNonExistingOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The option "foo" does not exist. Defined options are: "a", "z".'); $this->resolver->setDefault('z', '1'); $this->resolver->setDefault('a', '2'); $this->resolver->resolve(['foo' => 'bar']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @expectedExceptionMessage The options "baz", "foo", "ping" do not exist. Defined options are: "a", "z". - */ public function testResolveFailsIfMultipleNonExistingOptions() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); + $this->expectExceptionMessage('The options "baz", "foo", "ping" do not exist. Defined options are: "a", "z".'); $this->resolver->setDefault('z', '1'); $this->resolver->setDefault('a', '2'); $this->resolver->resolve(['ping' => 'pong', 'foo' => 'bar', 'baz' => 'bam']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testResolveFailsFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->resolve([]); }); @@ -81,11 +75,9 @@ class OptionsResolverTest extends TestCase ], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetDefaultFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('lazy', function (Options $options) { $options->setDefault('default', 42); }); @@ -225,11 +217,9 @@ class OptionsResolverTest extends TestCase $this->assertSame($this->resolver, $this->resolver->setRequired('foo')); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetRequiredFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setRequired('bar'); }); @@ -237,11 +227,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - */ public function testResolveFailsIfRequiredOptionMissing() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\MissingOptionsException'); $this->resolver->setRequired('foo'); $this->resolver->resolve(); @@ -353,11 +341,9 @@ class OptionsResolverTest extends TestCase $this->assertSame(['bar'], $this->resolver->getMissingOptions()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetDefinedFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setDefined('bar'); }); @@ -450,11 +436,9 @@ class OptionsResolverTest extends TestCase $this->assertFalse($this->resolver->isDefined('foo')); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - */ public function testSetAllowedTypesFailsIfUnknownOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); $this->resolver->setAllowedTypes('foo', 'string'); } @@ -467,11 +451,9 @@ class OptionsResolverTest extends TestCase $this->assertSame(['foo' => ['bar', 'baz']], $options); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetAllowedTypesFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setAllowedTypes('bar', 'string'); }); @@ -481,38 +463,33 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime[]". - */ public function testResolveFailsIfInvalidTypedArray() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[]'); $this->resolver->resolve(['foo' => [new \DateTime()]]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value "bar" is expected to be of type "int[]", but is of type "string". - */ public function testResolveFailsWithNonArray() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value "bar" is expected to be of type "int[]", but is of type "string".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[]'); $this->resolver->resolve(['foo' => 'bar']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass[]". - */ public function testResolveFailsIfTypedArrayContainsInvalidTypes() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass|array|DateTime".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[]'); + $values = range(1, 5); $values[] = new \stdClass(); $values[] = []; @@ -522,22 +499,18 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(['foo' => $values]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double[][]". - */ public function testResolveFailsWithCorrectLevelsButWrongScalar() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); - $this->resolver->resolve( - [ - 'foo' => [ - [1.2], - ], - ] - ); + $this->resolver->resolve([ + 'foo' => [ + [1.2], + ], + ]); } /** @@ -548,12 +521,8 @@ class OptionsResolverTest extends TestCase $this->resolver->setDefined('option'); $this->resolver->setAllowedTypes('option', $allowedType); - if (method_exists($this, 'expectException')) { - $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); - $this->expectExceptionMessage($exceptionMessage); - } else { - $this->setExpectedException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException', $exceptionMessage); - } + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage($exceptionMessage); $this->resolver->resolve(['option' => $actualType]); } @@ -569,6 +538,11 @@ class OptionsResolverTest extends TestCase [42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'], [null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'], ['bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'], + [['foo', 12], 'string[]', 'The option "option" with value array is expected to be of type "string[]", but one of the elements is of type "integer".'], + [123, ['string[]', 'string'], 'The option "option" with value 123 is expected to be of type "string[]" or "string", but is of type "integer".'], + [[null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'], + [['string', null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'], + [[\stdClass::class], ['string'], 'The option "option" with value array is expected to be of type "string", but is of type "array".'], ]; } @@ -580,12 +554,10 @@ class OptionsResolverTest extends TestCase $this->assertNotEmpty($this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value 42 is expected to be of type "string" or "bool", but is of type "integer". - */ public function testResolveFailsIfInvalidTypeMultiple() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value 42 is expected to be of type "string" or "bool", but is of type "integer".'); $this->resolver->setDefault('foo', 42); $this->resolver->setAllowedTypes('foo', ['string', 'bool']); @@ -619,34 +591,29 @@ class OptionsResolverTest extends TestCase new \DateTime(), ], ]; + $result = $this->resolver->resolve($data); $this->assertEquals($data, $result); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfNotInstanceOfClass() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 'bar'); $this->resolver->setAllowedTypes('foo', '\stdClass'); $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - */ public function testAddAllowedTypesFailsIfUnknownOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); $this->resolver->addAllowedTypes('foo', 'string'); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfAddAllowedTypesFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->addAllowedTypes('bar', 'string'); }); @@ -656,11 +623,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfInvalidAddedType() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->addAllowedTypes('foo', 'string'); @@ -675,11 +640,9 @@ class OptionsResolverTest extends TestCase $this->assertNotEmpty($this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfInvalidAddedTypeMultiple() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->addAllowedTypes('foo', ['string', 'bool']); @@ -716,19 +679,15 @@ class OptionsResolverTest extends TestCase $this->assertNotEmpty($this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - */ public function testSetAllowedValuesFailsIfUnknownOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); $this->resolver->setAllowedValues('foo', 'bar'); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetAllowedValuesFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setAllowedValues('bar', 'baz'); }); @@ -738,35 +697,29 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value 42 is invalid. Accepted values are: "bar". - */ public function testResolveFailsIfInvalidValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value 42 is invalid. Accepted values are: "bar".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedValues('foo', 'bar'); $this->resolver->resolve(['foo' => 42]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value null is invalid. Accepted values are: "bar". - */ public function testResolveFailsIfInvalidValueIsNull() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value null is invalid. Accepted values are: "bar".'); $this->resolver->setDefault('foo', null); $this->resolver->setAllowedValues('foo', 'bar'); $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfInvalidValueStrict() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->setAllowedValues('foo', '42'); @@ -789,12 +742,10 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => null], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value 42 is invalid. Accepted values are: "bar", false, null. - */ public function testResolveFailsIfInvalidValueMultiple() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value 42 is invalid. Accepted values are: "bar", false, null.'); $this->resolver->setDefault('foo', 42); $this->resolver->setAllowedValues('foo', ['bar', false, null]); @@ -840,11 +791,9 @@ class OptionsResolverTest extends TestCase $this->assertSame('bar', $passedValue); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfAllClosuresReturnFalse() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->setAllowedValues('foo', [ function () { return false; }, @@ -867,19 +816,15 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => 'bar'], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - */ public function testAddAllowedValuesFailsIfUnknownOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); $this->resolver->addAllowedValues('foo', 'bar'); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfAddAllowedValuesFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->addAllowedValues('bar', 'baz'); }); @@ -889,11 +834,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfInvalidAddedValue() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->addAllowedValues('foo', 'bar'); @@ -916,11 +859,9 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => null], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfInvalidAddedValueMultiple() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->addAllowedValues('foo', ['bar', 'baz']); @@ -953,11 +894,9 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => 'baz'], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testResolveFailsIfAllAddedClosuresReturnFalse() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 42); $this->resolver->setAllowedValues('foo', function () { return false; }); $this->resolver->addAllowedValues('foo', function () { return false; }); @@ -999,19 +938,15 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => 'normalized'], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - */ public function testSetNormalizerFailsIfUnknownOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException'); $this->resolver->setNormalizer('foo', function () {}); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetNormalizerFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setNormalizer('foo', function () {}); }); @@ -1045,11 +980,9 @@ class OptionsResolverTest extends TestCase $this->assertEquals(['foo' => 'normalized[baz]'], $resolved); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testValidateTypeBeforeNormalization() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 'bar'); $this->resolver->setAllowedTypes('foo', 'int'); @@ -1061,11 +994,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ public function testValidateValueBeforeNormalization() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); $this->resolver->setDefault('foo', 'bar'); $this->resolver->setAllowedValues('foo', 'baz'); @@ -1115,11 +1046,9 @@ class OptionsResolverTest extends TestCase ], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - */ public function testFailIfCyclicDependencyBetweenNormalizers() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException'); $this->resolver->setDefault('norm1', 'bar'); $this->resolver->setDefault('norm2', 'baz'); @@ -1134,11 +1063,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - */ public function testFailIfCyclicDependencyBetweenNormalizerAndLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException'); $this->resolver->setDefault('lazy', function (Options $options) { $options['norm']; }); @@ -1256,11 +1183,9 @@ class OptionsResolverTest extends TestCase ], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfSetDefaultsFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->setDefaults(['two' => '2']); }); @@ -1337,11 +1262,9 @@ class OptionsResolverTest extends TestCase $this->assertSame(['foo' => 'bar'], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfRemoveFromLazyOption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->remove('bar'); }); @@ -1413,11 +1336,9 @@ class OptionsResolverTest extends TestCase $this->assertSame(['foo' => 'bar'], $this->resolver->resolve()); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testFailIfClearFromLazyption() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', function (Options $options) { $options->clear(); }); @@ -1472,50 +1393,40 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(['default2' => 42, 'required' => 'value']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testArrayAccessGetFailsOutsideResolve() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('default', 0); $this->resolver['default']; } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testArrayAccessExistsFailsOutsideResolve() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('default', 0); isset($this->resolver['default']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testArrayAccessSetNotSupported() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver['default'] = 0; } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException - */ public function testArrayAccessUnsetNotSupported() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('default', 0); unset($this->resolver['default']); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @expectedExceptionMessage The option "undefined" does not exist. Defined options are: "foo", "lazy". - */ public function testFailIfGetNonExisting() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoSuchOptionException'); + $this->expectExceptionMessage('The option "undefined" does not exist. Defined options are: "foo", "lazy".'); $this->resolver->setDefault('foo', 'bar'); $this->resolver->setDefault('lazy', function (Options $options) { @@ -1525,12 +1436,10 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @expectedExceptionMessage The optional option "defined" has no value set. You should make sure it is set with "isset" before reading it. - */ public function testFailIfGetDefinedButUnset() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\NoSuchOptionException'); + $this->expectExceptionMessage('The optional option "defined" has no value set. You should make sure it is set with "isset" before reading it.'); $this->resolver->setDefined('defined'); $this->resolver->setDefault('lazy', function (Options $options) { @@ -1540,11 +1449,9 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - */ public function testFailIfCyclicDependency() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\OptionDefinitionException'); $this->resolver->setDefault('lazy1', function (Options $options) { $options['lazy2']; }); @@ -1574,11 +1481,10 @@ class OptionsResolverTest extends TestCase * In resolve() we count the options that are actually set (which may be * only a subset of the defined options). Outside of resolve(), it's not * clear what is counted. - * - * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException */ public function testCountFailsOutsideResolve() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\AccessException'); $this->resolver->setDefault('foo', 0); $this->resolver->setRequired('bar'); $this->resolver->setDefined('bar'); @@ -1598,13 +1504,11 @@ class OptionsResolverTest extends TestCase 1, 2, ], ], - ], $this->resolver->resolve( - [ - 'foo' => [ - [1, 2], - ], - ] - )); + ], $this->resolver->resolve([ + 'foo' => [ + [1, 2], + ], + ])); } public function testNested2Arrays() @@ -1635,34 +1539,28 @@ class OptionsResolverTest extends TestCase )); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer[][][][]". - */ public function testNestedArraysException() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'float[][][][]'); - $this->resolver->resolve( - [ - 'foo' => [ + $this->resolver->resolve([ + 'foo' => [ + [ [ - [ - [1, 2], - ], + [1, 2], ], ], - ] - ); + ], + ]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]". - */ public function testNestedArrayException1() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); $this->resolver->resolve([ @@ -1672,12 +1570,10 @@ class OptionsResolverTest extends TestCase ]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]". - */ public function testNestedArrayException2() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'int[][]'); $this->resolver->resolve([ @@ -1687,12 +1583,10 @@ class OptionsResolverTest extends TestCase ]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string[][]". - */ public function testNestedArrayException3() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string|integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[][][]'); $this->resolver->resolve([ @@ -1702,12 +1596,10 @@ class OptionsResolverTest extends TestCase ]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer[][][]". - */ public function testNestedArrayException4() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[][][]'); $this->resolver->resolve([ @@ -1718,12 +1610,10 @@ class OptionsResolverTest extends TestCase ]); } - /** - * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @expectedExceptionMessage The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array[]". - */ public function testNestedArrayException5() { + $this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException'); + $this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array".'); $this->resolver->setDefined('foo'); $this->resolver->setAllowedTypes('foo', 'string[]'); $this->resolver->resolve([ diff --git a/vendor/topthink/think-helper/.gitignore b/vendor/topthink/think-helper/.gitignore deleted file mode 100644 index e244eda0b..000000000 --- a/vendor/topthink/think-helper/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/ -/.idea/ \ No newline at end of file diff --git a/vendor/topthink/think-helper/LICENSE b/vendor/topthink/think-helper/LICENSE deleted file mode 100644 index 8dada3eda..000000000 --- a/vendor/topthink/think-helper/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/topthink/think-helper/README.md b/vendor/topthink/think-helper/README.md deleted file mode 100644 index 51b69c53f..000000000 --- a/vendor/topthink/think-helper/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# thinkphp5 常用的一些扩展类库 - -> 更新完善中 - -> 以下类库都在`\\think\\helper`命名空间下 - -## Str -> 字符串操作 - -``` -// 检查字符串中是否包含某些字符串 -Str::contains($haystack, $needles) - -// 检查字符串是否以某些字符串结尾 -Str::endsWith($haystack, $needles) - -// 获取指定长度的随机字母数字组合的字符串 -Str::random($length = 16) - -// 字符串转小写 -Str::lower($value) - -// 字符串转大写 -Str::upper($value) - -// 获取字符串的长度 -Str::length($value) - -// 截取字符串 -Str::substr($string, $start, $length = null) - -``` \ No newline at end of file diff --git a/vendor/topthink/think-helper/composer.json b/vendor/topthink/think-helper/composer.json deleted file mode 100644 index d246fa3c9..000000000 --- a/vendor/topthink/think-helper/composer.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "topthink/think-helper", - "description": "The ThinkPHP5 Helper Package", - "license": "Apache-2.0", - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "autoload": { - "psr-4": { - "think\\helper\\": "src" - }, - "files": [ - "src/helper.php" - ] - } -} diff --git a/vendor/topthink/think-helper/src/Arr.php b/vendor/topthink/think-helper/src/Arr.php deleted file mode 100644 index 7350bb245..000000000 --- a/vendor/topthink/think-helper/src/Arr.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\helper; - - -class Arr -{ - - public static function isAssoc(array $array) - { - $keys = array_keys($array); - - return array_keys($keys) !== $keys; - } - - public static function sortRecursive($array) - { - foreach ($array as &$value) { - if (is_array($value)) { - $value = static::sortRecursive($value); - } - } - - if (static::isAssoc($array)) { - ksort($array); - } else { - sort($array); - } - - return $array; - } -} \ No newline at end of file diff --git a/vendor/topthink/think-helper/src/Str.php b/vendor/topthink/think-helper/src/Str.php deleted file mode 100644 index ba56cb44a..000000000 --- a/vendor/topthink/think-helper/src/Str.php +++ /dev/null @@ -1,202 +0,0 @@ - -// +---------------------------------------------------------------------- -namespace think\helper; - -class Str -{ - - protected static $snakeCache = []; - - protected static $camelCache = []; - - protected static $studlyCache = []; - - /** - * 检查字符串中是否包含某些字符串 - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function contains($haystack, $needles) - { - foreach ((array) $needles as $needle) { - if ($needle != '' && mb_strpos($haystack, $needle) !== false) { - return true; - } - } - - return false; - } - - /** - * 检查字符串是否以某些字符串结尾 - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function endsWith($haystack, $needles) - { - foreach ((array) $needles as $needle) { - if ((string) $needle === static::substr($haystack, -static::length($needle))) { - return true; - } - } - - return false; - } - - /** - * 检查字符串是否以某些字符串开头 - * - * @param string $haystack - * @param string|array $needles - * @return bool - */ - public static function startsWith($haystack, $needles) - { - foreach ((array) $needles as $needle) { - if ($needle != '' && mb_strpos($haystack, $needle) === 0) { - return true; - } - } - - return false; - } - - /** - * 获取指定长度的随机字母数字组合的字符串 - * - * @param int $length - * @return string - */ - public static function random($length = 16) - { - $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - - return static::substr(str_shuffle(str_repeat($pool, $length)), 0, $length); - } - - /** - * 字符串转小写 - * - * @param string $value - * @return string - */ - public static function lower($value) - { - return mb_strtolower($value, 'UTF-8'); - } - - /** - * 字符串转大写 - * - * @param string $value - * @return string - */ - public static function upper($value) - { - return mb_strtoupper($value, 'UTF-8'); - } - - /** - * 获取字符串的长度 - * - * @param string $value - * @return int - */ - public static function length($value) - { - return mb_strlen($value); - } - - /** - * 截取字符串 - * - * @param string $string - * @param int $start - * @param int|null $length - * @return string - */ - public static function substr($string, $start, $length = null) - { - return mb_substr($string, $start, $length, 'UTF-8'); - } - - /** - * 驼峰转下划线 - * - * @param string $value - * @param string $delimiter - * @return string - */ - public static function snake($value, $delimiter = '_') - { - $key = $value; - - if (isset(static::$snakeCache[$key][$delimiter])) { - return static::$snakeCache[$key][$delimiter]; - } - - if (!ctype_lower($value)) { - $value = preg_replace('/\s+/u', '', $value); - - $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1' . $delimiter, $value)); - } - - return static::$snakeCache[$key][$delimiter] = $value; - } - - /** - * 下划线转驼峰(首字母小写) - * - * @param string $value - * @return string - */ - public static function camel($value) - { - if (isset(static::$camelCache[$value])) { - return static::$camelCache[$value]; - } - - return static::$camelCache[$value] = lcfirst(static::studly($value)); - } - - /** - * 下划线转驼峰(首字母大写) - * - * @param string $value - * @return string - */ - public static function studly($value) - { - $key = $value; - - if (isset(static::$studlyCache[$key])) { - return static::$studlyCache[$key]; - } - - $value = ucwords(str_replace(['-', '_'], ' ', $value)); - - return static::$studlyCache[$key] = str_replace(' ', '', $value); - } - - /** - * 转为首字母大写的标题格式 - * - * @param string $value - * @return string - */ - public static function title($value) - { - return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8'); - } -} \ No newline at end of file diff --git a/vendor/topthink/think-helper/src/helper.php b/vendor/topthink/think-helper/src/helper.php deleted file mode 100644 index f0bb10693..000000000 --- a/vendor/topthink/think-helper/src/helper.php +++ /dev/null @@ -1,38 +0,0 @@ - -// +---------------------------------------------------------------------- - - -if (!function_exists('classnames')) { - /** - * css样式名生成器 - * classnames("foo", "bar"); // => "foo bar" - * classnames("foo", [ "bar"=> true ]); // => "foo bar" - * classnames([ "foo-bar"=> true ]); // => "foo-bar" - * classnames([ "foo-bar"=> false ]); // => " - * classnames([ "foo" => true ], [ "bar"=> true ]); // => "foo bar" - * classnames([ "foo" => true, "bar"=> true ]); // => "foo bar" - * classnames("foo", [ "bar"=> true, "duck"=> false ], "baz", [ "quux"=> true ]); // => "foo bar baz quux" - * classnames(null, false, "bar", 0, 1, [ "baz"=> null ]); // => "bar 1" - */ - function classnames() - { - $args = func_get_args(); - $classes = array_map(function ($arg) { - if (is_array($arg)) { - return implode(" ", array_filter(array_map(function ($expression, $class) { - return $expression ? $class : false; - }, $arg, array_keys($arg)))); - } - return $arg; - }, $args); - return implode(" ", array_filter($classes)); - } -} \ No newline at end of file diff --git a/vendor/topthink/think-queue/README.md b/vendor/topthink/think-queue/README.md index df032c71c..e52bd7367 100644 --- a/vendor/topthink/think-queue/README.md +++ b/vendor/topthink/think-queue/README.md @@ -4,18 +4,17 @@ > composer require topthink/think-queue ## 配置 -> 配置文件位于 `application/extra/queue.php` ### 公共配置 ``` -[ - 'connector'=>'sync' //驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动,topthink:Topthink驱动 +'queue'=>[ + 'type'=>'sync' //驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动,topthink:Topthink驱动 //或其他自定义的完整的类名 ] ``` ### 驱动配置 -> 各个驱动的具体可用配置项在`think\queue\connector`目录下各个驱动类里的`options`属性中,写在上面的`queue`配置里即可覆盖 +> 各个驱动的具体可用配置项在`think\queue\driver`目录下各个驱动类里的`options`属性中,写在上面的`queue`配置里即可覆盖 ## 使用 Database @@ -109,7 +108,7 @@ class Job2{ ## 发布任务 -> `think\Queue::push($job, $data = '', $queue = null)` 和 `think\Queue::later($delay, $job, $data = '', $queue = null)` 两个方法,前者是立即执行,后者是在`$delay`秒后执行 +> `think\queue\Queue:push($job, $data = '', $queue = null)` 和 `think\queue\Queue::later($delay, $job, $data = '', $queue = null)` 两个方法,前者是立即执行,后者是在`$delay`秒后执行 `$job` 是任务名 单模块的,且命名空间是`app\job`的,比如上面的例子一,写`Job1`类名即可 @@ -129,4 +128,4 @@ class Job2{ 两种,具体的可选参数可以输入命令加 --help 查看 ->可配合supervisor使用,保证进程常驻 +>可配合supervisor使用,保证进程常驻 \ No newline at end of file diff --git a/vendor/topthink/think-queue/composer.json b/vendor/topthink/think-queue/composer.json index 311083476..1af4a181a 100644 --- a/vendor/topthink/think-queue/composer.json +++ b/vendor/topthink/think-queue/composer.json @@ -1,7 +1,6 @@ { "name": "topthink/think-queue", "description": "The ThinkPHP5 Queue Package", - "type": "think-extend", "authors": [ { "name": "yunwuxin", @@ -9,24 +8,13 @@ } ], "license": "Apache-2.0", + "minimum-stability": "dev", "autoload": { "psr-4": { - "think\\": "src" + "think\\queue\\": "src" }, "files": [ - "src/common.php" + "src/config.php" ] - }, - "require": { - "topthink/think-helper": ">=1.0.4", - "topthink/think-installer": ">=1.0.10" - }, - "require-dev": { - "topthink/framework": "~5.0.0" - }, - "extra": { - "think-config": { - "queue": "src/config.php" - } } } diff --git a/vendor/topthink/think-queue/src/queue/Job.php b/vendor/topthink/think-queue/src/Job.php similarity index 97% rename from vendor/topthink/think-queue/src/queue/Job.php rename to vendor/topthink/think-queue/src/Job.php index 099b0ac64..9d15a635c 100644 --- a/vendor/topthink/think-queue/src/queue/Job.php +++ b/vendor/topthink/think-queue/src/Job.php @@ -12,7 +12,7 @@ namespace think\queue; use DateTime; -use think\App; +use think\Config; abstract class Job { @@ -147,7 +147,7 @@ abstract class Job list($module, $name) = explode('/', $name, 2); } - $name = App::$namespace . ($module ? '\\' . strtolower($module) : '') . '\\job\\' . $name; + $name = Config::get('app_namespace') . ($module ? '\\' . strtolower($module) : '') . '\\job\\' . $name; } if (class_exists($name)) { return new $name(); @@ -210,4 +210,4 @@ abstract class Job { return $this->queue; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/Listener.php b/vendor/topthink/think-queue/src/Listener.php similarity index 99% rename from vendor/topthink/think-queue/src/queue/Listener.php rename to vendor/topthink/think-queue/src/Listener.php index e8fcaa401..5917dd52d 100644 --- a/vendor/topthink/think-queue/src/queue/Listener.php +++ b/vendor/topthink/think-queue/src/Listener.php @@ -11,6 +11,7 @@ namespace think\queue; + use Closure; use think\Process; @@ -78,6 +79,7 @@ class Listener $this->handleWorkerOutput($type, $line); }); + if ($this->memoryExceeded($memory)) { $this->stop(); } @@ -161,4 +163,4 @@ class Listener { $this->maxTries = $tries; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/Queue.php b/vendor/topthink/think-queue/src/Queue.php index 42ee37131..9359c09f1 100644 --- a/vendor/topthink/think-queue/src/Queue.php +++ b/vendor/topthink/think-queue/src/Queue.php @@ -9,41 +9,75 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -namespace think; +namespace think\queue; -use think\helper\Str; -use think\queue\Connector; +use think\Config; -/** - * Class Queue - * @package think\queue - * - * @method static push($job, $data = '', $queue = null) - * @method static later($delay, $job, $data = '', $queue = null) - * @method static pop($queue = null) - * @method static marshal() - */ class Queue { - /** @var Connector */ - protected static $connector; + protected static $instance = []; - private static function buildConnector() + /** + * 添加任务到队列 + * @param $job + * @param string $data + * @param null $queue + */ + public static function push($job, $data = '', $queue = null) + { + self::handle()->push($job, $data, $queue); + + } + + /** + * 添加延迟任务到队列 + * @param $delay + * @param $job + * @param string $data + * @param null $queue + */ + public static function later($delay, $job, $data = '', $queue = null) + { + self::handle()->later($delay, $job, $data, $queue); + } + + /** + * 获取第一个任务 + * @param null $queue + * @return mixed + */ + public static function pop($queue = null) + { + if (!method_exists(self::handle(), 'pop')) + throw new \RuntimeException('pop queues not support for this type'); + + return self::handle()->pop($queue); + } + + + /** + * 由订阅的推送执行任务 + */ + public static function marshal() + { + if (!method_exists(self::handle(), 'marshal')) + throw new \RuntimeException('push queues not support for this type'); + + self::handle()->marshal(); + } + + private static function handle() { $options = Config::get('queue'); - $type = !empty($options['connector']) ? $options['connector'] : 'Sync'; + $type = !empty($options['type']) ? $options['type'] : 'Sync'; - if (!isset(self::$connector)) { + if (!isset(self::$instance[$type])) { - $class = false !== strpos($type, '\\') ? $type : '\\think\\queue\\connector\\' . Str::studly($type); + $class = false !== strpos($type, '\\') ? $type : '\\think\\queue\\driver\\' . ucwords($type); - self::$connector = new $class($options); + self::$instance[$type] = new $class($options); } - return self::$connector; + return self::$instance[$type]; } - public static function __callStatic($name, $arguments) - { - return call_user_func_array([self::buildConnector(), $name], $arguments); - } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/Worker.php b/vendor/topthink/think-queue/src/Worker.php similarity index 88% rename from vendor/topthink/think-queue/src/queue/Worker.php rename to vendor/topthink/think-queue/src/Worker.php index 9e370f01e..e8618ed13 100644 --- a/vendor/topthink/think-queue/src/queue/Worker.php +++ b/vendor/topthink/think-queue/src/Worker.php @@ -13,7 +13,6 @@ namespace think\queue; use Exception; use think\Hook; -use think\Queue; class Worker { @@ -32,11 +31,9 @@ class Worker $job = $this->getNextJob($queue); if (!is_null($job)) { - Hook::listen('worker_before_process', $queue); return $this->process($job, $maxTries, $delay); } - Hook::listen('worker_before_sleep', $queue); $this->sleep($sleep); return ['job' => null, 'failed' => false]; @@ -94,13 +91,9 @@ class Worker */ protected function logFailedJob(Job $job) { - if (!$job->isDeleted()) { - try { - $job->delete(); - $job->failed(); - } finally { - Hook::listen('queue_failed', $job); - } + if (Hook::listen('queue.failed', $job, null, true)) { + $job->delete(); + $job->failed(); } return ['job' => $job, 'failed' => true]; @@ -116,4 +109,4 @@ class Worker sleep($seconds); } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/command/Listen.php b/vendor/topthink/think-queue/src/command/Listen.php similarity index 91% rename from vendor/topthink/think-queue/src/queue/command/Listen.php rename to vendor/topthink/think-queue/src/command/Listen.php index 475913511..6332a4c10 100644 --- a/vendor/topthink/think-queue/src/queue/command/Listen.php +++ b/vendor/topthink/think-queue/src/command/Listen.php @@ -11,6 +11,7 @@ namespace think\queue\command; + use think\console\Command; use think\console\Input; use think\console\input\Option; @@ -36,7 +37,7 @@ class Listen extends Command public function initialize(Input $input, Output $output) { - $this->listener = new Listener($this->findCommandPath()); + $this->listener = new Listener(getcwd()); $this->listener->setSleep($input->getOption('sleep')); $this->listener->setMaxTries($input->getOption('tries')); @@ -57,9 +58,4 @@ class Listen extends Command $this->listener->listen($queue, $delay, $memory, $timeout); } - - protected function findCommandPath() - { - return defined('ROOT_PATH') ? ROOT_PATH : dirname($_SERVER['argv'][0]); - } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/command/Restart.php b/vendor/topthink/think-queue/src/command/Restart.php similarity index 99% rename from vendor/topthink/think-queue/src/queue/command/Restart.php rename to vendor/topthink/think-queue/src/command/Restart.php index 29d4a18f4..e84cef71d 100644 --- a/vendor/topthink/think-queue/src/queue/command/Restart.php +++ b/vendor/topthink/think-queue/src/command/Restart.php @@ -11,6 +11,7 @@ namespace think\queue\command; + use think\Cache; use think\console\Command; use think\console\Input; @@ -28,4 +29,4 @@ class Restart extends Command Cache::set('think:queue:restart', time()); $output->writeln("Broadcasting queue restart signal."); } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/command/Subscribe.php b/vendor/topthink/think-queue/src/command/Subscribe.php similarity index 98% rename from vendor/topthink/think-queue/src/queue/command/Subscribe.php rename to vendor/topthink/think-queue/src/command/Subscribe.php index 35fc72530..6f09331b1 100644 --- a/vendor/topthink/think-queue/src/queue/command/Subscribe.php +++ b/vendor/topthink/think-queue/src/command/Subscribe.php @@ -16,7 +16,7 @@ use think\console\Input; use think\console\input\Argument; use think\console\input\Option; use think\console\Output; -use think\Queue; +use think\queue\Queue; use think\Url; class Subscribe extends Command @@ -43,4 +43,4 @@ class Subscribe extends Command $output->write('Queue subscriber added: ' . $input->getArgument('url') . ''); } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/command/Work.php b/vendor/topthink/think-queue/src/command/Work.php similarity index 94% rename from vendor/topthink/think-queue/src/queue/command/Work.php rename to vendor/topthink/think-queue/src/command/Work.php index f7c2c95c8..53e23de64 100644 --- a/vendor/topthink/think-queue/src/queue/command/Work.php +++ b/vendor/topthink/think-queue/src/command/Work.php @@ -15,7 +15,6 @@ use think\console\Command; use think\console\Input; use think\console\input\Option; use think\console\Output; -use think\Hook; use think\queue\Job; use think\queue\Worker; use Exception; @@ -66,7 +65,6 @@ class Work extends Command $memory = $input->getOption('memory'); if ($input->getOption('daemon')) { - Hook::listen('worker_daemon_start', $queue); $this->daemon( $queue, $delay, $memory, $input->getOption('sleep'), $input->getOption('tries') @@ -109,13 +107,7 @@ class Work extends Command $queue, $delay, $sleep, $maxTries ); - if ( $this->memoryExceeded($memory) ) { - Hook::listen('worker_memory_exceeded', $queue); - $this->stop(); - } - - if ( $this->queueShouldRestart($lastRestart) ) { - Hook::listen('worker_queue_restart', $queue); + if ($this->memoryExceeded($memory) || $this->queueShouldRestart($lastRestart)) { $this->stop(); } } @@ -207,4 +199,4 @@ class Work extends Command die; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/common.php b/vendor/topthink/think-queue/src/common.php deleted file mode 100644 index 81b35d1d3..000000000 --- a/vendor/topthink/think-queue/src/common.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -\think\Console::addDefaultCommands([ - "think\\queue\\command\\Work", - "think\\queue\\command\\Restart", - "think\\queue\\command\\Listen", - "think\\queue\\command\\Subscribe" -]); - -if (!function_exists('queue')) { - - /** - * 添加到队列 - * @param $job - * @param string $data - * @param int $delay - * @param null $queue - */ - function queue($job, $data = '', $delay = 0, $queue = null) - { - if ($delay > 0) { - \think\Queue::later($delay, $job, $data, $queue); - } else { - \think\Queue::push($job, $data, $queue); - } - } -} diff --git a/vendor/topthink/think-queue/src/config.php b/vendor/topthink/think-queue/src/config.php index 9223ef610..aa413787a 100644 --- a/vendor/topthink/think-queue/src/config.php +++ b/vendor/topthink/think-queue/src/config.php @@ -2,13 +2,16 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -return [ - 'connector' => 'Sync' -]; +\think\Console::addDefaultCommands([ + "think\\queue\\command\\Work", + "think\\queue\\command\\Restart", + "think\\queue\\command\\Listen", + "think\\queue\\command\\Subscribe" +]); \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/connector/Database.php b/vendor/topthink/think-queue/src/driver/Database.php similarity index 94% rename from vendor/topthink/think-queue/src/queue/connector/Database.php rename to vendor/topthink/think-queue/src/driver/Database.php index ad7c60107..0c26d5f6c 100644 --- a/vendor/topthink/think-queue/src/queue/connector/Database.php +++ b/vendor/topthink/think-queue/src/driver/Database.php @@ -9,13 +9,12 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -namespace think\queue\connector; +namespace think\queue\driver; use think\Db; -use think\queue\Connector; use think\queue\job\Database as DatabaseJob; -class Database extends Connector +class Database { protected $db; @@ -45,6 +44,12 @@ class Database extends Connector return $this->pushToDatabase($delay, $queue, $this->createPayload($job, $data)); } + + protected function createPayload($job, $data) + { + return json_encode(['job' => $job, 'data' => $data]); + } + public function pop($queue = null) { $queue = $this->getQueue($queue); @@ -116,7 +121,7 @@ class Database extends Connector ->order('id', 'asc') ->find(); - return $job ? (object) $job : null; + return $job ? (object)$job : null; } /** @@ -150,7 +155,7 @@ class Database extends Connector ->update([ 'reserved' => 0, 'reserved_at' => null, - 'attempts' => ['inc', 1] + 'attempts' => ['exp', 'attempts + 1'] ]); } @@ -168,4 +173,4 @@ class Database extends Connector { return $queue ?: $this->options['default']; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/connector/Redis.php b/vendor/topthink/think-queue/src/driver/Redis.php similarity index 88% rename from vendor/topthink/think-queue/src/queue/connector/Redis.php rename to vendor/topthink/think-queue/src/driver/Redis.php index 9320d53e0..86f0a8937 100644 --- a/vendor/topthink/think-queue/src/queue/connector/Redis.php +++ b/vendor/topthink/think-queue/src/driver/Redis.php @@ -9,14 +9,13 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -namespace think\queue\connector; +namespace think\queue\driver; + use Exception; -use think\helper\Str; -use think\queue\Connector; use think\queue\job\Redis as RedisJob; -class Redis extends Connector +class Redis { /** @var \Redis */ protected $redis; @@ -48,7 +47,7 @@ class Redis extends Connector if ('' != $this->options['password']) { $this->redis->auth($this->options['password']); } - + if (0 != $this->options['select']) { $this->redis->select($this->options['select']); } @@ -72,10 +71,8 @@ class Redis extends Connector $queue = $this->getQueue($queue); - $this->migrateExpiredJobs($queue . ':delayed', $queue, false); - if (!is_null($this->options['expire'])) { - $this->migrateExpiredJobs($queue . ':reserved', $queue); + $this->migrateAllExpiredJobs($queue); } $job = $this->redis->lPop($queue); @@ -110,11 +107,12 @@ class Redis extends Connector return json_decode($payload, true)['id']; } - protected function createPayload($job, $data = '', $queue = null) + + protected function createPayload($job, $data) { - $payload = $this->setMeta( - parent::createPayload($job, $data), 'id', $this->getRandomId() - ); + $payload = json_encode(['job' => $job, 'data' => $data]); + + $payload = $this->setMeta($payload, 'id', $this->getRandomId()); return $this->setMeta($payload, 'attempts', 1); } @@ -131,6 +129,19 @@ class Redis extends Connector $this->redis->zRem($this->getQueue($queue) . ':reserved', $job); } + /** + * 移动所有任务 + * + * @param string $queue + * @return void + */ + protected function migrateAllExpiredJobs($queue) + { + $this->migrateExpiredJobs($queue . ':delayed', $queue, false); + + $this->migrateExpiredJobs($queue . ':reserved', $queue); + } + /** * 移动延迟任务 * @@ -171,6 +182,7 @@ class Redis extends Connector } } + /** * 获取所有到期任务 * @@ -183,6 +195,7 @@ class Redis extends Connector return $this->redis->zRangeByScore($from, '-inf', $time); } + /** * 删除过期任务 * @@ -220,7 +233,14 @@ class Redis extends Connector */ protected function getRandomId() { - return Str::random(32); + return uniqid(); + } + + protected function setMeta($payload, $key, $value) + { + $payload = json_decode($payload, true); + $payload[$key] = $value; + return json_encode($payload); } /** diff --git a/vendor/topthink/think-queue/src/queue/connector/Sync.php b/vendor/topthink/think-queue/src/driver/Sync.php similarity index 88% rename from vendor/topthink/think-queue/src/queue/connector/Sync.php rename to vendor/topthink/think-queue/src/driver/Sync.php index 2fbdedaaf..aa721e5c4 100644 --- a/vendor/topthink/think-queue/src/queue/connector/Sync.php +++ b/vendor/topthink/think-queue/src/driver/Sync.php @@ -9,14 +9,13 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -namespace think\queue\connector; +namespace think\queue\driver; use Exception; -use think\queue\Connector; use think\queue\job\Sync as SyncJob; use Throwable; -class Sync extends Connector +class Sync { public function push($job, $data = '', $queue = null) @@ -54,4 +53,8 @@ class Sync extends Connector return new SyncJob($payload); } -} + protected function createPayload($job, $data = '', $queue = null) + { + return json_encode(['job' => $job, 'data' => $data]); + } +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/connector/Topthink.php b/vendor/topthink/think-queue/src/driver/Topthink.php similarity index 96% rename from vendor/topthink/think-queue/src/queue/connector/Topthink.php rename to vendor/topthink/think-queue/src/driver/Topthink.php index a21c054c8..1f417d26a 100644 --- a/vendor/topthink/think-queue/src/queue/connector/Topthink.php +++ b/vendor/topthink/think-queue/src/driver/Topthink.php @@ -9,15 +9,14 @@ // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- -namespace think\queue\connector; +namespace think\queue\driver; use think\exception\HttpException; -use think\queue\Connector; use think\Request; use think\queue\job\Topthink as TopthinkJob; use think\Response; -class Topthink extends Connector +class Topthink { protected $options = [ 'token' => '', @@ -170,7 +169,7 @@ class Topthink extends Connector } } $this->reportHttpError($this->last_status, "Service unavailable"); - return; + return null; } protected static function jsonDecode($response) @@ -196,6 +195,11 @@ class Topthink extends Connector throw new HttpException($status, "http error: {$status} | {$text}"); } + protected function createPayload($job, $data = '') + { + return json_encode(['job' => $job, 'data' => $data]); + } + /** * Marshal out the pushed job and payload. * @@ -210,6 +214,11 @@ class Topthink extends Connector ]; } + public function getQueue($queue) + { + return $queue ?: $this->options['default']; + } + public function __destruct() { if ($this->curl != null) { @@ -217,9 +226,4 @@ class Topthink extends Connector $this->curl = null; } } - - public function pop($queue = null) - { - throw new \RuntimeException('pop queues not support for this type'); - } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/job/Database.php b/vendor/topthink/think-queue/src/job/Database.php similarity index 95% rename from vendor/topthink/think-queue/src/queue/job/Database.php rename to vendor/topthink/think-queue/src/job/Database.php index 06064b3e3..e939a2fb0 100644 --- a/vendor/topthink/think-queue/src/queue/job/Database.php +++ b/vendor/topthink/think-queue/src/job/Database.php @@ -11,7 +11,7 @@ namespace think\queue\job; use think\queue\Job; -use think\queue\connector\Database as DatabaseQueue; +use think\queue\driver\Database as DatabaseQueue; class Database extends Job { @@ -74,7 +74,7 @@ class Database extends Job */ public function attempts() { - return (int) $this->job->attempts; + return (int)$this->job->attempts; } /** @@ -85,4 +85,4 @@ class Database extends Job { return $this->job->payload; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/job/Redis.php b/vendor/topthink/think-queue/src/job/Redis.php similarity index 97% rename from vendor/topthink/think-queue/src/queue/job/Redis.php rename to vendor/topthink/think-queue/src/job/Redis.php index 10477ce6a..e78af050b 100644 --- a/vendor/topthink/think-queue/src/queue/job/Redis.php +++ b/vendor/topthink/think-queue/src/job/Redis.php @@ -11,12 +11,14 @@ namespace think\queue\job; + use think\queue\Job; -use think\queue\connector\Redis as RedisQueue; +use think\queue\driver\Redis as RedisQueue; class Redis extends Job { + /** * The redis queue instance. * @var RedisQueue @@ -63,6 +65,7 @@ class Redis extends Job return $this->job; } + /** * 删除任务 * @@ -89,4 +92,4 @@ class Redis extends Job $this->redis->release($this->queue, $this->job, $delay, $this->attempts() + 1); } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/job/Sync.php b/vendor/topthink/think-queue/src/job/Sync.php similarity index 99% rename from vendor/topthink/think-queue/src/queue/job/Sync.php rename to vendor/topthink/think-queue/src/job/Sync.php index e81a758af..d724f7e19 100644 --- a/vendor/topthink/think-queue/src/queue/job/Sync.php +++ b/vendor/topthink/think-queue/src/job/Sync.php @@ -11,6 +11,7 @@ namespace think\queue\job; + use think\queue\Job; class Sync extends Job @@ -53,4 +54,4 @@ class Sync extends Job { return $this->payload; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/job/Topthink.php b/vendor/topthink/think-queue/src/job/Topthink.php similarity index 95% rename from vendor/topthink/think-queue/src/queue/job/Topthink.php rename to vendor/topthink/think-queue/src/job/Topthink.php index b98b59c17..5106190ea 100644 --- a/vendor/topthink/think-queue/src/queue/job/Topthink.php +++ b/vendor/topthink/think-queue/src/job/Topthink.php @@ -11,8 +11,9 @@ namespace think\queue\job; + use think\queue\Job; -use think\queue\connector\Topthink as TopthinkQueue; +use think\queue\driver\Topthink as TopthinkQueue; class Topthink extends Job { @@ -54,7 +55,7 @@ class Topthink extends Job */ public function attempts() { - return (int) $this->job->attempts; + return (int)$this->job->attempts; } public function delete() @@ -82,4 +83,4 @@ class Topthink extends Job return $this->job->payload; } -} +} \ No newline at end of file diff --git a/vendor/topthink/think-queue/src/queue/CallQueuedHandler.php b/vendor/topthink/think-queue/src/queue/CallQueuedHandler.php deleted file mode 100644 index 0f1a627dd..000000000 --- a/vendor/topthink/think-queue/src/queue/CallQueuedHandler.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\queue; - -class CallQueuedHandler -{ - - public function call(Job $job, array $data) - { - $command = unserialize($data['command']); - - call_user_func([$command, 'handle']); - - if (!$job->isDeletedOrReleased()) { - $job->delete(); - } - } - - public function failed(array $data) - { - $command = unserialize($data['command']); - - if (method_exists($command, 'failed')) { - $command->failed(); - } - } -} diff --git a/vendor/topthink/think-queue/src/queue/Connector.php b/vendor/topthink/think-queue/src/queue/Connector.php deleted file mode 100644 index b06943722..000000000 --- a/vendor/topthink/think-queue/src/queue/Connector.php +++ /dev/null @@ -1,69 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\queue; - -use InvalidArgumentException; - -abstract class Connector -{ - protected $options = []; - - abstract public function push($job, $data = '', $queue = null); - - abstract public function later($delay, $job, $data = '', $queue = null); - - abstract public function pop($queue = null); - - public function marshal() - { - throw new \RuntimeException('pop queues not support for this type'); - } - - protected function createPayload($job, $data = '', $queue = null) - { - if (is_object($job)) { - $payload = json_encode([ - 'job' => 'think\queue\CallQueuedHandler@call', - 'data' => [ - 'commandName' => get_class($job), - 'command' => serialize(clone $job), - ], - ]); - } else { - $payload = json_encode($this->createPlainPayload($job, $data)); - } - - if (JSON_ERROR_NONE !== json_last_error()) { - throw new InvalidArgumentException('Unable to create payload: ' . json_last_error_msg()); - } - - return $payload; - } - - protected function createPlainPayload($job, $data) - { - return ['job' => $job, 'data' => $data]; - } - - protected function setMeta($payload, $key, $value) - { - $payload = json_decode($payload, true); - $payload[$key] = $value; - $payload = json_encode($payload); - - if (JSON_ERROR_NONE !== json_last_error()) { - throw new InvalidArgumentException('Unable to create payload: ' . json_last_error_msg()); - } - - return $payload; - } -} diff --git a/vendor/topthink/think-queue/src/queue/Queueable.php b/vendor/topthink/think-queue/src/queue/Queueable.php deleted file mode 100644 index 2a6ec4e89..000000000 --- a/vendor/topthink/think-queue/src/queue/Queueable.php +++ /dev/null @@ -1,46 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\queue; - -trait Queueable -{ - - /** @var string 队列名称 */ - public $queue; - - /** @var integer 延迟时间 */ - public $delay; - - /** - * 设置队列名 - * @param $queue - * @return $this - */ - public function queue($queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * 设置延迟时间 - * @param $delay - * @return $this - */ - public function delay($delay) - { - $this->delay = $delay; - - return $this; - } -} diff --git a/vendor/topthink/think-queue/src/queue/ShouldQueue.php b/vendor/topthink/think-queue/src/queue/ShouldQueue.php deleted file mode 100644 index cb49c12d0..000000000 --- a/vendor/topthink/think-queue/src/queue/ShouldQueue.php +++ /dev/null @@ -1,17 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\queue; - -interface ShouldQueue -{ - -} diff --git a/vendor/zoujingli/ip2region/Ip2Region.php b/vendor/zoujingli/ip2region/Ip2Region.php index 2167040cc..b16ebbc9a 100644 --- a/vendor/zoujingli/ip2region/Ip2Region.php +++ b/vendor/zoujingli/ip2region/Ip2Region.php @@ -4,86 +4,85 @@ * * @author chenxin * @date 2015-10-29 -*/ + */ -defined('INDEX_BLOCK_LENGTH') or define('INDEX_BLOCK_LENGTH', 12); -defined('TOTAL_HEADER_LENGTH') or define('TOTAL_HEADER_LENGTH', 8192); +defined('INDEX_BLOCK_LENGTH') or define('INDEX_BLOCK_LENGTH', 12); +defined('TOTAL_HEADER_LENGTH') or define('TOTAL_HEADER_LENGTH', 8192); -class Ip2Region +class Ip2Region { /** * db file handler - */ - private $dbFileHandler = NULL; + */ + private $dbFileHandler = null; /** * header block info - */ - private $HeaderSip = NULL; - private $HeaderPtr = NULL; - private $headerLen = 0; + */ + private $HeaderSip = null; + private $HeaderPtr = null; + private $headerLen = 0; /** * super block index info - */ + */ private $firstIndexPtr = 0; - private $lastIndexPtr = 0; - private $totalBlocks = 0; + private $lastIndexPtr = 0; + private $totalBlocks = 0; /** * for memory mode only * the original db binary string - */ - private $dbBinStr = NULL; - private $dbFile = NULL; - + */ + private $dbBinStr = null; + private $dbFile = null; + /** * construct method * - * @param ip2regionFile - */ - public function __construct($ip2regionFile = null) - { + * @param string ip2regionFile + */ + public function __construct($ip2regionFile = null) + { $this->dbFile = is_null($ip2regionFile) ? __DIR__ . '/ip2region.db' : $ip2regionFile; } /** * all the db binary string will be loaded into memory * then search the memory only and this will a lot faster than disk base search - * @Note: + * @Note: * invoke it once before put it to public invoke could make it thread safe * - * @param $ip - */ + * @param string $ip + * @return array|null + * @throws Exception + */ public function memorySearch($ip) { //check and load the binary string for the first time - if ( $this->dbBinStr == NULL ) { + if ($this->dbBinStr == null) { $this->dbBinStr = file_get_contents($this->dbFile); - if ( $this->dbBinStr == false ) { + if ($this->dbBinStr == false) { throw new Exception("Fail to open the db file {$this->dbFile}"); } - $this->firstIndexPtr = self::getLong($this->dbBinStr, 0); - $this->lastIndexPtr = self::getLong($this->dbBinStr, 4); - $this->totalBlocks = ($this->lastIndexPtr-$this->firstIndexPtr)/INDEX_BLOCK_LENGTH + 1; + $this->lastIndexPtr = self::getLong($this->dbBinStr, 4); + $this->totalBlocks = ($this->lastIndexPtr - $this->firstIndexPtr) / INDEX_BLOCK_LENGTH + 1; } - - if ( is_string($ip) ) $ip = self::safeIp2long($ip); - + if (is_string($ip)) $ip = self::safeIp2long($ip); //binary search to define the data $l = 0; $h = $this->totalBlocks; $dataPtr = 0; - while ( $l <= $h ) { + while ($l <= $h) { $m = (($l + $h) >> 1); $p = $this->firstIndexPtr + $m * INDEX_BLOCK_LENGTH; $sip = self::getLong($this->dbBinStr, $p); - if ( $ip < $sip ) { + if ($ip < $sip) { $h = $m - 1; } else { $eip = self::getLong($this->dbBinStr, $p + 4); - if ( $ip > $eip ) { + if ($ip > $eip) { $l = $m + 1; } else { $dataPtr = self::getLong($this->dbBinStr, $p + 8); @@ -91,63 +90,57 @@ class Ip2Region } } } - //not matched just stop it here - if ( $dataPtr == 0 ) return NULL; - + if ($dataPtr == 0) return null; //get the data $dataLen = (($dataPtr >> 24) & 0xFF); $dataPtr = ($dataPtr & 0x00FFFFFF); - return array( - 'city_id' => self::getLong($this->dbBinStr, $dataPtr), - 'region' => substr($this->dbBinStr, $dataPtr + 4, $dataLen - 4) + 'city_id' => self::getLong($this->dbBinStr, $dataPtr), + 'region' => substr($this->dbBinStr, $dataPtr + 4, $dataLen - 4), ); } /** - * get the data block throught the specifield ip address or long ip numeric with binary search algorithm + * get the data block through the specified ip address or long ip numeric with binary search algorithm * - * @param ip - * @return mixed Array or NULL for any error - */ - public function binarySearch( $ip ) + * @param string ip + * @return mixed Array or NULL for any error + * @throws Exception + */ + public function binarySearch($ip) { //check and conver the ip address - if ( is_string($ip) ) $ip = self::safeIp2long($ip); - if ( $this->totalBlocks == 0 ) { + if (is_string($ip)) $ip = self::safeIp2long($ip); + if ($this->totalBlocks == 0) { //check and open the original db file - if ( $this->dbFileHandler == NULL ) { + if ($this->dbFileHandler == null) { $this->dbFileHandler = fopen($this->dbFile, 'r'); - if ( $this->dbFileHandler == false ) { + if ($this->dbFileHandler == false) { throw new Exception("Fail to open the db file {$this->dbFile}"); } } - fseek($this->dbFileHandler, 0); $superBlock = fread($this->dbFileHandler, 8); - $this->firstIndexPtr = self::getLong($superBlock, 0); - $this->lastIndexPtr = self::getLong($superBlock, 4); - $this->totalBlocks = ($this->lastIndexPtr-$this->firstIndexPtr)/INDEX_BLOCK_LENGTH + 1; + $this->lastIndexPtr = self::getLong($superBlock, 4); + $this->totalBlocks = ($this->lastIndexPtr - $this->firstIndexPtr) / INDEX_BLOCK_LENGTH + 1; } - //binary search to define the data $l = 0; $h = $this->totalBlocks; $dataPtr = 0; - while ( $l <= $h ) { + while ($l <= $h) { $m = (($l + $h) >> 1); $p = $m * INDEX_BLOCK_LENGTH; - fseek($this->dbFileHandler, $this->firstIndexPtr + $p); $buffer = fread($this->dbFileHandler, INDEX_BLOCK_LENGTH); - $sip = self::getLong($buffer, 0); - if ( $ip < $sip ) { + $sip = self::getLong($buffer, 0); + if ($ip < $sip) { $h = $m - 1; } else { $eip = self::getLong($buffer, 4); - if ( $ip > $eip ) { + if ($ip > $eip) { $l = $m + 1; } else { $dataPtr = self::getLong($buffer, 8); @@ -155,207 +148,196 @@ class Ip2Region } } } - //not matched just stop it here - if ( $dataPtr == 0 ) return NULL; - - + if ($dataPtr == 0) return null; //get the data $dataLen = (($dataPtr >> 24) & 0xFF); $dataPtr = ($dataPtr & 0x00FFFFFF); - fseek($this->dbFileHandler, $dataPtr); $data = fread($this->dbFileHandler, $dataLen); - return array( - 'city_id' => self::getLong($data, 0), - 'region' => substr($data, 4) + 'city_id' => self::getLong($data, 0), + 'region' => substr($data, 4), ); } /** - * get the data block associated with the specifield ip with b-tree search algorithm + * get the data block associated with the specified ip with b-tree search algorithm * @Note: not thread safe * - * @param ip + * @param string ip * @return Mixed Array for NULL for any error - */ - public function btreeSearch( $ip ) + * @throws Exception + */ + public function btreeSearch($ip) { - if ( is_string($ip) ) $ip = self::safeIp2long($ip); - + if (is_string($ip)) $ip = self::safeIp2long($ip); //check and load the header - if ( $this->HeaderSip == NULL ) { + if ($this->HeaderSip == null) { //check and open the original db file - if ( $this->dbFileHandler == NULL ) { + if ($this->dbFileHandler == null) { $this->dbFileHandler = fopen($this->dbFile, 'r'); - if ( $this->dbFileHandler == false ) { + if ($this->dbFileHandler == false) { throw new Exception("Fail to open the db file {$this->dbFile}"); } } - fseek($this->dbFileHandler, 8); $buffer = fread($this->dbFileHandler, TOTAL_HEADER_LENGTH); - + //fill the header $idx = 0; $this->HeaderSip = array(); $this->HeaderPtr = array(); - for ( $i = 0; $i < TOTAL_HEADER_LENGTH; $i += 8 ) { + for ($i = 0; $i < TOTAL_HEADER_LENGTH; $i += 8) { $startIp = self::getLong($buffer, $i); $dataPtr = self::getLong($buffer, $i + 4); - if ( $dataPtr == 0 ) break; - + if ($dataPtr == 0) break; $this->HeaderSip[] = $startIp; $this->HeaderPtr[] = $dataPtr; $idx++; } - $this->headerLen = $idx; } - + //1. define the index block with the binary search - $l = 0; $h = $this->headerLen; $sptr = 0; $eptr = 0; - while ( $l <= $h ) { + $l = 0; + $h = $this->headerLen; + $sptr = 0; + $eptr = 0; + while ($l <= $h) { $m = (($l + $h) >> 1); - + //perfetc matched, just return it - if ( $ip == $this->HeaderSip[$m] ) { - if ( $m > 0 ) { - $sptr = $this->HeaderPtr[$m-1]; - $eptr = $this->HeaderPtr[$m ]; + if ($ip == $this->HeaderSip[$m]) { + if ($m > 0) { + $sptr = $this->HeaderPtr[$m - 1]; + $eptr = $this->HeaderPtr[$m]; } else { - $sptr = $this->HeaderPtr[$m ]; - $eptr = $this->HeaderPtr[$m+1]; + $sptr = $this->HeaderPtr[$m]; + $eptr = $this->HeaderPtr[$m + 1]; } - + break; } - + //less then the middle value - if ( $ip < $this->HeaderSip[$m] ) { - if ( $m == 0 ) { - $sptr = $this->HeaderPtr[$m ]; - $eptr = $this->HeaderPtr[$m+1]; + if ($ip < $this->HeaderSip[$m]) { + if ($m == 0) { + $sptr = $this->HeaderPtr[$m]; + $eptr = $this->HeaderPtr[$m + 1]; break; - } else if ( $ip > $this->HeaderSip[$m-1] ) { - $sptr = $this->HeaderPtr[$m-1]; - $eptr = $this->HeaderPtr[$m ]; + } elseif ($ip > $this->HeaderSip[$m - 1]) { + $sptr = $this->HeaderPtr[$m - 1]; + $eptr = $this->HeaderPtr[$m]; break; } $h = $m - 1; } else { - if ( $m == $this->headerLen - 1 ) { - $sptr = $this->HeaderPtr[$m-1]; - $eptr = $this->HeaderPtr[$m ]; + if ($m == $this->headerLen - 1) { + $sptr = $this->HeaderPtr[$m - 1]; + $eptr = $this->HeaderPtr[$m]; break; - } else if ( $ip <= $this->HeaderSip[$m+1] ) { - $sptr = $this->HeaderPtr[$m ]; - $eptr = $this->HeaderPtr[$m+1]; + } elseif ($ip <= $this->HeaderSip[$m + 1]) { + $sptr = $this->HeaderPtr[$m]; + $eptr = $this->HeaderPtr[$m + 1]; break; } $l = $m + 1; } } - + //match nothing just stop it - if ( $sptr == 0 ) return NULL; - + if ($sptr == 0) return null; + //2. search the index blocks to define the data $blockLen = $eptr - $sptr; fseek($this->dbFileHandler, $sptr); $index = fread($this->dbFileHandler, $blockLen + INDEX_BLOCK_LENGTH); - - $dataptr = 0; - $l = 0; $h = $blockLen / INDEX_BLOCK_LENGTH; - while ( $l <= $h ) { + + $dataPtr = 0; + $l = 0; + $h = $blockLen / INDEX_BLOCK_LENGTH; + while ($l <= $h) { $m = (($l + $h) >> 1); $p = (int)($m * INDEX_BLOCK_LENGTH); $sip = self::getLong($index, $p); - if ( $ip < $sip ) { + if ($ip < $sip) { $h = $m - 1; } else { $eip = self::getLong($index, $p + 4); - if ( $ip > $eip ) { + if ($ip > $eip) { $l = $m + 1; } else { - $dataptr = self::getLong($index, $p + 8); + $dataPtr = self::getLong($index, $p + 8); break; } } } - + //not matched - if ( $dataptr == 0 ) return NULL; - + if ($dataPtr == 0) return null; + //3. get the data - $dataLen = (($dataptr >> 24) & 0xFF); - $dataPtr = ($dataptr & 0x00FFFFFF); - + $dataLen = (($dataPtr >> 24) & 0xFF); + $dataPtr = ($dataPtr & 0x00FFFFFF); + fseek($this->dbFileHandler, $dataPtr); $data = fread($this->dbFileHandler, $dataLen); - return array( - 'city_id' => self::getLong($data, 0), - 'region' => substr($data, 4) + 'city_id' => self::getLong($data, 0), + 'region' => substr($data, 4), ); } - /** - * safe self::safeIp2long function + * safe self::safeIp2long function * - * @param ip - * */ - public static function safeIp2long($ip) + * @param string ip + * + * @return false|int|string + */ + public static function safeIp2long($ip) { $ip = ip2long($ip); - // convert signed int to unsigned int if on 32 bit operating system if ($ip < 0 && PHP_INT_SIZE == 4) { $ip = sprintf("%u", $ip); - } - + } return $ip; } - - /** * read a long from a byte buffer * - * @param b - * @param offset - */ - public static function getLong( $b, $offset ) + * @param string b + * @param integer offset + * @return int|string + */ + public static function getLong($b, $offset) { - $val = ( - (ord($b[$offset++])) | - (ord($b[$offset++]) << 8) | - (ord($b[$offset++]) << 16) | - (ord($b[$offset ]) << 24) + $val = ( + (ord($b[$offset++])) | + (ord($b[$offset++]) << 8) | + (ord($b[$offset++]) << 16) | + (ord($b[$offset]) << 24) ); - // convert signed int to unsigned int if on 32 bit operating system if ($val < 0 && PHP_INT_SIZE == 4) { $val = sprintf("%u", $val); - } - + } return $val; } /** * destruct method, resource destroy - */ + */ public function __destruct() { - if ( $this->dbFileHandler != NULL ) { + if ($this->dbFileHandler != null) { fclose($this->dbFileHandler); } - - $this->dbBinStr = NULL; - $this->HeaderSip = NULL; - $this->HeaderPtr = NULL; + $this->dbBinStr = null; + $this->HeaderSip = null; + $this->HeaderPtr = null; } -} -?> +} \ No newline at end of file diff --git a/vendor/zoujingli/ip2region/ip2region.db b/vendor/zoujingli/ip2region/ip2region.db index 564178f3f..6cf58efb2 100644 Binary files a/vendor/zoujingli/ip2region/ip2region.db and b/vendor/zoujingli/ip2region/ip2region.db differ diff --git a/vendor/zoujingli/ip2region/test.php b/vendor/zoujingli/ip2region/test.php index 61bc599be..1279714a6 100644 --- a/vendor/zoujingli/ip2region/test.php +++ b/vendor/zoujingli/ip2region/test.php @@ -3,12 +3,17 @@ require 'Ip2Region.php'; $ip2region = new Ip2Region(); -$ip = '101.105.35.57'; - +$ip = '61.140.232.170'; +echo PHP_EOL; +echo "查询IP:{$ip}" . PHP_EOL; $info = $ip2region->btreeSearch($ip); - var_export($info); +echo PHP_EOL; +$info = $ip2region->memorySearch($ip); +var_export($info); +echo PHP_EOL; + // array ( // 'city_id' => 2163, // 'region' => '中国|华南|广东省|深圳市|鹏博士', diff --git a/vendor/zoujingli/wechat-php-sdk/README.md b/vendor/zoujingli/wechat-php-sdk/README.md index b5ceed275..75d9d8eb2 100644 --- a/vendor/zoujingli/wechat-php-sdk/README.md +++ b/vendor/zoujingli/wechat-php-sdk/README.md @@ -13,8 +13,10 @@ 此`SDK`已历经数个线上项目验证与考验,可靠性与稳定性极高,欢迎`fork`或`star`此项目。 -# 新微信开发工具推荐 -WeChatDeveloper:https://github.com/zoujingli/WeChatDeveloper +## 新微信开发工具推荐 +* 微信服务号、微信小程序、微信支付、支付宝支付 +* Gitee 仓库 WeChatDevloper: https://gitee.com/zoujingli/WeChatDeveloper +* Github 仓库 WeChatDeveloper:https://github.com/zoujingli/WeChatDeveloper **微信SDK开发帮助及交流** -- @@ -22,13 +24,13 @@ WeChatDeveloper:https://github.com/zoujingli/WeChatDeveloper * **文档链接地址**:http://www.kancloud.cn/zoujingli/wechat-php-sdk -* **ThinkAdmin**:https://github.com/zoujingli/ThinkAdmin +* **Think.Admin**:https://github.com/zoujingli/Think.Admin * **开发交流QQ群:513350915(新)** **若对您有帮助,可以赞助并支持下作者哦,谢谢!** -- -![](http://plugs.ctolog.com/pay.png) +![](http://static.thinkadmin.top/pay.png) **官方接口文档链接** diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php b/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php index ae9fc85bc..9219697ea 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php @@ -25,7 +25,7 @@ use Wechat\Lib\Cache; spl_autoload_register(function ($class) { if (0 === stripos($class, 'Wechat\\')) { $filename = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php'; - file_exists($filename) && require($filename); + if (file_exists($filename)) require $filename; } }); @@ -76,7 +76,7 @@ class Loader * @param array $config SDK配置(token,appid,appsecret,encodingaeskey,mch_id,partnerkey,ssl_cer,ssl_key,qrc_img) * @return WechatCard|WechatCustom|WechatDevice|WechatExtends|WechatMedia|WechatMenu|WechatOauth|WechatPay|WechatPoi|WechatReceive|WechatScript|WechatService|WechatUser */ - static public function & get_instance($type, $config = array()) + static public function get_instance($type, $config = array()) { return self::get($type, $config); } @@ -87,7 +87,7 @@ class Loader * @param array $config SDK配置(token,appid,appsecret,encodingaeskey,mch_id,partnerkey,ssl_cer,ssl_key,qrc_img) * @return WechatCard|WechatCustom|WechatDevice|WechatExtends|WechatMedia|WechatMenu|WechatOauth|WechatPay|WechatPoi|WechatReceive|WechatScript|WechatService|WechatUser */ - static public function & get($type, $config = array()) + static public function get($type, $config = array()) { $index = md5(strtolower($type) . md5(json_encode(self::$config))); if (!isset(self::$cache[$index])) { diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php index b26dd1f96..c069f22f5 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php @@ -122,7 +122,7 @@ class WechatScript extends Common "timestamp" => $data['timestamp'], "signature" => Tools::getSignature($data, 'sha1'), 'jsApiList' => array( - 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', + 'updateTimelineShareData', 'updateAppMessageShareData', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'hideOptionMenu', 'showOptionMenu', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem', 'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'closeWindow', 'scanQRCode', 'chooseWXPay', 'translateVoice', 'getNetworkType', 'openLocation', 'getLocation', diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php index 0798951ba..e8182bc96 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php @@ -198,7 +198,7 @@ class WechatUser extends Common /** * 删除粉丝分组 - * @param type $id + * @param string $id * @return bool */ public function delGroup($id) diff --git a/vendor/zoujingli/wechat-php-sdk/composer.json b/vendor/zoujingli/wechat-php-sdk/composer.json index b3f9dfd1b..81791c072 100644 --- a/vendor/zoujingli/wechat-php-sdk/composer.json +++ b/vendor/zoujingli/wechat-php-sdk/composer.json @@ -8,6 +8,9 @@ "wechat-php-sdk" ], "require": { + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", "php": ">=5.3.3" }, "autoload": {