From 4ccf04652185999083be9dbca736df3fd9d71e95 Mon Sep 17 00:00:00 2001 From: Wisp X <1591788658@qq.com> Date: Sat, 3 Aug 2019 23:59:37 +0800 Subject: [PATCH] =?UTF-8?q?:package:=20=E6=9B=B4=E6=96=B0thinkphp(v5.1.37.?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 86 +-- thinkphp/library/think/App.php | 2 +- thinkphp/library/think/Console.php | 13 +- thinkphp/library/think/Model.php | 2 +- thinkphp/library/think/Validate.php | 2 +- thinkphp/library/think/cache/Driver.php | 2 - thinkphp/library/think/cache/driver/Redis.php | 6 +- thinkphp/library/think/db/Query.php | 13 +- thinkphp/library/think/model/Collection.php | 6 +- thinkphp/library/think/model/Relation.php | 21 + .../library/think/model/concern/Attribute.php | 6 +- .../think/model/concern/Conversion.php | 8 +- .../think/model/concern/RelationShip.php | 6 +- thinkphp/library/think/route/Rule.php | 17 +- thinkphp/library/think/route/RuleGroup.php | 2 +- thinkphp/library/think/route/RuleItem.php | 14 +- vendor/composer/installed.json | 94 +-- vendor/guzzlehttp/psr7/.editorconfig | 9 - vendor/guzzlehttp/psr7/CHANGELOG.md | 23 +- vendor/guzzlehttp/psr7/composer.json | 10 +- vendor/guzzlehttp/psr7/src/LimitStream.php | 2 +- vendor/guzzlehttp/psr7/src/MessageTrait.php | 60 +- vendor/guzzlehttp/psr7/src/Request.php | 9 + vendor/guzzlehttp/psr7/src/Response.php | 28 +- vendor/guzzlehttp/psr7/src/ServerRequest.php | 2 +- vendor/guzzlehttp/psr7/src/Stream.php | 33 +- vendor/guzzlehttp/psr7/src/Uri.php | 36 +- vendor/guzzlehttp/psr7/src/functions.php | 1 + vendor/qiniu/php-sdk/.travis.yml | 5 + .../php-sdk/examples/upload_and_callback.php | 8 +- vendor/qiniu/php-sdk/phpunit.xml.dist | 1 - .../php-sdk/src/Qiniu/Cdn/CdnManager.php | 9 +- vendor/qiniu/php-sdk/src/Qiniu/Config.php | 61 +- .../qiniu/php-sdk/src/Qiniu/Http/Client.php | 10 +- .../qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php | 11 +- .../src/Qiniu/Storage/BucketManager.php | 653 +++++++++++++++++- .../src/Qiniu/Storage/FormUploader.php | 2 - vendor/qiniu/php-sdk/src/Qiniu/Zone.php | 200 +----- .../php-sdk/tests/Qiniu/Tests/AuthTest.php | 0 .../php-sdk/tests/Qiniu/Tests/Base64Test.php | 0 .../php-sdk/tests/Qiniu/Tests/BucketTest.php | 0 .../tests/Qiniu/Tests/CdnManagerTest.php | 11 +- .../php-sdk/tests/Qiniu/Tests/Crc32Test.php | 0 .../tests/Qiniu/Tests/DownloadTest.php | 0 .../php-sdk/tests/Qiniu/Tests/EtagTest.php | 0 .../php-sdk/tests/Qiniu/Tests/FopTest.php | 0 .../php-sdk/tests/Qiniu/Tests/FormUpTest.php | 0 .../php-sdk/tests/Qiniu/Tests/HttpTest.php | 0 .../tests/Qiniu/Tests/ImageUrlBuilderTest.php | 0 .../php-sdk/tests/Qiniu/Tests/PfopTest.php | 0 .../tests/Qiniu/Tests/ResumeUpTest.php | 2 +- .../php-sdk/tests/Qiniu/Tests/ZoneTest.php | 0 vendor/qiniu/php-sdk/tests/bootstrap.php | 2 +- vendor/ralouphie/getallheaders/.gitignore | 5 - vendor/ralouphie/getallheaders/.travis.yml | 18 - vendor/ralouphie/getallheaders/README.md | 8 + vendor/ralouphie/getallheaders/composer.json | 13 +- vendor/ralouphie/getallheaders/phpunit.xml | 22 - .../getallheaders/tests/GetAllHeadersTest.php | 121 ---- 59 files changed, 1065 insertions(+), 610 deletions(-) delete mode 100644 vendor/guzzlehttp/psr7/.editorconfig mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/AuthTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/Crc32Test.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/Qiniu/Tests/ZoneTest.php mode change 100644 => 100755 vendor/qiniu/php-sdk/tests/bootstrap.php delete mode 100644 vendor/ralouphie/getallheaders/.gitignore delete mode 100644 vendor/ralouphie/getallheaders/.travis.yml delete mode 100644 vendor/ralouphie/getallheaders/phpunit.xml delete mode 100644 vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php diff --git a/composer.lock b/composer.lock index cf32766f..bcce1824 100644 --- a/composer.lock +++ b/composer.lock @@ -21,7 +21,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -68,7 +68,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -170,7 +170,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -241,7 +241,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -285,20 +285,20 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.5.2", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "9f83dded91781a01c63574e387eaa769be769115" + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", - "reference": "9f83dded91781a01c63574e387eaa769be769115", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -306,18 +306,22 @@ "require": { "php": ">=5.4.0", "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5" + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { + "ext-zlib": "*", "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -354,7 +358,7 @@ "uri", "url" ], - "time": "2018-12-04T20:46:45+00:00" + "time": "2019-07-01T23:21:34+00:00" }, { "name": "phpmailer/phpmailer", @@ -371,7 +375,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -443,7 +447,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -499,7 +503,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -538,20 +542,20 @@ }, { "name": "qiniu/php-sdk", - "version": "v7.2.7", + "version": "v7.2.9", "source": { "type": "git", "url": "https://github.com/qiniu/php-sdk.git", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6" + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/88d11a5857ebc6871204e9be6ceec54bf5f381e6", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6", + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/afe7d8715d8a688b1d8d8cdf031240d2363dad90", + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -591,34 +595,34 @@ "sdk", "storage" ], - "time": "2018-11-06T13:34:32+00:00" + "time": "2019-07-09T07:55:07+00:00" }, { "name": "ralouphie/getallheaders", - "version": "2.0.5", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] }, "require": { - "php": ">=5.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~3.7.0", - "satooshi/php-coveralls": ">=1.0" + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, "type": "library", "autoload": { @@ -637,7 +641,7 @@ } ], "description": "A polyfill for getallheaders.", - "time": "2016-02-11T07:05:27+00:00" + "time": "2019-03-08T08:55:37+00:00" }, { "name": "symfony/event-dispatcher", @@ -654,7 +658,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -707,20 +711,20 @@ }, { "name": "topthink/framework", - "version": "v5.1.36", + "version": "v5.1.37.1", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "135eee67ce9ee0b07da201f743d7dd88ec431abb" + "reference": "05eecd121d18d6705aaa10aa44fcdf7c14da4d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/135eee67ce9ee0b07da201f743d7dd88ec431abb", - "reference": "135eee67ce9ee0b07da201f743d7dd88ec431abb", + "url": "https://api.github.com/repos/top-think/framework/zipball/05eecd121d18d6705aaa10aa44fcdf7c14da4d0b", + "reference": "05eecd121d18d6705aaa10aa44fcdf7c14da4d0b", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -760,7 +764,7 @@ "orm", "thinkphp" ], - "time": "2019-04-28T08:56:58+00:00" + "time": "2019-05-28T06:57:29+00:00" }, { "name": "topthink/think-captcha", @@ -777,7 +781,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -822,7 +826,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -868,7 +872,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -915,7 +919,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] diff --git a/thinkphp/library/think/App.php b/thinkphp/library/think/App.php index 49c6a2de..1fb9fbda 100644 --- a/thinkphp/library/think/App.php +++ b/thinkphp/library/think/App.php @@ -20,7 +20,7 @@ use think\route\Dispatch; */ class App extends Container { - const VERSION = '5.1.36 LTS'; + const VERSION = '5.1.37 LTS'; /** * 当前模块路径 diff --git a/thinkphp/library/think/Console.php b/thinkphp/library/think/Console.php index d1212907..22f3e2c5 100644 --- a/thinkphp/library/think/Console.php +++ b/thinkphp/library/think/Console.php @@ -487,12 +487,17 @@ class Console public function getNamespaces() { $namespaces = []; - foreach ($this->commands as $command) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); + foreach ($this->commands as $name => $command) { + if (is_string($command)) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($name)); + } else { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); - foreach ($command->getAliases() as $alias) { - $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); + foreach ($command->getAliases() as $alias) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); + } } + } return array_values(array_unique(array_filter($namespaces))); diff --git a/thinkphp/library/think/Model.php b/thinkphp/library/think/Model.php index 8e6ee412..65e543d9 100644 --- a/thinkphp/library/think/Model.php +++ b/thinkphp/library/think/Model.php @@ -571,7 +571,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $this->autoRelationUpdate(); } - return false; + return true; } elseif ($this->autoWriteTimestamp && $this->updateTime && !isset($data[$this->updateTime])) { // 自动写入更新时间 $data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); diff --git a/thinkphp/library/think/Validate.php b/thinkphp/library/think/Validate.php index b526be7f..d4f6d236 100644 --- a/thinkphp/library/think/Validate.php +++ b/thinkphp/library/think/Validate.php @@ -519,7 +519,7 @@ class Validate if (isset($this->append[$field])) { // 追加额外的验证规则 - $rules = array_unique(array_merge($rules, $this->append[$field])); + $rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR); } $i = 0; diff --git a/thinkphp/library/think/cache/Driver.php b/thinkphp/library/think/cache/Driver.php index 2dd23293..64216810 100644 --- a/thinkphp/library/think/cache/Driver.php +++ b/thinkphp/library/think/cache/Driver.php @@ -249,7 +249,6 @@ abstract class Driver { if ($this->tag) { $key = $this->getTagkey($this->tag); - $prev = $this->tag; $this->tag = null; if ($this->has($key)) { @@ -266,7 +265,6 @@ abstract class Driver } $this->set($key, $value, 0); - $this->tag = $prev; } } diff --git a/thinkphp/library/think/cache/driver/Redis.php b/thinkphp/library/think/cache/driver/Redis.php index 2095f597..813746e7 100644 --- a/thinkphp/library/think/cache/driver/Redis.php +++ b/thinkphp/library/think/cache/driver/Redis.php @@ -267,10 +267,6 @@ class Redis extends Driver protected function getTagItem($tag) { $tagName = $this->getTagKey($tag); - $keys = $this->handler->sMembers($tagName); - - return array_map(function ($key) { - return $this->getCacheKey($key); - }, $keys); + return $this->handler->sMembers($tagName); } } diff --git a/thinkphp/library/think/db/Query.php b/thinkphp/library/think/db/Query.php index ca2f1a10..5b1785e4 100644 --- a/thinkphp/library/think/db/Query.php +++ b/thinkphp/library/think/db/Query.php @@ -1512,6 +1512,7 @@ class Query { if ($field instanceof $this) { $this->options['where'] = $field->getOptions('where'); + $this->bind($field->getBind(false)); return $this; } @@ -2197,12 +2198,12 @@ class Query } /** - * 设置需要追加输出的属性 + * 设置需要附加的输出属性 * @access public - * @param array $append 需要追加的属性 + * @param array $append 属性列表 * @return $this */ - public function append(array $append) + public function append(array $append = []) { $this->options['append'] = $append; return $this; @@ -3355,13 +3356,13 @@ class Query // 输出属性控制 if (!empty($options['visible'])) { - $result->visible($options['visible']); + $result->visible($options['visible'], true); } elseif (!empty($options['hidden'])) { - $result->hidden($options['hidden']); + $result->hidden($options['hidden'], true); } if (!empty($options['append'])) { - $result->append($options['append']); + $result->append($options['append'], true); } // 关联查询 diff --git a/thinkphp/library/think/model/Collection.php b/thinkphp/library/think/model/Collection.php index 09b61a80..34ec067e 100644 --- a/thinkphp/library/think/model/Collection.php +++ b/thinkphp/library/think/model/Collection.php @@ -24,8 +24,10 @@ class Collection extends BaseCollection */ public function load($relation) { - $item = current($this->items); - $item->eagerlyResultSet($this->items, $relation); + if (!$this->isEmpty()) { + $item = current($this->items); + $item->eagerlyResultSet($this->items, $relation); + } return $this; } diff --git a/thinkphp/library/think/model/Relation.php b/thinkphp/library/think/model/Relation.php index c2b9adc7..ac6dd4cf 100644 --- a/thinkphp/library/think/model/Relation.php +++ b/thinkphp/library/think/model/Relation.php @@ -58,6 +58,16 @@ abstract class Relation return $this->query->getModel(); } + /** + * 获取当前的关联模型类的实例 + * @access public + * @return Query + */ + public function getQuery() + { + return $this->query; + } + /** * 设置当前关联为自关联 * @access public @@ -129,6 +139,17 @@ abstract class Relation } } + /** + * 更新数据 + * @access public + * @param array $data 更新数据 + * @return integer|string + */ + public function update(array $data = []) + { + return $this->query->update($data); + } + /** * 删除记录 * @access public diff --git a/thinkphp/library/think/model/concern/Attribute.php b/thinkphp/library/think/model/concern/Attribute.php index 4686b0b8..66627b38 100644 --- a/thinkphp/library/think/model/concern/Attribute.php +++ b/thinkphp/library/think/model/concern/Attribute.php @@ -327,9 +327,13 @@ trait Attribute $method = 'set' . Loader::parseName($name, 1) . 'Attr'; if (method_exists($this, $method)) { - $value = $this->$method($value, array_merge($this->data, $data)); + $origin = $this->data; + $value = $this->$method($value, array_merge($this->data, $data)); $this->set[$name] = true; + if (is_null($value) && $origin !== $this->data) { + return; + } } elseif (isset($this->type[$name])) { // 类型转换 $value = $this->writeTransform($value, $this->type[$name]); diff --git a/thinkphp/library/think/model/concern/Conversion.php b/thinkphp/library/think/model/concern/Conversion.php index ef409c4e..922d5b0e 100644 --- a/thinkphp/library/think/model/concern/Conversion.php +++ b/thinkphp/library/think/model/concern/Conversion.php @@ -164,13 +164,15 @@ trait Conversion foreach ($data as $key => $val) { if ($val instanceof Model || $val instanceof ModelCollection) { // 关联模型对象 - if (isset($this->visible[$key])) { + if (isset($this->visible[$key]) && is_array($this->visible[$key])) { $val->visible($this->visible[$key]); - } elseif (isset($this->hidden[$key])) { + } elseif (isset($this->hidden[$key]) && is_array($this->hidden[$key])) { $val->hidden($this->hidden[$key]); } // 关联模型对象 - $item[$key] = $val->toArray(); + if (!isset($this->hidden[$key]) || true !== $this->hidden[$key]) { + $item[$key] = $val->toArray(); + } } elseif (isset($this->visible[$key])) { $item[$key] = $this->getAttr($key); } elseif (!isset($this->hidden[$key]) && !$hasVisible) { diff --git a/thinkphp/library/think/model/concern/RelationShip.php b/thinkphp/library/think/model/concern/RelationShip.php index 38ad5d20..9ca709a5 100644 --- a/thinkphp/library/think/model/concern/RelationShip.php +++ b/thinkphp/library/think/model/concern/RelationShip.php @@ -204,7 +204,7 @@ trait RelationShip $relationResult = $this->$method(); if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); + $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); } $this->relation[$relation] = $relationResult->getRelation($subRelation, $closure); @@ -248,7 +248,7 @@ trait RelationShip $relationResult = $this->$relation(); if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); + $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); } $relationResult->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $join); @@ -290,7 +290,7 @@ trait RelationShip $relationResult = $this->$relation(); if (isset($withRelationAttr[$relationName])) { - $relationResult->withAttr($withRelationAttr[$relationName]); + $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); } $relationResult->eagerlyResult($result, $relation, $subRelation, $closure, $join); diff --git a/thinkphp/library/think/route/Rule.php b/thinkphp/library/think/route/Rule.php index f841ada6..996305f7 100644 --- a/thinkphp/library/think/route/Rule.php +++ b/thinkphp/library/think/route/Rule.php @@ -642,17 +642,26 @@ abstract class Rule protected function checkCrossDomain($request) { if (!empty($this->option['cross_domain'])) { - $header = [ - 'Access-Control-Allow-Origin' => '*', - 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE', - 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With', + 'Access-Control-Allow-Credentials' => 'true', + 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE', + 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With', ]; if (!empty($this->option['header'])) { $header = array_merge($header, $this->option['header']); } + if (!isset($header['Access-Control-Allow-Origin'])) { + $httpOrigin = $request->header('origin'); + + if ($httpOrigin && strpos(config('cookie.domain'), $httpOrigin)) { + $header['Access-Control-Allow-Origin'] = $httpOrigin; + } else { + $header['Access-Control-Allow-Origin'] = '*'; + } + } + $this->option['header'] = $header; if ($request->method(true) == 'OPTIONS') { diff --git a/thinkphp/library/think/route/RuleGroup.php b/thinkphp/library/think/route/RuleGroup.php index faad639a..5781d8cf 100644 --- a/thinkphp/library/think/route/RuleGroup.php +++ b/thinkphp/library/think/route/RuleGroup.php @@ -118,8 +118,8 @@ class RuleGroup extends Rule */ public function check($request, $url, $completeMatch = false) { + // 跨域OPTIONS请求 if ($dispatch = $this->checkCrossDomain($request)) { - // 跨域OPTIONS请求 return $dispatch; } diff --git a/thinkphp/library/think/route/RuleItem.php b/thinkphp/library/think/route/RuleItem.php index e4bddd90..a05d2deb 100644 --- a/thinkphp/library/think/route/RuleItem.php +++ b/thinkphp/library/think/route/RuleItem.php @@ -149,11 +149,6 @@ class RuleItem extends Rule */ public function checkRule($request, $url, $match = null, $completeMatch = false) { - if ($dispatch = $this->checkCrossDomain($request)) { - // 允许跨域 - return $dispatch; - } - // 检查参数有效性 if (!$this->checkOption($this->option, $request)) { return false; @@ -169,6 +164,15 @@ class RuleItem extends Rule } if (false !== $match) { + if (!empty($option['cross_domain'])) { + if ($dispatch = $this->checkCrossDomain($request)) { + // 允许跨域 + return $dispatch; + } + + $option['header'] = $this->option['header']; + } + // 检查前置行为 if (isset($option['before']) && false === $this->checkBefore($option['before'])) { return false; diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index aeb03ce8..2811bb5c 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -15,7 +15,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -64,7 +64,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -168,7 +168,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -241,7 +241,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -286,21 +286,21 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.5.2", - "version_normalized": "1.5.2.0", + "version": "1.6.1", + "version_normalized": "1.6.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "9f83dded91781a01c63574e387eaa769be769115" + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", - "reference": "9f83dded91781a01c63574e387eaa769be769115", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -308,19 +308,23 @@ "require": { "php": ">=5.4.0", "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5" + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { + "ext-zlib": "*", "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, - "time": "2018-12-04T20:46:45+00:00", + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2019-07-01T23:21:34+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "installation-source": "dist", @@ -375,7 +379,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -449,7 +453,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -507,7 +511,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -547,21 +551,21 @@ }, { "name": "qiniu/php-sdk", - "version": "v7.2.7", - "version_normalized": "7.2.7.0", + "version": "v7.2.9", + "version_normalized": "7.2.9.0", "source": { "type": "git", "url": "https://github.com/qiniu/php-sdk.git", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6" + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/88d11a5857ebc6871204e9be6ceec54bf5f381e6", - "reference": "88d11a5857ebc6871204e9be6ceec54bf5f381e6", + "url": "https://api.github.com/repos/qiniu/php-sdk/zipball/afe7d8715d8a688b1d8d8cdf031240d2363dad90", + "reference": "afe7d8715d8a688b1d8d8cdf031240d2363dad90", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -573,7 +577,7 @@ "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.3" }, - "time": "2018-11-06T13:34:32+00:00", + "time": "2019-07-09T07:55:07+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -606,33 +610,33 @@ }, { "name": "ralouphie/getallheaders", - "version": "2.0.5", - "version_normalized": "2.0.5.0", + "version": "3.0.3", + "version_normalized": "3.0.3.0", "source": { "type": "git", "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] }, "require": { - "php": ">=5.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~3.7.0", - "satooshi/php-coveralls": ">=1.0" + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, - "time": "2016-02-11T07:05:27+00:00", + "time": "2019-03-08T08:55:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -668,7 +672,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -722,21 +726,21 @@ }, { "name": "topthink/framework", - "version": "v5.1.36", - "version_normalized": "5.1.36.0", + "version": "v5.1.37.1", + "version_normalized": "5.1.37.1", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "135eee67ce9ee0b07da201f743d7dd88ec431abb" + "reference": "05eecd121d18d6705aaa10aa44fcdf7c14da4d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/135eee67ce9ee0b07da201f743d7dd88ec431abb", - "reference": "135eee67ce9ee0b07da201f743d7dd88ec431abb", + "url": "https://api.github.com/repos/top-think/framework/zipball/05eecd121d18d6705aaa10aa44fcdf7c14da4d0b", + "reference": "05eecd121d18d6705aaa10aa44fcdf7c14da4d0b", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -754,7 +758,7 @@ "sebastian/phpcpd": "2.*", "squizlabs/php_codesniffer": "2.*" }, - "time": "2019-04-28T08:56:58+00:00", + "time": "2019-05-28T06:57:29+00:00", "type": "think-framework", "installation-source": "dist", "notification-url": "https://packagist.org/downloads/", @@ -795,7 +799,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -842,7 +846,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -890,7 +894,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -939,7 +943,7 @@ "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] diff --git a/vendor/guzzlehttp/psr7/.editorconfig b/vendor/guzzlehttp/psr7/.editorconfig deleted file mode 100644 index 677e36e2..00000000 --- a/vendor/guzzlehttp/psr7/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md index 27b65f09..8a3743db 100644 --- a/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -10,6 +10,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.6.0] + +### Added + +- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244) +- Added MIME type for WEBP image format (#246) +- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272) + +### Changed + +- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262) +- Accept port number 0 to be valid (#270) + +### Fixed + +- Fixed subsequent reads from `php://input` in ServerRequest (#247) +- Fixed readable/writable detection for certain stream modes (#248) +- Fixed encoding of special characters in the `userInfo` component of an URI (#253) + + ## [1.5.2] - 2018-12-04 ### Fixed @@ -209,7 +229,8 @@ Currently unsupported: -[Unreleased]: https://github.com/guzzle/psr7/compare/1.5.2...HEAD +[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 [1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 [1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 [1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json index 2add153e..168a055b 100644 --- a/vendor/guzzlehttp/psr7/composer.json +++ b/vendor/guzzlehttp/psr7/composer.json @@ -18,14 +18,18 @@ "require": { "php": ">=5.4.0", "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5" + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "require-dev": { - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8", + "ext-zlib": "*" }, "provide": { "psr/http-message-implementation": "1.0" }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" @@ -39,7 +43,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } } } diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php index 3c13d4f4..e4f239e3 100644 --- a/vendor/guzzlehttp/psr7/src/LimitStream.php +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -72,7 +72,7 @@ class LimitStream implements StreamInterface { if ($whence !== SEEK_SET || $offset < 0) { throw new \RuntimeException(sprintf( - 'Cannot seek to offset % with whence %s', + 'Cannot seek to offset %s with whence %s', $offset, $whence )); diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php index 1e4da649..a7966d10 100644 --- a/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -66,11 +66,8 @@ trait MessageTrait public function withHeader($header, $value) { - if (!is_array($value)) { - $value = [$value]; - } - - $value = $this->trimHeaderValues($value); + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); $normalized = strtolower($header); $new = clone $this; @@ -85,11 +82,8 @@ trait MessageTrait public function withAddedHeader($header, $value) { - if (!is_array($value)) { - $value = [$value]; - } - - $value = $this->trimHeaderValues($value); + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); $normalized = strtolower($header); $new = clone $this; @@ -144,11 +138,13 @@ trait MessageTrait { $this->headerNames = $this->headers = []; foreach ($headers as $header => $value) { - if (!is_array($value)) { - $value = [$value]; + if (is_int($header)) { + // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec + // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. + $header = (string) $header; } - - $value = $this->trimHeaderValues($value); + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); $normalized = strtolower($header); if (isset($this->headerNames[$normalized])) { $header = $this->headerNames[$normalized]; @@ -160,6 +156,19 @@ trait MessageTrait } } + private function normalizeHeaderValue($value) + { + if (!is_array($value)) { + return $this->trimHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimHeaderValues($value); + } + /** * Trims whitespace from the header values. * @@ -177,7 +186,28 @@ trait MessageTrait private function trimHeaderValues(array $values) { return array_map(function ($value) { - return trim($value, " \t"); + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return trim((string) $value, " \t"); }, $values); } + + private function assertHeader($header) + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if ($header === '') { + throw new \InvalidArgumentException('Header name can not be empty.'); + } + } } diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php index 00066424..59f337db 100644 --- a/vendor/guzzlehttp/psr7/src/Request.php +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -36,6 +36,7 @@ class Request implements RequestInterface $body = null, $version = '1.1' ) { + $this->assertMethod($method); if (!($uri instanceof UriInterface)) { $uri = new Uri($uri); } @@ -91,6 +92,7 @@ class Request implements RequestInterface public function withMethod($method) { + $this->assertMethod($method); $new = clone $this; $new->method = strtoupper($method); return $new; @@ -139,4 +141,11 @@ class Request implements RequestInterface // See: http://tools.ietf.org/html/rfc7230#section-5.4 $this->headers = [$header => [$host]] + $this->headers; } + + private function assertMethod($method) + { + if (!is_string($method) || $method === '') { + throw new \InvalidArgumentException('Method must be a non-empty string.'); + } + } } diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php index 6e72c06b..e7e04d86 100644 --- a/vendor/guzzlehttp/psr7/src/Response.php +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -93,11 +93,11 @@ class Response implements ResponseInterface $version = '1.1', $reason = null ) { - if (filter_var($status, FILTER_VALIDATE_INT) === false) { - throw new \InvalidArgumentException('Status code must be an integer value.'); - } + $this->assertStatusCodeIsInteger($status); + $status = (int) $status; + $this->assertStatusCodeRange($status); - $this->statusCode = (int) $status; + $this->statusCode = $status; if ($body !== '' && $body !== null) { $this->stream = stream_for($body); @@ -125,12 +125,30 @@ class Response implements ResponseInterface public function withStatus($code, $reasonPhrase = '') { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + $new = clone $this; - $new->statusCode = (int) $code; + $new->statusCode = $code; if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { $reasonPhrase = self::$phrases[$new->statusCode]; } $new->reasonPhrase = $reasonPhrase; return $new; } + + private function assertStatusCodeIsInteger($statusCode) + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange($statusCode) + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } } diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php index 99f453a5..1a09a6c8 100644 --- a/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -168,7 +168,7 @@ class ServerRequest extends Request implements ServerRequestInterface $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; $headers = getallheaders(); $uri = self::getUriFromGlobals(); - $body = new LazyOpenStream('php://input', 'r+'); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php index 111795eb..d9e7409c 100644 --- a/vendor/guzzlehttp/psr7/src/Stream.php +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -10,6 +10,17 @@ use Psr\Http\Message\StreamInterface; */ class Stream implements StreamInterface { + /** + * Resource modes. + * + * @var string + * + * @see http://php.net/manual/function.fopen.php + * @see http://php.net/manual/en/function.gzopen.php + */ + const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/'; + const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/'; + private $stream; private $size; private $seekable; @@ -18,22 +29,6 @@ class Stream implements StreamInterface private $uri; private $customMetadata; - /** @var array Hash of readable and writable stream types */ - private static $readWriteHash = [ - 'read' => [ - 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, - 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, - 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, - 'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true, - ], - 'write' => [ - 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, - 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true, - 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, - 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true - ] - ]; - /** * This constructor accepts an associative array of options. * @@ -65,8 +60,8 @@ class Stream implements StreamInterface $this->stream = $stream; $meta = stream_get_meta_data($this->stream); $this->seekable = $meta['seekable']; - $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); - $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); + $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); $this->uri = $this->getMetadata('uri'); } @@ -197,6 +192,8 @@ class Stream implements StreamInterface public function seek($offset, $whence = SEEK_SET) { + $whence = (int) $whence; + if (!isset($this->stream)) { throw new \RuntimeException('Stream is detached'); } diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php index 36219568..825a25ee 100644 --- a/vendor/guzzlehttp/psr7/src/Uri.php +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -437,9 +437,9 @@ class Uri implements UriInterface public function withUserInfo($user, $password = null) { - $info = $user; - if ($password != '') { - $info .= ':' . $password; + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); } if ($this->userInfo === $info) { @@ -537,7 +537,9 @@ class Uri implements UriInterface $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; - $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; $this->host = isset($parts['host']) ? $this->filterHost($parts['host']) : ''; @@ -554,7 +556,7 @@ class Uri implements UriInterface ? $this->filterQueryAndFragment($parts['fragment']) : ''; if (isset($parts['pass'])) { - $this->userInfo .= ':' . $parts['pass']; + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); } $this->removeDefaultPort(); @@ -576,6 +578,26 @@ class Uri implements UriInterface return strtolower($scheme); } + /** + * @param string $component + * + * @return string + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component) + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + /** * @param string $host * @@ -606,9 +628,9 @@ class Uri implements UriInterface } $port = (int) $port; - if (1 > $port || 0xffff < $port) { + if (0 > $port || 0xffff < $port) { throw new \InvalidArgumentException( - sprintf('Invalid port: %d. Must be between 1 and 65535', $port) + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) ); } diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php index 957bfb42..8e6dafe6 100644 --- a/vendor/guzzlehttp/psr7/src/functions.php +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -724,6 +724,7 @@ function mimetype_from_extension($extension) 'txt' => 'text/plain', 'wav' => 'audio/x-wav', 'webm' => 'video/webm', + 'webp' => 'image/webp', 'wma' => 'audio/x-ms-wma', 'wmv' => 'video/x-ms-wmv', 'woff' => 'application/x-font-woff', diff --git a/vendor/qiniu/php-sdk/.travis.yml b/vendor/qiniu/php-sdk/.travis.yml index 60951b15..cada8cd0 100644 --- a/vendor/qiniu/php-sdk/.travis.yml +++ b/vendor/qiniu/php-sdk/.travis.yml @@ -21,3 +21,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/examples/upload_and_callback.php b/vendor/qiniu/php-sdk/examples/upload_and_callback.php index 4762bd33..1a707055 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 72ff67f9..840f6e56 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 0e6abac0..c3247579 100644 --- a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php +++ b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php @@ -169,21 +169,22 @@ 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); + $url = $parsedUrl['scheme'].'://'.$parsedUrl['host'].$path; + if (isset($parsedUrl['query'])) { - $signedUrl = $rawUrl . '&sign=' . $signStr . '&t=' . $expireHex; + $signedUrl = $url . '&sign=' . $signStr . '&t=' . $expireHex; } else { - $signedUrl = $rawUrl . '?sign=' . $signStr . '&t=' . $expireHex; + $signedUrl = $url . '?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 b1f63674..ec75df68 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.9'; 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 425c314c..0fe03cee 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/Rtc/AppClient.php b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php index c07ee72f..0fd0019a 100755 --- 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:人数限制 @@ -41,6 +42,7 @@ class AppClient } /* + * 更新应用 * appId: app 的唯一标识,创建的时候由系统生成。 * Title: app 的名称, 可选。 * Hub: 绑定的直播 hub,可选,用于合流后 rtmp 推流。 @@ -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/Storage/BucketManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php index 2e82a147..e38f433e 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=' . $share; + $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 5c3361f9..d87756a0 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/Zone.php b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php index 9b142dcc..7af0e3f5 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/AuthTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/AuthTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php old mode 100644 new mode 100755 index 5a858dfa..3c45bbdf --- a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php @@ -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/Crc32Test.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Crc32Test.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php old mode 100644 new mode 100755 index 00008d45..41e6ea8a --- 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/Qiniu/Tests/ZoneTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ZoneTest.php old mode 100644 new mode 100755 diff --git a/vendor/qiniu/php-sdk/tests/bootstrap.php b/vendor/qiniu/php-sdk/tests/bootstrap.php old mode 100644 new mode 100755 index 5bd8b056..c300057c --- 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://phpsdk.peterpy.cn"; $tid = getenv('TRAVIS_JOB_NUMBER'); if (!empty($tid)) { diff --git a/vendor/ralouphie/getallheaders/.gitignore b/vendor/ralouphie/getallheaders/.gitignore deleted file mode 100644 index 1324e7d3..00000000 --- a/vendor/ralouphie/getallheaders/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.idea -.DS_store -/vendor/ -composer.phar -composer.lock diff --git a/vendor/ralouphie/getallheaders/.travis.yml b/vendor/ralouphie/getallheaders/.travis.yml deleted file mode 100644 index f45b55fa..00000000 --- a/vendor/ralouphie/getallheaders/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - -before_script: - - composer install - -script: - - mkdir -p build/logs - - php vendor/bin/phpunit -c phpunit.xml - -after_script: - - php vendor/bin/coveralls -v \ No newline at end of file diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md index f3329d66..9430d76b 100644 --- a/vendor/ralouphie/getallheaders/README.md +++ b/vendor/ralouphie/getallheaders/README.md @@ -14,6 +14,14 @@ This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/f ## Install +For PHP version **`>= 5.6`**: + ``` composer require ralouphie/getallheaders ``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json index 5a0d595c..de8ce62e 100644 --- a/vendor/ralouphie/getallheaders/composer.json +++ b/vendor/ralouphie/getallheaders/composer.json @@ -9,13 +9,18 @@ } ], "require": { - "php": ">=5.3" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~3.7.0", - "satooshi/php-coveralls": ">=1.0" + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" }, "autoload": { "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } } -} \ No newline at end of file +} diff --git a/vendor/ralouphie/getallheaders/phpunit.xml b/vendor/ralouphie/getallheaders/phpunit.xml deleted file mode 100644 index 7255b23d..00000000 --- a/vendor/ralouphie/getallheaders/phpunit.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - ./tests - - - - - src - - - - - - - - \ No newline at end of file diff --git a/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php b/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php deleted file mode 100644 index 8e3d1790..00000000 --- a/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php +++ /dev/null @@ -1,121 +0,0 @@ - $val) { - $_SERVER[$key] = $val; - } - $result = getallheaders(); - $this->assertEquals($expected, $result, "Error testing $test_type works."); - } - - public function testWorksData() - { - return array( - array( - 'normal case', - array( - 'Key-One' => 'foo', - 'Key-Two' => 'bar', - 'Another-Key-For-Testing' => 'baz' - ), - array( - 'HTTP_KEY_ONE' => 'foo', - 'HTTP_KEY_TWO' => 'bar', - 'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz' - ) - ), - array( - 'Content-Type', - array( - 'Content-Type' => 'two' - ), - array( - 'HTTP_CONTENT_TYPE' => 'one', - 'CONTENT_TYPE' => 'two' - ) - ), - array( - 'Content-Length', - array( - 'Content-Length' => '222' - ), - array( - 'CONTENT_LENGTH' => '222', - 'HTTP_CONTENT_LENGTH' => '111' - ) - ), - array( - 'Content-Length (HTTP_CONTENT_LENGTH only)', - array( - 'Content-Length' => '111' - ), - array( - 'HTTP_CONTENT_LENGTH' => '111' - ) - ), - array( - 'Content-MD5', - array( - 'Content-Md5' => 'aef123' - ), - array( - 'CONTENT_MD5' => 'aef123', - 'HTTP_CONTENT_MD5' => 'fea321' - ) - ), - array( - 'Content-MD5 (HTTP_CONTENT_MD5 only)', - array( - 'Content-Md5' => 'f123' - ), - array( - 'HTTP_CONTENT_MD5' => 'f123' - ) - ), - array( - 'Authorization (normal)', - array( - 'Authorization' => 'testing' - ), - array( - 'HTTP_AUTHORIZATION' => 'testing', - ) - ), - array( - 'Authorization (redirect)', - array( - 'Authorization' => 'testing redirect' - ), - array( - 'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect', - ) - ), - array( - 'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)', - array( - 'Authorization' => 'Basic ' . base64_encode('foo:bar') - ), - array( - 'PHP_AUTH_USER' => 'foo', - 'PHP_AUTH_PW' => 'bar' - ) - ), - array( - 'Authorization (PHP_AUTH_DIGEST)', - array( - 'Authorization' => 'example-digest' - ), - array( - 'PHP_AUTH_DIGEST' => 'example-digest' - ) - ) - ); - } -}