This commit is contained in:
toogee 2020-01-07 14:29:33 +08:00
parent c0b2b29a61
commit 03063bc9c1
17 changed files with 80 additions and 102 deletions

18
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.62", "version": "1.0.63",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0" "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8132daec326565036bc8e8d1876f77ec183a7bd6",
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0", "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -94,7 +94,7 @@
"sftp", "sftp",
"storage" "storage"
], ],
"time": "2019-12-29T14:46:55+00:00" "time": "2020-01-04T16:30:31+00:00"
}, },
{ {
"name": "league/flysystem-cached-adapter", "name": "league/flysystem-cached-adapter",
@ -722,12 +722,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "444277e2acff186a8066a8a42912ebea01d948c5" "reference": "9caecd97608c937059fc09550b41af2557471d35"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/444277e2acff186a8066a8a42912ebea01d948c5", "url": "https://api.github.com/repos/top-think/think-orm/zipball/9caecd97608c937059fc09550b41af2557471d35",
"reference": "444277e2acff186a8066a8a42912ebea01d948c5", "reference": "9caecd97608c937059fc09550b41af2557471d35",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -765,7 +765,7 @@
"database", "database",
"orm" "orm"
], ],
"time": "2019-12-28T13:25:27+00:00" "time": "2020-01-04T04:00:06+00:00"
}, },
{ {
"name": "topthink/think-template", "name": "topthink/think-template",

View File

@ -1,63 +0,0 @@
<?php
use think\facade\Env;
return [
// 默认使用的数据库连接配置
'default' => Env::get('database.driver', 'mysql'),
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
// true为自动识别类型 false关闭
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
// 数据库类型
'type' => Env::get('database.type', 'mysql'),
// 服务器地址
'hostname' => Env::get('database.hostname', '127.0.0.1'),
// 数据库名
'database' => Env::get('database.database', ''),
// 用户名
'username' => Env::get('database.username', 'root'),
// 密码
'password' => Env::get('database.password', ''),
// 端口
'hostport' => Env::get('database.hostport', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => Env::get('database.charset', 'utf8'),
// 数据库表前缀
'prefix' => Env::get('database.prefix', ''),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL
'trigger_sql' => true,
// 开启字段缓存
'fields_cache' => false,
// 字段缓存路径
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
],
// 更多的数据库配置信息
],
];

View File

@ -7,7 +7,7 @@ return [
// 模板引擎类型使用Think // 模板引擎类型使用Think
'type' => 'Think', 'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 3, 'auto_rule' => 2,
// 模板目录名 // 模板目录名
'view_dir_name' => 'view', 'view_dir_name' => 'view',
// 模板后缀 // 模板后缀

View File

@ -1,17 +1,17 @@
[ [
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.62", "version": "1.0.63",
"version_normalized": "1.0.62.0", "version_normalized": "1.0.63.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0" "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8132daec326565036bc8e8d1876f77ec183a7bd6",
"reference": "14dd5d7dff5fbc29ca9a2a53ff109760e40d91a0", "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -47,7 +47,7 @@
"spatie/flysystem-dropbox": "Allows you to use Dropbox storage", "spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
"srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
}, },
"time": "2019-12-29T14:46:55+00:00", "time": "2020-01-04T16:30:31+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -954,12 +954,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-orm.git", "url": "https://github.com/top-think/think-orm.git",
"reference": "a343dbb39fc51a09e78a68e7968dc8e8060c4a66" "reference": "9caecd97608c937059fc09550b41af2557471d35"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/a343dbb39fc51a09e78a68e7968dc8e8060c4a66", "url": "https://api.github.com/repos/top-think/think-orm/zipball/9caecd97608c937059fc09550b41af2557471d35",
"reference": "a343dbb39fc51a09e78a68e7968dc8e8060c4a66", "reference": "9caecd97608c937059fc09550b41af2557471d35",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -975,7 +975,7 @@
"psr/simple-cache": "^1.0", "psr/simple-cache": "^1.0",
"topthink/think-helper": "^3.1" "topthink/think-helper": "^3.1"
}, },
"time": "2020-01-01T12:36:51+00:00", "time": "2020-01-04T04:00:06+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -557,6 +557,10 @@ abstract class AbstractFtpAdapter extends AbstractAdapter
*/ */
protected function normalizePermissions($permissions) protected function normalizePermissions($permissions)
{ {
if (is_numeric($permissions)) {
return $permissions & 0777;
}
// remove the type identifier // remove the type identifier
$permissions = substr($permissions, 1); $permissions = substr($permissions, 1);

View File

@ -6,9 +6,11 @@ use ErrorException;
use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait; use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait;
use League\Flysystem\AdapterInterface; use League\Flysystem\AdapterInterface;
use League\Flysystem\Config; use League\Flysystem\Config;
use League\Flysystem\ConnectionErrorException;
use League\Flysystem\ConnectionRuntimeException;
use League\Flysystem\InvalidRootException;
use League\Flysystem\Util; use League\Flysystem\Util;
use League\Flysystem\Util\MimeType; use League\Flysystem\Util\MimeType;
use RuntimeException;
class Ftp extends AbstractFtpAdapter class Ftp extends AbstractFtpAdapter
{ {
@ -135,7 +137,7 @@ class Ftp extends AbstractFtpAdapter
} }
if ( ! $this->connection) { if ( ! $this->connection) {
throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); throw new ConnectionRuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort());
} }
$this->login(); $this->login();
@ -153,7 +155,7 @@ class Ftp extends AbstractFtpAdapter
if ($this->utf8) { if ($this->utf8) {
$response = ftp_raw($this->connection, "OPTS UTF8 ON"); $response = ftp_raw($this->connection, "OPTS UTF8 ON");
if (substr($response[0], 0, 3) !== '200') { if (substr($response[0], 0, 3) !== '200') {
throw new RuntimeException( throw new ConnectionRuntimeException(
'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort()
); );
} }
@ -163,7 +165,7 @@ class Ftp extends AbstractFtpAdapter
/** /**
* Set the connections to passive mode. * Set the connections to passive mode.
* *
* @throws RuntimeException * @throws ConnectionRuntimeException
*/ */
protected function setConnectionPassiveMode() protected function setConnectionPassiveMode()
{ {
@ -172,7 +174,7 @@ class Ftp extends AbstractFtpAdapter
} }
if ( ! ftp_pasv($this->connection, $this->passive)) { if ( ! ftp_pasv($this->connection, $this->passive)) {
throw new RuntimeException( throw new ConnectionRuntimeException(
'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort()
); );
} }
@ -187,7 +189,7 @@ class Ftp extends AbstractFtpAdapter
$connection = $this->connection; $connection = $this->connection;
if ($root && ! ftp_chdir($connection, $root)) { if ($root && ! ftp_chdir($connection, $root)) {
throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); throw new InvalidRootException('Root is invalid or does not exist: ' . $this->getRoot());
} }
// Store absolute path for further reference. // Store absolute path for further reference.
@ -200,7 +202,7 @@ class Ftp extends AbstractFtpAdapter
/** /**
* Login. * Login.
* *
* @throws RuntimeException * @throws ConnectionRuntimeException
*/ */
protected function login() protected function login()
{ {
@ -215,7 +217,7 @@ class Ftp extends AbstractFtpAdapter
if ( ! $isLoggedIn) { if ( ! $isLoggedIn) {
$this->disconnect(); $this->disconnect();
throw new RuntimeException( throw new ConnectionRuntimeException(
'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort(
) . ', username: ' . $this->getUsername() ) . ', username: ' . $this->getUsername()
); );
@ -526,7 +528,7 @@ class Ftp extends AbstractFtpAdapter
* *
* @return bool * @return bool
* *
* @throws ErrorException * @throws ConnectionErrorException
*/ */
public function isConnected() public function isConnected()
{ {
@ -534,7 +536,7 @@ class Ftp extends AbstractFtpAdapter
return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false; return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false;
} catch (ErrorException $e) { } catch (ErrorException $e) {
if (strpos($e->getMessage(), 'ftp_rawlist') === false) { if (strpos($e->getMessage(), 'ftp_rawlist') === false) {
throw $e; throw new ConnectionErrorException($e->getMessage());
} }
return false; return false;

View File

@ -0,0 +1,9 @@
<?php
namespace League\Flysystem;
use ErrorException;
class ConnectionErrorException extends ErrorException implements FilesystemException
{
}

View File

@ -0,0 +1,9 @@
<?php
namespace League\Flysystem;
use RuntimeException;
class ConnectionRuntimeException extends RuntimeException implements FilesystemException
{
}

View File

@ -2,7 +2,7 @@
namespace League\Flysystem; namespace League\Flysystem;
class Exception extends \Exception class Exception extends \Exception implements FilesystemException
{ {
// //
} }

View File

@ -0,0 +1,7 @@
<?php
namespace League\Flysystem;
interface FilesystemException
{
}

View File

@ -7,6 +7,6 @@ use LogicException;
/** /**
* Thrown when the MountManager cannot find a filesystem. * Thrown when the MountManager cannot find a filesystem.
*/ */
class FilesystemNotFoundException extends LogicException class FilesystemNotFoundException extends LogicException implements FilesystemException
{ {
} }

View File

@ -0,0 +1,9 @@
<?php
namespace League\Flysystem;
use RuntimeException;
class InvalidRootException extends RuntimeException implements FilesystemException
{
}

View File

@ -5,7 +5,7 @@ namespace League\Flysystem;
use RuntimeException; use RuntimeException;
use SplFileInfo; use SplFileInfo;
class NotSupportedException extends RuntimeException class NotSupportedException extends RuntimeException implements FilesystemException
{ {
/** /**
* Create a new exception for a link. * Create a new exception for a link.

View File

@ -4,7 +4,7 @@ namespace League\Flysystem;
use LogicException; use LogicException;
class RootViolationException extends LogicException class RootViolationException extends LogicException implements FilesystemException
{ {
// //
} }

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-01-02 11:24:44 // This file is automatically generated at:2020-01-07 14:28:37
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\captcha\\CaptchaService', 0 => 'think\\captcha\\CaptchaService',

View File

@ -906,7 +906,8 @@ abstract class PDOConnection extends Connection implements ConnectionInterface
return 0; return 0;
} }
$query->parseOptions(); $options = $query->parseOptions();
$replace = !empty($options['replace']);
if (0 === $limit && count($dataSet) >= 5000) { if (0 === $limit && count($dataSet) >= 5000) {
$limit = 1000; $limit = 1000;
@ -921,7 +922,7 @@ abstract class PDOConnection extends Connection implements ConnectionInterface
$count = 0; $count = 0;
foreach ($array as $item) { foreach ($array as $item) {
$sql = $this->builder->insertAll($query, $item); $sql = $this->builder->insertAll($query, $item, $replace);
$count += $this->execute($query, $sql, $query->getBind()); $count += $this->execute($query, $sql, $query->getBind());
} }
@ -935,7 +936,7 @@ abstract class PDOConnection extends Connection implements ConnectionInterface
return $count; return $count;
} }
$sql = $this->builder->insertAll($query, $dataSet); $sql = $this->builder->insertAll($query, $dataSet, $replace);
return $this->execute($query, $sql, $query->getBind()); return $this->execute($query, $sql, $query->getBind());
} }

View File

@ -424,7 +424,7 @@ trait Attribute
break; break;
case 'datetime': case 'datetime':
$value = is_numeric($value) ? $value : strtotime($value); $value = is_numeric($value) ? $value : strtotime($value);
$value = $this->formatDateTime('Y-m-d H:i:s.u', $value); $value = $this->formatDateTime('Y-m-d H:i:s.u', $value, true);
break; break;
case 'object': case 'object':
if (is_object($value)) { if (is_object($value)) {