ComposerUpdate

This commit is contained in:
Anyon 2020-06-01 16:24:23 +08:00
parent e50922ecf6
commit 24757017e4
6 changed files with 65 additions and 21 deletions

View File

@ -30,9 +30,8 @@ class Update extends Controller
*/ */
public function get() public function get()
{ {
$this->file = $this->app->getRootPath() . decode(input('encode', '0')); if (file_exists($file = $this->app->getRootPath() . decode(input('encode', '0')))) {
if (file_exists($this->file)) { $this->success('读取文件成功!', ['content' => base64_encode(file_get_contents($file))]);
$this->success('读取文件成功!', ['content' => base64_encode(file_get_contents($this->file))]);
} else { } else {
$this->error('读取文件内容失败!'); $this->error('读取文件内容失败!');
} }
@ -43,9 +42,10 @@ class Update extends Controller
*/ */
public function tree() public function tree()
{ {
$this->rules = unserialize($this->request->post('rules', 'a:0:{}', '')); $this->success('获取文件列表成功!', InstallService::instance()->getList(
$this->ignore = unserialize($this->request->post('ignore', 'a:0:{}', '')); unserialize($this->request->post('rules', 'a:0:{}', '')),
$this->success('获取文件列表成功!', InstallService::instance()->getList($this->rules, $this->ignore)); unserialize($this->request->post('ignore', 'a:0:{}', ''))
));
} }
} }

View File

@ -108,7 +108,7 @@ class Upload extends Controller
$local = LocalStorage::instance(); $local = LocalStorage::instance();
$realpath = dirname($realname = $local->path($this->name, $this->safe)); $realpath = dirname($realname = $local->path($this->name, $this->safe));
file_exists($realpath) && is_dir($realpath) || mkdir($realpath, 0755, true); 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()); $info = $local->info($this->name, $this->safe, $file->getOriginalName());
} else { } else {
$bina = file_get_contents($file->getRealPath()); $bina = file_get_contents($file->getRealPath());

24
composer.lock generated
View File

@ -504,16 +504,16 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.4.40", "version": "v3.4.41",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "79701529391f802604ec92080364d617f029974b" "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/79701529391f802604ec92080364d617f029974b", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd",
"reference": "79701529391f802604ec92080364d617f029974b", "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -560,7 +560,21 @@
"configuration", "configuration",
"options" "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", "name": "topthink/framework",

View File

@ -513,17 +513,17 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.4.40", "version": "v3.4.41",
"version_normalized": "3.4.40.0", "version_normalized": "3.4.41.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "79701529391f802604ec92080364d617f029974b" "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/79701529391f802604ec92080364d617f029974b", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3b9fe6db7fe3694307d182dd73983584af77d5fd",
"reference": "79701529391f802604ec92080364d617f029974b", "reference": "3b9fe6db7fe3694307d182dd73983584af77d5fd",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -535,7 +535,7 @@
"require": { "require": {
"php": "^5.5.9|>=7.0.8" "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", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -571,6 +571,20 @@
"config", "config",
"configuration", "configuration",
"options" "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"
}
] ]
}, },
{ {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-05-29 11:47:46 // This file is automatically generated at:2020-06-01 16:22:21
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -146,7 +146,7 @@ class OptionsResolver implements Options
$reflClosure = new \ReflectionFunction($value); $reflClosure = new \ReflectionFunction($value);
$params = $reflClosure->getParameters(); $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 // Initialize the option if no previous value exists
if (!isset($this->defaults[$option])) { if (!isset($this->defaults[$option])) {
$this->defaults[$option] = null; $this->defaults[$option] = null;
@ -1066,4 +1066,20 @@ class OptionsResolver implements Options
{ {
return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; 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;
}
} }