From 24757017e41360f23cd9050acfa428600d29325c Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 1 Jun 2020 16:24:23 +0800 Subject: [PATCH] ComposerUpdate --- app/admin/controller/api/Update.php | 14 +++++----- app/admin/controller/api/Upload.php | 2 +- composer.lock | 24 +++++++++++++---- vendor/composer/installed.json | 26 ++++++++++++++----- vendor/services.php | 2 +- .../options-resolver/OptionsResolver.php | 18 ++++++++++++- 6 files changed, 65 insertions(+), 21 deletions(-) diff --git a/app/admin/controller/api/Update.php b/app/admin/controller/api/Update.php index da7853d90..b415231bf 100644 --- a/app/admin/controller/api/Update.php +++ b/app/admin/controller/api/Update.php @@ -30,9 +30,8 @@ class Update extends Controller */ public function get() { - $this->file = $this->app->getRootPath() . decode(input('encode', '0')); - if (file_exists($this->file)) { - $this->success('读取文件成功!', ['content' => base64_encode(file_get_contents($this->file))]); + if (file_exists($file = $this->app->getRootPath() . decode(input('encode', '0')))) { + $this->success('读取文件成功!', ['content' => base64_encode(file_get_contents($file))]); } else { $this->error('读取文件内容失败!'); } @@ -43,9 +42,10 @@ class Update extends Controller */ public function tree() { - $this->rules = unserialize($this->request->post('rules', 'a:0:{}', '')); - $this->ignore = unserialize($this->request->post('ignore', 'a:0:{}', '')); - $this->success('获取文件列表成功!', InstallService::instance()->getList($this->rules, $this->ignore)); + $this->success('获取文件列表成功!', InstallService::instance()->getList( + unserialize($this->request->post('rules', 'a:0:{}', '')), + unserialize($this->request->post('ignore', 'a:0:{}', '')) + )); } -} +} \ No newline at end of file diff --git a/app/admin/controller/api/Upload.php b/app/admin/controller/api/Upload.php index c454fdf7a..082c00dfd 100644 --- a/app/admin/controller/api/Upload.php +++ b/app/admin/controller/api/Upload.php @@ -108,7 +108,7 @@ class Upload extends Controller $local = LocalStorage::instance(); $realpath = dirname($realname = $local->path($this->name, $this->safe)); file_exists($realpath) && is_dir($realpath) || mkdir($realpath, 0755, true); - rename($file->getPathname(), $realname); + @rename($file->getPathname(), $realname); $info = $local->info($this->name, $this->safe, $file->getOriginalName()); } else { $bina = file_get_contents($file->getRealPath()); diff --git a/composer.lock b/composer.lock index 091559c10..4d669437b 100644 --- a/composer.lock +++ b/composer.lock @@ -504,16 +504,16 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.40", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "79701529391f802604ec92080364d617f029974b" + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/79701529391f802604ec92080364d617f029974b", - "reference": "79701529391f802604ec92080364d617f029974b", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd", + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd", "shasum": "", "mirrors": [ { @@ -560,7 +560,21 @@ "configuration", "options" ], - "time": "2020-04-06T08:30:32+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-05-21T13:02:25+00:00" }, { "name": "topthink/framework", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 708a006aa..2993c9173 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -513,17 +513,17 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.40", - "version_normalized": "3.4.40.0", + "version": "v3.4.41", + "version_normalized": "3.4.41.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "79701529391f802604ec92080364d617f029974b" + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/79701529391f802604ec92080364d617f029974b", - "reference": "79701529391f802604ec92080364d617f029974b", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd", + "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd", "shasum": "", "mirrors": [ { @@ -535,7 +535,7 @@ "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2020-04-06T08:30:32+00:00", + "time": "2020-05-21T13:02:25+00:00", "type": "library", "extra": { "branch-alias": { @@ -571,6 +571,20 @@ "config", "configuration", "options" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ] }, { diff --git a/vendor/services.php b/vendor/services.php index d9aabe57b..ffc2ad644 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/symfony/options-resolver/OptionsResolver.php b/vendor/symfony/options-resolver/OptionsResolver.php index fd8a603fe..7354caf8a 100644 --- a/vendor/symfony/options-resolver/OptionsResolver.php +++ b/vendor/symfony/options-resolver/OptionsResolver.php @@ -146,7 +146,7 @@ class OptionsResolver implements Options $reflClosure = new \ReflectionFunction($value); $params = $reflClosure->getParameters(); - if (isset($params[0]) && null !== ($class = $params[0]->getClass()) && Options::class === $class->name) { + if (isset($params[0]) && Options::class === $this->getParameterClassName($params[0])) { // Initialize the option if no previous value exists if (!isset($this->defaults[$option])) { $this->defaults[$option] = null; @@ -1066,4 +1066,20 @@ class OptionsResolver implements Options { return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; } + + /** + * @return string|null + */ + private function getParameterClassName(\ReflectionParameter $parameter) + { + if (!method_exists($parameter, 'getType')) { + return ($class = $parameter->getClass()) ? $class->name : null; + } + + if (!($type = $parameter->getType()) || $type->isBuiltin()) { + return null; + } + + return method_exists($type, 'getName') ? $type->getName() : (string) $type; + } }