Composer Update

This commit is contained in:
邹景立 2021-06-22 17:06:31 +08:00
parent 6e2a989be5
commit 866d6e2173
250 changed files with 7195 additions and 2346 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,218 @@
@charset "UTF-8";body,html{height:100%;display:block}body{background:url(../img/login/bg1.jpg) no-repeat center center;background-size:cover}.login-container{height:100%}.login-container .header{top:0;left:0;width:100%;height:47px;position:absolute;text-shadow:#000 .1em .1em .1em}.login-container .header .title{color:#fff;float:left;font-size:18px;line-height:47px;text-indent:40px;letter-spacing:1px}.login-container .header a,.login-container .header a:focus,.login-container .header a:hover{color:#fff;letter-spacing:1px;text-decoration:none}.login-container .header ul{float:right}.login-container .header ul li{float:left;line-height:47px;margin-left:10px}.login-container form{top:50%;left:50%;width:300px;position:absolute;margin-top:-250px;margin-left:-150px}.login-container form h2{color:#fff;padding:20px 0;font-size:25px;text-align:center;font-weight:700;letter-spacing:3px;text-shadow:#000 .05em .05em .05em}.login-container form ul li{position:relative;margin-top:20px;text-shadow:#000 .1em .1em .1em}.login-container form ul li.verify label{width:200px}.login-container form ul li.verify input.layui-input{text-transform:uppercase}.login-container form ul li.verify img{width:95px;height:44px;cursor:pointer;position:absolute;margin-left:5px;border-radius:5px;box-shadow:0 2px 5px 0 rgba(0,0,0,.1)}.login-container form ul li i.layui-icon{color:#fff;font-size:18px;position:absolute;padding:14px 15px 13px 20px}.login-container form ul li input{color:#fff;height:45px;padding:0 15px;font-size:14px;line-height:1em;text-indent:35px;border-radius:6px;letter-spacing:1px;background:rgba(0,0,0,.12);text-shadow:#000 .1em .1em .1em;-webkit-text-fill-color:#fff!important;box-shadow:0 2px 3px 0 rgba(0,0,0,.3) inset!important}.login-container form ul li input:-webkit-autofill,.login-container form ul li input:-webkit-autofill:active,.login-container form ul li input:-webkit-autofill:focus,.login-container form ul li input:-webkit-autofill:hover,.login-container form ul li input:active,.login-container form ul li input:focus,.login-container form ul li input:hover{text-shadow:#000 .1em .1em .1em;box-shadow:0 2px 3px 0 rgba(0,0,0,.3) inset!important;-webkit-text-fill-color:#fff!important;-webkit-transition-delay:9999s!important;-webkit-transition:color 9999s ease-out,background-color 9999s ease-out!important}.login-container form ul li span{letter-spacing:1px;color:#ff0!important}.login-container form ul li button{color:#333!important;height:45px!important;background:#fff!important;border-radius:4px!important;letter-spacing:1px!important;box-shadow:0 15px 30px 0 hsla(0,0%,100%,.25) inset,0 2px 7px 0 rgba(0,0,0,.2)}.login-container .footer{left:0;bottom:0;color:#fff;width:100%;position:absolute;text-align:center;line-height:30px;padding-bottom:10px;text-shadow:#000 .1em .1em .1em}.login-container .footer a,.login-container .footer span{color:#fff}.login-container .footer a:hover{color:#ccc}#supersized{top:0;left:0;width:100%;height:100%;z-index:-999;display:block;position:fixed;overflow:hidden}#supersized img{border:0;width:auto;height:auto;display:none;outline:0;position:relative;max-width:none!important}#supersized.speed img{image-rendering:-moz-crisp-edges;-ms-interpolation-mode:nearest-neighbor}#supersized.quality img{image-rendering:optimizeQuality;-ms-interpolation-mode:bicubic}#supersized a,#supersized li{width:100%;height:100%;display:block;cursor:default}#supersized li{top:0;left:0;z-index:-30;position:fixed;overflow:hidden;list-style:none}#supersized li.prevslide{z-index:-20}#supersized li.prevslide img{display:inline}#supersized li.activeslide{z-index:-10}#supersized li.activeslide img{display:inline}#supersized li.image-loading{width:100%;height:100%;background:url(../../plugs/supersized/progress.gif) no-repeat center center}#supersized li.image-loading img{visibility:hidden}#supersized-loader{top:50%;left:50%;z-index:0;width:60px;height:60px;position:absolute;text-indent:-999em;margin:-30px 0 0 -30px;background:url(../../plugs/supersized/progress.gif) no-repeat center center}/*# sourceMappingURL=login.css.map */
@charset "UTF-8";
body,
html {
height: 100%;
display: block;
}
body {
background: url("../img/login/bg1.jpg") no-repeat center center;
background-size: cover;
}
.login-container {
height: 100%;
}
.login-container .header {
top: 0;
left: 0;
width: 100%;
height: 47px;
position: absolute;
text-shadow: #000 0.1em 0.1em 0.1em;
}
.login-container .header .title {
color: #fff;
float: left;
font-size: 18px;
line-height: 47px;
text-indent: 40px;
letter-spacing: 1px;
}
.login-container .header a,
.login-container .header a:focus,
.login-container .header a:hover {
color: #fff;
letter-spacing: 1px;
text-decoration: none;
}
.login-container .header ul {
float: right;
}
.login-container .header ul li {
float: left;
line-height: 47px;
margin-left: 10px;
}
.login-container form {
top: 50%;
left: 50%;
width: 300px;
position: absolute;
margin-top: -250px;
margin-left: -150px;
}
.login-container form h2 {
color: #fff;
padding: 20px 0;
font-size: 25px;
text-align: center;
font-weight: 700;
letter-spacing: 3px;
text-shadow: #000 0.05em 0.05em 0.05em;
}
.login-container form ul li {
position: relative;
margin-top: 20px;
text-shadow: #000 0.1em 0.1em 0.1em;
}
.login-container form ul li.verify label {
width: 200px;
}
.login-container form ul li.verify input.layui-input {
text-transform: uppercase;
}
.login-container form ul li.verify img {
width: 95px;
height: 44px;
cursor: pointer;
position: absolute;
margin-left: 5px;
border-radius: 5px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
}
.login-container form ul li i.layui-icon {
color: #fff;
font-size: 18px;
position: absolute;
padding: 14px 15px 13px 20px;
}
.login-container form ul li input {
color: #fff;
height: 45px;
padding: 0 15px;
font-size: 14px;
line-height: 1em;
text-indent: 35px;
border-radius: 6px;
letter-spacing: 1px;
background: rgba(0, 0, 0, 0.12);
text-shadow: #000 0.1em 0.1em 0.1em;
-webkit-text-fill-color: #fff !important;
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3) inset !important;
}
.login-container form ul li input:hover,
.login-container form ul li input:focus,
.login-container form ul li input:active,
.login-container form ul li input:-webkit-autofill,
.login-container form ul li input:-webkit-autofill:hover,
.login-container form ul li input:-webkit-autofill:focus,
.login-container form ul li input:-webkit-autofill:active {
text-shadow: #000 0.1em 0.1em 0.1em;
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3) inset !important;
-webkit-text-fill-color: #fff !important;
-webkit-transition-delay: 9999s !important;
-webkit-transition: color 9999s ease-out, background-color 9999s ease-out !important;
}
.login-container form ul li span {
letter-spacing: 1px;
color: #ff0 !important;
}
.login-container form ul li button {
color: #333 !important;
height: 45px !important;
background: #fff !important;
border-radius: 4px !important;
letter-spacing: 1px !important;
box-shadow: 0 15px 30px 0 hsla(0, 0%, 100%, 0.25) inset, 0 2px 7px 0 rgba(0, 0, 0, 0.2);
}
.login-container .footer {
left: 0;
bottom: 0;
color: #fff;
width: 100%;
position: absolute;
text-align: center;
line-height: 30px;
padding-bottom: 10px;
text-shadow: #000 0.1em 0.1em 0.1em;
}
.login-container .footer a,
.login-container .footer span {
color: #fff;
}
.login-container .footer a:hover {
color: #ccc;
}
#supersized {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -999;
display: block;
position: fixed;
overflow: hidden;
}
#supersized img {
border: 0;
width: auto;
height: auto;
display: none;
outline: 0;
position: relative;
max-width: none !important;
}
#supersized.speed img {
image-rendering: -moz-crisp-edges;
-ms-interpolation-mode: nearest-neighbor;
}
#supersized.quality img {
image-rendering: optimizeQuality;
-ms-interpolation-mode: bicubic;
}
#supersized a,
#supersized li {
width: 100%;
height: 100%;
display: block;
cursor: default;
}
#supersized li {
top: 0;
left: 0;
z-index: -30;
position: fixed;
overflow: hidden;
list-style: none;
}
#supersized li.prevslide {
z-index: -20;
}
#supersized li.prevslide img {
display: inline;
}
#supersized li.activeslide {
z-index: -10;
}
#supersized li.activeslide img {
display: inline;
}
#supersized li.image-loading {
width: 100%;
height: 100%;
background: url(../../plugs/supersized/progress.gif) no-repeat center center;
}
#supersized li.image-loading img {
visibility: hidden;
}
#supersized-loader {
top: 50%;
left: 50%;
z-index: 0;
width: 60px;
height: 60px;
position: absolute;
text-indent: -999em;
margin: -30px 0 0 -30px;
background: url(../../plugs/supersized/progress.gif) no-repeat center center;
}
/*# sourceMappingURL=login.css.map */

View File

@ -1 +1 @@
{"version":3,"sources":["login.less"],"names":[],"mappings":"iBAeA,KAAM,KACJ,OAAA,KACA,QAAA,MAGF,KACE,WAAgB,0BAAA,UAAA,OAAA,OAChB,gBAAA,MAGF,iBACE,OAAA,KAEA,yBACE,IAAA,EACA,KAAA,EACA,MAAA,KACA,OAAA,KACA,SAAA,SACA,YAAA,KAAA,KAAA,KAAA,KAEA,gCACE,MAAA,KACA,MAAA,KACA,UAAA,KACA,YAAA,KACA,YAAA,KACA,eAAA,IAGF,2BACM,iCAAS,iCACX,MAAA,KACA,eAAA,IACA,gBAAA,KAIJ,4BACE,MAAA,MAEA,+BACE,MAAA,KACA,YAAA,KACA,YAAA,KAKN,sBACE,IAAA,IACA,KAAA,IACA,MAAA,MACA,SAAA,SACA,WAAA,OACA,YAAA,OAEA,yBACE,MAAA,KACA,QAAA,KAAA,EACA,UAAA,KACA,WAAA,OACA,YAAA,IACA,eAAA,IACA,YAAA,KAAA,MAAA,MAAA,MAGC,4BACD,SAAA,SACA,WAAA,KACA,YAAA,KAAA,KAAA,KAAA,KAGE,yCACE,MAAA,MAGG,qDACH,eAAA,UAGF,uCACE,MAAA,KACA,OAAA,KACA,OAAA,QACA,SAAA,SACA,YAAA,IACA,cAAA,IACA,WAAA,EAAA,IAAA,IAAA,EAAA,eAIH,yCACC,MAAA,KACA,UAAA,KACA,SAAA,SACA,QAAA,KAAA,KAAA,KAAA,KAGF,kCACE,MAAA,KACA,OAAA,KACA,QAAA,EAAA,KACA,UAAA,KACA,YAAA,IACA,YAAA,KACA,cAAA,IACA,eAAA,IACA,WAAA,gBACA,YAAA,KAAA,KAAA,KAAA,KACA,wBAAA,eACA,WAAA,EAAA,IAAA,IAAA,EAAA,eAAA,gBAGC,mDAC2C,0DAA1B,yDADoB,yDADnB,yCAAT,wCAAT,wCAGC,YAAA,KAAA,KAAA,KAAA,KACA,WAAA,EAAA,IAAA,IAAA,EAAA,eAAA,gBACA,wBAAA,eACA,yBAAA,gBACA,mBAAA,MAAA,MAAA,SAAA,iBAAA,MAAA,mBAIJ,iCACE,eAAA,IACA,MAAA,eAGF,mCACE,MAAA,eACA,OAAA,eACA,WAAA,eACA,cAAA,cACA,eAAA,cACA,WAAA,EAAA,KAAA,KAAA,EAAA,oBAAA,MAAA,EAAA,IAAA,IAAA,EAAA,eAKN,yBACE,KAAA,EACA,OAAA,EACA,MAAA,KACA,MAAA,KACA,SAAA,SACA,WAAA,OACA,YAAA,KACA,eAAA,KACA,YAAA,KAAA,KAAA,KAAA,KAEA,2BAAG,8BACD,MAAA,KAGD,iCACC,MAAA,KAKN,YACE,IAAA,EACA,KAAA,EACA,MAAA,KACA,OAAA,KACA,QAAA,KACA,QAAA,MACA,SAAA,MACA,SAAA,OAEA,gBACE,OAAA,EACA,MAAA,KACA,OAAA,KACA,QAAA,KACA,QAAA,EACA,SAAA,SACA,UAAA,eAGM,sBACN,gBAAA,iBACA,uBAAA,iBAGQ,wBACR,gBAAA,gBACA,uBAAA,QAGF,cAAG,eACD,MAAA,KACA,OAAA,KACA,QAAA,MACA,OAAA,QAGF,eACE,IAAA,EACA,KAAA,EACA,QAAA,IACA,SAAA,MACA,SAAA,OACA,WAAA,KAEC,yBACC,QAAA,IAEA,6BACE,QAAA,OAIH,2BACC,QAAA,IAEA,+BACE,QAAA,OAIH,6BACC,MAAA,KACA,OAAA,KACA,WAAA,yCAAA,UAAA,OAAA,OAEA,iCACE,WAAA,OAMR,mBACE,IAAA,IACA,KAAA,IACA,QAAA,EACA,MAAA,KACA,OAAA,KACA,SAAA,SACA,YAAA,OACA,OAAA,MAAA,EAAA,EAAA,MACA,WAAA,yCAAA,UAAA,OAAA"}
{"version":3,"sources":["login.less"],"names":[],"mappings":"AAAA,SAAS;AAeT;AAAM;EACJ,YAAA;EACA,cAAA;;AAGF;EACE,gBAAgB,+CAAhB;EACA,sBAAA;;AAGF;EACE,YAAA;;AADF,gBAGE;EACE,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,mCAAA;;AATJ,gBAGE,QAQE;EACE,WAAA;EACA,WAAA;EACA,eAAA;EACA,iBAAA;EACA,iBAAA;EACA,mBAAA;;AAIA,gBAlBJ,QAiBE;AACK,gBAlBP,QAiBE,EACM;AAAQ,gBAlBhB,QAiBE,EACe;EACX,WAAA;EACA,mBAAA;EACA,qBAAA;;AAxBR,gBAGE,QAyBE;EACE,YAAA;;AA7BN,gBAGE,QAyBE,GAGE;EACE,WAAA;EACA,iBAAA;EACA,iBAAA;;AAlCR,gBAuCE;EACE,QAAA;EACA,SAAA;EACA,YAAA;EACA,kBAAA;EACA,kBAAA;EACA,mBAAA;;AA7CJ,gBAuCE,KAQE;EACE,WAAA;EACA,eAAA;EACA,eAAA;EACA,kBAAA;EACA,gBAAA;EACA,mBAAA;EACA,sCAAA;;AAtDN,gBAuCE,KAkBE,GAAG;EACD,kBAAA;EACA,gBAAA;EACA,mCAAA;;AAEA,gBAvBJ,KAkBE,GAAG,GAKA,OACC;EACE,YAAA;;AAFJ,gBAvBJ,KAkBE,GAAG,GAKA,OAKC,MAAK;EACH,yBAAA;;AANJ,gBAvBJ,KAkBE,GAAG,GAKA,OASC;EACE,WAAA;EACA,YAAA;EACA,eAAA;EACA,kBAAA;EACA,gBAAA;EACA,kBAAA;EACA,0CAAA;;AA9EV,gBAuCE,KAkBE,GAAG,GAyBD,EAAC;EACC,WAAA;EACA,eAAA;EACA,kBAAA;EACA,4BAAA;;AAtFR,gBAuCE,KAkBE,GAAG,GAgCD;EACE,WAAA;EACA,YAAA;EACA,eAAA;EACA,eAAA;EACA,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,mBAAA;EACA,+BAAA;EACA,mCAAA;EACA,6BAAA;EACA,gDAAA;;AAEA,gBAhEN,KAkBE,GAAG,GAgCD,MAcG;AAAQ,gBAhEf,KAkBE,GAAG,GAgCD,MAcY;AAAQ,gBAhExB,KAkBE,GAAG,GAgCD,MAcqB;AACnB,gBAjEN,KAkBE,GAAG,GAgCD,MAeG;AAAmB,gBAjE1B,KAkBE,GAAG,GAgCD,MAeuB,iBAAiB;AACtC,gBAlEN,KAkBE,GAAG,GAgCD,MAgBG,iBAAiB;AAAQ,gBAlEhC,KAkBE,GAAG,GAgCD,MAgB6B,iBAAiB;EAC1C,mCAAA;EACA,gDAAA;EACA,6BAAA;EACA,0CAAA;EACA,yEAAA;;AA9GV,gBAuCE,KAkBE,GAAG,GAyDD;EACE,mBAAA;EACA,WAAA;;AApHR,gBAuCE,KAkBE,GAAG,GA8DD;EACE,WAAA;EACA,uBAAA;EACA,gBAAA;EACA,6BAAA;EACA,8BAAA;EACA,uFAAA;;AA7HR,gBAkIE;EACE,OAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,kBAAA;EACA,kBAAA;EACA,iBAAA;EACA,oBAAA;EACA,mCAAA;;AA3IJ,gBAkIE,QAWE;AA7IJ,gBAkIE,QAWK;EACD,WAAA;;AA9IN,gBAkIE,QAeE,EAAC;EACC,WAAA;;AAKN;EACE,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,cAAA;EACA,eAAA;EACA,gBAAA;;AARF,WAUE;EACE,SAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,UAAA;EACA,kBAAA;EACA,eAAA;;AAGF,WAAC,MAAO;EACN,iCAAA;EACA,wCAAA;;AAGF,WAAC,QAAS;EACR,gCAAA;EACA,+BAAA;;AA3BJ,WA8BE;AA9BF,WA8BK;EACD,WAAA;EACA,YAAA;EACA,cAAA;EACA,eAAA;;AAlCJ,WAqCE;EACE,MAAA;EACA,OAAA;EACA,YAAA;EACA,eAAA;EACA,gBAAA;EACA,gBAAA;;AAEA,WARF,GAQG;EACC,YAAA;;AADF,WARF,GAQG,UAGC;EACE,eAAA;;AAIJ,WAhBF,GAgBG;EACC,YAAA;;AADF,WAhBF,GAgBG,YAGC;EACE,eAAA;;AAIJ,WAxBF,GAwBG;EACC,WAAA;EACA,YAAA;EACA,4EAAA;;AAHF,WAxBF,GAwBG,cAKC;EACE,kBAAA;;AAMR;EACE,QAAA;EACA,SAAA;EACA,UAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;EACA,mBAAA;EACA,uBAAA;EACA,4EAAA","file":"login.css"}

View File

@ -35,7 +35,7 @@ ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特
+ 内置控制器扩展类
+ 模型自动验证
> ThinkPHP5.1的运行环境要求PHP5.6+。
> ThinkPHP5.1的运行环境要求PHP5.6+ 兼容PHP8.0
## 安装
@ -70,6 +70,12 @@ composer update topthink/framework
+ [完全开发手册](https://www.kancloud.cn/manual/thinkphp5_1/content)
+ [升级指导](https://www.kancloud.cn/manual/thinkphp5_1/354155)
## 官方服务
+ [应用服务市场](https://market.topthink.com/)
+ [ThinkAPI——统一API服务](https://docs.topthink.com/think-api)
## 命名规范
`ThinkPHP5.1`遵循PSR-2命名规范和PSR-4自动加载规范。

View File

@ -20,7 +20,7 @@ use think\route\Dispatch;
*/
class App extends Container
{
const VERSION = '5.1.39 LTS';
const VERSION = '5.1.41 LTS';
/**
* 当前模块路径
@ -548,12 +548,10 @@ class App extends Container
public function routeInit()
{
// 路由检测
$files = scandir($this->routePath);
foreach ($files as $file) {
if (strpos($file, '.php')) {
$filename = $this->routePath . $file;
// 导入路由配置
$rules = include $filename;
if (is_dir($this->routePath)) {
$files = glob($this->routePath . '*.php');
foreach ($files as $file) {
$rules = include $file;
if (is_array($rules)) {
$this->route->import($rules);
}

View File

@ -400,7 +400,7 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria
*/
public function column($columnKey, $indexKey = null)
{
return array_column($this->items, $columnKey, $indexKey);
return array_column($this->toArray(), $columnKey, $indexKey);
}
/**

View File

@ -461,6 +461,25 @@ class Container implements ArrayAccess, IteratorAggregate, Countable
$type = key($vars) === 0 ? 1 : 0;
$params = $reflect->getParameters();
if (PHP_VERSION > 8.0) {
$args = $this->parseParamsForPHP8($params, $vars, $type);
} else {
$args = $this->parseParams($params, $vars, $type);
}
return $args;
}
/**
* 解析参数
* @access protected
* @param array $params 参数列表
* @param array $vars 参数数据
* @param int $type 参数类别
* @return array
*/
protected function parseParams($params, $vars, $type)
{
foreach ($params as $param) {
$name = $param->getName();
$lowerName = Loader::parseName($name);
@ -480,7 +499,38 @@ class Container implements ArrayAccess, IteratorAggregate, Countable
throw new InvalidArgumentException('method param miss:' . $name);
}
}
return $args;
}
/**
* 解析参数
* @access protected
* @param array $params 参数列表
* @param array $vars 参数数据
* @param int $type 参数类别
* @return array
*/
protected function parseParamsForPHP8($params, $vars, $type)
{
foreach ($params as $param) {
$name = $param->getName();
$lowerName = Loader::parseName($name);
$reflectionType = $param->getType();
if ($reflectionType && $reflectionType->isBuiltin() === false) {
$args[] = $this->getObjectParam($reflectionType->getName(), $vars);
} elseif (1 == $type && !empty($vars)) {
$args[] = array_shift($vars);
} elseif (0 == $type && array_key_exists($name, $vars)) {
$args[] = $vars[$name];
} elseif (0 == $type && array_key_exists($lowerName, $vars)) {
$args[] = $vars[$lowerName];
} elseif ($param->isDefaultValueAvailable()) {
$args[] = $param->getDefaultValue();
} else {
throw new InvalidArgumentException('method param miss:' . $name);
}
}
return $args;
}

View File

@ -18,34 +18,43 @@ use think\db\Query;
* Class Model
* @package think
* @mixin Query
* @method Query where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
* @method Query whereRaw(string $where, array $bind = []) static 表达式查询
* @method Query whereExp(string $field, string $condition, array $bind = []) static 字段表达式查询
* @method Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 条件查询
* @method Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询
* @method Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
* @method Query with(mixed $with) static 关联预载入
* @method Query count(string $field) static Count统计查询
* @method Query min(string $field) static Min统计查询
* @method Query max(string $field) static Max统计查询
* @method Query sum(string $field) static SUM统计查询
* @method Query avg(string $field) static Avg统计查询
* @method Query field(mixed $field, boolean $except = false) static 指定查询字段
* @method Query fieldRaw(string $field, array $bind = []) static 指定查询字段
* @method Query union(mixed $union, boolean $all = false) static UNION查询
* @method Query limit(mixed $offset, integer $length = null) static 查询LIMIT
* @method Query order(mixed $field, string $order = null) static 查询ORDER
* @method Query orderRaw(string $field, array $bind = []) static 查询ORDER
* @method Query cache(mixed $key = null , integer $expire = null) static 设置查询缓存
* @method mixed value(string $field) static 获取某个字段的值
* @method $this scope(string|array $scope) static 查询范围
* @method $this where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
* @method $this whereRaw(string $where, array $bind = [], string $logic = 'AND') static 表达式查询
* @method $this whereExp(string $field, string $condition, array $bind = [], string $logic = 'AND') static 字段表达式查询
* @method $this when(mixed $condition, mixed $query, mixed $otherwise = null) static 条件查询
* @method $this join(mixed $join, mixed $condition = null, string $type = 'INNER', array $bind = []) static JOIN查询
* @method $this view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
* @method $this with(mixed $with, callable $callback = null) static 关联预载入
* @method $this count(string $field = '*') static Count统计查询
* @method $this min(string $field, bool $force = true) static Min统计查询
* @method $this max(string $field, bool $force = true) static Max统计查询
* @method $this sum(string $field) static SUM统计查询
* @method $this avg(string $field) static Avg统计查询
* @method $this field(mixed $field, boolean $except = false, string $tableName = '', string $prefix = '', string $alias = '') static 指定查询字段
* @method $this fieldRaw(string $field) static 指定查询字段
* @method $this union(mixed $union, boolean $all = false) static UNION查询
* @method $this limit(mixed $offset, integer $length = null) static 查询LIMIT
* @method $this order(mixed $field, string $order = null) static 查询ORDER
* @method $this orderRaw(string $field, array $bind = []) static 查询ORDER
* @method $this cache(mixed $key = null , integer|\DateTime $expire = null, string $tag = null) static 设置查询缓存
* @method mixed value(string $field, mixed $default = null) static 获取某个字段的值
* @method array column(string $field, string $key = '') static 获取某个列的值
* @method mixed find(mixed $data = null) static 查询单个记录
* @method mixed select(mixed $data = null) static 查询多个记录
* @method mixed get(mixed $data = null,mixed $with =[],bool $cache= false) static 查询单个记录 支持关联预载入
* @method mixed getOrFail(mixed $data = null,mixed $with =[],bool $cache= false) static 查询单个记录 不存在则抛出异常
* @method mixed findOrEmpty(mixed $data = null,mixed $with =[],bool $cache= false) static 查询单个记录 不存在则返回空模型
* @method mixed all(mixed $data = null,mixed $with =[],bool $cache= false) static 查询多个记录 支持关联预载入
* @method \think\Model withAttr(array $name,\Closure $closure) 动态定义获取器
* @method $this find(mixed $data = null) static 查询单个记录
* @method $this findOrFail(mixed $data = null) 查询单个记录
* @method Collection|$this[] select(mixed $data = null) static 查询多个记录
* @method $this get(mixed $data = null,mixed $with = [],bool $cache = false, bool $failException = false) static 查询单个记录 支持关联预载入
* @method $this getOrFail(mixed $data = null,mixed $with = [],bool $cache = false) static 查询单个记录 不存在则抛出异常
* @method $this findOrEmpty(mixed $data = null) static 查询单个记录 不存在则返回空模型
* @method Collection|$this[] all(mixed $data = null,mixed $with = [],bool $cache = false) static 查询多个记录 支持关联预载入
* @method $this withAttr(array $name,\Closure $closure = null) static 动态定义获取器
* @method $this withJoin(string|array $with, string $joinType = '') static
* @method $this withCount(string|array $relation, bool $subQuery = true) static 关联统计
* @method $this withSum(string|array $relation, string $field, bool $subQuery = true) static 关联SUM统计
* @method $this withMax(string|array $relation, string $field, bool $subQuery = true) static 关联MAX统计
* @method $this withMin(string|array $relation, string $field, bool $subQuery = true) static 关联Min统计
* @method $this withAvg(string|array $relation, string $field, bool $subQuery = true) static 关联Avg统计
* @method Paginator|$this paginate() static 分页
*/
abstract class Model implements \JsonSerializable, \ArrayAccess
{

View File

@ -1800,7 +1800,7 @@ class Request
public function host($strict = false)
{
if (!$this->host) {
$this->host = $this->server('HTTP_X_REAL_HOST') ?: $this->server('HTTP_HOST');
$this->host = $this->server('HTTP_X_REAL_HOST') ?: $this->server('HTTP_X_FORWARDED_HOST') ?: $this->server('HTTP_HOST');
}
return true === $strict && strpos($this->host, ':') ? strstr($this->host, ':', true) : $this->host;

View File

@ -13,9 +13,11 @@ namespace think;
use think\exception\RouteNotFoundException;
use think\route\AliasRule;
use think\route\Dispatch;
use think\route\dispatch\Url as UrlDispatch;
use think\route\Domain;
use think\route\Resource;
use think\route\Rule;
use think\route\RuleGroup;
use think\route\RuleItem;

View File

@ -408,6 +408,7 @@ class Validate
foreach ($this->append as $key => $rule) {
if (!isset($rules[$key])) {
$rules[$key] = $rule;
unset($this->append[$key]);
}
}
@ -520,6 +521,7 @@ class Validate
if (isset($this->append[$field])) {
// 追加额外的验证规则
$rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR);
unset($this->append[$field]);
}
$i = 0;

View File

@ -90,7 +90,7 @@ class Redis extends Driver
*/
public function has($name)
{
return $this->handler->exists($this->getCacheKey($name));
return $this->handler->exists($this->getCacheKey($name)) ? true : false;
}
/**

View File

@ -684,7 +684,7 @@ abstract class Builder
*/
protected function parseClosure(Query $query, $call, $show = true)
{
$newQuery = $query->newQuery()->setConnection($this->connection);
$newQuery = $query->newQuery()->removeOption();
$call($newQuery);
return $newQuery->buildSql($show);

View File

@ -1764,7 +1764,7 @@ class Query
* var_page:分页变量,
* list_rows:每页数量
* type:分页类名
* @return \think\Paginator
* @return $this[]|\think\Paginator
* @throws DbException
*/
public function paginate($listRows = null, $simple = false, $config = [])
@ -3464,7 +3464,7 @@ class Query
}
/**
* 查找单条记录 如果不存在则抛出异常
* 查找单条记录 不存在则返回空模型
* @access public
* @param array|string|Query|\Closure $data
* @return array|\PDOStatement|string|Model

View File

@ -125,7 +125,13 @@ class Mysql extends Builder
$key = trim($key);
if (strpos($key, '->') && false === strpos($key, '(')) {
if(strpos($key, '->>') && false === strpos($key, '(')){
// JSON字段支持
list($field, $name) = explode('->>', $key, 2);
return $this->parseKey($query, $field, true) . '->>\'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->>', '.', $name) . '\'';
}
elseif (strpos($key, '->') && false === strpos($key, '(')) {
// JSON字段支持
list($field, $name) = explode('->', $key, 2);

View File

@ -97,10 +97,10 @@ class Mysql extends Connection
$info[$val['field']] = [
'name' => $val['field'],
'type' => $val['type'],
'notnull' => (bool) ('' === $val['null']), // not null is empty, null is yes
'notnull' => 'NO' == $val['null'],
'default' => $val['default'],
'primary' => (strtolower($val['key']) == 'pri'),
'autoinc' => (strtolower($val['extra']) == 'auto_increment'),
'primary' => strtolower($val['key']) == 'pri',
'autoinc' => strtolower($val['extra']) == 'auto_increment',
];
}
}
@ -187,7 +187,7 @@ class Mysql extends Connection
return false;
}
$this->execute("XA START '$xid'");
$this->linkID->exec("XA START '$xid'");
}
/**
@ -199,8 +199,8 @@ class Mysql extends Connection
public function prepareXa($xid)
{
$this->initConnect(true);
$this->execute("XA END '$xid'");
$this->execute("XA PREPARE '$xid'");
$this->linkID->exec("XA END '$xid'");
$this->linkID->exec("XA PREPARE '$xid'");
}
/**
@ -212,7 +212,7 @@ class Mysql extends Connection
public function commitXa($xid)
{
$this->initConnect(true);
$this->execute("XA COMMIT '$xid'");
$this->linkID->exec("XA COMMIT '$xid'");
}
/**
@ -224,6 +224,6 @@ class Mysql extends Connection
public function rollbackXa($xid)
{
$this->initConnect(true);
$this->execute("XA ROLLBACK '$xid'");
$this->linkID->exec("XA ROLLBACK '$xid'");
}
}

View File

@ -27,7 +27,7 @@ use think\Facade;
* @method void import(array $rules, string $type = '*') static 导入配置文件的路由规则
* @method \think\route\RuleItem rule(string $rule, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由规则
* @method void rules(array $rules, string $method = '*', array $option = [], array $pattern = []) static 批量注册路由规则
* @method \think\route\RuleGroup group(string|array $name, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由分组
* @method \think\route\RuleGroup group(string|array $name, array|\Closure $route, array $method = '*', array $option = [], array $pattern = []) static 注册路由分组
* @method \think\route\RuleItem any(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由
* @method \think\route\RuleItem get(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由
* @method \think\route\RuleItem post(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由

View File

@ -32,6 +32,22 @@ class Collection extends BaseCollection
return $this;
}
/**
* 绑定(一对一)关联属性到当前模型
* @access protected
* @param string $relation 关联名称
* @param array $attrs 绑定属性
* @return $this
*/
public function bindAttr($relation, array $attrs = [])
{
$this->each(function (Model $model) use ($relation, $attrs) {
$model->bindAttr($relation, $attrs);
});
return $this;
}
/**
* 设置需要隐藏的输出属性
* @access public

View File

@ -87,7 +87,7 @@ trait Conversion
if (isset($this->data[$key])) {
throw new Exception('bind attr has exists:' . $key);
} else {
$this->data[$key] = $model->$attr;
$this->data[$key] = $model->getAttr($attr);
}
}
}

View File

@ -13,6 +13,7 @@ namespace think\model\concern;
use think\Collection;
use think\db\Query;
use think\Exception;
use think\Loader;
use think\Model;
use think\model\Relation;
@ -115,6 +116,32 @@ trait RelationShip
return $this;
}
/**
* 绑定(一对一)关联属性到当前模型
* @access protected
* @param string $relation 关联名称
* @param array $attrs 绑定属性
* @return $this
* @throws Exception
*/
public function bindAttr($relation, array $attrs = [])
{
$relation = $this->getRelation($relation);
foreach ($attrs as $key => $attr) {
$key = is_numeric($key) ? $attr : $key;
$value = $this->getOrigin($key);
if (!is_null($value)) {
throw new Exception('bind attr has exists:' . $key);
}
$this->setAttr($key, $relation ? $relation->getAttr($attr) : null);
}
return $this;
}
/**
* 关联数据写入
* @access public

View File

@ -139,6 +139,10 @@ trait SoftDelete
*/
public static function destroy($data, $force = false)
{
// 传入空不执行删除但是0可以删除
if (empty($data) && 0 !== $data) {
return false;
}
// 包含软删除数据
$query = (new static())->db(false);

View File

@ -19,6 +19,7 @@ use think\Loader;
use think\Model;
use think\model\Pivot;
use think\model\Relation;
use think\Paginator;
class BelongsToMany extends Relation
{
@ -582,7 +583,7 @@ class BelongsToMany extends Relation
* 判断是否存在关联数据
* @access public
* @param mixed $data 数据 可以使用关联模型对象 或者 关联对象的主键
* @return Pivot
* @return Pivot|false
* @throws Exception
*/
public function attached($data)

View File

@ -81,7 +81,7 @@ class HasManyThrough extends Relation
*/
public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER')
{
$model = App::parseName(App::classBaseName($this->parent));
$model = Loader::parseName(basename(str_replace('\\', '/', get_class($this->parent))));
$throughTable = $this->through->getTable();
$pk = $this->throughPk;
$throughKey = $this->throughKey;
@ -114,7 +114,7 @@ class HasManyThrough extends Relation
*/
public function hasWhere($where = [], $fields = null)
{
$model = App::parseName(App::classBaseName($this->parent));
$model = Loader::parseName(basename(str_replace('\\', '/', get_class($this->parent))));
$throughTable = $this->through->getTable();
$pk = $this->throughPk;
$throughKey = $this->throughKey;
@ -169,7 +169,7 @@ class HasManyThrough extends Relation
], $foreignKey, $relation, $subRelation, $closure);
// 关联属性名
$attr = App::parseName($relation);
$attr = Loader::parseName($relation);
// 关联数据封装
foreach ($resultSet as $result) {
@ -218,7 +218,7 @@ class HasManyThrough extends Relation
$relationModel->setParent(clone $result);
}
$result->setRelation(App::parseName($relation), $this->resultSetBuild($data[$pk]));
$result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$pk]));
}
/**
@ -279,7 +279,7 @@ class HasManyThrough extends Relation
}
}
$alias = App::parseName(App::classBaseName($this->model));
$alias = Loader::parseName(basename(str_replace('\\', '/', $this->model)));
$throughTable = $this->through->getTable();
$pk = $this->throughPk;
$throughKey = $this->throughKey;
@ -315,7 +315,7 @@ class HasManyThrough extends Relation
}
}
$alias = App::parseName(App::classBaseName($this->model));
$alias = Loader::parseName(basename(str_replace('\\', '/', $this->model)));
$throughTable = $this->through->getTable();
$pk = $this->throughPk;
$throughKey = $this->throughKey;

View File

@ -144,7 +144,7 @@ class HasOne extends OneToOne
return $this->parent->db()
->alias($model)
->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) {
$query->table([$table => $relation])
->field($relation . '.' . $foreignKey)
->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey)

View File

@ -186,8 +186,16 @@ class MorphTo extends Relation
foreach ($range as $key => $val) {
// 多态类型映射
$model = $this->parseModel($key);
$obj = new $model;
$obj = (new $model)->db();
$pk = $obj->getPk();
// 预载入关联查询 支持嵌套预载入
if ($closure instanceof \Closure) {
$closure($obj);
if ($field = $obj->getOptions('with_field')) {
$obj->field($field)->removeOption('with_field');
}
}
$list = $obj->all($val, $subRelation);
$data = [];

View File

@ -282,20 +282,22 @@ abstract class OneToOne extends Relation
/**
* 绑定关联属性到父模型
* @access protected
* @param Model $model 关联模型对象
* @param Model $result 父模型对象
* @param Model $result 关联模型对象
* @param Model $model 父模型对象
* @return void
* @throws Exception
*/
protected function bindAttr($model, &$result)
{
foreach ($this->bindAttr as $key => $attr) {
$key = is_numeric($key) ? $attr : $key;
if (isset($result->$key)) {
$key = is_numeric($key) ? $attr : $key;
$value = $result->getOrigin($key);
if (!is_null($value)) {
throw new Exception('bind attr has exists:' . $key);
} else {
$result->setAttr($key, $model ? $model->$attr : null);
}
$result->setAttr($key, $model ? $model->getAttr($attr) : null);
}
}

View File

@ -13,6 +13,7 @@ namespace think\route;
use think\Container;
use think\Loader;
use think\Request;
use think\Route;
use think\route\dispatch\Callback as CallbackDispatch;
use think\route\dispatch\Controller as ControllerDispatch;

View File

@ -1,5 +1,15 @@
# ChangeLog - Aliyun OSS SDK for PHP
## v2.4.2 / 2021-06-04
* Compatible with PHP8.
* Fixed: compatible with PHP5.4.
* Fixed: the signature is incorrect in some scenarios
* Update: change $requestUrl from a member variable to a local variable.
## v2.4.1 / 2020-09-29
* Fixed: the getBucketPolicy bug.
## v2.4.0 / 2020-08-31
* Added: disable Expect: 100-continue

View File

@ -14,8 +14,8 @@
"php":">=5.3"
},
"require-dev" : {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "~1.0"
"phpunit/phpunit": "*",
"satooshi/php-coveralls": "*"
},
"minimum-stability": "stable",
"autoload": {

View File

@ -439,7 +439,8 @@ BBB;
$sub_object = $xml->addChild('Object');
$key = OssUtil::sReplace($object->getKey());
$sub_object->addChild('Key', $key);
if (!empty($object->getVersionId())) {
$versionId = $object->getVersionId();
if (!empty($versionId)) {
$sub_object->addChild('VersionId', $object->getVersionId());
}
}

View File

@ -777,7 +777,7 @@ class RequestCore
* data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
* parameters.
*
* @param resource $curl_handle (Optional) The reference to the already executed cURL request.
* @param resource|\CurlHandle|null|false $curl_handle (Optional) The reference to the already executed cURL request. Receive CurlHandle instance from PHP8.0
* @param string $response (Optional) The actual response content itself that needs to be parsed.
* @return ResponseCore A <ResponseCore> object containing a parsed HTTP response.
*/
@ -788,8 +788,8 @@ class RequestCore
$this->response = $response;
}
// As long as this came back as a valid resource...
if (is_resource($curl_handle)) {
// As long as this came back as a valid resource or CurlHandle instance...
if (is_resource($curl_handle) || (is_object($curl_handle) && get_class($curl_handle) === 'CurlHandle')) {
// Determine what's what.
$header_size = curl_getinfo($curl_handle, CURLINFO_HEADER_SIZE);
$this->response_headers = substr($this->response, 0, $header_size);
@ -844,12 +844,13 @@ class RequestCore
$this->response = curl_exec($curl_handle);
if ($this->response === false) {
throw new RequestCore_Exception('cURL resource: ' . (string)$curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
throw new RequestCore_Exception('cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');
}
$parsed_response = $this->process_response($curl_handle, $this->response);
curl_close($curl_handle);
unset($curl_handle);
if ($parse) {
return $parsed_response;

View File

@ -1132,7 +1132,8 @@ class OssClient
$options[self::OSS_OBJECT] = '/';
$options[self::OSS_SUB_RESOURCE] = 'policy';
$response = $this->auth($options);
return $response->body;
$result = new BodyResult($response);
return $result->getData();
}
/**
@ -2842,10 +2843,10 @@ class OssClient
$non_signable_resource .= $conjunction . $query_string;
$conjunction = '&';
}
$this->requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource;
$requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource;
//Creates the request
$request = new RequestCore($this->requestUrl, $this->requestProxy);
$request = new RequestCore($requestUrl, $this->requestProxy);
$request->set_useragent($this->generateUserAgent());
// Streaming uploads
if (isset($options[self::OSS_FILE_UPLOAD])) {
@ -2942,10 +2943,10 @@ class OssClient
$request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
if (isset($options[self::OSS_PREAUTH]) && (integer)$options[self::OSS_PREAUTH] > 0) {
$signed_url = $this->requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature);
$signed_url = $requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature);
return $signed_url;
} elseif (isset($options[self::OSS_PREAUTH])) {
return $this->requestUrl;
return $requestUrl;
}
if ($this->timeout !== 0) {
@ -2961,7 +2962,7 @@ class OssClient
throw(new OssException('RequestCoreException: ' . $e->getMessage()));
}
$response_header = $request->get_response_header();
$response_header['oss-request-url'] = $this->requestUrl;
$response_header['oss-request-url'] = $requestUrl;
$response_header['oss-redirects'] = $this->redirects;
$response_header['oss-stringtosign'] = $string_to_sign;
$response_header['oss-requestheaders'] = $request->request_headers;
@ -3256,7 +3257,12 @@ class OssClient
$queryStringSorted = substr($queryStringSorted, 0, -1);
return $explodeResult[0] . '?' . $queryStringSorted;
$result = '';
for ($i = 0; $i < $index -1; $i++)
{
$result .= $explodeResult[$i] . '?';
}
return $result . $queryStringSorted;
}
/**
@ -3502,8 +3508,8 @@ class OssClient
);
// OssClient version information
const OSS_NAME = "aliyun-sdk-php";
const OSS_VERSION = "2.4.0";
const OSS_BUILD = "20200831";
const OSS_VERSION = "2.4.2";
const OSS_BUILD = "20210604";
const OSS_AUTHOR = "";
const OSS_OPTIONS_ORIGIN = 'Origin';
const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
@ -3516,7 +3522,6 @@ class OssClient
// user's domain type. It could be one of the four: OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME
private $hostType = self::OSS_HOST_TYPE_NORMAL;
private $requestUrl;
private $requestProxy = null;
private $accessKeyId;
private $accessKeySecret;

View File

@ -6,7 +6,7 @@ use OSS\Result\AclResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class AclResultTest extends \PHPUnit_Framework_TestCase
class AclResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -6,7 +6,7 @@ use OSS\Http\ResponseCore;
use OSS\Result\BodyResult;
class BodyResultTest extends \PHPUnit_Framework_TestCase
class BodyResultTest extends \PHPUnit\Framework\TestCase
{
public function testParseValid200()
{

View File

@ -6,19 +6,19 @@ require_once __DIR__ . '/Common.php';
use OSS\Model\CnameConfig;
class BucketCnameTest extends \PHPUnit_Framework_TestCase
class BucketCnameTest extends \PHPUnit\Framework\TestCase
{
private $bucketName;
private $client;
public function setUp()
protected function setUp(): void
{
$this->client = Common::getOssClient();
$this->bucketName = 'php-sdk-test-bucket-' . strval(rand(0, 10000));
$this->client->createBucket($this->bucketName);
}
public function tearDown()
protected function tearDown(): void
{
$this->client->deleteBucket($this->bucketName);
}

View File

@ -8,7 +8,7 @@ use OSS\Model\BucketInfo;
* Class BucketInfoTest
* @package OSS\Tests
*/
class BucketInfoTest extends \PHPUnit_Framework_TestCase
class BucketInfoTest extends \PHPUnit\Framework\TestCase
{
public function testConstruct()
{

View File

@ -7,12 +7,12 @@ require_once __DIR__ . '/Common.php';
use OSS\Model\LiveChannelConfig;
use OSS\Core\OssException;
class BucketLiveChannelTest extends \PHPUnit_Framework_TestCase
class BucketLiveChannelTest extends \PHPUnit\Framework\TestCase
{
private $bucketName;
private $client;
public function setUp()
protected function setUp(): void
{
$this->client = Common::getOssClient();
$this->bucketName = 'php-sdk-test-rtmp-bucket-name-' . strval(rand(0, 10000));
@ -20,7 +20,7 @@ class BucketLiveChannelTest extends \PHPUnit_Framework_TestCase
Common::waitMetaSync();
}
public function tearDown()
protected function tearDown(): void
{
////to delete created bucket
//1. delele live channel

View File

@ -289,7 +289,7 @@ class CallbackTest extends TestOssClientBase
}
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
}

View File

@ -6,7 +6,7 @@ namespace OSS\Tests;
use OSS\Model\CnameConfig;
use OSS\Core\OssException;
class CnameConfigTest extends \PHPUnit_Framework_TestCase
class CnameConfigTest extends \PHPUnit\Framework\TestCase
{
private $xml1 = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -6,7 +6,7 @@ use OSS\Core\OssException;
use OSS\Http\ResponseCore;
use OSS\Result\CopyObjectResult;
class CopyObjectResultTest extends \PHPUnit_Framework_TestCase
class CopyObjectResultTest extends \PHPUnit\Framework\TestCase
{
private $body = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -45,7 +45,7 @@ BBBB;
new CopyObjectResult($response);
$this->assertFalse(true);
} catch (OssException $e) {
$this->assertFalse(false);
}
}

View File

@ -7,7 +7,7 @@ use OSS\Model\CorsConfig;
use OSS\Model\CorsRule;
use OSS\Core\OssException;
class CorsConfigTest extends \PHPUnit_Framework_TestCase
class CorsConfigTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -6,7 +6,7 @@ use OSS\Result\DeleteObjectVersionsResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class DeleteObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
class DeleteObjectVersionsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -7,7 +7,7 @@ use OSS\Result\ExistResult;
use OSS\Http\ResponseCore;
use OSS\Core\OssException;
class ExistResultTest extends \PHPUnit_Framework_TestCase
class ExistResultTest extends \PHPUnit\Framework\TestCase
{
public function testParseValid200()
{
@ -32,7 +32,7 @@ class ExistResultTest extends \PHPUnit_Framework_TestCase
new ExistResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -6,7 +6,7 @@ use OSS\Result\GetBucketEncryptionResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketEncryptionResultTest extends \PHPUnit_Framework_TestCase
class GetBucketEncryptionResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -6,7 +6,7 @@ use OSS\Result\GetBucketRequestPaymentResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketRequestPaymentResultTest extends \PHPUnit_Framework_TestCase
class GetBucketRequestPaymentResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -6,7 +6,7 @@ use OSS\Result\GetBucketStatResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketStatResultTest extends \PHPUnit_Framework_TestCase
class GetBucketStatResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -6,7 +6,7 @@ use OSS\Result\GetBucketTagsResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketTagsResultTest extends \PHPUnit_Framework_TestCase
class GetBucketTagsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" ?>

View File

@ -6,7 +6,7 @@ use OSS\Result\GetBucketWormResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class GetBucketWormResultTest extends \PHPUnit_Framework_TestCase
class GetBucketWormResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -7,7 +7,7 @@ use OSS\Core\OssException;
use OSS\Result\GetCorsResult;
use OSS\Http\ResponseCore;
class GetCorsResultTest extends \PHPUnit_Framework_TestCase
class GetCorsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -58,10 +58,10 @@ BBBB;
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetCorsResult($response);
$result = new GetCorsResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -8,7 +8,7 @@ use OSS\Core\OssException;
use OSS\Model\LifecycleConfig;
use OSS\Result\GetLifecycleResult;
class GetLifecycleResultTest extends \PHPUnit_Framework_TestCase
class GetLifecycleResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -49,10 +49,10 @@ BBBB;
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetLifecycleResult($response);
$result = new GetLifecycleResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}

View File

@ -8,7 +8,7 @@ use OSS\Http\ResponseCore;
use OSS\Core\OssException;
class GetLoggingResultTest extends \PHPUnit_Framework_TestCase
class GetLoggingResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -42,10 +42,10 @@ BBBB;
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetLoggingResult($response);
$result = new GetLoggingResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -7,7 +7,7 @@ use OSS\Http\ResponseCore;
use OSS\Core\OssException;
class GetRefererResultTest extends \PHPUnit_Framework_TestCase
class GetRefererResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -42,10 +42,10 @@ BBBB;
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetRefererResult($response);
$result = new GetRefererResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -7,7 +7,7 @@ use OSS\Result\GetWebsiteResult;
use OSS\Http\ResponseCore;
use OSS\Core\OssException;
class GetWebsiteResultTest extends \PHPUnit_Framework_TestCase
class GetWebsiteResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
@ -41,10 +41,10 @@ BBBB;
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetWebsiteResult($response);
$result = new GetWebsiteResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
* Class HeaderResultTest
* @package OSS\Tests
*/
class HeaderResultTest extends \PHPUnit_Framework_TestCase
class HeaderResultTest extends \PHPUnit\Framework\TestCase
{
public function testGetHeader()
{

View File

@ -7,7 +7,7 @@ use OSS\Http\ResponseCore;
use OSS\Http\RequestCore_Exception;
use Symfony\Component\Config\Definition\Exception\Exception;
class HttpTest extends \PHPUnit_Framework_TestCase
class HttpTest extends \PHPUnit\Framework\TestCase
{
public function testResponseCore()
@ -33,7 +33,7 @@ class HttpTest extends \PHPUnit_Framework_TestCase
$httpResponse = $httpCore->send_request();
$this->assertTrue(false);
} catch (RequestCore_Exception $e) {
$this->assertTrue(true);
}
}

View File

@ -7,7 +7,7 @@ use OSS\Core\OssException;
use OSS\Result\InitiateMultipartUploadResult;
use OSS\Http\ResponseCore;
class InitiateMultipartUploadResultTest extends \PHPUnit_Framework_TestCase
class InitiateMultipartUploadResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="UTF-8"?>
@ -41,7 +41,7 @@ BBBB;
$result = new InitiateMultipartUploadResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
}
}
}

View File

@ -7,7 +7,7 @@ use OSS\Model\LifecycleAction;
use OSS\Model\LifecycleConfig;
use OSS\Model\LifecycleRule;
class LifecycleConfigTest extends \PHPUnit_Framework_TestCase
class LifecycleConfigTest extends \PHPUnit\Framework\TestCase
{
private $validLifecycle = <<<BBBB

View File

@ -6,7 +6,7 @@ use OSS\Core\OssException;
use OSS\Http\ResponseCore;
use OSS\Result\ListBucketsResult;
class ListBucketsResultTest extends \PHPUnit_Framework_TestCase
class ListBucketsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="UTF-8"?>

View File

@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
* Class ListMultipartUploadResultTest
* @package OSS\Tests
*/
class ListMultipartUploadResultTest extends \PHPUnit_Framework_TestCase
class ListMultipartUploadResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="UTF-8"?>

View File

@ -6,7 +6,7 @@ use OSS\Result\ListObjectVersionsResult;
use OSS\Core\OssException;
use OSS\Http\ResponseCore;
class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
class ListObjectVersionsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
@ -202,6 +202,7 @@ class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
$response = new ResponseCore(array(), "", 200);
$result = new ListObjectVersionsResult($response);
$list = $result->getData();
$this->assertTrue(true);
}
public function testParseInvalidXml()
@ -209,5 +210,6 @@ class ListObjectVersionsResultTest extends \PHPUnit_Framework_TestCase
$response = new ResponseCore(array(), $this->invalidXml, 200);
$result = new ListObjectVersionsResult($response);
$stat = $result->getData();
$this->assertTrue(true);
}
}

View File

@ -6,7 +6,7 @@ namespace OSS\Tests;
use OSS\Result\ListObjectsResult;
use OSS\Http\ResponseCore;
class ListObjectsResultTest extends \PHPUnit_Framework_TestCase
class ListObjectsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml1 = <<<BBBB

View File

@ -9,7 +9,7 @@ use OSS\Http\ResponseCore;
* Class ListPartsResultTest
* @package OSS\Tests
*/
class ListPartsResultTest extends \PHPUnit_Framework_TestCase
class ListPartsResultTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="UTF-8"?>

View File

@ -12,7 +12,7 @@ use OSS\Model\GetLiveChannelStatus;
use OSS\Model\GetLiveChannelHistory;
use OSS\Model\LiveChannelHistory;
class LiveChannelXmlTest extends \PHPUnit_Framework_TestCase
class LiveChannelXmlTest extends \PHPUnit\Framework\TestCase
{
private $config = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -4,7 +4,7 @@ namespace OSS\Tests;
use OSS\Model\LoggingConfig;
class LoggingConfigTest extends \PHPUnit_Framework_TestCase
class LoggingConfigTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -4,7 +4,7 @@ namespace OSS\Tests;
use OSS\Core\MimeTypes;
class MimeTypesTest extends \PHPUnit_Framework_TestCase
class MimeTypesTest extends \PHPUnit\Framework\TestCase
{
public function testGetMimeType()
{

View File

@ -29,9 +29,10 @@ class OssClientBucketPolicyTest extends TestOssClientBase
try {
$this->ossClient->deleteBucketPolicy($this->bucket);
$policy = $this->ossClient->getBucketPolicy($this->bucket);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
$this->assertEquals("NoSuchBucketPolicy", $e->getCode());
$this->assertEquals("NoSuchBucketPolicy", $e->getErrorCode());
}
try {

View File

@ -98,7 +98,7 @@ class OssClientBucketTest extends TestOssClientBase
}
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
@ -125,7 +125,7 @@ class OssClientBucketTest extends TestOssClientBase
$this->ossClient->createBucket($this->standardBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
}
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();

View File

@ -14,7 +14,7 @@ class OssClinetImageTest extends TestOssClientBase
private $object;
private $download_file;
public function setUp()
protected function setUp(): void
{
parent::setUp();
@ -28,7 +28,7 @@ class OssClinetImageTest extends TestOssClientBase
$this->client->uploadFile($this->bucketName, $this->object, $this->local_file);
}
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();
unlink($this->download_file);

View File

@ -145,7 +145,7 @@ class OssClientListObjectsTest extends TestOssClientBase
$this->assertEquals("true", $listObjectInfo->getIsTruncated());
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
//folder
@ -177,7 +177,7 @@ class OssClientListObjectsTest extends TestOssClientBase
}
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();
}

View File

@ -330,6 +330,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
try {
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
$this->assertFalse(false);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -343,6 +344,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
try {
$this->ossClient->multiuploadFile($this->bucket, $object, $file, $options);
$this->assertFalse(false);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -385,6 +387,7 @@ class OssClientMultipartUploadTest extends TestOssClientBase
try {
$this->ossClient->multiuploadFile($this->bucket, $object, $file);
$this->assertTrue(false);
} catch (OssException $e) {
$this->assertTrue(true);
if (strpos($e, "parameter invalid, file is empty") == false)

View File

@ -426,6 +426,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
$object = 'mpu/multipart-bigfile-test.tmp';
try {
$this->ossClient->multiuploadFile($this->bucket, $object, $bigFileName, $options);
$this->assertTrue(true);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -446,7 +447,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
unlink($bigFileName);
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->payerClient = new OssClient(
@ -464,7 +465,7 @@ class OssClientObjectRequestPaymentTest extends TestOssClientBase
$this->ossClient->putSymlink($this->bucket, "default-symlink", "default-object");
}
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();
}

View File

@ -622,49 +622,158 @@ class OssClientObjectTest extends TestOssClientBase
public function testUploadStream()
{
$object = "oss-php-sdk-test/put-from-stream.txt";
$options = array(OssClient::OSS_CHECK_MD5 => true);
$object = "oss-php-sdk-test/put-from-stream.txt";
$options = array(OssClient::OSS_CHECK_MD5 => true);
$handle = fopen(__FILE__, 'rb');
/**
* Upload data to start MD5
*/
try {
$this->ossClient->uploadStream($this->bucket, $object, $handle, $options);
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Check if the replication is the same
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Upload data to start MD5
*/
try {
$this->ossClient->uploadStream($this->bucket, $object, $handle, $options);
} catch (OssException $e) {
$this->assertFalse(true);
}
$object = "oss-php-sdk-test/put-from-stream-without-md5.txt";
/**
* Check if the replication is the same
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
$object = "oss-php-sdk-test/put-from-stream-without-md5.txt";
$handle = fopen(__FILE__, 'rb');
try {
$this->ossClient->uploadStream($this->bucket, $object, $handle);
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Check if the replication is the same
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
try {
$this->ossClient->uploadStream($this->bucket, $object, $handle);
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Check if the replication is the same
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
}
public function setUp()
public function testObjectKeyWithQuestionMark()
{
/**
* Upload the local variable to bucket
*/
$object = "oss-php-sdk-test/??/upload-test-object-name???123??123??.txt";
$content = file_get_contents(__FILE__);
$options = array(
OssClient::OSS_LENGTH => strlen($content),
OssClient::OSS_HEADERS => array(
'Expires' => 'Fri, 28 Feb 2020 05:38:42 GMT',
'Cache-Control' => 'no-cache',
'Content-Disposition' => 'attachment;filename=oss_download.log',
'Content-Language' => 'zh-CN',
'x-oss-server-side-encryption' => 'AES256',
'x-oss-meta-self-define-title' => 'user define meta info',
),
);
try {
$this->ossClient->putObject($this->bucket, $object, $content, $options);
} catch (OssException $e) {
$this->assertFalse(true);
}
try {
$this->ossClient->putObject($this->bucket, $object, $content, $options);
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* GetObject to the local variable and check for match
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* GetObject first five bytes
*/
try {
$options = array(OssClient::OSS_RANGE => '0-4');
$content = $this->ossClient->getObject($this->bucket, $object, $options);
$this->assertEquals($content, '<?php');
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Upload the local file to object
*/
try {
$this->ossClient->uploadFile($this->bucket, $object, __FILE__);
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Download the file to the local variable and check for match.
*/
try {
$content = $this->ossClient->getObject($this->bucket, $object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
/**
* Copy object
*/
$to_bucket = $this->bucket;
$to_object = $object . '.copy';
$options = array();
try {
$result = $this->ossClient->copyObject($this->bucket, $object, $to_bucket, $to_object, $options);
$this->assertFalse(empty($result));
$this->assertEquals(strlen("2016-11-21T03:46:58.000Z"), strlen($result[0]));
$this->assertEquals(strlen("\"5B3C1A2E053D763E1B002CC607C5A0FE\""), strlen($result[1]));
} catch (OssException $e) {
$this->assertFalse(true);
var_dump($e->getMessage());
}
/**
* Check if the replication is the same
*/
try {
$content = $this->ossClient->getObject($this->bucket, $to_object);
$this->assertEquals($content, file_get_contents(__FILE__));
} catch (OssException $e) {
$this->assertFalse(true);
}
try {
$this->assertTrue($this->ossClient->doesObjectExist($this->bucket, $object));
$this->ossClient->deleteObject($this->bucket, $object);
$this->assertFalse($this->ossClient->doesObjectExist($this->bucket, $object));
} catch (OssException $e) {
$this->assertFalse(true);
}
}
protected function setUp(): void
{
parent::setUp();
$this->ossClient->putObject($this->bucket, 'oss-php-sdk-test/upload-test-object-name.txt', file_get_contents(__FILE__));

View File

@ -569,7 +569,7 @@ class OssClientObjectVersioningTest extends TestOssClientBase
$this->assertEquals(0, count($deleteMarkerList));
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
@ -577,7 +577,7 @@ class OssClientObjectVersioningTest extends TestOssClientBase
}
public function tearDown()
protected function tearDown(): void
{
if (!$this->ossClient->doesBucketExist($this->bucket)) {
return;

View File

@ -141,7 +141,7 @@ class OssClientRestoreObjectTest extends TestOssClientBase
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
@ -160,7 +160,7 @@ class OssClientRestoreObjectTest extends TestOssClientBase
$this->ossClient->createBucket($this->archiveBucket, OssClient::OSS_ACL_TYPE_PRIVATE, $options);
}
public function tearDown()
protected function tearDown(): void
{
parent::tearDown();

View File

@ -131,13 +131,13 @@ class OssClientSignatureTest extends TestOssClientBase
$this->assertTrue(strpos($signedUrl1, 'Expires='.$expiration) !== false);
}
public function tearDown()
protected function tearDown(): void
{
$this->ossClient->deleteObject($this->bucket, "a.file");
parent::tearDown();
}
public function setUp()
protected function setUp(): void
{
parent::setUp();
/**

View File

@ -111,7 +111,7 @@ class OssClientTest extends TestOssClientBase
$ossClient->listBuckets();
$this->assertFalse(true);
} catch (OssException $e) {
$this->assertFalse(false);
}
}
@ -123,6 +123,7 @@ class OssClientTest extends TestOssClientBase
$endpoint = ' ' . getenv('OSS_ENDPOINT') . '/ ';
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
$ossClient->listBuckets();
$this->assertTrue(true);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -196,6 +197,7 @@ class OssClientTest extends TestOssClientBase
try {
$object='test-dir';
$ossClient->createObjectDir($bucket,$object);
$this->assertTrue(true);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -204,6 +206,7 @@ class OssClientTest extends TestOssClientBase
$object='0';
$ossClient->createObjectDir($bucket,$object);
$ossClient->putObject($bucket,$object, '');
$this->assertTrue(true);
} catch (OssException $e) {
var_dump($e);
$this->assertFalse(true);
@ -219,6 +222,7 @@ class OssClientTest extends TestOssClientBase
$bucket = getenv('OSS_BUCKET');
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
$ossClient->getBucketCors($bucket);
$this->assertTrue(true);
} catch (OssException $e) {
$this->assertFalse(true);
}
@ -233,6 +237,7 @@ class OssClientTest extends TestOssClientBase
$bucket = $this->bucket;
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint, false);
$ossClient->getBucketCname($bucket);
$this->assertTrue(true);
} catch (OssException $e) {
$this->assertFalse(true);
}

View File

@ -4,7 +4,7 @@ namespace OSS\Tests;
use OSS\Core\OssException;
class OssExceptionTest extends \PHPUnit_Framework_TestCase
class OssExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testOSS_exception()
{

View File

@ -7,7 +7,7 @@ use OSS\Core\OssException;
use OSS\Core\OssUtil;
use OSS\OssClient;
class OssUtilTest extends \PHPUnit_Framework_TestCase
class OssUtilTest extends \PHPUnit\Framework\TestCase
{
public function testIsChinese()
{
@ -147,10 +147,10 @@ BBBB;
$this->assertNotNull($list);
}
public function testIsWin()
{
//$this->assertTrue(OssUtil::isWin());
}
//public function testIsWin()
//{
// //$this->assertTrue(OssUtil::isWin());
//}
public function testGetMd5SumForFile()
{

View File

@ -6,7 +6,7 @@ use OSS\Core\OssException;
use OSS\Http\ResponseCore;
use OSS\Result\PutSetDeleteResult;
class ResultTest extends \PHPUnit_Framework_TestCase
class ResultTest extends \PHPUnit\Framework\TestCase
{
public function testNullResponse()
@ -50,16 +50,16 @@ class ResultTest extends \PHPUnit_Framework_TestCase
new PutSetDeleteResult($response);
$this->assertFalse(true);
} catch (OssException $e) {
$this->assertFalse(false);
}
}
public function setUp()
protected function setUp(): void
{
}
public function tearDown()
protected function tearDown(): void
{
}

View File

@ -5,7 +5,7 @@ namespace OSS\Tests;
use OSS\Model\RefererConfig;
class RefererConfigTest extends \PHPUnit_Framework_TestCase
class RefererConfigTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB

View File

@ -5,7 +5,7 @@ namespace OSS\Tests;
use OSS\Core\OssException;
use OSS\Model\StorageCapacityConfig;
class StorageCapacityConfigTest extends \PHPUnit_Framework_TestCase
class StorageCapacityConfigTest extends \PHPUnit\Framework\TestCase
{
private $validXml_10 = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -6,7 +6,7 @@ use OSS\Model\StorageCapacityConfig;
use OSS\Result\GetStorageCapacityResult;
use OSS\Core\OssException;
class StorageCapacityTest extends \PHPUnit_Framework_TestCase
class StorageCapacityTest extends \PHPUnit\Framework\TestCase
{
private $inValidXml = <<<BBBB
@ -29,7 +29,9 @@ BBBB;
try {
new GetStorageCapacityResult($response);
$this->assertTrue(false);
} catch (OssException $e) {}
} catch (OssException $e) {
$this->assertTrue(true);
}
}
public function testParseEmptyXml()
@ -38,7 +40,9 @@ BBBB;
try {
new GetStorageCapacityResult($response);
$this->assertTrue(false);
} catch (OssException $e) {}
} catch (OssException $e) {
$this->assertTrue(true);
}
}
public function testParseValidXml()

View File

@ -6,7 +6,7 @@ use OSS\OssClient;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Common.php';
class TestOssClientBase extends \PHPUnit_Framework_TestCase
class TestOssClientBase extends \PHPUnit\Framework\TestCase
{
/**
* @var OssClient
@ -18,7 +18,7 @@ class TestOssClientBase extends \PHPUnit_Framework_TestCase
*/
protected $bucket;
public function setUp()
protected function setUp(): void
{
$this->bucket = Common::getBucketName() .'-'. time();
$this->ossClient = Common::getOssClient();
@ -26,7 +26,7 @@ class TestOssClientBase extends \PHPUnit_Framework_TestCase
Common::waitMetaSync();
}
public function tearDown()
protected function tearDown(): void
{
if (!$this->ossClient->doesBucketExist($this->bucket)) {
return;

View File

@ -7,7 +7,7 @@ use OSS\Core\OssException;
use OSS\Result\UploadPartResult;
use OSS\Http\ResponseCore;
class UploadPartResultTest extends \PHPUnit_Framework_TestCase
class UploadPartResultTest extends \PHPUnit\Framework\TestCase
{
private $validHeader = array('etag' => '7265F4D211B56873A381D321F586E4A9');
private $invalidHeader = array();

View File

@ -5,7 +5,7 @@ namespace OSS\Tests;
use OSS\Model\WebsiteConfig;
class WebsiteConfigTest extends \PHPUnit_Framework_TestCase
class WebsiteConfigTest extends \PHPUnit\Framework\TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>

View File

@ -37,11 +37,13 @@ namespace Composer\Autoload;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
private $vendorDir;
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
@ -57,10 +59,17 @@ class ClassLoader
private $missingClasses = array();
private $apcuPrefix;
private static $registeredLoaders = array();
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
@ -300,6 +309,17 @@ class ClassLoader
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
@ -308,13 +328,17 @@ class ClassLoader
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
@ -323,6 +347,8 @@ class ClassLoader
return true;
}
return null;
}
/**
@ -367,6 +393,16 @@ class ClassLoader
return $file;
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup

337
vendor/composer/InstalledVersions.php vendored Normal file
View File

@ -0,0 +1,337 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require it's presence, you can require `composer-runtime-api ^2.0`
*/
class InstalledVersions
{
private static $installed;
private static $canGetVendors;
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
}

View File

@ -14,6 +14,7 @@ return array(
'AliPay\\Transfer' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => $vendorDir . '/zoujingli/wechat-developer/AliPay/Web.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Endroid\\QrCode\\Bundle\\Controller\\QrCodeController' => $vendorDir . '/endroid/qr-code/src/Bundle/Controller/QrCodeController.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\Configuration' => $vendorDir . '/endroid/qr-code/src/Bundle/DependencyInjection/Configuration.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\EndroidQrCodeExtension' => $vendorDir . '/endroid/qr-code/src/Bundle/DependencyInjection/EndroidQrCodeExtension.php',
@ -211,8 +212,14 @@ return array(
'WeOpen\\Login' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/Login.php',
'WeOpen\\MiniApp' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/MiniApp.php',
'WeOpen\\Service' => $vendorDir . '/zoujingli/weopen-developer/WeOpen/Service.php',
'WePayV3\\Cert' => $vendorDir . '/zoujingli/wechat-developer/WePayV3/Cert.php',
'WePayV3\\Contracts\\BasicWePay' => $vendorDir . '/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php',
'WePayV3\\Contracts\\DecryptAes' => $vendorDir . '/zoujingli/wechat-developer/WePayV3/Contracts/DecryptAes.php',
'WePayV3\\Order' => $vendorDir . '/zoujingli/wechat-developer/WePayV3/Order.php',
'WePayV3\\Refund' => $vendorDir . '/zoujingli/wechat-developer/WePayV3/Refund.php',
'WePay\\Bill' => $vendorDir . '/zoujingli/wechat-developer/WePay/Bill.php',
'WePay\\Coupon' => $vendorDir . '/zoujingli/wechat-developer/WePay/Coupon.php',
'WePay\\Custom' => $vendorDir . '/zoujingli/wechat-developer/WePay/Custom.php',
'WePay\\Order' => $vendorDir . '/zoujingli/wechat-developer/WePay/Order.php',
'WePay\\Redpack' => $vendorDir . '/zoujingli/wechat-developer/WePay/Redpack.php',
'WePay\\Refund' => $vendorDir . '/zoujingli/wechat-developer/WePay/Refund.php',
@ -265,7 +272,9 @@ return array(
'library\\tools\\JsonRpcServer' => $vendorDir . '/zoujingli/think-library/src/tools/JsonRpcServer.php',
'library\\tools\\Node' => $vendorDir . '/zoujingli/think-library/src/tools/Node.php',
'library\\tools\\Options' => $vendorDir . '/zoujingli/think-library/src/tools/Options.php',
'think\\composer\\LibraryInstaller' => $vendorDir . '/topthink/think-installer/src/LibraryInstaller.php',
'think\\composer\\Plugin' => $vendorDir . '/topthink/think-installer/src/Plugin.php',
'think\\composer\\Promise' => $vendorDir . '/topthink/think-installer/src/Promise.php',
'think\\composer\\ThinkExtend' => $vendorDir . '/topthink/think-installer/src/ThinkExtend.php',
'think\\composer\\ThinkFramework' => $vendorDir . '/topthink/think-installer/src/ThinkFramework.php',
'think\\composer\\ThinkTesting' => $vendorDir . '/topthink/think-installer/src/ThinkTesting.php',

View File

@ -9,6 +9,7 @@ return array(
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
'library\\' => array($vendorDir . '/zoujingli/think-library/src'),
'WePay\\' => array($vendorDir . '/zoujingli/wechat-developer/WePay'),
'WePayV3\\' => array($vendorDir . '/zoujingli/wechat-developer/WePayV3'),
'WeOpen\\' => array($vendorDir . '/zoujingli/weopen-developer/WeOpen'),
'WeMini\\' => array($vendorDir . '/zoujingli/wechat-developer/WeMini', $vendorDir . '/zoujingli/weopen-developer/WeMini'),
'WeChat\\' => array($vendorDir . '/zoujingli/wechat-developer/WeChat', $vendorDir . '/zoujingli/weopen-developer/WeChat'),

View File

@ -22,13 +22,15 @@ class ComposerAutoloaderInit4d241e9f8bb10d006cd7432f945fdb5b
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit4d241e9f8bb10d006cd7432f945fdb5b', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit4d241e9f8bb10d006cd7432f945fdb5b', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b::getInitializer($loader));
} else {

View File

@ -23,6 +23,7 @@ class ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b
'W' =>
array (
'WePay\\' => 6,
'WePayV3\\' => 8,
'WeOpen\\' => 7,
'WeMini\\' => 7,
'WeChat\\' => 7,
@ -62,6 +63,10 @@ class ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b
array (
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay',
),
'WePayV3\\' =>
array (
0 => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3',
),
'WeOpen\\' =>
array (
0 => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen',
@ -107,6 +112,7 @@ class ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b
'AliPay\\Transfer' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Transfer.php',
'AliPay\\Wap' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Wap.php',
'AliPay\\Web' => __DIR__ . '/..' . '/zoujingli/wechat-developer/AliPay/Web.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Endroid\\QrCode\\Bundle\\Controller\\QrCodeController' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/Controller/QrCodeController.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\Configuration' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/DependencyInjection/Configuration.php',
'Endroid\\QrCode\\Bundle\\DependencyInjection\\EndroidQrCodeExtension' => __DIR__ . '/..' . '/endroid/qr-code/src/Bundle/DependencyInjection/EndroidQrCodeExtension.php',
@ -304,8 +310,14 @@ class ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b
'WeOpen\\Login' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/Login.php',
'WeOpen\\MiniApp' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/MiniApp.php',
'WeOpen\\Service' => __DIR__ . '/..' . '/zoujingli/weopen-developer/WeOpen/Service.php',
'WePayV3\\Cert' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3/Cert.php',
'WePayV3\\Contracts\\BasicWePay' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3/Contracts/BasicWePay.php',
'WePayV3\\Contracts\\DecryptAes' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3/Contracts/DecryptAes.php',
'WePayV3\\Order' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3/Order.php',
'WePayV3\\Refund' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePayV3/Refund.php',
'WePay\\Bill' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Bill.php',
'WePay\\Coupon' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Coupon.php',
'WePay\\Custom' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Custom.php',
'WePay\\Order' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Order.php',
'WePay\\Redpack' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Redpack.php',
'WePay\\Refund' => __DIR__ . '/..' . '/zoujingli/wechat-developer/WePay/Refund.php',
@ -358,7 +370,9 @@ class ComposerStaticInit4d241e9f8bb10d006cd7432f945fdb5b
'library\\tools\\JsonRpcServer' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/JsonRpcServer.php',
'library\\tools\\Node' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/Node.php',
'library\\tools\\Options' => __DIR__ . '/..' . '/zoujingli/think-library/src/tools/Options.php',
'think\\composer\\LibraryInstaller' => __DIR__ . '/..' . '/topthink/think-installer/src/LibraryInstaller.php',
'think\\composer\\Plugin' => __DIR__ . '/..' . '/topthink/think-installer/src/Plugin.php',
'think\\composer\\Promise' => __DIR__ . '/..' . '/topthink/think-installer/src/Promise.php',
'think\\composer\\ThinkExtend' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkExtend.php',
'think\\composer\\ThinkFramework' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkFramework.php',
'think\\composer\\ThinkTesting' => __DIR__ . '/..' . '/topthink/think-installer/src/ThinkTesting.php',

File diff suppressed because it is too large Load Diff

115
vendor/composer/installed.php vendored Normal file
View File

@ -0,0 +1,115 @@
<?php return array(
'root' => array(
'pretty_version' => '5.x-dev',
'version' => '5.9999999.9999999.9999999-dev',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '6e2a989be5a020078f58c5f6fa4db0c577ffbb8f',
'name' => 'zoujingli/thinkadmin',
'dev' => false,
),
'versions' => array(
'aliyuncs/oss-sdk-php' => array(
'pretty_version' => 'v2.4.2',
'version' => '2.4.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../aliyuncs/oss-sdk-php',
'aliases' => array(),
'reference' => '0c9d902c33847c07efc66c4cdf823deaea8fc2b6',
'dev_requirement' => false,
),
'endroid/qr-code' => array(
'pretty_version' => '1.9.3',
'version' => '1.9.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../endroid/qr-code',
'aliases' => array(),
'reference' => 'c9644bec2a9cc9318e98d1437de3c628dcd1ef93',
'dev_requirement' => false,
),
'qiniu/php-sdk' => array(
'pretty_version' => 'v7.3.0',
'version' => '7.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../qiniu/php-sdk',
'aliases' => array(),
'reference' => '0a461e13b09545b23df361843c6a65fdd3a26426',
'dev_requirement' => false,
),
'symfony/options-resolver' => array(
'pretty_version' => 'v3.4.47',
'version' => '3.4.47.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(),
'reference' => 'c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744',
'dev_requirement' => false,
),
'topthink/framework' => array(
'pretty_version' => 'v5.1.41',
'version' => '5.1.41.0',
'type' => 'think-framework',
'install_path' => __DIR__ . '/../../thinkphp',
'aliases' => array(),
'reference' => '7137741a323a4a60cfca334507cd1812fac91bb2',
'dev_requirement' => false,
),
'topthink/think-installer' => array(
'pretty_version' => 'v2.0.5',
'version' => '2.0.5.0',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../topthink/think-installer',
'aliases' => array(),
'reference' => '38ba647706e35d6704b5d370c06f8a160b635f88',
'dev_requirement' => false,
),
'zoujingli/ip2region' => array(
'pretty_version' => 'v1.0.10',
'version' => '1.0.10.0',
'type' => 'library',
'install_path' => __DIR__ . '/../zoujingli/ip2region',
'aliases' => array(),
'reference' => '453480d0ab5b6fdbdf4aa400b7598a10ff2dc5c0',
'dev_requirement' => false,
),
'zoujingli/think-library' => array(
'pretty_version' => 'v5.1.x-dev',
'version' => '5.1.9999999.9999999-dev',
'type' => 'library',
'install_path' => __DIR__ . '/../zoujingli/think-library',
'aliases' => array(),
'reference' => '38c150e2a61280f1f16d16a08aeabdc18b551151',
'dev_requirement' => false,
),
'zoujingli/thinkadmin' => array(
'pretty_version' => '5.x-dev',
'version' => '5.9999999.9999999.9999999-dev',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '6e2a989be5a020078f58c5f6fa4db0c577ffbb8f',
'dev_requirement' => false,
),
'zoujingli/wechat-developer' => array(
'pretty_version' => 'v1.2.31',
'version' => '1.2.31.0',
'type' => 'library',
'install_path' => __DIR__ . '/../zoujingli/wechat-developer',
'aliases' => array(),
'reference' => '0cf699c725f69d66657a50e60d22f71c9e5a5e16',
'dev_requirement' => false,
),
'zoujingli/weopen-developer' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'type' => 'library',
'install_path' => __DIR__ . '/../zoujingli/weopen-developer',
'aliases' => array(
0 => '9999999-dev',
),
'reference' => '4d0d3c064e54556621453845fc65ba52de58a880',
'dev_requirement' => false,
),
),
);

26
vendor/composer/platform_check.php vendored Normal file
View File

@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 50600)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

View File

@ -33,3 +33,10 @@ tools:
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

View File

@ -1,4 +1,3 @@
sudo: false
language: php
php:
@ -8,6 +7,7 @@ php:
- 7.0
dist: trusty
os: linux
before_script:
- export QINIU_TEST_ENV="travis"
@ -18,13 +18,12 @@ script:
- ./vendor/bin/phpcs --standard=PSR2 src
- ./vendor/bin/phpcs --standard=PSR2 examples
- ./vendor/bin/phpcs --standard=PSR2 tests
- ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover tests/Qiniu/Tests/
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
env:
global:
- QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5
- secure: "V9BsntXQZwvO9EOD6itzaae2uq+GemzyTUTxMTJx1/jFoUNpCU2O2UAgjA2XSEr5sgci0KWDV4Krbzv3EBB4uplOFLMI3w32256UHbT9E0x3YjhfPJZk68MH1iS1be7X81LDHON7yveavK8987s3qzjeUcbfLSPgccT+cvf7+dc="
- QINIU_ACCESS_KEY=vHg2e7nOh7Jsucv2Azr5FH6omPgX22zoJRWa0FN5
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@ -1,5 +1,32 @@
# Changelog
## 7.3.0 (2020-09-24)
### 新增
* 【对象存储】增加异步抓取方法与demo
* 【融合cdn】增加查询CDN刷新记录、查询CDN预取记录方法与demo
* 【云短信】增加查询短信发送记录的方法
* 【实时音视频】增加rtc停止房间的合流转推方法
* 【内容审核】增加图片审核、视频审核方法与demo
### 修复
* 【对象存储】修复签算 token 时上传策略中的 forceSaveKey 字段不生效的问题
* 【对象存储】修复更新空间事件通知规则方法
### 优化
* 【对象存储】创建空间迁移到mkbucketv3 api
* 优化对 http2 返回头的判断
* 优化 demo 中的文档注释说明
* docs 目录下的 rtc demo 移动至 examples/rtc 目录下
* docs 目录下的 sms demo 移动至 examples/sms 目录下
## 7.2.10 (2019-10-28)
* 去除云短信类类型指定
* 修改不传文件名时存在表单上传错误的情况
## 7.2.9 (2019-07-09)
* 添加空间管理、云短信接口
* 去除无效参数
## 7.2.7 (2018-11-06)
* 添加 QVM 内网上传到 KODO 的 zone 设置

View File

@ -1,21 +1,22 @@
# Qiniu Cloud SDK for PHP
[![doxygen.io](http://doxygen.io/github.com/qiniu/php-sdk/?status.svg)](http://doxygen.io/github.com/qiniu/php-sdk/)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![Build Status](https://travis-ci.org/qiniu/php-sdk.svg)](https://travis-ci.org/qiniu/php-sdk)
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/php-sdk.svg?label=release)](https://github.com/qiniu/php-sdk/releases)
[![Latest Stable Version](https://img.shields.io/packagist/v/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk)
[![Total Downloads](https://img.shields.io/packagist/dt/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/qiniu/php-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/qiniu/php-sdk/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master)
[![Coverage Status](https://codecov.io/gh/qiniu/php-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/php-sdk)
[![Join Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/qiniu/php-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![@qiniu on weibo](http://img.shields.io/badge/weibo-%40qiniutek-blue.svg)](http://weibo.com/qiniutek)
## 安装
* 通过composer这是推荐的方式可以使用composer.json 声明依赖或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。
* 推荐使用 `composer` 进行安装。可以使用 composer.json 声明依赖或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。
```bash
$ composer require qiniu/php-sdk
```
* 直接下载安装SDK 没有依赖其他第三方库,但需要参照 composer的autoloader增加一个自己的autoloader程序。
* 直接下载安装SDK 没有依赖其他第三方库,但需要参照 composer autoloader增加一个自己的 autoloader 程序。
## 运行环境
@ -31,10 +32,10 @@ $ composer require qiniu/php-sdk
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
...
$upManager = new UploadManager();
$uploadMgr = new UploadManager();
$auth = new Auth($accessKey, $secretKey);
$token = $auth->uploadToken($bucketName);
list($ret, $error) = $upManager->put($token, 'formput', 'hello world');
$token = $auth->uploadToken($bucket);
list($ret, $error) = $uploadMgr->putFile($token, 'key', 'filePath');
...
```
@ -46,8 +47,8 @@ $ ./vendor/bin/phpunit tests/Qiniu/Tests/
## 常见问题
- $error保留了请求响应的信息失败情况下ret 为none, 将$error可以打印出来提交给我们。
- API 的使用 demo 可以参考 [单元测试](https://github.com/qiniu/php-sdk/blob/master/tests)。
- `$error` 保留了请求响应的信息,失败情况下 `ret` `none`, 将 `$error` 可以打印出来,提交给我们。
- API 的使用 demo 可以参考 [examples](https://github.com/qiniu/php-sdk/tree/master/examples)。
## 代码贡献
@ -60,12 +61,12 @@ $ ./vendor/bin/phpunit tests/Qiniu/Tests/
## 联系我们
- 如果需要帮助请提交工单在portal右侧点击咨询和建议提交工单或者直接向 support@qiniu.com 发送邮件)
- 如果有什么问题,可以到问答社区提问,[问答社区](http://qiniu.segmentfault.com/)
- 更详细的文档,见[官方文档站](http://developer.qiniu.com/)
- 如果发现了bug 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果有什么问题,可以到问答社区提问,[问答社区](https://qiniu.segmentfault.com/)
- 更详细的文档,见[官方文档站](https://developer.qiniu.com/)
- 如果发现了 bug 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果要提交代码,欢迎提交 pull request
- 欢迎关注我们的[微信](http://www.qiniu.com/#weixin) [微博](http://weibo.com/qiniutek),及时获取动态信息。
- 欢迎关注我们的[微信](https://www.qiniu.com/#weixin) [微博](https://weibo.com/qiniutek),及时获取动态信息。
## 代码许可

View File

@ -1,71 +0,0 @@
# Rtc Streaming Cloud Server-Side Library For PHP
## Features
- Appclient
- [x] 创建房间: client->createApp()
- [x] 查看房间: client->getApp()
- [x] 删除房间: client->deleteApp()
- [x] 生成房间token: client->appToken()
## Contents
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [App](#app)
- [Create a app](#create-a-app)
- [Get a app](#get-a-app)
- [Delete a app](#delete-a-app)
- [Generate a app token](#generate-a-app-token)
## Usage
### App
#### Create a app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->createApp("901","testApp");
print_r($resp);
```
#### Get an app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->getApp("deq02uhb6");
print_r($resp);
```
#### Delete an app
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->deleteApp("deq02uhb6");
print_r($resp);
```
#### Generate an app token
```php
$ak = "gwd_gV4gPKZZsmEOvAuNU1AcumicmuHooTfu64q5";
$sk = "xxxx";
$auth = new Auth($ak, $sk);
$client = new Qiniu\Rtc\AppClient($auth);
$resp=$client->appToken("deq02uhb6", "lfx", '1111', (time()+3600), 'user');
print_r($resp);
```

Some files were not shown because too many files have changed in this diff Show More