diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php index 6ebe081b6..b1b874a06 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php @@ -16,7 +16,9 @@ namespace app\adminapi\controller\v1\setting; use app\adminapi\controller\AuthController; use app\services\system\SystemCrudServices; +use app\services\system\SystemMenusServices; use think\facade\App; +use think\helper\Str; /** * Class SystemCrud @@ -39,11 +41,23 @@ class SystemCrud extends AuthController $this->services = $services; } + /** + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ public function index() { - + return app('json')->success($this->services->getList()); } + /** + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ public function save() { $data = $this->request->postMore([ @@ -61,7 +75,82 @@ class SystemCrud extends AuthController ]); $this->services->createCrud($data); + + return app('json')->success('创建成功'); } + /** + * 获取创建文件的目录存放位置 + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function getFilePath() + { + [$menuName, $tableName, $fromField, $columnField] = $this->request->postMore([ + ['menuName', ''], + ['tableName', ''], + ['fromField', []], + ['columnField', []], + ], true); + $routeName = 'crud/' . Str::snake($tableName); + + $make = $this->services->makeFile($tableName, $routeName, false, [ + 'menuName' => $menuName, + 'fromField' => $fromField, + 'columnField' => $columnField, + ]); + + $makePath = []; + foreach ($make as $key => $item) { + $makePath[$key] = $item['path']; + } + + return app('json')->success($makePath); + } + + /** + * 获取tree菜单 + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function getMenus() + { + return app('json')->success(app()->make(SystemMenusServices::class) + ->getList(['auth_type' => 1], ['pid', 'id', 'menu_name as label', 'id as value'])); + } + + /** + * 获取创建表数据类型 + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function columnType() + { + return app('json')->success($this->services->getTabelRule()); + } + + /** + * @param $id + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function delete($id) + { + if (!$id) { + return app('json')->fail('缺少参数'); + } + + $this->services->delete($id); + + return app('json')->success('删除成功'); + } } diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php index 234bd459b..e00e5e15d 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php @@ -13,6 +13,7 @@ namespace app\adminapi\controller\v1\setting; use app\adminapi\controller\AuthController; use app\services\system\SystemMenusServices; +use app\services\system\SystemRouteServices; use think\facade\App; use think\facade\Route; @@ -97,6 +98,39 @@ class SystemMenus extends AuthController } } + /** + * 批量保存权限 + * @return \think\Response + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function batchSave() + { + $menus = $this->request->post('menus', []); + if (!$menus) { + return app('json')->fail(100026); + } + $data = []; + + foreach ($menus as $menu) { + if (empty($menu['menu_name'])) { + return app('json')->fail(400198); + } + $data[] = [ + 'methods' => $menu['method'], + 'menu_name' => $menu['menu_name'], + 'unique_auth' => $menu['unique_auth'] ?? '', + 'api_url' => $menu['api_url'], + 'pid' => $menu['path'], + ]; + } + + $this->services->saveAll($data); + + return app('json')->success(100021); + } + /** * 获取一条菜单权限信息 * @param int $id @@ -222,25 +256,14 @@ class SystemMenus extends AuthController public function ruleList() { //获取所有的路由 - $this->app = app(); - $this->app->route->setTestMode(true); - $this->app->route->clear(); - $path = $this->app->getRootPath() . 'app' . DS . 'adminapi' . DS . 'route' . DS; - $files = is_dir($path) ? scandir($path) : []; - foreach ($files as $file) { - if (strpos($file, '.php')) { - include $path . $file; - } - } - $ruleList = $this->app->route->getRuleList(); + $ruleList = app()->make(SystemRouteServices::class)->selectList(['app_name' => 'adminapi'], 'name,path,method,type,id'); $menuApiList = $this->services->getColumn(['auth_type' => 2, 'is_del' => 0], "concat(`api_url`,'_',lower(`methods`)) as rule"); if ($menuApiList) $menuApiList = array_column($menuApiList, 'rule'); $list = []; foreach ($ruleList as $item) { - $item['rule'] = str_replace('adminapi/', '', $item['rule']); - if (!in_array($item['rule'] . '_' . $item['method'], $menuApiList)) { - $item['real_name'] = $item['option']['real_name'] ?? ''; - unset($item['option']); + $item['path'] = str_replace('adminapi/', '', $item['path']); + if (!in_array($item['path'] . '_' . $item['method'], $menuApiList)) { + $item['real_name'] = $item['name'] ?? ''; $item['method'] = strtoupper($item['method']); $list[] = $item; } diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemRouteCate.php b/crmeb/app/adminapi/controller/v1/setting/SystemRouteCate.php index 985fe1d94..fd2f5eb17 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemRouteCate.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemRouteCate.php @@ -101,7 +101,7 @@ class SystemRouteCate extends AuthController */ public function edit($id) { - return app('json')->success($this->services->getFrom($id)); + return app('json')->success($this->services->getFrom($id, $this->request->get('app_name', 'adminapi'))); } /** diff --git a/crmeb/app/adminapi/route/agent.php b/crmeb/app/adminapi/route/agent.php index fce8d2fd3..d5d1244e0 100644 --- a/crmeb/app/adminapi/route/agent.php +++ b/crmeb/app/adminapi/route/agent.php @@ -42,13 +42,30 @@ Route::group('agent', function () { Route::get('config/edit_basics', 'v1.setting.SystemConfig/edit_basics')->option(['real_name' => '积分配置编辑表单']); //积分配置保存数据 Route::post('config/save_basics', 'v1.setting.SystemConfig/save_basics')->option(['real_name' => '积分配置保存数据']); - //分销员等级资源路由 - Route::resource('level', 'v1.agent.AgentLevel')->name('AgentLevelResource')->option(['real_name' => '分销员等级']); + Route::resource('level', 'v1.agent.AgentLevel')->except(['read'])->name('AgentLevel')->option([ + 'real_name' => [ + 'index' => '获取分销员等级列表', + 'create' => '获取分销员等级表单', + 'save' => '保存分销员等级', + 'edit' => '获取修改分销员等级表单', + 'update' => '修改分销员等级', + 'delete' => '删除分销员等级' + ] + ]); //修改分销等级状态 Route::put('level/set_status/:id/:status', 'v1.agent.AgentLevel/set_status')->name('levelSetStatus')->option(['real_name' => '修改分销等级状态']); //分销员等级任务资源路由 - Route::resource('level_task', 'v1.agent.AgentLevelTask')->name('AgentLevelTaskResource')->option(['real_name' => '分销员等级任务']); + Route::resource('level_task', 'v1.agent.AgentLevelTask')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取分销员等级任务列表', + 'create' => '获取分销员等级任务表单', + 'save' => '保存分销员等级任务', + 'edit' => '获取修改分销员等级任务表单', + 'update' => '修改分销员等级任务', + 'delete' => '删除分销员等级任务' + ] + ]); //修改分销任务状态 Route::put('level_task/set_status/:id/:status', 'v1.agent.AgentLevelTask/set_status')->name('levelTaskSetStatus')->option(['real_name' => '修改分销等级任务状态']); //获取赠送分销等级表单 @@ -66,10 +83,10 @@ Route::group('agent', function () { Route::post('division/agent/save', 'v1.agent.Division/divisionAgentSave')->name('divisionAgentSave')->option(['real_name' => '事业部保存']);//代理商保存 Route::put('division/set_status/:status/:uid', 'v1.agent.Division/setDivisionStatus')->name('setDivisionStatus')->option(['real_name' => '状态切换']);//状态切换 Route::delete('division/del/:type/:uid', 'v1.agent.Division/delDivision')->name('delDivision')->option(['real_name' => '删除代理商']);//状态切换 - Route::get('division/agent_apply/list','v1.agent.Division/AdminApplyList')->name('AdminApplyList')->option(['real_name'=>'代理商申请列表']);//代理商申请列表 - Route::get('division/examine_apply/:id/:type','v1.agent.Division/examineApply')->name('examineApply')->option(['real_name'=>'审核表单']);//审核表单 - Route::post('division/apply_agent/save','v1.agent.Division/applyAgentSave')->name('applyAgentSave')->option(['real_name'=>'提交审核']);//提交审核 - Route::delete('division/del_apply/:id','v1.agent.Division/delApply')->name('delApply')->option(['real_name'=>'删除审核']);//删除审核 + Route::get('division/agent_apply/list', 'v1.agent.Division/AdminApplyList')->name('AdminApplyList')->option(['real_name' => '代理商申请列表']);//代理商申请列表 + Route::get('division/examine_apply/:id/:type', 'v1.agent.Division/examineApply')->name('examineApply')->option(['real_name' => '审核表单']);//审核表单 + Route::post('division/apply_agent/save', 'v1.agent.Division/applyAgentSave')->name('applyAgentSave')->option(['real_name' => '提交审核']);//提交审核 + Route::delete('division/del_apply/:id', 'v1.agent.Division/delApply')->name('delApply')->option(['real_name' => '删除审核']);//删除审核 })->middleware([ \app\http\middleware\AllowOriginMiddleware::class, diff --git a/crmeb/app/adminapi/route/app.php b/crmeb/app/adminapi/route/app.php index e6077701c..48d9fe869 100644 --- a/crmeb/app/adminapi/route/app.php +++ b/crmeb/app/adminapi/route/app.php @@ -15,7 +15,16 @@ use think\facade\Route; */ Route::group('app', function () { //小程序模板资源路由 - Route::resource('routine', 'v1.application.routine.RoutineTemplate')->name('RoutineResource')->option(['real_name' => '小程序订阅消息']); + Route::resource('routine', 'v1.application.routine.RoutineTemplate')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取小程序订阅消息列表', + 'create' => '获取小程序订阅消息表单', + 'save' => '保存小程序订阅消息', + 'edit' => '获取修改小程序订阅消息表单', + 'update' => '修改小程序订阅消息', + 'delete' => '删除小程序订阅消息' + ] + ]); //一键同步订阅消息 Route::get('routine/syncSubscribe', 'v1.application.routine.RoutineTemplate/syncSubscribe')->name('syncSubscribe')->option(['real_name' => '一键同步订阅消息']); //一键同步微信模版消息消息 @@ -27,7 +36,16 @@ Route::group('app', function () { //保存菜单 Route::post('wechat/menu', 'v1.application.wechat.menus/save')->option(['real_name' => '保存微信公众号菜单']); //微信模板消息资源路由 - Route::resource('wechat/template', 'v1.application.wechat.WechatTemplate')->name('WechatTemplateResource')->option(['real_name' => '公众号模版消息']); + Route::resource('wechat/template', 'v1.application.wechat.WechatTemplate')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取公众号模版消息列表', + 'create' => '获取公众号模版消息表单', + 'save' => '保存公众号模版消息', + 'edit' => '获取修改公众号模版消息表单', + 'update' => '修改公众号模版消息', + 'delete' => '删除公众号模版消息' + ] + ]); //微信模板消息修改状态 Route::put('wechat/template/set_status/:id/:status', 'v1.application.wechat.WechatTemplate/set_status')->name('WechatTemplateSetStatus')->option(['real_name' => '修改关键字回复状态']); //关注回复 @@ -78,11 +96,36 @@ Route::group('app', function () { /** 客服相关 */ //客服反馈接口 - Route::resource('feedback', 'v1.kefu.StoreServiceFeedback')->only(['index', 'delete', 'update', 'edit'])->option(['real_name' => '用户反馈']); + Route::resource('feedback', 'v1.kefu.StoreServiceFeedback')->only(['index', 'delete', 'update', 'edit'])->option([ + 'real_name' => [ + 'index' => '获取用户反馈列表', + 'edit' => '获取修改用户反馈表单', + 'update' => '修改用户反馈', + 'delete' => '删除用户反馈' + ] + ]); //话术接口 - Route::resource('wechat/speechcraft', 'v1.kefu.StoreServiceSpeechcraft')->option(['real_name' => '客服话术']); + Route::resource('wechat/speechcraft', 'v1.kefu.StoreServiceSpeechcraft')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取客服话术列表', + 'create' => '获取客服话术表单', + 'save' => '保存客服话术', + 'edit' => '获取修改客服话术表单', + 'update' => '修改客服话术', + 'delete' => '删除客服话术' + ] + ]); //话术分类接口 - Route::resource('wechat/speechcraftcate', 'v1.kefu.StoreServiceSpeechcraftCate')->option(['real_name' => '客服话术分类']); + Route::resource('wechat/speechcraftcate', 'v1.kefu.StoreServiceSpeechcraftCate')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取客服话术分类列表', + 'create' => '获取客服话术分类表单', + 'save' => '保存客服话术分类', + 'edit' => '获取修改客服话术分类表单', + 'update' => '修改客服话术分类', + 'delete' => '删除客服话术分类' + ] + ]); //客服列表 Route::get('wechat/kefu', 'v1.kefu.StoreService/index')->option(['real_name' => '客服列表']); //客服登录 diff --git a/crmeb/app/adminapi/route/cms.php b/crmeb/app/adminapi/route/cms.php index 4495ad388..c01758fe2 100644 --- a/crmeb/app/adminapi/route/cms.php +++ b/crmeb/app/adminapi/route/cms.php @@ -15,13 +15,31 @@ use think\facade\Route; */ Route::group('cms', function () { //文章资源路由 - Route::resource('cms', 'v1.cms.Article')->name('ArticleResource')->option(['real_name' => '文章']); + Route::resource('cms', 'v1.cms.Article')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取文章列表', + 'create' => '获取文章表单', + 'save' => '保存文章', + 'edit' => '获取修改文章表单', + 'update' => '修改文章', + 'delete' => '删除文章' + ] + ]); //关联商品 Route::put('cms/relation/:id', 'v1.cms.Article/relation')->name('Relation')->option(['real_name' => '文章关联商品']); //取消关联 Route::put('cms/unrelation/:id', 'v1.cms.Article/unrelation')->name('UnRelation')->option(['real_name' => '取消文章关联商品']); //文章分类资源路由 - Route::resource('category', 'v1.cms.ArticleCategory')->name('ArticleCategoryResource')->option(['real_name' => '文章分类']); + Route::resource('category', 'v1.cms.ArticleCategory')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取文章分类列表', + 'create' => '获取文章分类表单', + 'save' => '保存文章分类', + 'edit' => '获取修改文章分类表单', + 'update' => '修改文章分类', + 'delete' => '删除文章分类' + ] + ]); //修改状态 Route::put('category/set_status/:id/:status', 'v1.cms.ArticleCategory/set_status')->name('CategoryStatus')->option(['real_name' => '修改文章分类状态']); //分类列表 diff --git a/crmeb/app/adminapi/route/file.php b/crmeb/app/adminapi/route/file.php index 5779549bc..20f00c334 100644 --- a/crmeb/app/adminapi/route/file.php +++ b/crmeb/app/adminapi/route/file.php @@ -27,7 +27,17 @@ Route::group('file', function () { //上传图片 Route::post('upload/[:upload_type]', 'v1.file.SystemAttachment/upload')->option(['real_name' => '上传图片', 'is_common' => true]); //附件分类管理资源路由 - Route::resource('category', 'v1.file.SystemAttachmentCategory')->option(['real_name' => '附件分类管理', 'is_common' => true]); + Route::resource('category', 'v1.file.SystemAttachmentCategory')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取附件分类管理列表', + 'create' => '获取附件分类管理表单', + 'save' => '保存附件分类管理', + 'edit' => '获取修改附件分类管理表单', + 'update' => '修改附件分类管理', + 'delete' => '删除附件分类管理' + ], + 'is_common' => true + ]); //获取上传类型 Route::get('upload_type', 'v1.file.SystemAttachment/uploadType')->option(['real_name' => '上传类型', 'is_common' => true]); //分片上传本地视频 diff --git a/crmeb/app/adminapi/route/freight.php b/crmeb/app/adminapi/route/freight.php index a33e19254..271fa6a3e 100644 --- a/crmeb/app/adminapi/route/freight.php +++ b/crmeb/app/adminapi/route/freight.php @@ -15,7 +15,16 @@ use think\facade\Route; */ Route::group('freight', function () { //物流公司资源路由 - Route::resource('express', 'v1.freight.Express')->name('ExpressResource')->option(['real_name' => '物流公司']); + Route::resource('express', 'v1.freight.Express')->except(['read'])->name('ExpressResource')->option([ + 'real_name' => [ + 'index' => '获取物流公司列表', + 'create' => '获取物流公司表单', + 'save' => '保存物流公司', + 'edit' => '获取修改物流公司表单', + 'update' => '修改物流公司', + 'delete' => '删除物流公司' + ], + ]); //修改状态 Route::put('express/set_status/:id/:status', 'v1.freight.Express/set_status')->option(['real_name' => '修改物流公司状态']); //同步物流快递公司 diff --git a/crmeb/app/adminapi/route/marketing.php b/crmeb/app/adminapi/route/marketing.php index 5fed6a69a..af81edda4 100644 --- a/crmeb/app/adminapi/route/marketing.php +++ b/crmeb/app/adminapi/route/marketing.php @@ -182,12 +182,14 @@ Route::group('marketing', function () { Route::post('lottery/record/deliver', 'v1.marketing.lottery.LuckLotteryRecord/deliver')->option(['real_name' => '抽奖中奖发货、备注处理']); //积分记录 - Route::get('point_record', 'v1.marketing.integral.StorePointRecord/pointRecord')->option(['read_name' => '积分记录列表']); - Route::post('point_record/remark/:id', 'v1.marketing.integral.StorePointRecord/pointRecordRemark')->option(['read_name' => '积分记录列表备注']); - Route::get('point/get_basic', 'v1.marketing.integral.StorePointRecord/getBasic')->option(['read_name' => '积分统计基本信息']); - Route::get('point/get_trend', 'v1.marketing.integral.StorePointRecord/getTrend')->option(['read_name' => '积分统计趋势图']); - Route::get('point/get_channel', 'v1.marketing.integral.StorePointRecord/getChannel')->option(['read_name' => '积分来源统计']); - Route::get('point/get_type', 'v1.marketing.integral.StorePointRecord/getType')->option(['read_name' => '积分消耗统计']); + Route::get('point_record', 'v1.marketing.integral.StorePointRecord/pointRecord')->option(['real_name' => '积分记录列表']); + Route::post('point_record/remark/:id', 'v1.marketing.integral.StorePointRecord/pointRecordRemark')->option(['real_name' => '积分记录列表备注']); + Route::get('point/get_basic', 'v1.marketing.integral.StorePointRecord/getBasic')->option(['real_name' => '积分统计基本信息']); + Route::get('point/get_trend', 'v1.marketing.integral.StorePointRecord/getTrend')->option(['real_name' => '积分统计趋势图']); + //积分来源统计 + Route::get('point/get_channel', 'v1.marketing.integral.StorePointRecord/getChannel')->option(['real_name' => '积分来源统计']); + //积分消耗统计 + Route::get('point/get_type', 'v1.marketing.integral.StorePointRecord/getType')->option(['real_name' => '积分消耗统计']); })->middleware([ \app\http\middleware\AllowOriginMiddleware::class, diff --git a/crmeb/app/adminapi/route/setting.php b/crmeb/app/adminapi/route/setting.php index b50ac455a..df0aa7b63 100644 --- a/crmeb/app/adminapi/route/setting.php +++ b/crmeb/app/adminapi/route/setting.php @@ -16,7 +16,16 @@ use think\facade\Route; Route::group('setting', function () { //管理员资源路由 - Route::resource('admin', 'v1.setting.SystemAdmin')->except(['read'])->option(['real_name' => '管理员']); + Route::resource('admin', 'v1.setting.SystemAdmin')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取管理员列表', + 'create' => '获取管理员表单', + 'save' => '保存管理员', + 'edit' => '获取修改管理员表单', + 'update' => '修改管理员', + 'delete' => '删除管理员' + ] + ]); //退出登陆 Route::get('admin/logout', 'v1.setting.SystemAdmin/logout')->name('SystemAdminLogout')->option(['real_name' => '退出登陆']); //修改状态 @@ -27,8 +36,20 @@ Route::group('setting', function () { Route::put('update_admin', 'v1.setting.SystemAdmin/update_admin')->name('SystemAdminUpdateAdmin')->option(['real_name' => '修改当前管理员信息']); //设置文件管理密码 Route::put('set_file_password', 'v1.setting.SystemAdmin/set_file_password')->name('SystemAdminSetFilePassword')->option(['real_name' => '设置当前文件管理密码']); + //批量保存权限 + Route::post('menus/batch', 'v1.setting.SystemMenus/batchSave')->name('SystemMenusBatchSave')->option(['real_name' => '批量保存权限']); //权限菜单资源路由 - Route::resource('menus', 'v1.setting.SystemMenus')->option(['real_name' => '权限菜单']); + Route::resource('menus', 'v1.setting.SystemMenus')->option([ + 'real_name' => [ + 'index' => '获取权限菜单列表', + 'create' => '获取权限菜单表单', + 'save' => '保存权限菜单', + 'edit' => '获取修改权限菜单表单', + 'read' => '查看权限菜单信息', + 'update' => '修改权限菜单', + 'delete' => '删除权限菜单' + ], + ]); //未添加的权限规则列表 Route::get('ruleList', 'v1.setting.SystemMenus/ruleList')->option(['real_name' => '未添加的权限规则列表']); //修改显示 @@ -46,11 +67,29 @@ Route::group('setting', function () { //删除身份 Route::delete('role/:id', 'v1.setting.SystemRole/delete')->option(['real_name' => '删除管理员身份']); //配置分类资源路由 - Route::resource('config_class', 'v1.setting.SystemConfigTab')->option(['real_name' => '系统配置分类']); + Route::resource('config_class', 'v1.setting.SystemConfigTab')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取系统配置分类列表', + 'create' => '获取系统配置分类表单', + 'save' => '保存系统配置分类', + 'edit' => '获取修改系统配置分类表单', + 'update' => '修改系统配置分类', + 'delete' => '删除系统配置分类' + ], + ]); //修改配置分类状态 Route::put('config_class/set_status/:id/:status', 'v1.setting.SystemConfigTab/set_status')->option(['real_name' => '修改配置分类状态']); //配置资源路由 - Route::resource('config', 'v1.setting.SystemConfig')->option(['real_name' => '系统配置']); + Route::resource('config', 'v1.setting.SystemConfig')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取系统配置列表', + 'create' => '获取系统配置表单', + 'save' => '保存系统配置', + 'edit' => '获取修改系统配置表单', + 'update' => '修改系统配置', + 'delete' => '删除系统配置' + ] + ]); //修改配置状态 Route::put('config/set_status/:id/:status', 'v1.setting.SystemConfig/set_status')->option(['real_name' => '修改配置状态']); //基本配置编辑表单 @@ -66,11 +105,29 @@ Route::group('setting', function () { //获取某个分类下的所有配置信息 Route::get('config_list/:tabId', 'v1.setting.SystemConfig/get_config_list')->option(['real_name' => '获取某个分类下的所有配置信息']); //组合数据资源路由 - Route::resource('group', 'v1.setting.SystemGroup')->option(['real_name' => '组合数据']); + Route::resource('group', 'v1.setting.SystemGroup')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取组合数据列表', + 'create' => '获取组合数据表单', + 'save' => '保存组合数据', + 'edit' => '获取修改组合数据表单', + 'update' => '修改组合数据', + 'delete' => '删除组合数据' + ] + ]); //组合数据全部 Route::get('group_all', 'v1.setting.SystemGroup/getGroup')->option(['real_name' => '组合数据全部']); //组合数据子数据资源路由 - Route::resource('group_data', 'v1.setting.SystemGroupData')->option(['real_name' => '组合数据子数据']); + Route::resource('group_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取组合数据子数据列表', + 'create' => '获取组合数据子数据表单', + 'save' => '保存组合数据子数据', + 'edit' => '获取修改组合数据子数据表单', + 'update' => '修改组合数据子数据', + 'delete' => '删除组合数据子数据' + ] + ]); //修改数据状态 Route::get('group_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '组合数据头部']); //修改数据状态 @@ -105,34 +162,77 @@ Route::group('setting', function () { Route::get('get_kf_adv', 'v1.setting.SystemGroupData/getKfAdv')->option(['real_name' => '获取客服广告']); //设置客服广告 Route::post('set_kf_adv', 'v1.setting.SystemGroupData/setKfAdv')->option(['real_name' => '设置客服广告']); - - //签到天数配置资源 - Route::resource('sign_data', 'v1.setting.SystemGroupData')->option(['real_name' => '签到天数配置']); + Route::resource('sign_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取签到天数配置列表', + 'create' => '获取签到天数配置表单', + 'save' => '保存签到天数配置', + 'edit' => '获取修改签到天数配置表单', + 'update' => '修改签到天数配置', + 'delete' => '删除签到天数配置' + ] + ]); //签到数据字段 Route::get('sign_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '签到数据头部']); //修改签到数据状态 Route::put('sign_data/set_status/:id/:status', 'v1.setting.SystemGroupData/set_status')->option(['real_name' => '修改签到数据状态']); //订单详情动态图配置资源 - Route::resource('order_data', 'v1.setting.SystemGroupData')->option(['real_name' => '订单详情动态图配置资源']); + Route::resource('order_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取订单详情动态图列表', + 'create' => '获取订单详情动态图表单', + 'save' => '保存订单详情动态图', + 'edit' => '获取修改订单详情动态图表单', + 'update' => '修改订单详情动态图', + 'delete' => '删除订单详情动态图' + ] + ]); //订单数据字段 Route::get('order_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '订单数据字段']); //订单数据状态 Route::put('order_data/set_status/:id/:status', 'v1.setting.SystemGroupData/set_status')->option(['real_name' => '订单数据状态']); //个人中心菜单配置资源 - Route::resource('usermenu_data', 'v1.setting.SystemGroupData')->option(['real_name' => '个人中心菜单']); + Route::resource('usermenu_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取个人中心菜单列表', + 'create' => '获取个人中心菜单表单', + 'save' => '保存个人中心菜单', + 'edit' => '获取修改个人中心菜单表单', + 'update' => '修改个人中心菜单', + 'delete' => '删除个人中心菜单' + ] + ]); //个人中心菜单数据字段 Route::get('usermenu_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '个人中心菜单数据字段']); //个人中心菜单数据状态 Route::put('usermenu_data/set_status/:id/:status', 'v1.setting.SystemGroupData/set_status')->option(['real_name' => '个人中心菜单数据状态']); //分享海报配置资源 - Route::resource('poster_data', 'v1.setting.SystemGroupData')->option(['real_name' => '分享海报']); + Route::resource('poster_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取分享海报列表', + 'create' => '获取分享海报表单', + 'save' => '保存分享海报', + 'edit' => '获取修改分享海报表单', + 'update' => '修改分享海报', + 'delete' => '删除分享海报' + ] + ]); //分享海报数据字段 Route::get('poster_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '分享海报数据字段']); //分享海报数据状态 Route::put('poster_data/set_status/:id/:status', 'v1.setting.SystemGroupData/set_status')->option(['real_name' => '分享海报数据状态']); //秒杀配置资源 - Route::resource('seckill_data', 'v1.setting.SystemGroupData')->option(['real_name' => '秒杀配置']); + Route::resource('seckill_data', 'v1.setting.SystemGroupData')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取分秒杀配置列表', + 'create' => '获取秒杀配置表单', + 'save' => '保存秒杀配置', + 'edit' => '获取修改秒杀配置表单', + 'update' => '修改秒杀配置', + 'delete' => '删除秒杀配置' + ] + ]); //秒杀数据字段 Route::get('seckill_data/header', 'v1.setting.SystemGroupData/header')->option(['real_name' => '秒杀数据字段']); //秒杀数据状态 diff --git a/crmeb/app/adminapi/route/system.php b/crmeb/app/adminapi/route/system.php index ea4396745..ccb3816c3 100644 --- a/crmeb/app/adminapi/route/system.php +++ b/crmeb/app/adminapi/route/system.php @@ -121,7 +121,7 @@ Route::group('system', function () { //保存路由权限 Route::post('route/:id', 'v1.setting.SystemRoute/save')->option(['real_name' => '保存路由权限']); //路由分类 - Route::resource('route_cate', 'v1.setting.SystemRouteCate')->option([ + Route::resource('route_cate', 'v1.setting.SystemRouteCate')->except(['read'])->option([ 'real_name' => [ 'index' => '获取路由分类列表', 'create' => '获取创建路由分类表单', @@ -131,7 +131,18 @@ Route::group('system', function () { 'delete' => '删除路由分类' ], ]); - + //获取CRUD列表 + Route::get('crud/column_type', 'v1.setting.SystemCrud/columnType')->option(['real_name' => '获取CRUD列表']); + //获取菜单TREE形数据 + Route::get('crud/menus', 'v1.setting.SystemCrud/getMenus')->option(['real_name' => '获取菜单TREE形数据']); + //获取CRUD文件存放 + Route::post('crud/file_path', 'v1.setting.SystemCrud/getFilePath')->option(['real_name' => '获取CRUD文件存放']); + //删除CRUD + Route::delete('crud/:id', 'v1.setting.SystemCrud/delete')->option(['real_name' => '删除CRUD']); + //获取CRUD列表 + Route::get('crud', 'v1.setting.SystemCrud/index')->option(['real_name' => '获取CRUD列表']); + //保存生成CRUD + Route::post('crud', 'v1.setting.SystemCrud/save')->option(['real_name' => '保存生成CRUD']); })->middleware([ \app\http\middleware\AllowOriginMiddleware::class, \app\adminapi\middleware\AdminAuthTokenMiddleware::class, diff --git a/crmeb/app/adminapi/route/user.php b/crmeb/app/adminapi/route/user.php index d53d2acca..3b887a786 100644 --- a/crmeb/app/adminapi/route/user.php +++ b/crmeb/app/adminapi/route/user.php @@ -15,7 +15,16 @@ use think\facade\Route; */ Route::group('user', function () { //用户管理资源路由 - Route::resource('user', 'v1.user.user')->option(['real_name' => '用户']); + Route::resource('user', 'v1.user.user')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取用户列表', + 'create' => '获取用户表单', + 'save' => '保存用户', + 'edit' => '获取修改用户表单', + 'update' => '修改用户', + 'delete' => '删除用户' + ] + ]); //添加用户保存 Route::post('user/save', 'v1.user.user/save_info')->option(['real_name' => '添加用户']); //同步微信用户 @@ -98,7 +107,16 @@ Route::group('user', function () { //设置会员分组 Route::put('save_set_label', 'v1.user.user/save_set_label')->option(['real_name' => '保存用户标签']); //标签分类 - Route::resource('user_label_cate', 'v1.user.UserLabelCate')->option(['real_name' => '标签分类']); + Route::resource('user_label_cate', 'v1.user.UserLabelCate')->except(['read'])->option([ + 'real_name' => [ + 'index' => '获取标签分类', + 'create' => '获取标签分类表单', + 'save' => '保存标签分类', + 'edit' => '获取修改标签分类表单', + 'update' => '修改标签分类', + 'delete' => '删除标签分类' + ] + ]); Route::get('user_label_cate/all', 'v1.user.user_label_cate/getAll')->option(['real_name' => '获取用户标签分类全部']); //会员卡批次列表资源 diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php index 8cfb30181..ca604a7b3 100644 --- a/crmeb/app/dao/BaseDao.php +++ b/crmeb/app/dao/BaseDao.php @@ -46,12 +46,13 @@ abstract class BaseDao /** * 读取数据条数 * @param array $where + * @param bool $search * @return int * @throws \ReflectionException */ - public function count(array $where = []) + public function count(array $where = [], bool $search = true) { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } /** @@ -324,7 +325,6 @@ abstract class BaseDao $with = []; $otherWhere = []; $responses = new \ReflectionClass($this->setModel()); - foreach ($where as $key => $value) { $method = 'search' . Str::studly($key) . 'Attr'; if ($responses->hasMethod($method)) { @@ -352,10 +352,29 @@ abstract class BaseDao { [$with, $otherWhere] = $this->getSearchData($where); return $this->getModel()->withSearch($with, $where)->when($search, function ($query) use ($otherWhere) { - $query->where($otherWhere); + $query->where($this->filterWhere($otherWhere)); }); } + /** + * 过滤数据表中不存在的where条件字段 + * @param array $where + * @return array + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/04/11 + */ + protected function filterWhere(array $where = []) + { + $fields = $this->getModel()->getTableFields(); + foreach ($where as $key => $item) { + if (!in_array($item[0], $fields)) { + unset($where[$key]); + } + } + return $where; + } + /** * 搜索 * @param array $where diff --git a/crmeb/app/dao/activity/combination/StoreCombinationDao.php b/crmeb/app/dao/activity/combination/StoreCombinationDao.php index ef78215ce..f8f14349a 100644 --- a/crmeb/app/dao/activity/combination/StoreCombinationDao.php +++ b/crmeb/app/dao/activity/combination/StoreCombinationDao.php @@ -65,12 +65,13 @@ class StoreCombinationDao extends BaseDao /** * 获取指定条件下的条数 * @param array $where + * @param bool $search * @return int * @throws \ReflectionException */ - public function count(array $where = []): int + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } /** diff --git a/crmeb/app/dao/activity/integral/StoreIntegralDao.php b/crmeb/app/dao/activity/integral/StoreIntegralDao.php index 94df3303b..a39f9faeb 100644 --- a/crmeb/app/dao/activity/integral/StoreIntegralDao.php +++ b/crmeb/app/dao/activity/integral/StoreIntegralDao.php @@ -35,11 +35,13 @@ class StoreIntegralDao extends BaseDao /** * 获取指定条件下的条数 * @param array $where + * @param bool $search * @return int + * @throws \ReflectionException */ - public function count(array $where = []): int + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } /** diff --git a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php index 31f6142bc..c9af9bc1f 100644 --- a/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php +++ b/crmeb/app/dao/activity/integral/StoreIntegralOrderDao.php @@ -89,11 +89,13 @@ class StoreIntegralOrderDao extends BaseDao /** * 获取订单总数 * @param array $where + * @param bool $search * @return int + * @throws \ReflectionException */ - public function count(array $where = []): int + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } /** diff --git a/crmeb/app/dao/order/OtherOrderDao.php b/crmeb/app/dao/order/OtherOrderDao.php index 770eddaf5..c5e6f1437 100644 --- a/crmeb/app/dao/order/OtherOrderDao.php +++ b/crmeb/app/dao/order/OtherOrderDao.php @@ -181,8 +181,17 @@ class OtherOrderDao extends BaseDao }); } - public function count(array $where = []): int + /** + * @param array $where + * @param bool $search + * @return int + * @throws \ReflectionException + * @author 吴汐 + * @email 442384644@qq.com + * @date 2023/04/11 + */ + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } } diff --git a/crmeb/app/dao/order/StoreOrderDao.php b/crmeb/app/dao/order/StoreOrderDao.php index 703c88d6b..67c94b37c 100644 --- a/crmeb/app/dao/order/StoreOrderDao.php +++ b/crmeb/app/dao/order/StoreOrderDao.php @@ -263,11 +263,13 @@ class StoreOrderDao extends BaseDao /** * 获取订单总数 * @param array $where + * @param bool $search * @return int + * @throws \ReflectionException */ - public function count(array $where = []): int + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->count(); + return $this->search($where, $search)->count(); } /** diff --git a/crmeb/app/dao/product/product/StoreProductLogDao.php b/crmeb/app/dao/product/product/StoreProductLogDao.php index 8285db7fe..58fa07cae 100644 --- a/crmeb/app/dao/product/product/StoreProductLogDao.php +++ b/crmeb/app/dao/product/product/StoreProductLogDao.php @@ -28,7 +28,7 @@ class StoreProductLogDao extends BaseDao public function getRanking($where) { - return $this->search($where)->with('storeName') + return $this->search($where, false)->with('storeName') ->field([ 'product_id', 'SUM(visit_num) as visit', @@ -47,7 +47,7 @@ class StoreProductLogDao extends BaseDao public function getRepeats($where, $product_id) { - return count($this->search($where)->where('type', 'pay')->where('product_id', $product_id)->field('count(pay_uid) as p')->group('pay_uid')->having('p>1')->select()); + return count($this->search($where, false)->where('type', 'pay')->where('product_id', $product_id)->field('count(pay_uid) as p')->group('pay_uid')->having('p>1')->select()); } /** diff --git a/crmeb/app/dao/system/SystemMenusDao.php b/crmeb/app/dao/system/SystemMenusDao.php index 276276604..a410beef4 100644 --- a/crmeb/app/dao/system/SystemMenusDao.php +++ b/crmeb/app/dao/system/SystemMenusDao.php @@ -76,10 +76,10 @@ class SystemMenusDao extends BaseDao * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getMenusList(array $where) + public function getMenusList(array $where, array $field = ['*']) { $where = array_merge($where, ['is_del' => 0]); - return $this->search($where)->order('sort DESC,id ASC')->select(); + return $this->search($where)->field($field)->order('sort DESC,id ASC')->select(); } /** diff --git a/crmeb/app/dao/wechat/WechatReplyKeyDao.php b/crmeb/app/dao/wechat/WechatReplyKeyDao.php index 633d53d82..a14560f9d 100644 --- a/crmeb/app/dao/wechat/WechatReplyKeyDao.php +++ b/crmeb/app/dao/wechat/WechatReplyKeyDao.php @@ -103,10 +103,11 @@ class WechatReplyKeyDao extends BaseDao /** * 获取条件下的条数 * @param array $where + * @param bool $search * @return int */ - public function count(array $where = []): int + public function count(array $where = [], bool $search = true): int { - return $this->search($where)->group($this->alias . '.id')->count(); + return $this->search($where, $search)->group($this->alias . '.id')->count(); } } diff --git a/crmeb/app/services/BaseServices.php b/crmeb/app/services/BaseServices.php index 637cfe589..e7f06e508 100644 --- a/crmeb/app/services/BaseServices.php +++ b/crmeb/app/services/BaseServices.php @@ -33,6 +33,7 @@ use think\Model; * @method mixed delete($id, ?string $key = null) 删除 * @method mixed save(array $data) 保存数据 * @method mixed saveAll(array $data) 批量保存数据 + * @method Model selectList(array $where, string $field = '*', int $page = 0, int $limit = 0, string $order = '', array $with = [], bool $search = false) 获取列表 * @method bool bcInc($key, string $incField, string $inc, string $keyField = null, int $acc = 2) 高精度加法 * @method bool bcDec($key, string $decField, string $dec, string $keyField = null, int $acc = 2) 高精度 减法 * @method mixed decStockIncSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 减库存加销量 diff --git a/crmeb/app/services/article/ArticleServices.php b/crmeb/app/services/article/ArticleServices.php index 0cc0032b3..4cc3b5f86 100644 --- a/crmeb/app/services/article/ArticleServices.php +++ b/crmeb/app/services/article/ArticleServices.php @@ -131,11 +131,12 @@ class ArticleServices extends BaseServices /** * 获取数量 * @param array $where + * @param bool $search * @return int */ - public function count(array $where) + public function count(array $where = [], bool $search = true): int { - return $this->dao->count($where); + return $this->search($where, $search)->count(); } /**获取一条数据 diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php index 699854f51..cbd4106ec 100644 --- a/crmeb/app/services/system/SystemCrudServices.php +++ b/crmeb/app/services/system/SystemCrudServices.php @@ -27,6 +27,7 @@ use crmeb\services\crud\ViewPages; use crmeb\services\crud\ViewRouter; use think\exception\ValidateException; use think\facade\Db; +use think\helper\Str; use think\migration\Migrator; use Phinx\Db\Adapter\MysqlAdapter; @@ -49,6 +50,21 @@ class SystemCrudServices extends BaseServices $this->dao = $dao; } + /** + * @return array + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ + public function getList() + { + [$page, $limit] = $this->getPageValue(); + $list = $this->dao->selectList([], '*', $page, $limit, 'id desc'); + $count = $this->dao->count(); + + return compact('list', 'count'); + } + public function getTabelRule() { $adapter = app()->make(MysqlAdapter::class); @@ -90,6 +106,14 @@ class SystemCrudServices extends BaseServices return $columns; } + /** + * 创建 + * @param array $data + * @return mixed + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/11 + */ public function createCrud(array $data) { $tableName = $data['tableName']; @@ -108,9 +132,8 @@ class SystemCrudServices extends BaseServices throw new ValidateException('请先创建' . $tableName . '表'); } - //TODO 没写完 - $routeName = ''; - $uniqueAuth = ''; + $routeName = 'crud/' . Str::snake($tableName); + $uniqueAuth = $routeName . '-index-list'; $make = $this->makeFile($tableName, $routeName, true, $data, $filePath); $makePath = []; @@ -133,10 +156,72 @@ class SystemCrudServices extends BaseServices ]; $menuInfo = app()->make(SystemMenusServices::class)->save($data); //写入路由权限 - //TODO 没写完 - + $cateId = app()->make(SystemRouteServices::class)->topCateId('adminapi'); + $ruleData = [ + [ + 'path' => $routeName, + 'method' => 'GET', + 'name' => $data['menuName'] . '列表接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '/create', + 'method' => 'GET', + 'name' => $data['menuName'] . '获取创建表单接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName, + 'method' => 'POST', + 'name' => $data['menuName'] . '保存数据接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '//edit', + 'method' => 'GET', + 'name' => $data['menuName'] . '获取修改表单接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '/', + 'method' => 'PUT', + 'name' => $data['menuName'] . '修改数据接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + [ + 'path' => $routeName . '/', + 'method' => 'DELETE', + 'name' => $data['menuName'] . '删除数据接口', + 'app_name' => 'adminapi', + 'cate_id' => $cateId, + 'add_time' => date('Y-m-d H:i:s') + ], + ]; + app()->make(SystemRouteServices::class)->saveAll($ruleData); + //记录权限加入菜单表 + $menuData = []; + foreach ($ruleData as $item) { + $menuData[] = [ + 'pid' => $menuInfo->id, + 'method' => $item['method'], + 'api_url' => $item['path'], + 'name' => $item['name'], + 'is_del' => 0, + ]; + } + app()->make(SystemMenusServices::class)->saveAll($menuData); //记录crud生成 - $this->dao->save([ + $res = $this->dao->save([ 'pid' => $data['pid'], 'name' => $data['menuName'], 'table_name' => $tableName, @@ -144,6 +229,7 @@ class SystemCrudServices extends BaseServices 'make_path' => json_encode($makePath), 'add_time' => time() ]); + return $res->toArray(); } /** diff --git a/crmeb/app/services/system/SystemMenusServices.php b/crmeb/app/services/system/SystemMenusServices.php index c616fdaca..40f568eab 100644 --- a/crmeb/app/services/system/SystemMenusServices.php +++ b/crmeb/app/services/system/SystemMenusServices.php @@ -89,9 +89,9 @@ class SystemMenusServices extends BaseServices * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getList(array $where) + public function getList(array $where, array $field = ['*']) { - $menusList = $this->dao->getMenusList($where); + $menusList = $this->dao->getMenusList($where, $field); $menusList = $this->getMenusData($menusList); return get_tree_children($menusList); } diff --git a/crmeb/app/services/system/SystemRouteCateServices.php b/crmeb/app/services/system/SystemRouteCateServices.php index b8f25d299..39cec6423 100644 --- a/crmeb/app/services/system/SystemRouteCateServices.php +++ b/crmeb/app/services/system/SystemRouteCateServices.php @@ -69,9 +69,9 @@ class SystemRouteCateServices extends BaseServices * @email 136327134@qq.com * @date 2023/4/6 */ - public function getAllList(string $appName = 'outapi', string $field = '*') + public function getAllList(string $appName = 'outapi', string $field = '*', string $order = '') { - $list = $this->dao->selectList(['app_name' => $appName], $field)->toArray(); + $list = $this->dao->selectList(['app_name' => $appName], $field, 0, 0, $order)->toArray(); return get_tree_children($list); } diff --git a/crmeb/app/services/system/SystemRouteServices.php b/crmeb/app/services/system/SystemRouteServices.php index f11ea60d3..91aa8f302 100644 --- a/crmeb/app/services/system/SystemRouteServices.php +++ b/crmeb/app/services/system/SystemRouteServices.php @@ -68,7 +68,9 @@ class SystemRouteServices extends BaseServices throw new ValidateException('修改的路由不存在'); } - return $routeInfo->toArray(); + $routeInfo = $routeInfo->toArray(); + $routeInfo['cate_tree'] = app()->make(SystemRouteCateServices::class)->getAllList($routeInfo['app_name'], '*', 'id asc,sort desc'); + return $routeInfo; } /** @@ -119,28 +121,44 @@ class SystemRouteServices extends BaseServices $route = $this->app->route->getRuleList(); $action_arr = ['index', 'read', 'create', 'save', 'edit', 'update', 'delete']; - foreach ($route as &$item) { + + foreach ($route as $key => $item) { $real_name = $item['option']['real_name'] ?? ''; if (is_array($real_name)) { - foreach ($action_arr as $action) { - if (Str::contains($item['route'], $action)) { - $real_name = $real_name[$action] ?? ''; + foreach ($action_arr as $a) { + if (Str::contains($item['route'], $a)) { + $real_name = $real_name[$a] ?? ''; } } } $item['option']['real_name'] = $real_name; + $route[$key] = $item; + $except = $item['option']['except'] ?? []; + + $router = is_string($item['route']) ? explode('/', $item['route']) : []; + $action = $router[count($router) - 1] ?? null; + //去除不需要的路由 + if ($except && $action && in_array($action, $except)) { + unset($route[$key]); + } + $only = $item['option']['only'] ?? []; + if ($only && $action && !in_array($action, $only)) { + unset($route[$key]); + } } return $route; } /** - * 同步路由 + * 获取顶级id + * @param string $app + * @return mixed * @author 等风来 * @email 136327134@qq.com - * @date 2023/4/6 + * @date 2023/4/11 */ - public function syncRoute(string $app = 'adminapi') + public function topCateId(string $app) { $id = app()->make(SystemRouteCateServices::class)->value(['app_name' => $app, 'name' => '全部权限', 'pid' => 0], 'id'); if (!$id) { @@ -152,6 +170,19 @@ class SystemRouteServices extends BaseServices ]); $id = $res->id; } + + return $id; + } + + /** + * 同步路由 + * @author 等风来 + * @email 136327134@qq.com + * @date 2023/4/6 + */ + public function syncRoute(string $app = 'adminapi') + { + $id = $this->topCateId($app); $listAll = $this->getRouteListAll($app); //保持新增的权限路由 $data = $this->dao->selectList(['app_name' => $app], 'path,method')->toArray(); diff --git a/crmeb/composer.lock b/crmeb/composer.lock index 2537a4eee..8311f8523 100644 --- a/crmeb/composer.lock +++ b/crmeb/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7c5a944e11d96dd74471efbeddebdae8", + "content-hash": "792b4cc7488c49b6d812dda8d5c55d02", "packages": [ { "name": "adbario/php-dot-notation", @@ -1954,149 +1954,6 @@ ], "time": "2022-05-21T17:30:32+00:00" }, - { - "name": "league/flysystem", - "version": "1.0.61", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "time": "2019-12-08T21:46:50+00:00" - }, - { - "name": "league/flysystem-cached-adapter", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ], - "description": "An adapter decorator to enable meta-data caching.", - "time": "2018-07-09T20:51:04+00:00" - }, { "name": "lizhichao/one-sm", "version": "1.10", @@ -2711,73 +2568,6 @@ ], "time": "2019-06-25T10:00:57+00:00" }, - { - "name": "opis/closure", - "version": "3.5.1", - "source": { - "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.4 || ^7.0" - }, - "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5.x-dev" - } - }, - "autoload": { - "psr-4": { - "Opis\\Closure\\": "src/" - }, - "files": [ - "functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" - } - ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", - "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" - ], - "time": "2019-11-29T22:36:02+00:00" - }, { "name": "overtrue/socialite", "version": "1.3.0", @@ -4524,16 +4314,16 @@ }, { "name": "topthink/framework", - "version": "v6.0.3", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "b4046fb21e6163ba23a792b694162693dbe71b4b" + "reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/b4046fb21e6163ba23a792b694162693dbe71b4b", - "reference": "b4046fb21e6163ba23a792b694162693dbe71b4b", + "url": "https://api.github.com/repos/top-think/framework/zipball/67235be5b919aaaf1de5aed9839f65d8e766aca3", + "reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3", "shasum": "", "mirrors": [ { @@ -4545,17 +4335,16 @@ "require": { "ext-json": "*", "ext-mbstring": "*", - "league/flysystem": "^1.0", - "league/flysystem-cached-adapter": "^1.0", - "opis/closure": "^3.1", - "php": ">=7.1.0", + "php": ">=7.2.5", "psr/container": "~1.0", + "psr/http-message": "^1.0", "psr/log": "~1.0", "psr/simple-cache": "^1.0", "topthink/think-helper": "^3.1.1", - "topthink/think-orm": "^2.0" + "topthink/think-orm": "^2.0|^3.0" }, "require-dev": { + "guzzlehttp/psr7": "^2.1.0", "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.2", "phpunit/phpunit": "^7.0" @@ -4588,7 +4377,11 @@ "orm", "thinkphp" ], - "time": "2020-06-26T16:03:10+00:00" + "support": { + "issues": "https://github.com/top-think/framework/issues", + "source": "https://github.com/top-think/framework/tree/v6.1.2" + }, + "time": "2023-02-08T02:24:01+00:00" }, { "name": "topthink/think-captcha", @@ -4776,6 +4569,66 @@ "description": "The ThinkPHP5 Image Package", "time": "2016-09-29T06:05:43+00:00" }, + { + "name": "topthink/think-migration", + "version": "v3.0.4", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-migration.git", + "reference": "c5880669b277762d5ff935e551bc0d5c71de6811" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/top-think/think-migration/zipball/c5880669b277762d5ff935e551bc0d5c71de6811", + "reference": "c5880669b277762d5ff935e551bc0d5c71de6811", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "topthink/framework": "^6.0", + "topthink/think-helper": "^3.0.3" + }, + "require-dev": { + "fzaninotto/faker": "^1.8" + }, + "suggest": { + "fzaninotto/faker": "Required to use the factory builder (^1.8)." + }, + "type": "library", + "extra": { + "think": { + "services": [ + "think\\migration\\Service" + ] + } + }, + "autoload": { + "psr-4": { + "Phinx\\": "phinx/src/Phinx", + "think\\migration\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "support": { + "issues": "https://github.com/top-think/think-migration/issues", + "source": "https://github.com/top-think/think-migration/tree/v3.0.4" + }, + "time": "2022-10-26T07:57:54+00:00" + }, { "name": "topthink/think-multi-app", "version": "v1.0.14", diff --git a/crmeb/crmeb/services/pay/storage/AllinPay.php b/crmeb/crmeb/services/pay/storage/AllinPay.php index 04afa521d..b676b518e 100644 --- a/crmeb/crmeb/services/pay/storage/AllinPay.php +++ b/crmeb/crmeb/services/pay/storage/AllinPay.php @@ -14,6 +14,7 @@ namespace crmeb\services\pay\storage; use app\services\pay\PayServices; +use crmeb\exceptions\AdminException; use crmeb\exceptions\PayException; use crmeb\services\pay\BasePay; use crmeb\services\pay\PayInterface; @@ -115,7 +116,8 @@ class AllinPay extends BasePay implements PayInterface */ public function refund(string $outTradeNo, array $options = []) { - return $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo); + $result = $this->pay->refund($options['refund_price'], $options['order_id'], $outTradeNo); + if ($result['retcode'] != 'SUCCESS') throw new AdminException($result['retmsg']); } public function queryRefund(string $outTradeNo, string $outRequestNo, array $other = []) diff --git a/crmeb/crmeb/services/pay/storage/WechatPay.php b/crmeb/crmeb/services/pay/storage/WechatPay.php index 856f1a22a..153c57c9a 100644 --- a/crmeb/crmeb/services/pay/storage/WechatPay.php +++ b/crmeb/crmeb/services/pay/storage/WechatPay.php @@ -103,18 +103,22 @@ class WechatPay extends BasePay implements PayInterface $refundNo = $opt['refund_id'] ?? $outTradeNo; $opUserId = $opt['op_user_id'] ?? null; $type = $opt['type'] ?? 'out_trade_no'; - /*仅针对老资金流商户使用 - REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款) - REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款 - */ + /** + * 仅针对老资金流商户使用 + * REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款) + * REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款 + */ $refundAccount = $opt['refund_account'] ?? 'REFUND_SOURCE_UNSETTLED_FUNDS'; if (isset($opt['wechat'])) { - return WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount); + $result = WechatService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount); + if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']); } else { if ($opt['pay_new_weixin_open']) { - return MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt); + $result = MiniProgramService::miniRefund($outTradeNo, $totalFee, $refundFee, $opt); + if ($result['errcode'] != 0) throw new AdminException($result['errmsg']); } else { - return MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount); + $result = MiniProgramService::refund($outTradeNo, $refundNo, $totalFee, $refundFee, $opUserId, $refundReason, $type, $refundAccount); + if ($result['status'] != 'SUCCESS') throw new AdminException($result['status']); } } } diff --git a/crmeb/public/install/.env b/crmeb/public/install/.env index 71c73fb47..bfac354fe 100755 --- a/crmeb/public/install/.env +++ b/crmeb/public/install/.env @@ -1 +1 @@ -APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = #DB_HOST# HOSTPORT = #DB_PORT# USERNAME = #DB_USER# PASSWORD = '#DB_PWD#' DATABASE = #DB_NAME# PREFIX = #DB_PREFIX# CHARSET = utf8mb4 DEBUG = true [LANG] default_lang = zh-cn [CACHE] DRIVER = #CACHE_TYPE# CACHE_PREFIX = #CACHE_PREFIX# CACHE_TAG_PREFIX = #CACHE_TAG_PREFIX# [REDIS] REDIS_HOSTNAME = #RB_HOST# PORT = #RB_PORT# REDIS_PASSWORD = '#RB_PWD#' SELECT = #RB_SELECT# [QUEUE] QUEUE_NAME = #QUEUE_NAME# \ No newline at end of file +APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = #DB_HOST# HOSTPORT = #DB_PORT# USERNAME = #DB_USER# PASSWORD = #DB_PWD# DATABASE = #DB_NAME# PREFIX = #DB_PREFIX# CHARSET = utf8mb4 DEBUG = true [LANG] default_lang = zh-cn [CACHE] DRIVER = #CACHE_TYPE# CACHE_PREFIX = #CACHE_PREFIX# CACHE_TAG_PREFIX = #CACHE_TAG_PREFIX# [REDIS] REDIS_HOSTNAME = #RB_HOST# PORT = #RB_PORT# REDIS_PASSWORD = '#RB_PWD#' SELECT = #RB_SELECT# [QUEUE] QUEUE_NAME = #QUEUE_NAME# \ No newline at end of file diff --git a/crmeb/vendor/composer/autoload_files.php b/crmeb/vendor/composer/autoload_files.php index 906679780..b9790e1f6 100644 --- a/crmeb/vendor/composer/autoload_files.php +++ b/crmeb/vendor/composer/autoload_files.php @@ -17,7 +17,6 @@ return array( 'd767e4fc2dc52fe66584ab8c6684783e' => $vendorDir . '/adbario/php-dot-notation/src/helpers.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', - '538ca81a9a966a6716601ecf48f4eaef' => $vendorDir . '/opis/closure/functions.php', '65fec9ebcfbb3cbb4fd0d519687aea01' => $vendorDir . '/danielstjules/stringy/src/Create.php', 'abede361264e2ae69ec1eee813a101af' => $vendorDir . '/markbaker/complex/classes/src/functions/abs.php', '21a5860fbef5be28db5ddfbc3cca67c4' => $vendorDir . '/markbaker/complex/classes/src/functions/acos.php', diff --git a/crmeb/vendor/composer/autoload_psr4.php b/crmeb/vendor/composer/autoload_psr4.php index f4bde3f27..1e635d1f4 100644 --- a/crmeb/vendor/composer/autoload_psr4.php +++ b/crmeb/vendor/composer/autoload_psr4.php @@ -46,15 +46,12 @@ return array( 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), 'Phinx\\' => array($vendorDir . '/topthink/think-migration/phinx/src/Phinx'), 'Overtrue\\Socialite\\' => array($vendorDir . '/overtrue/socialite/src'), - 'Opis\\Closure\\' => array($vendorDir . '/opis/closure/src'), 'OneSm\\' => array($vendorDir . '/lizhichao/one-sm/src'), 'OSS\\' => array($vendorDir . '/aliyuncs/oss-sdk-php/src/OSS'), 'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'), 'Lizhichao\\Word\\' => array($vendorDir . '/lizhichao/word/Lib'), - 'League\\Flysystem\\Cached\\' => array($vendorDir . '/league/flysystem-cached-adapter/src'), - 'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'), 'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'), 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), diff --git a/crmeb/vendor/composer/autoload_static.php b/crmeb/vendor/composer/autoload_static.php index 972e95e80..a37dd6d2b 100644 --- a/crmeb/vendor/composer/autoload_static.php +++ b/crmeb/vendor/composer/autoload_static.php @@ -18,7 +18,6 @@ class ComposerStaticInitf16474ac994ccc25392f403933800b79 'd767e4fc2dc52fe66584ab8c6684783e' => __DIR__ . '/..' . '/adbario/php-dot-notation/src/helpers.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', - '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php', '65fec9ebcfbb3cbb4fd0d519687aea01' => __DIR__ . '/..' . '/danielstjules/stringy/src/Create.php', 'abede361264e2ae69ec1eee813a101af' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php', '21a5860fbef5be28db5ddfbc3cca67c4' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acos.php', @@ -167,7 +166,6 @@ class ComposerStaticInitf16474ac994ccc25392f403933800b79 'O' => array ( 'Overtrue\\Socialite\\' => 19, - 'Opis\\Closure\\' => 13, 'OneSm\\' => 6, 'OSS\\' => 4, ), @@ -180,8 +178,6 @@ class ComposerStaticInitf16474ac994ccc25392f403933800b79 'L' => array ( 'Lizhichao\\Word\\' => 15, - 'League\\Flysystem\\Cached\\' => 24, - 'League\\Flysystem\\' => 17, ), 'J' => array ( @@ -414,10 +410,6 @@ class ComposerStaticInitf16474ac994ccc25392f403933800b79 array ( 0 => __DIR__ . '/..' . '/overtrue/socialite/src', ), - 'Opis\\Closure\\' => - array ( - 0 => __DIR__ . '/..' . '/opis/closure/src', - ), 'OneSm\\' => array ( 0 => __DIR__ . '/..' . '/lizhichao/one-sm/src', @@ -442,14 +434,6 @@ class ComposerStaticInitf16474ac994ccc25392f403933800b79 array ( 0 => __DIR__ . '/..' . '/lizhichao/word/Lib', ), - 'League\\Flysystem\\Cached\\' => - array ( - 0 => __DIR__ . '/..' . '/league/flysystem-cached-adapter/src', - ), - 'League\\Flysystem\\' => - array ( - 0 => __DIR__ . '/..' . '/league/flysystem/src', - ), 'JmesPath\\' => array ( 0 => __DIR__ . '/..' . '/mtdowling/jmespath.php/src', diff --git a/crmeb/vendor/composer/installed.json b/crmeb/vendor/composer/installed.json index 73a628f7d..fd95918e4 100644 --- a/crmeb/vendor/composer/installed.json +++ b/crmeb/vendor/composer/installed.json @@ -2047,155 +2047,6 @@ ], "install-path": "../intervention/image" }, - { - "name": "league/flysystem", - "version": "1.0.61", - "version_normalized": "1.0.61.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9", - "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "time": "2019-12-08T21:46:50+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "install-path": "../league/flysystem" - }, - { - "name": "league/flysystem-cached-adapter", - "version": "1.0.9", - "version_normalized": "1.0.9.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "time": "2018-07-09T20:51:04+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ], - "description": "An adapter decorator to enable meta-data caching.", - "install-path": "../league/flysystem-cached-adapter" - }, { "name": "lizhichao/one-sm", "version": "1.10", @@ -2833,76 +2684,6 @@ ], "install-path": "../nesbot/carbon" }, - { - "name": "opis/closure", - "version": "3.5.1", - "version_normalized": "3.5.1.0", - "source": { - "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", - "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.4 || ^7.0" - }, - "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "time": "2019-11-29T22:36:02+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Opis\\Closure\\": "src/" - }, - "files": [ - "functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" - } - ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", - "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" - ], - "install-path": "../opis/closure" - }, { "name": "overtrue/socialite", "version": "1.3.0", @@ -4733,17 +4514,17 @@ }, { "name": "topthink/framework", - "version": "v6.0.3", - "version_normalized": "6.0.3.0", + "version": "v6.1.2", + "version_normalized": "6.1.2.0", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "b4046fb21e6163ba23a792b694162693dbe71b4b" + "reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/b4046fb21e6163ba23a792b694162693dbe71b4b", - "reference": "b4046fb21e6163ba23a792b694162693dbe71b4b", + "url": "https://api.github.com/repos/top-think/framework/zipball/67235be5b919aaaf1de5aed9839f65d8e766aca3", + "reference": "67235be5b919aaaf1de5aed9839f65d8e766aca3", "shasum": "", "mirrors": [ { @@ -4755,22 +4536,21 @@ "require": { "ext-json": "*", "ext-mbstring": "*", - "league/flysystem": "^1.0", - "league/flysystem-cached-adapter": "^1.0", - "opis/closure": "^3.1", - "php": ">=7.1.0", + "php": ">=7.2.5", "psr/container": "~1.0", + "psr/http-message": "^1.0", "psr/log": "~1.0", "psr/simple-cache": "^1.0", "topthink/think-helper": "^3.1.1", - "topthink/think-orm": "^2.0" + "topthink/think-orm": "^2.0|^3.0" }, "require-dev": { + "guzzlehttp/psr7": "^2.1.0", "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.2", "phpunit/phpunit": "^7.0" }, - "time": "2020-06-26T16:03:10+00:00", + "time": "2023-02-08T02:24:01+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4800,6 +4580,10 @@ "orm", "thinkphp" ], + "support": { + "issues": "https://github.com/top-think/framework/issues", + "source": "https://github.com/top-think/framework/tree/v6.1.2" + }, "install-path": "../topthink/framework" }, { diff --git a/crmeb/vendor/composer/installed.php b/crmeb/vendor/composer/installed.php index f7f744561..890d816e7 100644 --- a/crmeb/vendor/composer/installed.php +++ b/crmeb/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'topthink/think', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '7c2cc12b79fc2e12fb5f255ac2746a4ffaa6110a', + 'reference' => 'aa532e3f4aa4c78a733d68dc8cfd89eff585fbb6', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -439,24 +439,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'league/flysystem' => array( - 'pretty_version' => '1.0.61', - 'version' => '1.0.61.0', - 'reference' => '4fb13c01784a6c9f165a351e996871488ca2d8c9', - 'type' => 'library', - 'install_path' => __DIR__ . '/../league/flysystem', - 'aliases' => array(), - 'dev_requirement' => false, - ), - 'league/flysystem-cached-adapter' => array( - 'pretty_version' => '1.0.9', - 'version' => '1.0.9.0', - 'reference' => '08ef74e9be88100807a3b92cc9048a312bf01d6f', - 'type' => 'library', - 'install_path' => __DIR__ . '/../league/flysystem-cached-adapter', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'lizhichao/one-sm' => array( 'pretty_version' => '1.10', 'version' => '1.10.0.0', @@ -538,15 +520,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'opis/closure' => array( - 'pretty_version' => '3.5.1', - 'version' => '3.5.1.0', - 'reference' => '93ebc5712cdad8d5f489b500c59d122df2e53969', - 'type' => 'library', - 'install_path' => __DIR__ . '/../opis/closure', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'overtrue/socialite' => array( 'pretty_version' => '1.3.0', 'version' => '1.3.0.0', @@ -818,9 +791,9 @@ 'dev_requirement' => false, ), 'topthink/framework' => array( - 'pretty_version' => 'v6.0.3', - 'version' => '6.0.3.0', - 'reference' => 'b4046fb21e6163ba23a792b694162693dbe71b4b', + 'pretty_version' => 'v6.1.2', + 'version' => '6.1.2.0', + 'reference' => '67235be5b919aaaf1de5aed9839f65d8e766aca3', 'type' => 'library', 'install_path' => __DIR__ . '/../topthink/framework', 'aliases' => array(), @@ -829,7 +802,7 @@ 'topthink/think' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '7c2cc12b79fc2e12fb5f255ac2746a4ffaa6110a', + 'reference' => 'aa532e3f4aa4c78a733d68dc8cfd89eff585fbb6', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/crmeb/vendor/league/flysystem-cached-adapter/.editorconfig b/crmeb/vendor/league/flysystem-cached-adapter/.editorconfig deleted file mode 100644 index 153cf3ef5..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -; top-most EditorConfig file -root = true - -; Unix-style newlines -[*] -end_of_line = LF - -[*.php] -indent_style = space -indent_size = 4 diff --git a/crmeb/vendor/league/flysystem-cached-adapter/.gitignore b/crmeb/vendor/league/flysystem-cached-adapter/.gitignore deleted file mode 100644 index 7aea75f4f..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -coverage -coverage.xml -composer.lock -vendor \ No newline at end of file diff --git a/crmeb/vendor/league/flysystem-cached-adapter/.php_cs b/crmeb/vendor/league/flysystem-cached-adapter/.php_cs deleted file mode 100644 index 6643a32cf..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/.php_cs +++ /dev/null @@ -1,7 +0,0 @@ -level(Symfony\CS\FixerInterface::PSR2_LEVEL) - ->fixers(['-yoda_conditions', 'ordered_use', 'short_array_syntax']) - ->finder(Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__.'/src/')); \ No newline at end of file diff --git a/crmeb/vendor/league/flysystem-cached-adapter/.scrutinizer.yml b/crmeb/vendor/league/flysystem-cached-adapter/.scrutinizer.yml deleted file mode 100644 index fa39b52b3..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/.scrutinizer.yml +++ /dev/null @@ -1,34 +0,0 @@ -filter: - paths: [src/*] -checks: - php: - code_rating: true - remove_extra_empty_lines: true - remove_php_closing_tag: true - remove_trailing_whitespace: true - fix_use_statements: - remove_unused: true - preserve_multiple: false - preserve_blanklines: true - order_alphabetically: true - fix_php_opening_tag: true - fix_linefeed: true - fix_line_ending: true - fix_identation_4spaces: true - fix_doc_comments: true -tools: - external_code_coverage: - timeout: 900 - runs: 6 - php_code_coverage: false - php_code_sniffer: - config: - standard: PSR2 - filter: - paths: ['src'] - php_loc: - enabled: true - excluded_dirs: [vendor, spec, stubs] - php_cpd: - enabled: true - excluded_dirs: [vendor, spec, stubs] \ No newline at end of file diff --git a/crmeb/vendor/league/flysystem-cached-adapter/.travis.yml b/crmeb/vendor/league/flysystem-cached-adapter/.travis.yml deleted file mode 100644 index 6706449fd..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php - -php: - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -matrix: - allow_failures: - - php: 5.5 - -env: - - COMPOSER_OPTS="" - - COMPOSER_OPTS="--prefer-lowest" - -install: - - if [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then composer require phpunit/phpunit:^4.8.36 phpspec/phpspec:^2 --prefer-dist --update-with-dependencies; fi - - if [[ "${TRAVIS_PHP_VERSION}" == "7.2" ]]; then composer require phpunit/phpunit:^6.0 --prefer-dist --update-with-dependencies; fi - - travis_retry composer update --prefer-dist $COMPOSER_OPTS - -script: - - vendor/bin/phpspec run - - vendor/bin/phpunit - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar' - - php ocular.phar code-coverage:upload --format=php-clover ./clover/phpunit.xml' diff --git a/crmeb/vendor/league/flysystem-cached-adapter/LICENSE b/crmeb/vendor/league/flysystem-cached-adapter/LICENSE deleted file mode 100644 index 666f6c826..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/crmeb/vendor/league/flysystem-cached-adapter/clover/.gitignore b/crmeb/vendor/league/flysystem-cached-adapter/clover/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/clover/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/crmeb/vendor/league/flysystem-cached-adapter/composer.json b/crmeb/vendor/league/flysystem-cached-adapter/composer.json deleted file mode 100644 index df7fb7fd9..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "league/flysystem-cached-adapter", - "description": "An adapter decorator to enable meta-data caching.", - "autoload": { - "psr-4": { - "League\\Flysystem\\Cached\\": "src/" - } - }, - "require": { - "league/flysystem": "~1.0", - "psr/cache": "^1.0.0" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7", - "mockery/mockery": "~0.9", - "predis/predis": "~1.0", - "tedivm/stash": "~0.12" - }, - "suggest": { - "ext-phpredis": "Pure C implemented extension for PHP" - }, - "license": "MIT", - "authors": [ - { - "name": "frankdejonge", - "email": "info@frenky.net" - } - ] -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/phpspec.yml b/crmeb/vendor/league/flysystem-cached-adapter/phpspec.yml deleted file mode 100644 index 5eabcb21b..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/phpspec.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -suites: - cached_adapter_suite: - namespace: League\Flysystem\Cached - psr4_prefix: League\Flysystem\Cached -formatter.name: pretty diff --git a/crmeb/vendor/league/flysystem-cached-adapter/phpunit.php b/crmeb/vendor/league/flysystem-cached-adapter/phpunit.php deleted file mode 100644 index d10958796..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/phpunit.php +++ /dev/null @@ -1,3 +0,0 @@ - - - - - ./tests/ - - - - - ./src/ - - - - - - - - diff --git a/crmeb/vendor/league/flysystem-cached-adapter/readme.md b/crmeb/vendor/league/flysystem-cached-adapter/readme.md deleted file mode 100644 index dd1433d98..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/readme.md +++ /dev/null @@ -1,20 +0,0 @@ -# Flysystem Cached CachedAdapter - -[![Author](http://img.shields.io/badge/author-@frankdejonge-blue.svg?style=flat-square)](https://twitter.com/frankdejonge) -[![Build Status](https://img.shields.io/travis/thephpleague/flysystem-cached-adapter/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/flysystem-cached-adapter) -[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter/code-structure) -[![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/flysystem-cached-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/flysystem-cached-adapter) -[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Packagist Version](https://img.shields.io/packagist/v/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) -[![Total Downloads](https://img.shields.io/packagist/dt/league/flysystem-cached-adapter.svg?style=flat-square)](https://packagist.org/packages/league/flysystem-cached-adapter) - - -The adapter decorator caches metadata and directory listings. - -```bash -composer require league/flysystem-cached-adapter -``` - -## Usage - -[Check out the docs.](https://flysystem.thephpleague.com/docs/advanced/caching/) diff --git a/crmeb/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php b/crmeb/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php deleted file mode 100644 index 69428d990..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/spec/CachedAdapterSpec.php +++ /dev/null @@ -1,435 +0,0 @@ -adapter = $adapter; - $this->cache = $cache; - $this->cache->load()->shouldBeCalled(); - $this->beConstructedWith($adapter, $cache); - } - - public function it_is_initializable() - { - $this->shouldHaveType('League\Flysystem\Cached\CachedAdapter'); - $this->shouldHaveType('League\Flysystem\AdapterInterface'); - } - - public function it_should_forward_read_streams() - { - $path = 'path.txt'; - $response = ['path' => $path]; - $this->adapter->readStream($path)->willReturn($response); - $this->readStream($path)->shouldbe($response); - } - - public function it_should_cache_writes() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->write($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->write($path, $contents, $config)->shouldBe($response); - } - - public function it_should_cache_streamed_writes() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->writeStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->writeStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_cache_streamed_updates() - { - $type = 'file'; - $path = 'path.txt'; - $stream = tmpfile(); - $config = new Config(); - $response = compact('path', 'stream', 'type'); - $this->adapter->updateStream($path, $stream, $config)->willReturn($response); - $this->cache->updateObject($path, ['contents' => false] + $response, true)->shouldBeCalled(); - $this->updateStream($path, $stream, $config)->shouldBe($response); - fclose($stream); - } - - public function it_should_ignore_failed_writes() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->write($path, $contents, $config)->willReturn(false); - $this->write($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_writes() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->writeStream($path, $contents, $config)->willReturn(false); - $this->writeStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_updated() - { - $type = 'file'; - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $response = compact('path', 'contents', 'type'); - $this->adapter->update($path, $contents, $config)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->update($path, $contents, $config)->shouldBe($response); - } - - public function it_should_ignore_failed_updates() - { - $path = 'path.txt'; - $contents = 'contents'; - $config = new Config(); - $this->adapter->update($path, $contents, $config)->willReturn(false); - $this->update($path, $contents, $config)->shouldBe(false); - } - - public function it_should_ignore_failed_streamed_updates() - { - $path = 'path.txt'; - $contents = tmpfile(); - $config = new Config(); - $this->adapter->updateStream($path, $contents, $config)->willReturn(false); - $this->updateStream($path, $contents, $config)->shouldBe(false); - fclose($contents); - } - - public function it_should_cache_renames() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(true); - $this->cache->rename($old, $new)->shouldBeCalled(); - $this->rename($old, $new)->shouldBe(true); - } - - public function it_should_ignore_rename_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->rename($old, $new)->willReturn(false); - $this->rename($old, $new)->shouldBe(false); - } - - public function it_should_cache_copies() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(true); - $this->cache->copy($old, $new)->shouldBeCalled(); - $this->copy($old, $new)->shouldBe(true); - } - - public function it_should_ignore_copy_fails() - { - $old = 'old.txt'; - $new = 'new.txt'; - $this->adapter->copy($old, $new)->willReturn(false); - $this->copy($old, $new)->shouldBe(false); - } - - public function it_should_cache_deletes() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(true); - $this->cache->delete($delete)->shouldBeCalled(); - $this->delete($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_fails() - { - $delete = 'delete.txt'; - $this->adapter->delete($delete)->willReturn(false); - $this->delete($delete)->shouldBe(false); - } - - public function it_should_cache_dir_deletes() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(true); - $this->cache->deleteDir($delete)->shouldBeCalled(); - $this->deleteDir($delete)->shouldBe(true); - } - - public function it_should_ignore_delete_dir_fails() - { - $delete = 'delete'; - $this->adapter->deleteDir($delete)->willReturn(false); - $this->deleteDir($delete)->shouldBe(false); - } - - public function it_should_cache_dir_creates() - { - $dirname = 'dirname'; - $config = new Config(); - $response = ['path' => $dirname, 'type' => 'dir']; - $this->adapter->createDir($dirname, $config)->willReturn($response); - $this->cache->updateObject($dirname, $response, true)->shouldBeCalled(); - $this->createDir($dirname, $config)->shouldBe($response); - } - - public function it_should_ignore_create_dir_fails() - { - $dirname = 'dirname'; - $config = new Config(); - $this->adapter->createDir($dirname, $config)->willReturn(false); - $this->createDir($dirname, $config)->shouldBe(false); - } - - public function it_should_cache_set_visibility() - { - $path = 'path.txt'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($path, $visibility)->willReturn(true); - $this->cache->updateObject($path, ['path' => $path, 'visibility' => $visibility], true)->shouldBeCalled(); - $this->setVisibility($path, $visibility)->shouldBe(true); - } - - public function it_should_ignore_set_visibility_fails() - { - $dirname = 'delete'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $this->adapter->setVisibility($dirname, $visibility)->willReturn(false); - $this->setVisibility($dirname, $visibility)->shouldBe(false); - } - - public function it_should_indicate_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(false); - $this->has($path)->shouldBe(false); - } - - public function it_should_indicate_file_existance() - { - $this->cache->has($path = 'path.txt')->willReturn(true); - $this->has($path)->shouldBe(true); - } - - public function it_should_cache_missing_files() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(false); - $this->cache->storeMiss($path)->shouldBeCalled(); - $this->has($path)->shouldBe(false); - } - - public function it_should_delete_when_metadata_is_missing() - { - $path = 'path.txt'; - $this->cache->has($path)->willReturn(true); - $this->cache->getSize($path)->willReturn(['path' => $path]); - $this->adapter->getSize($path)->willReturn($response = ['path' => $path, 'size' => 1024]); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->getSize($path)->shouldBe($response); - } - - public function it_should_cache_has() - { - $this->cache->has($path = 'path.txt')->willReturn(null); - $this->adapter->has($path)->willReturn(true); - $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled(); - $this->has($path)->shouldBe(true); - } - - public function it_should_list_cached_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(true); - $response = [['path' => 'path.txt']]; - $this->cache->listContents($dirname, $recursive)->willReturn($response); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_ignore_failed_list_contents() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $this->adapter->listContents($dirname, $recursive)->willReturn(false); - $this->listContents($dirname, $recursive)->shouldBe(false); - } - - public function it_should_cache_contents_listings() - { - $this->cache->isComplete($dirname = 'dirname', $recursive = true)->willReturn(false); - $response = [['path' => 'path.txt']]; - $this->adapter->listContents($dirname, $recursive)->willReturn($response); - $this->cache->storeContents($dirname, $response, $recursive)->shouldBeCalled(); - $this->listContents($dirname, $recursive)->shouldBe($response); - } - - public function it_should_use_cached_visibility() - { - $this->make_it_use_getter_cache('getVisibility', 'path.txt', [ - 'path' => 'path.txt', - 'visibility' => AdapterInterface::VISIBILITY_PUBLIC, - ]); - } - - public function it_should_cache_get_visibility() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getVisibility', $path, $response); - } - - public function it_should_ignore_failed_get_visibility() - { - $path = 'path.txt'; - $this->make_it_ignore_failed_getter('getVisibility', $path); - } - - public function it_should_use_cached_timestamp() - { - $this->make_it_use_getter_cache('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_cache_timestamps() - { - $this->make_it_cache_getter('getTimestamp', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_timestamps() - { - $this->make_it_ignore_failed_getter('getTimestamp', 'path.txt'); - } - - public function it_should_cache_get_metadata() - { - $path = 'path.txt'; - $response = ['visibility' => AdapterInterface::VISIBILITY_PUBLIC, 'path' => $path]; - $this->make_it_cache_getter('getMetadata', $path, $response); - } - - public function it_should_use_cached_metadata() - { - $this->make_it_use_getter_cache('getMetadata', 'path.txt', [ - 'path' => 'path.txt', - 'timestamp' => 1234, - ]); - } - - public function it_should_ignore_failed_get_metadata() - { - $this->make_it_ignore_failed_getter('getMetadata', 'path.txt'); - } - - public function it_should_cache_get_size() - { - $path = 'path.txt'; - $response = ['size' => 1234, 'path' => $path]; - $this->make_it_cache_getter('getSize', $path, $response); - } - - public function it_should_use_cached_size() - { - $this->make_it_use_getter_cache('getSize', 'path.txt', [ - 'path' => 'path.txt', - 'size' => 1234, - ]); - } - - public function it_should_ignore_failed_get_size() - { - $this->make_it_ignore_failed_getter('getSize', 'path.txt'); - } - - public function it_should_cache_get_mimetype() - { - $path = 'path.txt'; - $response = ['mimetype' => 'text/plain', 'path' => $path]; - $this->make_it_cache_getter('getMimetype', $path, $response); - } - - public function it_should_use_cached_mimetype() - { - $this->make_it_use_getter_cache('getMimetype', 'path.txt', [ - 'path' => 'path.txt', - 'mimetype' => 'text/plain', - ]); - } - - public function it_should_ignore_failed_get_mimetype() - { - $this->make_it_ignore_failed_getter('getMimetype', 'path.txt'); - } - - public function it_should_cache_reads() - { - $path = 'path.txt'; - $response = ['path' => $path, 'contents' => 'contents']; - $this->make_it_cache_getter('read', $path, $response); - } - - public function it_should_use_cached_file_contents() - { - $this->make_it_use_getter_cache('read', 'path.txt', [ - 'path' => 'path.txt', - 'contents' => 'contents' - ]); - } - - public function it_should_ignore_failed_reads() - { - $this->make_it_ignore_failed_getter('read', 'path.txt'); - } - - protected function make_it_use_getter_cache($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn($response); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_cache_getter($method, $path, $response) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn($response); - $this->cache->updateObject($path, $response, true)->shouldBeCalled(); - $this->{$method}($path)->shouldBe($response); - } - - protected function make_it_ignore_failed_getter($method, $path) - { - $this->cache->{$method}($path)->willReturn(false); - $this->adapter->{$method}($path)->willReturn(false); - $this->{$method}($path)->shouldBe(false); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/CacheInterface.php b/crmeb/vendor/league/flysystem-cached-adapter/src/CacheInterface.php deleted file mode 100644 index de3ab3d90..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/CacheInterface.php +++ /dev/null @@ -1,101 +0,0 @@ -adapter = $adapter; - $this->cache = $cache; - $this->cache->load(); - } - - /** - * Get the underlying Adapter implementation. - * - * @return AdapterInterface - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Get the used Cache implementation. - * - * @return CacheInterface - */ - public function getCache() - { - return $this->cache; - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config) - { - $result = $this->adapter->write($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - $result = $this->adapter->writeStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - $result = $this->adapter->update($path, $contents, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - $result = $this->adapter->updateStream($path, $resource, $config); - - if ($result !== false) { - $result['type'] = 'file'; - $contents = false; - $this->cache->updateObject($path, $result + compact('path', 'contents'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newPath) - { - $result = $this->adapter->rename($path, $newPath); - - if ($result !== false) { - $this->cache->rename($path, $newPath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - $result = $this->adapter->copy($path, $newpath); - - if ($result !== false) { - $this->cache->copy($path, $newpath); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $result = $this->adapter->delete($path); - - if ($result !== false) { - $this->cache->delete($path); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $result = $this->adapter->deleteDir($dirname); - - if ($result !== false) { - $this->cache->deleteDir($dirname); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - $result = $this->adapter->createDir($dirname, $config); - - if ($result !== false) { - $type = 'dir'; - $path = $dirname; - $this->cache->updateObject($dirname, compact('path', 'type'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function setVisibility($path, $visibility) - { - $result = $this->adapter->setVisibility($path, $visibility); - - if ($result !== false) { - $this->cache->updateObject($path, compact('path', 'visibility'), true); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - $cacheHas = $this->cache->has($path); - - if ($cacheHas !== null) { - return $cacheHas; - } - - $adapterResponse = $this->adapter->has($path); - - if (! $adapterResponse) { - $this->cache->storeMiss($path); - } else { - $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path'); - $this->cache->updateObject($path, $cacheEntry, true); - } - - return $adapterResponse; - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - return $this->callWithFallback('contents', $path, 'read'); - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return $this->adapter->readStream($path); - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - if ($this->cache->isComplete($directory, $recursive)) { - return $this->cache->listContents($directory, $recursive); - } - - $result = $this->adapter->listContents($directory, $recursive); - - if ($result !== false) { - $this->cache->storeContents($directory, $result, $recursive); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - return $this->callWithFallback(null, $path, 'getMetadata'); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->callWithFallback('size', $path, 'getSize'); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return $this->callWithFallback('mimetype', $path, 'getMimetype'); - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->callWithFallback('timestamp', $path, 'getTimestamp'); - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - return $this->callWithFallback('visibility', $path, 'getVisibility'); - } - - /** - * Call a method and cache the response. - * - * @param string $property - * @param string $path - * @param string $method - * - * @return mixed - */ - protected function callWithFallback($property, $path, $method) - { - $result = $this->cache->{$method}($path); - - if ($result !== false && ($property === null || array_key_exists($property, $result))) { - return $result; - } - - $result = $this->adapter->{$method}($path); - - if ($result) { - $object = $result + compact('path'); - $this->cache->updateObject($path, $object, true); - } - - return $result; - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php deleted file mode 100644 index c2076d490..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/AbstractCache.php +++ /dev/null @@ -1,417 +0,0 @@ -autosave) { - $this->save(); - } - } - - /** - * Get the autosave setting. - * - * @return bool autosave - */ - public function getAutosave() - { - return $this->autosave; - } - - /** - * Get the autosave setting. - * - * @param bool $autosave - */ - public function setAutosave($autosave) - { - $this->autosave = $autosave; - } - - /** - * Store the contents listing. - * - * @param string $directory - * @param array $contents - * @param bool $recursive - * - * @return array contents listing - */ - public function storeContents($directory, array $contents, $recursive = false) - { - $directories = [$directory]; - - foreach ($contents as $object) { - $this->updateObject($object['path'], $object); - $object = $this->cache[$object['path']]; - - if ($recursive && $this->pathIsInDirectory($directory, $object['path'])) { - $directories[] = $object['dirname']; - } - } - - foreach (array_unique($directories) as $directory) { - $this->setComplete($directory, $recursive); - } - - $this->autosave(); - } - - /** - * Update the metadata for an object. - * - * @param string $path object path - * @param array $object object metadata - * @param bool $autosave whether to trigger the autosave routine - */ - public function updateObject($path, array $object, $autosave = false) - { - if (! $this->has($path)) { - $this->cache[$path] = Util::pathinfo($path); - } - - $this->cache[$path] = array_merge($this->cache[$path], $object); - - if ($autosave) { - $this->autosave(); - } - - $this->ensureParentDirectories($path); - } - - /** - * Store object hit miss. - * - * @param string $path - */ - public function storeMiss($path) - { - $this->cache[$path] = false; - $this->autosave(); - } - - /** - * Get the contents listing. - * - * @param string $dirname - * @param bool $recursive - * - * @return array contents listing - */ - public function listContents($dirname = '', $recursive = false) - { - $result = []; - - foreach ($this->cache as $object) { - if ($object === false) { - continue; - } - if ($object['dirname'] === $dirname) { - $result[] = $object; - } elseif ($recursive && $this->pathIsInDirectory($dirname, $object['path'])) { - $result[] = $object; - } - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - if ($path !== false && array_key_exists($path, $this->cache)) { - return $this->cache[$path] !== false; - } - - if ($this->isComplete(Util::dirname($path), false)) { - return false; - } - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - if (isset($this->cache[$path]['contents']) && $this->cache[$path]['contents'] !== false) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - return false; - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - unset($this->cache[$path]); - $object['path'] = $newpath; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->cache[$newpath] = $object; - $this->autosave(); - } - } - - /** - * {@inheritdoc} - */ - public function copy($path, $newpath) - { - if ($this->has($path)) { - $object = $this->cache[$path]; - $object = array_merge($object, Util::pathinfo($newpath)); - $this->updateObject($newpath, $object, true); - } - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $this->storeMiss($path); - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - foreach ($this->cache as $path => $object) { - if ($this->pathIsInDirectory($dirname, $path) || $path === $dirname) { - unset($this->cache[$path]); - } - } - - unset($this->complete[$dirname]); - - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - if (isset($this->cache[$path]['mimetype'])) { - return $this->cache[$path]; - } - - if (! $result = $this->read($path)) { - return false; - } - - $mimetype = Util::guessMimeType($path, $result['contents']); - $this->cache[$path]['mimetype'] = $mimetype; - - return $this->cache[$path]; - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - if (isset($this->cache[$path]['size'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - if (isset($this->cache[$path]['timestamp'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getVisibility($path) - { - if (isset($this->cache[$path]['visibility'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - if (isset($this->cache[$path]['type'])) { - return $this->cache[$path]; - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function isComplete($dirname, $recursive) - { - if (! array_key_exists($dirname, $this->complete)) { - return false; - } - - if ($recursive && $this->complete[$dirname] !== 'recursive') { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function setComplete($dirname, $recursive) - { - $this->complete[$dirname] = $recursive ? 'recursive' : true; - } - - /** - * Filter the contents from a listing. - * - * @param array $contents object listing - * - * @return array filtered contents - */ - public function cleanContents(array $contents) - { - $cachedProperties = array_flip([ - 'path', 'dirname', 'basename', 'extension', 'filename', - 'size', 'mimetype', 'visibility', 'timestamp', 'type', - ]); - - foreach ($contents as $path => $object) { - if (is_array($object)) { - $contents[$path] = array_intersect_key($object, $cachedProperties); - } - } - - return $contents; - } - - /** - * {@inheritdoc} - */ - public function flush() - { - $this->cache = []; - $this->complete = []; - $this->autosave(); - } - - /** - * {@inheritdoc} - */ - public function autosave() - { - if ($this->autosave) { - $this->save(); - } - } - - /** - * Retrieve serialized cache data. - * - * @return string serialized data - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete]); - } - - /** - * Load from serialized cache data. - * - * @param string $json - */ - public function setFromStorage($json) - { - list($cache, $complete) = json_decode($json, true); - - if (json_last_error() === JSON_ERROR_NONE && is_array($cache) && is_array($complete)) { - $this->cache = $cache; - $this->complete = $complete; - } - } - - /** - * Ensure parent directories of an object. - * - * @param string $path object path - */ - public function ensureParentDirectories($path) - { - $object = $this->cache[$path]; - - while ($object['dirname'] !== '' && ! isset($this->cache[$object['dirname']])) { - $object = Util::pathinfo($object['dirname']); - $object['type'] = 'dir'; - $this->cache[$object['path']] = $object; - } - } - - /** - * Determines if the path is inside the directory. - * - * @param string $directory - * @param string $path - * - * @return bool - */ - protected function pathIsInDirectory($directory, $path) - { - return $directory === '' || strpos($path, $directory . '/') === 0; - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php deleted file mode 100644 index 3aa8b1aee..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Adapter.php +++ /dev/null @@ -1,115 +0,0 @@ -adapter = $adapter; - $this->file = $file; - $this->setExpire($expire); - } - - /** - * Set the expiration time in seconds. - * - * @param int $expire relative expiration time - */ - protected function setExpire($expire) - { - if ($expire) { - $this->expire = $this->getTime($expire); - } - } - - /** - * Get expiration time in seconds. - * - * @param int $time relative expiration time - * - * @return int actual expiration time - */ - protected function getTime($time = 0) - { - return intval(microtime(true)) + $time; - } - - /** - * {@inheritdoc} - */ - public function setFromStorage($json) - { - list($cache, $complete, $expire) = json_decode($json, true); - - if (! $expire || $expire > $this->getTime()) { - $this->cache = $cache; - $this->complete = $complete; - } else { - $this->adapter->delete($this->file); - } - } - - /** - * {@inheritdoc} - */ - public function load() - { - if ($this->adapter->has($this->file)) { - $file = $this->adapter->read($this->file); - if ($file && !empty($file['contents'])) { - $this->setFromStorage($file['contents']); - } - } - } - - /** - * {@inheritdoc} - */ - public function getForStorage() - { - $cleaned = $this->cleanContents($this->cache); - - return json_encode([$cleaned, $this->complete, $this->expire]); - } - - /** - * {@inheritdoc} - */ - public function save() - { - $config = new Config(); - $contents = $this->getForStorage(); - - if ($this->adapter->has($this->file)) { - $this->adapter->update($this->file, $contents, $config); - } else { - $this->adapter->write($this->file, $contents, $config); - } - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php deleted file mode 100644 index f67d2717a..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memcached.php +++ /dev/null @@ -1,59 +0,0 @@ -key = $key; - $this->expire = $expire; - $this->memcached = $memcached; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->memcached->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $expiration = $this->expire === null ? 0 : time() + $this->expire; - $this->memcached->set($this->key, $contents, $expiration); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php deleted file mode 100644 index d0914fabd..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Memory.php +++ /dev/null @@ -1,22 +0,0 @@ -client = $client ?: new Redis(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $contents = $this->client->get($this->key); - - if ($contents !== false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->client->set($this->key, $contents); - - if ($this->expire !== null) { - $this->client->expire($this->key, $this->expire); - } - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php deleted file mode 100644 index 8a295744b..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Predis.php +++ /dev/null @@ -1,75 +0,0 @@ -client = $client ?: new Client(); - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function load() - { - if (($contents = $this->executeCommand('get', [$this->key])) !== null) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $this->executeCommand('set', [$this->key, $contents]); - - if ($this->expire !== null) { - $this->executeCommand('expire', [$this->key, $this->expire]); - } - } - - /** - * Execute a Predis command. - * - * @param string $name - * @param array $arguments - * - * @return string - */ - protected function executeCommand($name, array $arguments) - { - $command = $this->client->createCommand($name, $arguments); - - return $this->client->executeCommand($command); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php deleted file mode 100644 index 43be87e53..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Psr6Cache.php +++ /dev/null @@ -1,59 +0,0 @@ -pool = $pool; - $this->key = $key; - $this->expire = $expire; - } - - /** - * {@inheritdoc} - */ - public function save() - { - $item = $this->pool->getItem($this->key); - $item->set($this->getForStorage()); - $item->expiresAfter($this->expire); - $this->pool->save($item); - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - if ($item->isHit()) { - $this->setFromStorage($item->get()); - } - } -} \ No newline at end of file diff --git a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php b/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php deleted file mode 100644 index e05b83228..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/src/Storage/Stash.php +++ /dev/null @@ -1,60 +0,0 @@ -key = $key; - $this->expire = $expire; - $this->pool = $pool; - } - - /** - * {@inheritdoc} - */ - public function load() - { - $item = $this->pool->getItem($this->key); - $contents = $item->get(); - - if ($item->isMiss() === false) { - $this->setFromStorage($contents); - } - } - - /** - * {@inheritdoc} - */ - public function save() - { - $contents = $this->getForStorage(); - $item = $this->pool->getItem($this->key); - $item->set($contents, $this->expire); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php deleted file mode 100644 index b63cba788..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/AdapterCacheTests.php +++ /dev/null @@ -1,104 +0,0 @@ -shouldReceive('has')->once()->with('file.json')->andReturn(false); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadExpired() - { - $response = ['contents' => json_encode([[], ['' => true], 1234567890]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('delete')->once()->with('file.json'); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = ['contents' => json_encode([[], ['' => true], 9876543210]), 'path' => 'file.json']; - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $cache = new Adapter($adapter, 'file.json', 10); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSaveExists() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(true); - $adapter->shouldReceive('update')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testSaveNew() - { - $response = json_encode([[], [], null]); - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', $response, Mockery::any()); - $cache = new Adapter($adapter, 'file.json', null); - $cache->save(); - } - - public function testStoreContentsRecursive() - { - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->once()->with('file.json')->andReturn(false); - $adapter->shouldReceive('write')->once()->with('file.json', Mockery::any(), Mockery::any()); - - $cache = new Adapter($adapter, 'file.json', null); - - $contents = [ - ['path' => 'foo/bar', 'dirname' => 'foo'], - ['path' => 'afoo/bang', 'dirname' => 'afoo'], - ]; - - $cache->storeContents('foo', $contents, true); - - $this->assertTrue($cache->isComplete('foo', true)); - $this->assertFalse($cache->isComplete('afoo', true)); - } - - public function testDeleteDir() - { - $cache_data = [ - 'foo' => ['path' => 'foo', 'type' => 'dir', 'dirname' => ''], - 'foo/bar' => ['path' => 'foo/bar', 'type' => 'file', 'dirname' => 'foo'], - 'foobaz' => ['path' => 'foobaz', 'type' => 'file', 'dirname' => ''], - ]; - - $response = [ - 'contents' => json_encode([$cache_data, [], null]), - 'path' => 'file.json', - ]; - - $adapter = Mockery::mock('League\Flysystem\AdapterInterface'); - $adapter->shouldReceive('has')->zeroOrMoreTimes()->with('file.json')->andReturn(true); - $adapter->shouldReceive('read')->once()->with('file.json')->andReturn($response); - $adapter->shouldReceive('update')->once()->with('file.json', Mockery::any(), Mockery::any())->andReturn(true); - - $cache = new Adapter($adapter, 'file.json', null); - $cache->load(); - - $cache->deleteDir('foo', true); - - $this->assertSame(1, count($cache->listContents('', true))); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php deleted file mode 100644 index 40d4c915e..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/InspectionTests.php +++ /dev/null @@ -1,16 +0,0 @@ -shouldReceive('load')->once(); - $cached_adapter = new CachedAdapter($adapter, $cache); - $this->assertInstanceOf('League\Flysystem\AdapterInterface', $cached_adapter->getAdapter()); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php deleted file mode 100644 index e3d9ad939..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/MemcachedTests.php +++ /dev/null @@ -1,35 +0,0 @@ -shouldReceive('get')->once()->andReturn(false); - $cache = new Memcached($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('get')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $client = Mockery::mock('Memcached'); - $client->shouldReceive('set')->once()->andReturn($response); - $cache = new Memcached($client); - $cache->save(); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php deleted file mode 100644 index 3ac58fd08..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/MemoryCacheTests.php +++ /dev/null @@ -1,255 +0,0 @@ -setAutosave(true); - $this->assertTrue($cache->getAutosave()); - $cache->setAutosave(false); - $this->assertFalse($cache->getAutosave()); - } - - public function testCacheMiss() - { - $cache = new Memory(); - $cache->storeMiss('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testIsComplete() - { - $cache = new Memory(); - $this->assertFalse($cache->isComplete('dirname', false)); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->isComplete('dirname', true)); - $cache->setComplete('dirname', true); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testCleanContents() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'invalid' => 'thing', - ]]; - - $expected = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - ]]; - - $output = $cache->cleanContents($input); - $this->assertEquals($expected, $output); - } - - public function testGetForStorage() - { - $cache = new Memory(); - $input = [[ - 'path' => 'path.txt', - 'visibility' => 'public', - 'type' => 'file', - ]]; - - $cache->storeContents('', $input, true); - $contents = $cache->listContents('', true); - $cached = []; - foreach ($contents as $item) { - $cached[$item['path']] = $item; - } - - $this->assertEquals(json_encode([$cached, ['' => 'recursive']]), $cache->getForStorage()); - } - - public function testParentCompleteIsUsedDuringHas() - { - $cache = new Memory(); - $cache->setComplete('dirname', false); - $this->assertFalse($cache->has('dirname/path.txt')); - } - - public function testFlush() - { - $cache = new Memory(); - $cache->setComplete('dirname', true); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'visibility' => 'public', - ]); - $cache->flush(); - $this->assertFalse($cache->isComplete('dirname', true)); - $this->assertNull($cache->has('path.txt')); - } - - public function testSetFromStorage() - { - $cache = new Memory(); - $json = [[ - 'path.txt' => ['path' => 'path.txt', 'type' => 'file'], - ], ['dirname' => 'recursive']]; - $jsonString = json_encode($json); - $cache->setFromStorage($jsonString); - $this->assertTrue($cache->has('path.txt')); - $this->assertTrue($cache->isComplete('dirname', true)); - } - - public function testGetMetadataFail() - { - $cache = new Memory(); - $this->assertFalse($cache->getMetadata('path.txt')); - } - - public function metaGetterProvider() - { - return [ - ['getTimestamp', 'timestamp', 12344], - ['getMimetype', 'mimetype', 'text/plain'], - ['getSize', 'size', 12], - ['getVisibility', 'visibility', 'private'], - ['read', 'contents', '__contents__'], - ]; - } - - /** - * @dataProvider metaGetterProvider - * - * @param $method - * @param $key - * @param $value - */ - public function testMetaGetters($method, $key, $value) - { - $cache = new Memory(); - $this->assertFalse($cache->{$method}('path.txt')); - $cache->updateObject('path.txt', $object = [ - 'path' => 'path.txt', - 'type' => 'file', - $key => $value, - ] + Util::pathinfo('path.txt'), true); - $this->assertEquals($object, $cache->{$method}('path.txt')); - $this->assertEquals($object, $cache->getMetadata('path.txt')); - } - - public function testGetDerivedMimetype() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'contents' => 'something', - ]); - $response = $cache->getMimetype('path.txt'); - $this->assertEquals('text/plain', $response['mimetype']); - } - - public function testCopyFail() - { - $cache = new Memory(); - $cache->copy('one', 'two'); - $this->assertNull($cache->has('two')); - $this->assertNull($cache->load()); - } - - public function testStoreContents() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/nested', 'type' => 'dir'], - ['path' => 'dirname/nested/deep', 'type' => 'dir'], - ['path' => 'other/nested/deep', 'type' => 'dir'], - ], true); - - $this->isTrue($cache->isComplete('other/nested', true)); - } - - public function testDelete() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $this->assertTrue($cache->has('path.txt')); - $cache->delete('path.txt'); - $this->assertFalse($cache->has('path.txt')); - } - - public function testDeleteDir() - { - $cache = new Memory(); - $cache->storeContents('dirname', [ - ['path' => 'dirname/path.txt', 'type' => 'file'], - ]); - $this->assertTrue($cache->isComplete('dirname', false)); - $this->assertTrue($cache->has('dirname/path.txt')); - $cache->deleteDir('dirname'); - $this->assertFalse($cache->isComplete('dirname', false)); - $this->assertNull($cache->has('dirname/path.txt')); - } - - public function testReadStream() - { - $cache = new Memory(); - $this->assertFalse($cache->readStream('path.txt')); - } - - public function testRename() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->rename('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testCopy() - { - $cache = new Memory(); - $cache->updateObject('path.txt', ['type' => 'file']); - $cache->copy('path.txt', 'newpath.txt'); - $this->assertTrue($cache->has('newpath.txt')); - } - - public function testComplextListContents() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/nested/file.txt', 'type' => 'file'], - ]); - - $this->assertCount(3, $cache->listContents('other', true)); - } - - public function testComplextListContentsWithDeletedFile() - { - $cache = new Memory(); - $cache->storeContents('', [ - ['path' => 'dirname', 'type' => 'dir'], - ['path' => 'dirname/file.txt', 'type' => 'file'], - ['path' => 'other', 'type' => 'dir'], - ['path' => 'other/file.txt', 'type' => 'file'], - ['path' => 'other/another_file.txt', 'type' => 'file'], - ]); - - $cache->delete('other/another_file.txt'); - $this->assertCount(4, $cache->listContents('', true)); - } - - public function testCacheMissIfContentsIsFalse() - { - $cache = new Memory(); - $cache->updateObject('path.txt', [ - 'path' => 'path.txt', - 'contents' => false, - ], true); - - $this->assertFalse($cache->read('path.txt')); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php deleted file mode 100644 index 148616ff1..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/NoopCacheTests.php +++ /dev/null @@ -1,35 +0,0 @@ -assertEquals($cache, $cache->storeMiss('file.txt')); - $this->assertNull($cache->setComplete('', false)); - $this->assertNull($cache->load()); - $this->assertNull($cache->flush()); - $this->assertNull($cache->has('path.txt')); - $this->assertNull($cache->autosave()); - $this->assertFalse($cache->isComplete('', false)); - $this->assertFalse($cache->read('something')); - $this->assertFalse($cache->readStream('something')); - $this->assertFalse($cache->getMetadata('something')); - $this->assertFalse($cache->getMimetype('something')); - $this->assertFalse($cache->getSize('something')); - $this->assertFalse($cache->getTimestamp('something')); - $this->assertFalse($cache->getVisibility('something')); - $this->assertEmpty($cache->listContents('', false)); - $this->assertFalse($cache->rename('', '')); - $this->assertFalse($cache->copy('', '')); - $this->assertNull($cache->save()); - $object = ['path' => 'path.ext']; - $this->assertEquals($object, $cache->updateObject('path.txt', $object)); - $this->assertEquals([['path' => 'some/file.txt']], $cache->storeContents('unknwon', [ - ['path' => 'some/file.txt'], - ], false)); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php deleted file mode 100644 index d1ccb6545..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/PhpRedisTests.php +++ /dev/null @@ -1,45 +0,0 @@ -shouldReceive('get')->with('flysystem')->once()->andReturn(false); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('get')->with('flysystem')->once()->andReturn($response); - $cache = new PhpRedis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $cache = new PhpRedis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Redis'); - $client->shouldReceive('set')->with('flysystem', $data)->once(); - $client->shouldReceive('expire')->with('flysystem', 20)->once(); - $cache = new PhpRedis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/PredisTests.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/PredisTests.php deleted file mode 100644 index e33e10468..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/PredisTests.php +++ /dev/null @@ -1,55 +0,0 @@ -shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn(null); - $cache = new Predis($client); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('get', ['flysystem'])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->andReturn($response); - $cache = new Predis($client); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $cache = new Predis($client); - $cache->save(); - } - - public function testSaveWithExpire() - { - $data = json_encode([[], []]); - $client = Mockery::mock('Predis\Client'); - $command = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('set', ['flysystem', $data])->once()->andReturn($command); - $client->shouldReceive('executeCommand')->with($command)->once(); - $expireCommand = Mockery::mock('Predis\Command\CommandInterface'); - $client->shouldReceive('createCommand')->with('expire', ['flysystem', 20])->once()->andReturn($expireCommand); - $client->shouldReceive('executeCommand')->with($expireCommand)->once(); - $cache = new Predis($client, 'flysystem', 20); - $cache->save(); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php deleted file mode 100644 index d5e5700cf..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/Psr6CacheTest.php +++ /dev/null @@ -1,45 +0,0 @@ -shouldReceive('isHit')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isHit')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Psr6Cache($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $ttl = 4711; - $pool = Mockery::mock('Psr\Cache\CacheItemPoolInterface'); - $item = Mockery::mock('Psr\Cache\CacheItemInterface'); - $item->shouldReceive('expiresAfter')->once()->with($ttl); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $pool->shouldReceive('save')->once()->with($item); - $cache = new Psr6Cache($pool, 'foo', $ttl); - $cache->save(); - } -} diff --git a/crmeb/vendor/league/flysystem-cached-adapter/tests/StashTest.php b/crmeb/vendor/league/flysystem-cached-adapter/tests/StashTest.php deleted file mode 100644 index 29e142d79..000000000 --- a/crmeb/vendor/league/flysystem-cached-adapter/tests/StashTest.php +++ /dev/null @@ -1,43 +0,0 @@ -shouldReceive('get')->once()->andReturn(null); - $item->shouldReceive('isMiss')->once()->andReturn(true); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertFalse($cache->isComplete('', false)); - } - - public function testLoadSuccess() - { - $response = json_encode([[], ['' => true]]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('get')->once()->andReturn($response); - $item->shouldReceive('isMiss')->once()->andReturn(false); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->load(); - $this->assertTrue($cache->isComplete('', false)); - } - - public function testSave() - { - $response = json_encode([[], []]); - $pool = Mockery::mock('Stash\Pool'); - $item = Mockery::mock('Stash\Item'); - $item->shouldReceive('set')->once()->andReturn($response); - $pool->shouldReceive('getItem')->once()->andReturn($item); - $cache = new Stash($pool); - $cache->save(); - } -} diff --git a/crmeb/vendor/league/flysystem/LICENSE b/crmeb/vendor/league/flysystem/LICENSE deleted file mode 100644 index f2684c841..000000000 --- a/crmeb/vendor/league/flysystem/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013-2019 Frank de Jonge - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/crmeb/vendor/league/flysystem/composer.json b/crmeb/vendor/league/flysystem/composer.json deleted file mode 100644 index 84229e9ff..000000000 --- a/crmeb/vendor/league/flysystem/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "league/flysystem", - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "filesystem", "filesystems", "files", "storage", "dropbox", "aws", - "abstraction", "s3", "ftp", "sftp", "remote", "webdav", - "file systems", "cloud", "cloud files", "rackspace", "copy.com" - ], - "license": "MIT", - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "require": { - "php": ">=5.5.9", - "ext-fileinfo": "*" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "League\\Flysystem\\Stub\\": "stub/" - }, - "files": [ - "tests/PHPUnitHacks.php" - ] - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "scripts": { - "phpstan": "php phpstan.php" - } -} diff --git a/crmeb/vendor/league/flysystem/deprecations.md b/crmeb/vendor/league/flysystem/deprecations.md deleted file mode 100644 index c336a425d..000000000 --- a/crmeb/vendor/league/flysystem/deprecations.md +++ /dev/null @@ -1,19 +0,0 @@ -# Deprecations - -This document lists all the planned deprecations. - -## Handlers will be removed in 2.0 - -The `Handler` type and associated calls will be removed in version 2.0. - -### Upgrade path - -You should create your own implementation for handling OOP usage, -but it's recommended to move away from using an OOP-style wrapper entirely. - -The reason for this is that it's too easy for implementation details (for -your application this is Flysystem) to leak into the application. The most -important part for Flysystem is that it improves portability and creates a -solid boundary between your application core and the infrastructure you use. -The OOP-style handling breaks this principle, therefore I want to stop -promoting it. diff --git a/crmeb/vendor/league/flysystem/src/Adapter/AbstractAdapter.php b/crmeb/vendor/league/flysystem/src/Adapter/AbstractAdapter.php deleted file mode 100644 index e577ac4a7..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/AbstractAdapter.php +++ /dev/null @@ -1,72 +0,0 @@ -pathPrefix = null; - - return; - } - - $this->pathPrefix = rtrim($prefix, '\\/') . $this->pathSeparator; - } - - /** - * Get the path prefix. - * - * @return string|null path prefix or null if pathPrefix is empty - */ - public function getPathPrefix() - { - return $this->pathPrefix; - } - - /** - * Prefix a path. - * - * @param string $path - * - * @return string prefixed path - */ - public function applyPathPrefix($path) - { - return $this->getPathPrefix() . ltrim($path, '\\/'); - } - - /** - * Remove a path prefix. - * - * @param string $path - * - * @return string path without the prefix - */ - public function removePathPrefix($path) - { - return substr($path, strlen($this->getPathPrefix())); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/crmeb/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php deleted file mode 100644 index 578b49190..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ /dev/null @@ -1,693 +0,0 @@ -safeStorage = new SafeStorage(); - $this->setConfig($config); - } - - /** - * Set the config. - * - * @param array $config - * - * @return $this - */ - public function setConfig(array $config) - { - foreach ($this->configurable as $setting) { - if ( ! isset($config[$setting])) { - continue; - } - - $method = 'set' . ucfirst($setting); - - if (method_exists($this, $method)) { - $this->$method($config[$setting]); - } - } - - return $this; - } - - /** - * Returns the host. - * - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * Set the host. - * - * @param string $host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - - return $this; - } - - /** - * Set the public permission value. - * - * @param int $permPublic - * - * @return $this - */ - public function setPermPublic($permPublic) - { - $this->permPublic = $permPublic; - - return $this; - } - - /** - * Set the private permission value. - * - * @param int $permPrivate - * - * @return $this - */ - public function setPermPrivate($permPrivate) - { - $this->permPrivate = $permPrivate; - - return $this; - } - - /** - * Returns the ftp port. - * - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Returns the root folder to work from. - * - * @return string - */ - public function getRoot() - { - return $this->root; - } - - /** - * Set the ftp port. - * - * @param int|string $port - * - * @return $this - */ - public function setPort($port) - { - $this->port = (int) $port; - - return $this; - } - - /** - * Set the root folder to work from. - * - * @param string $root - * - * @return $this - */ - public function setRoot($root) - { - $this->root = rtrim($root, '\\/') . $this->separator; - - return $this; - } - - /** - * Returns the ftp username. - * - * @return string username - */ - public function getUsername() - { - $username = $this->safeStorage->retrieveSafely('username'); - - return $username !== null ? $username : 'anonymous'; - } - - /** - * Set ftp username. - * - * @param string $username - * - * @return $this - */ - public function setUsername($username) - { - $this->safeStorage->storeSafely('username', $username); - - return $this; - } - - /** - * Returns the password. - * - * @return string password - */ - public function getPassword() - { - return $this->safeStorage->retrieveSafely('password'); - } - - /** - * Set the ftp password. - * - * @param string $password - * - * @return $this - */ - public function setPassword($password) - { - $this->safeStorage->storeSafely('password', $password); - - return $this; - } - - /** - * Returns the amount of seconds before the connection will timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->timeout; - } - - /** - * Set the amount of seconds before the connection should timeout. - * - * @param int $timeout - * - * @return $this - */ - public function setTimeout($timeout) - { - $this->timeout = (int) $timeout; - - return $this; - } - - /** - * Return the FTP system type. - * - * @return string - */ - public function getSystemType() - { - return $this->systemType; - } - - /** - * Set the FTP system type (windows or unix). - * - * @param string $systemType - * - * @return $this - */ - public function setSystemType($systemType) - { - $this->systemType = strtolower($systemType); - - return $this; - } - - /** - * True to enable timestamps for FTP servers that return unix-style listings. - * - * @param bool $bool - * - * @return $this - */ - public function setEnableTimestampsOnUnixListings($bool = false) - { - $this->enableTimestampsOnUnixListings = $bool; - - return $this; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return $this->listDirectoryContents($directory, $recursive); - } - - abstract protected function listDirectoryContents($directory, $recursive = false); - - /** - * Normalize a directory listing. - * - * @param array $listing - * @param string $prefix - * - * @return array directory listing - */ - protected function normalizeListing(array $listing, $prefix = '') - { - $base = $prefix; - $result = []; - $listing = $this->removeDotDirectories($listing); - - while ($item = array_shift($listing)) { - if (preg_match('#^.*:$#', $item)) { - $base = preg_replace('~^\./*|:$~', '', $item); - continue; - } - - $result[] = $this->normalizeObject($item, $base); - } - - return $this->sortListing($result); - } - - /** - * Sort a directory listing. - * - * @param array $result - * - * @return array sorted listing - */ - protected function sortListing(array $result) - { - $compare = function ($one, $two) { - return strnatcmp($one['path'], $two['path']); - }; - - usort($result, $compare); - - return $result; - } - - /** - * Normalize a file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - * - * @throws NotSupportedException - */ - protected function normalizeObject($item, $base) - { - $systemType = $this->systemType ?: $this->detectSystemType($item); - - if ($systemType === 'unix') { - return $this->normalizeUnixObject($item, $base); - } elseif ($systemType === 'windows') { - return $this->normalizeWindowsObject($item, $base); - } - - throw NotSupportedException::forFtpSystemType($systemType); - } - - /** - * Normalize a Unix file entry. - * - * Given $item contains: - * '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt' - * - * This function will return: - * [ - * 'type' => 'file', - * 'path' => 'file1.txt', - * 'visibility' => 'public', - * 'size' => 409, - * 'timestamp' => 1566205260 - * ] - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeUnixObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 7); - - if (count(explode(' ', $item, 9)) !== 9) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($permissions, /* $number */, /* $owner */, /* $group */, $size, $month, $day, $timeOrYear, $name) = explode(' ', $item, 9); - $type = $this->detectType($permissions); - $path = $base === '' ? $name : $base . $this->separator . $name; - - if ($type === 'dir') { - return compact('type', 'path'); - } - - $permissions = $this->normalizePermissions($permissions); - $visibility = $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE; - $size = (int) $size; - - $result = compact('type', 'path', 'visibility', 'size'); - if ($this->enableTimestampsOnUnixListings) { - $timestamp = $this->normalizeUnixTimestamp($month, $day, $timeOrYear); - $result += compact('timestamp'); - } - - return $result; - } - - /** - * Only accurate to the minute (current year), or to the day. - * - * Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command - * - * Note: The 'MLSD' command is a machine-readable replacement for 'LIST' - * but many FTP servers do not support it :( - * - * @param string $month e.g. 'Aug' - * @param string $day e.g. '19' - * @param string $timeOrYear e.g. '09:01' OR '2015' - * - * @return int - */ - protected function normalizeUnixTimestamp($month, $day, $timeOrYear) - { - if (is_numeric($timeOrYear)) { - $year = $timeOrYear; - $hour = '00'; - $minute = '00'; - $seconds = '00'; - } else { - $year = date('Y'); - list($hour, $minute) = explode(':', $timeOrYear); - $seconds = '00'; - } - $dateTime = DateTime::createFromFormat('Y-M-j-G:i:s', "{$year}-{$month}-{$day}-{$hour}:{$minute}:{$seconds}"); - - return $dateTime->getTimestamp(); - } - - /** - * Normalize a Windows/DOS file entry. - * - * @param string $item - * @param string $base - * - * @return array normalized file array - */ - protected function normalizeWindowsObject($item, $base) - { - $item = preg_replace('#\s+#', ' ', trim($item), 3); - - if (count(explode(' ', $item, 4)) !== 4) { - throw new RuntimeException("Metadata can't be parsed from item '$item' , not enough parts."); - } - - list($date, $time, $size, $name) = explode(' ', $item, 4); - $path = $base === '' ? $name : $base . $this->separator . $name; - - // Check for the correct date/time format - $format = strlen($date) === 8 ? 'm-d-yH:iA' : 'Y-m-dH:i'; - $dt = DateTime::createFromFormat($format, $date . $time); - $timestamp = $dt ? $dt->getTimestamp() : (int) strtotime("$date $time"); - - if ($size === '') { - $type = 'dir'; - - return compact('type', 'path', 'timestamp'); - } - - $type = 'file'; - $visibility = AdapterInterface::VISIBILITY_PUBLIC; - $size = (int) $size; - - return compact('type', 'path', 'visibility', 'size', 'timestamp'); - } - - /** - * Get the system type from a listing item. - * - * @param string $item - * - * @return string the system type - */ - protected function detectSystemType($item) - { - return preg_match('/^[0-9]{2,4}-[0-9]{2}-[0-9]{2}/', $item) ? 'windows' : 'unix'; - } - - /** - * Get the file type from the permissions. - * - * @param string $permissions - * - * @return string file type - */ - protected function detectType($permissions) - { - return substr($permissions, 0, 1) === 'd' ? 'dir' : 'file'; - } - - /** - * Normalize a permissions string. - * - * @param string $permissions - * - * @return int - */ - protected function normalizePermissions($permissions) - { - // remove the type identifier - $permissions = substr($permissions, 1); - - // map the string rights to the numeric counterparts - $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1']; - $permissions = strtr($permissions, $map); - - // split up the permission groups - $parts = str_split($permissions, 3); - - // convert the groups - $mapper = function ($part) { - return array_sum(str_split($part)); - }; - - // converts to decimal number - return octdec(implode('', array_map($mapper, $parts))); - } - - /** - * Filter out dot-directories. - * - * @param array $list - * - * @return array - */ - public function removeDotDirectories(array $list) - { - $filter = function ($line) { - return $line !== '' && ! preg_match('#.* \.(\.)?$|^total#', $line); - }; - - return array_filter($list, $filter); - } - - /** - * @inheritdoc - */ - public function has($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return $this->getMetadata($path); - } - - /** - * Ensure a directory exists. - * - * @param string $dirname - */ - public function ensureDirectory($dirname) - { - $dirname = (string) $dirname; - - if ($dirname !== '' && ! $this->has($dirname)) { - $this->createDir($dirname, new Config()); - } - } - - /** - * @return mixed - */ - public function getConnection() - { - $tries = 0; - - while ( ! $this->isConnected() && $tries < 3) { - $tries++; - $this->disconnect(); - $this->connect(); - } - - return $this->connection; - } - - /** - * Get the public permission value. - * - * @return int - */ - public function getPermPublic() - { - return $this->permPublic; - } - - /** - * Get the private permission value. - * - * @return int - */ - public function getPermPrivate() - { - return $this->permPrivate; - } - - /** - * Disconnect on destruction. - */ - public function __destruct() - { - $this->disconnect(); - } - - /** - * Establish a connection. - */ - abstract public function connect(); - - /** - * Close the connection. - */ - abstract public function disconnect(); - - /** - * Check if a connection is active. - * - * @return bool - */ - abstract public function isConnected(); -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php b/crmeb/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php deleted file mode 100644 index fd8d2161e..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/CanOverwriteFiles.php +++ /dev/null @@ -1,12 +0,0 @@ -transferMode = $mode; - - return $this; - } - - /** - * Set if Ssl is enabled. - * - * @param bool $ssl - * - * @return $this - */ - public function setSsl($ssl) - { - $this->ssl = (bool) $ssl; - - return $this; - } - - /** - * Set if passive mode should be used. - * - * @param bool $passive - */ - public function setPassive($passive = true) - { - $this->passive = $passive; - } - - /** - * @param bool $ignorePassiveAddress - */ - public function setIgnorePassiveAddress($ignorePassiveAddress) - { - $this->ignorePassiveAddress = $ignorePassiveAddress; - } - - /** - * @param bool $recurseManually - */ - public function setRecurseManually($recurseManually) - { - $this->recurseManually = $recurseManually; - } - - /** - * @param bool $utf8 - */ - public function setUtf8($utf8) - { - $this->utf8 = (bool) $utf8; - } - - /** - * Connect to the FTP server. - */ - public function connect() - { - if ($this->ssl) { - $this->connection = ftp_ssl_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } else { - $this->connection = ftp_connect($this->getHost(), $this->getPort(), $this->getTimeout()); - } - - if ( ! $this->connection) { - throw new RuntimeException('Could not connect to host: ' . $this->getHost() . ', port:' . $this->getPort()); - } - - $this->login(); - $this->setUtf8Mode(); - $this->setConnectionPassiveMode(); - $this->setConnectionRoot(); - $this->isPureFtpd = $this->isPureFtpdServer(); - } - - /** - * Set the connection to UTF-8 mode. - */ - protected function setUtf8Mode() - { - if ($this->utf8) { - $response = ftp_raw($this->connection, "OPTS UTF8 ON"); - if (substr($response[0], 0, 3) !== '200') { - throw new RuntimeException( - 'Could not set UTF-8 mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - } - - /** - * Set the connections to passive mode. - * - * @throws RuntimeException - */ - protected function setConnectionPassiveMode() - { - if (is_bool($this->ignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) { - ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress); - } - - if ( ! ftp_pasv($this->connection, $this->passive)) { - throw new RuntimeException( - 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort() - ); - } - } - - /** - * Set the connection root. - */ - protected function setConnectionRoot() - { - $root = $this->getRoot(); - $connection = $this->connection; - - if ($root && ! ftp_chdir($connection, $root)) { - throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot()); - } - - // Store absolute path for further reference. - // This is needed when creating directories and - // initial root was a relative path, else the root - // would be relative to the chdir'd path. - $this->root = ftp_pwd($connection); - } - - /** - * Login. - * - * @throws RuntimeException - */ - protected function login() - { - set_error_handler(function () { - }); - $isLoggedIn = ftp_login( - $this->connection, - $this->getUsername(), - $this->getPassword() - ); - restore_error_handler(); - - if ( ! $isLoggedIn) { - $this->disconnect(); - throw new RuntimeException( - 'Could not login with connection: ' . $this->getHost() . '::' . $this->getPort( - ) . ', username: ' . $this->getUsername() - ); - } - } - - /** - * Disconnect from the FTP server. - */ - public function disconnect() - { - if (is_resource($this->connection)) { - ftp_close($this->connection); - } - - $this->connection = null; - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $contents); - rewind($stream); - $result = $this->writeStream($path, $stream, $config); - fclose($stream); - - if ($result === false) { - return false; - } - - $result['contents'] = $contents; - $result['mimetype'] = $config->get('mimetype') ?: Util::guessMimeType($path, $contents); - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $this->ensureDirectory(Util::dirname($path)); - - if ( ! ftp_fput($this->getConnection(), $path, $resource, $this->transferMode)) { - return false; - } - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - } - - $type = 'file'; - - return compact('type', 'path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return $this->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return ftp_rename($this->getConnection(), $path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return ftp_delete($this->getConnection(), $path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $connection = $this->getConnection(); - $contents = array_reverse($this->listDirectoryContents($dirname, false)); - - foreach ($contents as $object) { - if ($object['type'] === 'file') { - if ( ! ftp_delete($connection, $object['path'])) { - return false; - } - } elseif ( ! $this->deleteDir($object['path'])) { - return false; - } - } - - return ftp_rmdir($connection, $dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $connection = $this->getConnection(); - $directories = explode('/', $dirname); - - foreach ($directories as $directory) { - if (false === $this->createActualDirectory($directory, $connection)) { - $this->setConnectionRoot(); - - return false; - } - - ftp_chdir($connection, $directory); - } - - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $dirname]; - } - - /** - * Create a directory. - * - * @param string $directory - * @param resource $connection - * - * @return bool - */ - protected function createActualDirectory($directory, $connection) - { - // List the current directory - $listing = ftp_nlist($connection, '.') ?: []; - - foreach ($listing as $key => $item) { - if (preg_match('~^\./.*~', $item)) { - $listing[$key] = substr($item, 2); - } - } - - if (in_array($directory, $listing, true)) { - return true; - } - - return (boolean) ftp_mkdir($connection, $directory); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - if ($path === '') { - return ['type' => 'dir', 'path' => '']; - } - - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - $listing = $this->ftpRawlist('-A', str_replace('*', '\\*', $path)); - - if (empty($listing) || in_array('total 0', $listing, true)) { - return false; - } - - if (preg_match('/.* not found/', $listing[0])) { - return false; - } - - if (preg_match('/^total [0-9]*$/', $listing[0])) { - array_shift($listing); - } - - return $this->normalizeObject($listing[0], ''); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - if ( ! $metadata = $this->getMetadata($path)) { - return false; - } - - $metadata['mimetype'] = MimeType::detectByFilename($path); - - return $metadata; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $timestamp = ftp_mdtm($this->getConnection(), $path); - - return ($timestamp !== -1) ? ['path' => $path, 'timestamp' => $timestamp] : false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - if ( ! $object = $this->readStream($path)) { - return false; - } - - $object['contents'] = stream_get_contents($object['stream']); - fclose($object['stream']); - unset($object['stream']); - - return $object; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $stream = fopen('php://temp', 'w+b'); - $result = ftp_fget($this->getConnection(), $stream, $path, $this->transferMode); - rewind($stream); - - if ( ! $result) { - fclose($stream); - - return false; - } - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $mode = $visibility === AdapterInterface::VISIBILITY_PUBLIC ? $this->getPermPublic() : $this->getPermPrivate(); - - if ( ! ftp_chmod($this->getConnection(), $mode, $path)) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $directory = str_replace('*', '\\*', $directory); - - if ($recursive && $this->recurseManually) { - return $this->listDirectoryContentsRecursive($directory); - } - - $options = $recursive ? '-alnR' : '-aln'; - $listing = $this->ftpRawlist($options, $directory); - - return $listing ? $this->normalizeListing($listing, $directory) : []; - } - - /** - * @inheritdoc - * - * @param string $directory - */ - protected function listDirectoryContentsRecursive($directory) - { - $listing = $this->normalizeListing($this->ftpRawlist('-aln', $directory) ?: [], $directory); - $output = []; - - foreach ($listing as $item) { - $output[] = $item; - if ($item['type'] !== 'dir') { - continue; - } - $output = array_merge($output, $this->listDirectoryContentsRecursive($item['path'])); - } - - return $output; - } - - /** - * Check if the connection is open. - * - * @return bool - * - * @throws ErrorException - */ - public function isConnected() - { - try { - return is_resource($this->connection) && ftp_rawlist($this->connection, $this->getRoot()) !== false; - } catch (ErrorException $e) { - if (strpos($e->getMessage(), 'ftp_rawlist') === false) { - throw $e; - } - - return false; - } - } - - /** - * @return bool - */ - protected function isPureFtpdServer() - { - $response = ftp_raw($this->connection, 'HELP'); - - return stripos(implode(' ', $response), 'Pure-FTPd') !== false; - } - - /** - * The ftp_rawlist function with optional escaping. - * - * @param string $options - * @param string $path - * - * @return array - */ - protected function ftpRawlist($options, $path) - { - $connection = $this->getConnection(); - - if ($this->isPureFtpd) { - $path = str_replace(' ', '\ ', $path); - } - - return ftp_rawlist($connection, $options . ' ' . $path); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/Ftpd.php b/crmeb/vendor/league/flysystem/src/Adapter/Ftpd.php deleted file mode 100644 index d5349e475..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/Ftpd.php +++ /dev/null @@ -1,45 +0,0 @@ - 'dir', 'path' => '']; - } - if (@ftp_chdir($this->getConnection(), $path) === true) { - $this->setConnectionRoot(); - - return ['type' => 'dir', 'path' => $path]; - } - - if ( ! ($object = ftp_raw($this->getConnection(), 'STAT ' . $path)) || count($object) < 3) { - return false; - } - - if (substr($object[1], 0, 5) === "ftpd:") { - return false; - } - - return $this->normalizeObject($object[1], ''); - } - - /** - * @inheritdoc - */ - protected function listDirectoryContents($directory, $recursive = true) - { - $listing = ftp_rawlist($this->getConnection(), $directory, $recursive); - - if ($listing === false || ( ! empty($listing) && substr($listing[0], 0, 5) === "ftpd:")) { - return []; - } - - return $this->normalizeListing($listing, $directory); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/Local.php b/crmeb/vendor/league/flysystem/src/Adapter/Local.php deleted file mode 100644 index 2b892ab74..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/Local.php +++ /dev/null @@ -1,532 +0,0 @@ - [ - 'public' => 0644, - 'private' => 0600, - ], - 'dir' => [ - 'public' => 0755, - 'private' => 0700, - ], - ]; - - /** - * @var string - */ - protected $pathSeparator = DIRECTORY_SEPARATOR; - - /** - * @var array - */ - protected $permissionMap; - - /** - * @var int - */ - protected $writeFlags; - - /** - * @var int - */ - private $linkHandling; - - /** - * Constructor. - * - * @param string $root - * @param int $writeFlags - * @param int $linkHandling - * @param array $permissions - * - * @throws LogicException - */ - public function __construct($root, $writeFlags = LOCK_EX, $linkHandling = self::DISALLOW_LINKS, array $permissions = []) - { - $root = is_link($root) ? realpath($root) : $root; - $this->permissionMap = array_replace_recursive(static::$permissions, $permissions); - $this->ensureDirectory($root); - - if ( ! is_dir($root) || ! is_readable($root)) { - throw new LogicException('The root path ' . $root . ' is not readable.'); - } - - $this->setPathPrefix($root); - $this->writeFlags = $writeFlags; - $this->linkHandling = $linkHandling; - } - - /** - * Ensure the root directory exists. - * - * @param string $root root directory path - * - * @return void - * - * @throws Exception in case the root directory can not be created - */ - protected function ensureDirectory($root) - { - if ( ! is_dir($root)) { - $umask = umask(0); - - if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { - $mkdirError = error_get_last(); - } - - umask($umask); - clearstatcache(false, $root); - - if ( ! is_dir($root)) { - $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; - throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); - } - } - } - - /** - * @inheritdoc - */ - public function has($path) - { - $location = $this->applyPathPrefix($path); - - return file_exists($location); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - - if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) { - return false; - } - - $type = 'file'; - $result = compact('contents', 'type', 'size', 'path'); - - if ($visibility = $config->get('visibility')) { - $result['visibility'] = $visibility; - $this->setVisibility($path, $visibility); - } - - return $result; - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, Config $config) - { - $location = $this->applyPathPrefix($path); - $this->ensureDirectory(dirname($location)); - $stream = fopen($location, 'w+b'); - - if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { - return false; - } - - $type = 'file'; - $result = compact('type', 'path'); - - if ($visibility = $config->get('visibility')) { - $this->setVisibility($path, $visibility); - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $location = $this->applyPathPrefix($path); - $stream = fopen($location, 'rb'); - - return ['type' => 'file', 'path' => $path, 'stream' => $stream]; - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, Config $config) - { - return $this->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - $location = $this->applyPathPrefix($path); - $size = file_put_contents($location, $contents, $this->writeFlags); - - if ($size === false) { - return false; - } - - $type = 'file'; - - $result = compact('type', 'path', 'size', 'contents'); - - if ($mimetype = $config->get('mimetype') ?: Util::guessMimeType($path, $contents)) { - $result['mimetype'] = $mimetype; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function read($path) - { - $location = $this->applyPathPrefix($path); - $contents = @file_get_contents($location); - - if ($contents === false) { - return false; - } - - return ['type' => 'file', 'path' => $path, 'contents' => $contents]; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $parentDirectory = $this->applyPathPrefix(Util::dirname($newpath)); - $this->ensureDirectory($parentDirectory); - - return rename($location, $destination); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $location = $this->applyPathPrefix($path); - $destination = $this->applyPathPrefix($newpath); - $this->ensureDirectory(dirname($destination)); - - return copy($location, $destination); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $location = $this->applyPathPrefix($path); - - return @unlink($location); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $result = []; - $location = $this->applyPathPrefix($directory); - - if ( ! is_dir($location)) { - return []; - } - - $iterator = $recursive ? $this->getRecursiveDirectoryIterator($location) : $this->getDirectoryIterator($location); - - foreach ($iterator as $file) { - $path = $this->getFilePath($file); - - if (preg_match('#(^|/|\\\\)\.{1,2}$#', $path)) { - continue; - } - - $result[] = $this->normalizeFileInfo($file); - } - - unset($iterator); - - return array_filter($result); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $info = new SplFileInfo($location); - - return $this->normalizeFileInfo($info); - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $location = $this->applyPathPrefix($path); - $finfo = new Finfo(FILEINFO_MIME_TYPE); - $mimetype = $finfo->file($location); - - if (in_array($mimetype, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) { - $mimetype = Util\MimeType::detectByFilename($location); - } - - return ['path' => $path, 'type' => 'file', 'mimetype' => $mimetype]; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $location = $this->applyPathPrefix($path); - clearstatcache(false, $location); - $permissions = octdec(substr(sprintf('%o', fileperms($location)), -4)); - $type = is_dir($location) ? 'dir' : 'file'; - - foreach ($this->permissionMap[$type] as $visibility => $visibilityPermissions) { - if ($visibilityPermissions == $permissions) { - return compact('path', 'visibility'); - } - } - - $visibility = substr(sprintf('%o', fileperms($location)), -4); - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $location = $this->applyPathPrefix($path); - $type = is_dir($location) ? 'dir' : 'file'; - $success = chmod($location, $this->permissionMap[$type][$visibility]); - - if ($success === false) { - return false; - } - - return compact('path', 'visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - $location = $this->applyPathPrefix($dirname); - $umask = umask(0); - $visibility = $config->get('visibility', 'public'); - $return = ['path' => $dirname, 'type' => 'dir']; - - if ( ! is_dir($location)) { - if (false === @mkdir($location, $this->permissionMap['dir'][$visibility], true) - || false === is_dir($location)) { - $return = false; - } - } - - umask($umask); - - return $return; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $location = $this->applyPathPrefix($dirname); - - if ( ! is_dir($location)) { - return false; - } - - $contents = $this->getRecursiveDirectoryIterator($location, RecursiveIteratorIterator::CHILD_FIRST); - - /** @var SplFileInfo $file */ - foreach ($contents as $file) { - $this->guardAgainstUnreadableFileInfo($file); - $this->deleteFileInfoObject($file); - } - - unset($contents); - - return rmdir($location); - } - - /** - * @param SplFileInfo $file - */ - protected function deleteFileInfoObject(SplFileInfo $file) - { - switch ($file->getType()) { - case 'dir': - rmdir($file->getRealPath()); - break; - case 'link': - unlink($file->getPathname()); - break; - default: - unlink($file->getRealPath()); - } - } - - /** - * Normalize the file info. - * - * @param SplFileInfo $file - * - * @return array|void - * - * @throws NotSupportedException - */ - protected function normalizeFileInfo(SplFileInfo $file) - { - if ( ! $file->isLink()) { - return $this->mapFileInfo($file); - } - - if ($this->linkHandling & self::DISALLOW_LINKS) { - throw NotSupportedException::forLink($file); - } - } - - /** - * Get the normalized path from a SplFileInfo object. - * - * @param SplFileInfo $file - * - * @return string - */ - protected function getFilePath(SplFileInfo $file) - { - $location = $file->getPathname(); - $path = $this->removePathPrefix($location); - - return trim(str_replace('\\', '/', $path), '/'); - } - - /** - * @param string $path - * @param int $mode - * - * @return RecursiveIteratorIterator - */ - protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST) - { - return new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), - $mode - ); - } - - /** - * @param string $path - * - * @return DirectoryIterator - */ - protected function getDirectoryIterator($path) - { - $iterator = new DirectoryIterator($path); - - return $iterator; - } - - /** - * @param SplFileInfo $file - * - * @return array - */ - protected function mapFileInfo(SplFileInfo $file) - { - $normalized = [ - 'type' => $file->getType(), - 'path' => $this->getFilePath($file), - ]; - - $normalized['timestamp'] = $file->getMTime(); - - if ($normalized['type'] === 'file') { - $normalized['size'] = $file->getSize(); - } - - return $normalized; - } - - /** - * @param SplFileInfo $file - * - * @throws UnreadableFileException - */ - protected function guardAgainstUnreadableFileInfo(SplFileInfo $file) - { - if ( ! $file->isReadable()) { - throw UnreadableFileException::forFileInfo($file); - } - } -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/NullAdapter.php b/crmeb/vendor/league/flysystem/src/Adapter/NullAdapter.php deleted file mode 100644 index 2527087f7..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/NullAdapter.php +++ /dev/null @@ -1,144 +0,0 @@ -get('visibility')) { - $result['visibility'] = $visibility; - } - - return $result; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, Config $config) - { - return false; - } - - /** - * @inheritdoc - */ - public function read($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - return false; - } - - /** - * @inheritdoc - */ - public function delete($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - return []; - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - return false; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - return compact('visibility'); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, Config $config) - { - return ['path' => $dirname, 'type' => 'dir']; - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - return false; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php b/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php deleted file mode 100644 index fc0a747ac..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/NotSupportingVisibilityTrait.php +++ /dev/null @@ -1,33 +0,0 @@ -readStream($path); - - if ($response === false || ! is_resource($response['stream'])) { - return false; - } - - $result = $this->writeStream($newpath, $response['stream'], new Config()); - - if ($result !== false && is_resource($response['stream'])) { - fclose($response['stream']); - } - - return $result !== false; - } - - // Required abstract method - - /** - * @param string $path - * - * @return resource - */ - abstract public function readStream($path); - - /** - * @param string $path - * @param resource $resource - * @param Config $config - * - * @return resource - */ - abstract public function writeStream($path, $resource, Config $config); -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php b/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php deleted file mode 100644 index 2b31c01d6..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php +++ /dev/null @@ -1,44 +0,0 @@ -read($path)) { - return false; - } - - $stream = fopen('php://temp', 'w+b'); - fwrite($stream, $data['contents']); - rewind($stream); - $data['stream'] = $stream; - unset($data['contents']); - - return $data; - } - - /** - * Reads a file. - * - * @param string $path - * - * @return array|false - * - * @see League\Flysystem\ReadInterface::read() - */ - abstract public function read($path); -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php b/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php deleted file mode 100644 index 80424960c..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/Polyfill/StreamedTrait.php +++ /dev/null @@ -1,9 +0,0 @@ -stream($path, $resource, $config, 'write'); - } - - /** - * Update a file using a stream. - * - * @param string $path - * @param resource $resource - * @param Config $config Config object or visibility setting - * - * @return mixed false of file metadata - */ - public function updateStream($path, $resource, Config $config) - { - return $this->stream($path, $resource, $config, 'update'); - } - - // Required abstract methods - abstract public function write($pash, $contents, Config $config); - abstract public function update($pash, $contents, Config $config); -} diff --git a/crmeb/vendor/league/flysystem/src/Adapter/SynologyFtp.php b/crmeb/vendor/league/flysystem/src/Adapter/SynologyFtp.php deleted file mode 100644 index fe0d344cf..000000000 --- a/crmeb/vendor/league/flysystem/src/Adapter/SynologyFtp.php +++ /dev/null @@ -1,8 +0,0 @@ -settings = $settings; - } - - /** - * Get a setting. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - public function get($key, $default = null) - { - if ( ! array_key_exists($key, $this->settings)) { - return $this->getDefault($key, $default); - } - - return $this->settings[$key]; - } - - /** - * Check if an item exists by key. - * - * @param string $key - * - * @return bool - */ - public function has($key) - { - if (array_key_exists($key, $this->settings)) { - return true; - } - - return $this->fallback instanceof Config - ? $this->fallback->has($key) - : false; - } - - /** - * Try to retrieve a default setting from a config fallback. - * - * @param string $key - * @param mixed $default - * - * @return mixed config setting or default when not found - */ - protected function getDefault($key, $default) - { - if ( ! $this->fallback) { - return $default; - } - - return $this->fallback->get($key, $default); - } - - /** - * Set a setting. - * - * @param string $key - * @param mixed $value - * - * @return $this - */ - public function set($key, $value) - { - $this->settings[$key] = $value; - - return $this; - } - - /** - * Set the fallback. - * - * @param Config $fallback - * - * @return $this - */ - public function setFallback(Config $fallback) - { - $this->fallback = $fallback; - - return $this; - } -} diff --git a/crmeb/vendor/league/flysystem/src/ConfigAwareTrait.php b/crmeb/vendor/league/flysystem/src/ConfigAwareTrait.php deleted file mode 100644 index 202d605da..000000000 --- a/crmeb/vendor/league/flysystem/src/ConfigAwareTrait.php +++ /dev/null @@ -1,49 +0,0 @@ -config = $config ? Util::ensureConfig($config) : new Config; - } - - /** - * Get the Config. - * - * @return Config config object - */ - public function getConfig() - { - return $this->config; - } - - /** - * Convert a config array to a Config object with the correct fallback. - * - * @param array $config - * - * @return Config - */ - protected function prepareConfig(array $config) - { - $config = new Config($config); - $config->setFallback($this->getConfig()); - - return $config; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Directory.php b/crmeb/vendor/league/flysystem/src/Directory.php deleted file mode 100644 index d4f90a880..000000000 --- a/crmeb/vendor/league/flysystem/src/Directory.php +++ /dev/null @@ -1,31 +0,0 @@ -filesystem->deleteDir($this->path); - } - - /** - * List the directory contents. - * - * @param bool $recursive - * - * @return array|bool directory contents or false - */ - public function getContents($recursive = false) - { - return $this->filesystem->listContents($this->path, $recursive); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Exception.php b/crmeb/vendor/league/flysystem/src/Exception.php deleted file mode 100644 index d4a9907b4..000000000 --- a/crmeb/vendor/league/flysystem/src/Exception.php +++ /dev/null @@ -1,8 +0,0 @@ -filesystem->has($this->path); - } - - /** - * Read the file. - * - * @return string|false file contents - */ - public function read() - { - return $this->filesystem->read($this->path); - } - - /** - * Read the file as a stream. - * - * @return resource|false file stream - */ - public function readStream() - { - return $this->filesystem->readStream($this->path); - } - - /** - * Write the new file. - * - * @param string $content - * - * @return bool success boolean - */ - public function write($content) - { - return $this->filesystem->write($this->path, $content); - } - - /** - * Write the new file using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function writeStream($resource) - { - return $this->filesystem->writeStream($this->path, $resource); - } - - /** - * Update the file contents. - * - * @param string $content - * - * @return bool success boolean - */ - public function update($content) - { - return $this->filesystem->update($this->path, $content); - } - - /** - * Update the file contents with a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function updateStream($resource) - { - return $this->filesystem->updateStream($this->path, $resource); - } - - /** - * Create the file or update if exists. - * - * @param string $content - * - * @return bool success boolean - */ - public function put($content) - { - return $this->filesystem->put($this->path, $content); - } - - /** - * Create the file or update if exists using a stream. - * - * @param resource $resource - * - * @return bool success boolean - */ - public function putStream($resource) - { - return $this->filesystem->putStream($this->path, $resource); - } - - /** - * Rename the file. - * - * @param string $newpath - * - * @return bool success boolean - */ - public function rename($newpath) - { - if ($this->filesystem->rename($this->path, $newpath)) { - $this->path = $newpath; - - return true; - } - - return false; - } - - /** - * Copy the file. - * - * @param string $newpath - * - * @return File|false new file or false - */ - public function copy($newpath) - { - if ($this->filesystem->copy($this->path, $newpath)) { - return new File($this->filesystem, $newpath); - } - - return false; - } - - /** - * Get the file's timestamp. - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp() - { - return $this->filesystem->getTimestamp($this->path); - } - - /** - * Get the file's mimetype. - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype() - { - return $this->filesystem->getMimetype($this->path); - } - - /** - * Get the file's visibility. - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility() - { - return $this->filesystem->getVisibility($this->path); - } - - /** - * Get the file's metadata. - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata() - { - return $this->filesystem->getMetadata($this->path); - } - - /** - * Get the file size. - * - * @return int|false The file size or false on failure. - */ - public function getSize() - { - return $this->filesystem->getSize($this->path); - } - - /** - * Delete the file. - * - * @return bool success boolean - */ - public function delete() - { - return $this->filesystem->delete($this->path); - } -} diff --git a/crmeb/vendor/league/flysystem/src/FileExistsException.php b/crmeb/vendor/league/flysystem/src/FileExistsException.php deleted file mode 100644 index c82e20c16..000000000 --- a/crmeb/vendor/league/flysystem/src/FileExistsException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File already exists at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/crmeb/vendor/league/flysystem/src/FileNotFoundException.php b/crmeb/vendor/league/flysystem/src/FileNotFoundException.php deleted file mode 100644 index 989df69bb..000000000 --- a/crmeb/vendor/league/flysystem/src/FileNotFoundException.php +++ /dev/null @@ -1,37 +0,0 @@ -path = $path; - - parent::__construct('File not found at path: ' . $this->getPath(), $code, $previous); - } - - /** - * Get the path which was not found. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Filesystem.php b/crmeb/vendor/league/flysystem/src/Filesystem.php deleted file mode 100644 index 45095263c..000000000 --- a/crmeb/vendor/league/flysystem/src/Filesystem.php +++ /dev/null @@ -1,408 +0,0 @@ -adapter = $adapter; - $this->setConfig($config); - } - - /** - * Get the Adapter. - * - * @return AdapterInterface adapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * @inheritdoc - */ - public function has($path) - { - $path = Util::normalizePath($path); - - return strlen($path) === 0 ? false : (bool) $this->getAdapter()->has($path); - } - - /** - * @inheritdoc - */ - public function write($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function writeStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $this->assertAbsent($path); - $config = $this->prepareConfig($config); - - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function put($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - return (bool) $this->getAdapter()->write($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function putStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - Util::rewindStream($resource); - - if ( ! $this->getAdapter() instanceof CanOverwriteFiles && $this->has($path)) { - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - return (bool) $this->getAdapter()->writeStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function readAndDelete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - $contents = $this->read($path); - - if ($contents === false) { - return false; - } - - $this->delete($path); - - return $contents; - } - - /** - * @inheritdoc - */ - public function update($path, $contents, array $config = []) - { - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - - $this->assertPresent($path); - - return (bool) $this->getAdapter()->update($path, $contents, $config); - } - - /** - * @inheritdoc - */ - public function updateStream($path, $resource, array $config = []) - { - if ( ! is_resource($resource)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #2 to be a valid resource.'); - } - - $path = Util::normalizePath($path); - $config = $this->prepareConfig($config); - $this->assertPresent($path); - Util::rewindStream($resource); - - return (bool) $this->getAdapter()->updateStream($path, $resource, $config); - } - - /** - * @inheritdoc - */ - public function read($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! ($object = $this->getAdapter()->read($path))) { - return false; - } - - return $object['contents']; - } - - /** - * @inheritdoc - */ - public function readStream($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if ( ! $object = $this->getAdapter()->readStream($path)) { - return false; - } - - return $object['stream']; - } - - /** - * @inheritdoc - */ - public function rename($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return (bool) $this->getAdapter()->rename($path, $newpath); - } - - /** - * @inheritdoc - */ - public function copy($path, $newpath) - { - $path = Util::normalizePath($path); - $newpath = Util::normalizePath($newpath); - $this->assertPresent($path); - $this->assertAbsent($newpath); - - return $this->getAdapter()->copy($path, $newpath); - } - - /** - * @inheritdoc - */ - public function delete($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->delete($path); - } - - /** - * @inheritdoc - */ - public function deleteDir($dirname) - { - $dirname = Util::normalizePath($dirname); - - if ($dirname === '') { - throw new RootViolationException('Root directories can not be deleted.'); - } - - return (bool) $this->getAdapter()->deleteDir($dirname); - } - - /** - * @inheritdoc - */ - public function createDir($dirname, array $config = []) - { - $dirname = Util::normalizePath($dirname); - $config = $this->prepareConfig($config); - - return (bool) $this->getAdapter()->createDir($dirname, $config); - } - - /** - * @inheritdoc - */ - public function listContents($directory = '', $recursive = false) - { - $directory = Util::normalizePath($directory); - $contents = $this->getAdapter()->listContents($directory, $recursive); - - return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) - ->formatListing($contents); - } - - /** - * @inheritdoc - */ - public function getMimetype($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getMimetype($path)) || ! array_key_exists('mimetype', $object)) { - return false; - } - - return $object['mimetype']; - } - - /** - * @inheritdoc - */ - public function getTimestamp($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getTimestamp($path)) || ! array_key_exists('timestamp', $object)) { - return false; - } - - return $object['timestamp']; - } - - /** - * @inheritdoc - */ - public function getVisibility($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getVisibility($path)) || ! array_key_exists('visibility', $object)) { - return false; - } - - return $object['visibility']; - } - - /** - * @inheritdoc - */ - public function getSize($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - if (( ! $object = $this->getAdapter()->getSize($path)) || ! array_key_exists('size', $object)) { - return false; - } - - return (int) $object['size']; - } - - /** - * @inheritdoc - */ - public function setVisibility($path, $visibility) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return (bool) $this->getAdapter()->setVisibility($path, $visibility); - } - - /** - * @inheritdoc - */ - public function getMetadata($path) - { - $path = Util::normalizePath($path); - $this->assertPresent($path); - - return $this->getAdapter()->getMetadata($path); - } - - /** - * @inheritdoc - */ - public function get($path, Handler $handler = null) - { - $path = Util::normalizePath($path); - - if ( ! $handler) { - $metadata = $this->getMetadata($path); - $handler = ($metadata && $metadata['type'] === 'file') ? new File($this, $path) : new Directory($this, $path); - } - - $handler->setPath($path); - $handler->setFilesystem($this); - - return $handler; - } - - /** - * Assert a file is present. - * - * @param string $path path to file - * - * @throws FileNotFoundException - * - * @return void - */ - public function assertPresent($path) - { - if ($this->config->get('disable_asserts', false) === false && ! $this->has($path)) { - throw new FileNotFoundException($path); - } - } - - /** - * Assert a file is absent. - * - * @param string $path path to file - * - * @throws FileExistsException - * - * @return void - */ - public function assertAbsent($path) - { - if ($this->config->get('disable_asserts', false) === false && $this->has($path)) { - throw new FileExistsException($path); - } - } -} diff --git a/crmeb/vendor/league/flysystem/src/FilesystemInterface.php b/crmeb/vendor/league/flysystem/src/FilesystemInterface.php deleted file mode 100644 index 09b811b1d..000000000 --- a/crmeb/vendor/league/flysystem/src/FilesystemInterface.php +++ /dev/null @@ -1,284 +0,0 @@ -path = $path; - $this->filesystem = $filesystem; - } - - /** - * Check whether the entree is a directory. - * - * @return bool - */ - public function isDir() - { - return $this->getType() === 'dir'; - } - - /** - * Check whether the entree is a file. - * - * @return bool - */ - public function isFile() - { - return $this->getType() === 'file'; - } - - /** - * Retrieve the entree type (file|dir). - * - * @return string file or dir - */ - public function getType() - { - $metadata = $this->filesystem->getMetadata($this->path); - - return $metadata ? $metadata['type'] : 'dir'; - } - - /** - * Set the Filesystem object. - * - * @param FilesystemInterface $filesystem - * - * @return $this - */ - public function setFilesystem(FilesystemInterface $filesystem) - { - $this->filesystem = $filesystem; - - return $this; - } - - /** - * Retrieve the Filesystem object. - * - * @return FilesystemInterface - */ - public function getFilesystem() - { - return $this->filesystem; - } - - /** - * Set the entree path. - * - * @param string $path - * - * @return $this - */ - public function setPath($path) - { - $this->path = $path; - - return $this; - } - - /** - * Retrieve the entree path. - * - * @return string path - */ - public function getPath() - { - return $this->path; - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @return mixed - */ - public function __call($method, array $arguments) - { - array_unshift($arguments, $this->path); - $callback = [$this->filesystem, $method]; - - try { - return call_user_func_array($callback, $arguments); - } catch (BadMethodCallException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_called_class() - . '::' . $method - ); - } - } -} diff --git a/crmeb/vendor/league/flysystem/src/MountManager.php b/crmeb/vendor/league/flysystem/src/MountManager.php deleted file mode 100644 index 620f540ea..000000000 --- a/crmeb/vendor/league/flysystem/src/MountManager.php +++ /dev/null @@ -1,648 +0,0 @@ - Filesystem,] - * - * @throws InvalidArgumentException - */ - public function __construct(array $filesystems = []) - { - $this->mountFilesystems($filesystems); - } - - /** - * Mount filesystems. - * - * @param FilesystemInterface[] $filesystems [:prefix => Filesystem,] - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystems(array $filesystems) - { - foreach ($filesystems as $prefix => $filesystem) { - $this->mountFilesystem($prefix, $filesystem); - } - - return $this; - } - - /** - * Mount filesystems. - * - * @param string $prefix - * @param FilesystemInterface $filesystem - * - * @throws InvalidArgumentException - * - * @return $this - */ - public function mountFilesystem($prefix, FilesystemInterface $filesystem) - { - if ( ! is_string($prefix)) { - throw new InvalidArgumentException(__METHOD__ . ' expects argument #1 to be a string.'); - } - - $this->filesystems[$prefix] = $filesystem; - - return $this; - } - - /** - * Get the filesystem with the corresponding prefix. - * - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return FilesystemInterface - */ - public function getFilesystem($prefix) - { - if ( ! isset($this->filesystems[$prefix])) { - throw new FilesystemNotFoundException('No filesystem mounted with prefix ' . $prefix); - } - - return $this->filesystems[$prefix]; - } - - /** - * Retrieve the prefix from an arguments array. - * - * @param array $arguments - * - * @throws InvalidArgumentException - * - * @return array [:prefix, :arguments] - */ - public function filterPrefix(array $arguments) - { - if (empty($arguments)) { - throw new InvalidArgumentException('At least one argument needed'); - } - - $path = array_shift($arguments); - - if ( ! is_string($path)) { - throw new InvalidArgumentException('First argument should be a string'); - } - - list($prefix, $path) = $this->getPrefixAndPath($path); - array_unshift($arguments, $path); - - return [$prefix, $arguments]; - } - - /** - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listContents($directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $filesystem = $this->getFilesystem($prefix); - $result = $filesystem->listContents($directory, $recursive); - - foreach ($result as &$file) { - $file['filesystem'] = $prefix; - } - - return $result; - } - - /** - * Call forwarder. - * - * @param string $method - * @param array $arguments - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function __call($method, $arguments) - { - list($prefix, $arguments) = $this->filterPrefix($arguments); - - return $this->invokePluginOnFilesystem($method, $arguments, $prefix); - } - - /** - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * @throws FileExistsException - * - * @return bool - */ - public function copy($from, $to, array $config = []) - { - list($prefixFrom, $from) = $this->getPrefixAndPath($from); - - $buffer = $this->getFilesystem($prefixFrom)->readStream($from); - - if ($buffer === false) { - return false; - } - - list($prefixTo, $to) = $this->getPrefixAndPath($to); - - $result = $this->getFilesystem($prefixTo)->writeStream($to, $buffer, $config); - - if (is_resource($buffer)) { - fclose($buffer); - } - - return $result; - } - - /** - * List with plugin adapter. - * - * @param array $keys - * @param string $directory - * @param bool $recursive - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return array - */ - public function listWith(array $keys = [], $directory = '', $recursive = false) - { - list($prefix, $directory) = $this->getPrefixAndPath($directory); - $arguments = [$keys, $directory, $recursive]; - - return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix); - } - - /** - * Move a file. - * - * @param string $from - * @param string $to - * @param array $config - * - * @throws InvalidArgumentException - * @throws FilesystemNotFoundException - * - * @return bool - */ - public function move($from, $to, array $config = []) - { - list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from); - list($prefixTo, $pathTo) = $this->getPrefixAndPath($to); - - if ($prefixFrom === $prefixTo) { - $filesystem = $this->getFilesystem($prefixFrom); - $renamed = $filesystem->rename($pathFrom, $pathTo); - - if ($renamed && isset($config['visibility'])) { - return $filesystem->setVisibility($pathTo, $config['visibility']); - } - - return $renamed; - } - - $copied = $this->copy($from, $to, $config); - - if ($copied) { - return $this->delete($from); - } - - return false; - } - - /** - * Invoke a plugin on a filesystem mounted on a given prefix. - * - * @param string $method - * @param array $arguments - * @param string $prefix - * - * @throws FilesystemNotFoundException - * - * @return mixed - */ - public function invokePluginOnFilesystem($method, $arguments, $prefix) - { - $filesystem = $this->getFilesystem($prefix); - - try { - return $this->invokePlugin($method, $arguments, $filesystem); - } catch (PluginNotFoundException $e) { - // Let it pass, it's ok, don't panic. - } - - $callback = [$filesystem, $method]; - - return call_user_func_array($callback, $arguments); - } - - /** - * @param string $path - * - * @throws InvalidArgumentException - * - * @return string[] [:prefix, :path] - */ - protected function getPrefixAndPath($path) - { - if (strpos($path, '://') < 1) { - throw new InvalidArgumentException('No prefix detected in path: ' . $path); - } - - return explode('://', $path, 2); - } - - /** - * Check whether a file exists. - * - * @param string $path - * - * @return bool - */ - public function has($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->has($path); - } - - /** - * Read a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents or false on failure. - */ - public function read($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->read($path); - } - - /** - * Retrieves a read-stream for a path. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return resource|false The path resource or false on failure. - */ - public function readStream($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readStream($path); - } - - /** - * Get a file's metadata. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return array|false The file metadata or false on failure. - */ - public function getMetadata($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMetadata($path); - } - - /** - * Get a file's size. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return int|false The file size or false on failure. - */ - public function getSize($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getSize($path); - } - - /** - * Get a file's mime-type. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file mime-type or false on failure. - */ - public function getMimetype($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getMimetype($path); - } - - /** - * Get a file's timestamp. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The timestamp or false on failure. - */ - public function getTimestamp($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getTimestamp($path); - } - - /** - * Get a file's visibility. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The visibility (public|private) or false on failure. - */ - public function getVisibility($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->getVisibility($path); - } - - /** - * Write a new file. - * - * @param string $path The path of the new file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function write($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->write($path, $contents, $config); - } - - /** - * Write a new file using a stream. - * - * @param string $path The path of the new file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileExistsException - * - * @return bool True on success, false on failure. - */ - public function writeStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); - } - - /** - * Update an existing file. - * - * @param string $path The path of the existing file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function update($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->update($path, $contents, $config); - } - - /** - * Update an existing file using a stream. - * - * @param string $path The path of the existing file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException If $resource is not a file handle. - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function updateStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); - } - - /** - * Rename a file. - * - * @param string $path Path to the existing file. - * @param string $newpath The new path of the file. - * - * @throws FileExistsException Thrown if $newpath exists. - * @throws FileNotFoundException Thrown if $path does not exist. - * - * @return bool True on success, false on failure. - */ - public function rename($path, $newpath) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->rename($path, $newpath); - } - - /** - * Delete a file. - * - * @param string $path - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function delete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->delete($path); - } - - /** - * Delete a directory. - * - * @param string $dirname - * - * @throws RootViolationException Thrown if $dirname is empty. - * - * @return bool True on success, false on failure. - */ - public function deleteDir($dirname) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->deleteDir($dirname); - } - - /** - * Create a directory. - * - * @param string $dirname The name of the new directory. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function createDir($dirname, array $config = []) - { - list($prefix, $dirname) = $this->getPrefixAndPath($dirname); - - return $this->getFilesystem($prefix)->createDir($dirname); - } - - /** - * Set the visibility for a file. - * - * @param string $path The path to the file. - * @param string $visibility One of 'public' or 'private'. - * - * @throws FileNotFoundException - * - * @return bool True on success, false on failure. - */ - public function setVisibility($path, $visibility) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->setVisibility($path, $visibility); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param string $contents The file contents. - * @param array $config An optional configuration array. - * - * @return bool True on success, false on failure. - */ - public function put($path, $contents, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->put($path, $contents, $config); - } - - /** - * Create a file or update if exists. - * - * @param string $path The path to the file. - * @param resource $resource The file handle. - * @param array $config An optional configuration array. - * - * @throws InvalidArgumentException Thrown if $resource is not a resource. - * - * @return bool True on success, false on failure. - */ - public function putStream($path, $resource, array $config = []) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->putStream($path, $resource, $config); - } - - /** - * Read and delete a file. - * - * @param string $path The path to the file. - * - * @throws FileNotFoundException - * - * @return string|false The file contents, or false on failure. - */ - public function readAndDelete($path) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->readAndDelete($path); - } - - /** - * Get a file/directory handler. - * - * @deprecated - * - * @param string $path The path to the file. - * @param Handler $handler An optional existing handler to populate. - * - * @return Handler Either a file or directory handler. - */ - public function get($path, Handler $handler = null) - { - list($prefix, $path) = $this->getPrefixAndPath($path); - - return $this->getFilesystem($prefix)->get($path); - } -} diff --git a/crmeb/vendor/league/flysystem/src/NotSupportedException.php b/crmeb/vendor/league/flysystem/src/NotSupportedException.php deleted file mode 100644 index 08f47f749..000000000 --- a/crmeb/vendor/league/flysystem/src/NotSupportedException.php +++ /dev/null @@ -1,37 +0,0 @@ -getPathname()); - } - - /** - * Create a new exception for a link. - * - * @param string $systemType - * - * @return static - */ - public static function forFtpSystemType($systemType) - { - $message = "The FTP system type '$systemType' is currently not supported."; - - return new static($message); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/AbstractPlugin.php b/crmeb/vendor/league/flysystem/src/Plugin/AbstractPlugin.php deleted file mode 100644 index 0d5678976..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/AbstractPlugin.php +++ /dev/null @@ -1,24 +0,0 @@ -filesystem = $filesystem; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/EmptyDir.php b/crmeb/vendor/league/flysystem/src/Plugin/EmptyDir.php deleted file mode 100644 index b5ae7f582..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/EmptyDir.php +++ /dev/null @@ -1,34 +0,0 @@ -filesystem->listContents($dirname, false); - - foreach ($listing as $item) { - if ($item['type'] === 'dir') { - $this->filesystem->deleteDir($item['path']); - } else { - $this->filesystem->delete($item['path']); - } - } - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/ForcedCopy.php b/crmeb/vendor/league/flysystem/src/Plugin/ForcedCopy.php deleted file mode 100644 index a41e9f3ae..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/ForcedCopy.php +++ /dev/null @@ -1,44 +0,0 @@ -filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->copy($path, $newpath); - } - - return false; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/ForcedRename.php b/crmeb/vendor/league/flysystem/src/Plugin/ForcedRename.php deleted file mode 100644 index 3f51cd607..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/ForcedRename.php +++ /dev/null @@ -1,44 +0,0 @@ -filesystem->delete($newpath); - } catch (FileNotFoundException $e) { - // The destination path does not exist. That's ok. - $deleted = true; - } - - if ($deleted) { - return $this->filesystem->rename($path, $newpath); - } - - return false; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/GetWithMetadata.php b/crmeb/vendor/league/flysystem/src/Plugin/GetWithMetadata.php deleted file mode 100644 index 6fe4f0562..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/GetWithMetadata.php +++ /dev/null @@ -1,51 +0,0 @@ -filesystem->getMetadata($path); - - if ( ! $object) { - return false; - } - - $keys = array_diff($metadata, array_keys($object)); - - foreach ($keys as $key) { - if ( ! method_exists($this->filesystem, $method = 'get' . ucfirst($key))) { - throw new InvalidArgumentException('Could not fetch metadata: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($path); - } - - return $object; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/ListFiles.php b/crmeb/vendor/league/flysystem/src/Plugin/ListFiles.php deleted file mode 100644 index 9669fe7e7..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/ListFiles.php +++ /dev/null @@ -1,35 +0,0 @@ -filesystem->listContents($directory, $recursive); - - $filter = function ($object) { - return $object['type'] === 'file'; - }; - - return array_values(array_filter($contents, $filter)); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/ListPaths.php b/crmeb/vendor/league/flysystem/src/Plugin/ListPaths.php deleted file mode 100644 index 514bdf0b3..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/ListPaths.php +++ /dev/null @@ -1,36 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $object) { - $result[] = $object['path']; - } - - return $result; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/ListWith.php b/crmeb/vendor/league/flysystem/src/Plugin/ListWith.php deleted file mode 100644 index d90464e52..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/ListWith.php +++ /dev/null @@ -1,60 +0,0 @@ -filesystem->listContents($directory, $recursive); - - foreach ($contents as $index => $object) { - if ($object['type'] === 'file') { - $missingKeys = array_diff($keys, array_keys($object)); - $contents[$index] = array_reduce($missingKeys, [$this, 'getMetadataByName'], $object); - } - } - - return $contents; - } - - /** - * Get a meta-data value by key name. - * - * @param array $object - * @param string $key - * - * @return array - */ - protected function getMetadataByName(array $object, $key) - { - $method = 'get' . ucfirst($key); - - if ( ! method_exists($this->filesystem, $method)) { - throw new \InvalidArgumentException('Could not get meta-data for key: ' . $key); - } - - $object[$key] = $this->filesystem->{$method}($object['path']); - - return $object; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/PluggableTrait.php b/crmeb/vendor/league/flysystem/src/Plugin/PluggableTrait.php deleted file mode 100644 index 922edfe52..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/PluggableTrait.php +++ /dev/null @@ -1,97 +0,0 @@ -plugins[$plugin->getMethod()] = $plugin; - - return $this; - } - - /** - * Find a specific plugin. - * - * @param string $method - * - * @throws PluginNotFoundException - * - * @return PluginInterface - */ - protected function findPlugin($method) - { - if ( ! isset($this->plugins[$method])) { - throw new PluginNotFoundException('Plugin not found for method: ' . $method); - } - - return $this->plugins[$method]; - } - - /** - * Invoke a plugin by method name. - * - * @param string $method - * @param array $arguments - * @param FilesystemInterface $filesystem - * - * @throws PluginNotFoundException - * - * @return mixed - */ - protected function invokePlugin($method, array $arguments, FilesystemInterface $filesystem) - { - $plugin = $this->findPlugin($method); - $plugin->setFilesystem($filesystem); - $callback = [$plugin, 'handle']; - - return call_user_func_array($callback, $arguments); - } - - /** - * Plugins pass-through. - * - * @param string $method - * @param array $arguments - * - * @throws BadMethodCallException - * - * @return mixed - */ - public function __call($method, array $arguments) - { - try { - return $this->invokePlugin($method, $arguments, $this); - } catch (PluginNotFoundException $e) { - throw new BadMethodCallException( - 'Call to undefined method ' - . get_class($this) - . '::' . $method - ); - } - } -} diff --git a/crmeb/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php b/crmeb/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php deleted file mode 100644 index fd1d7e7e3..000000000 --- a/crmeb/vendor/league/flysystem/src/Plugin/PluginNotFoundException.php +++ /dev/null @@ -1,10 +0,0 @@ -hash = spl_object_hash($this); - static::$safeStorage[$this->hash] = []; - } - - public function storeSafely($key, $value) - { - static::$safeStorage[$this->hash][$key] = $value; - } - - public function retrieveSafely($key) - { - if (array_key_exists($key, static::$safeStorage[$this->hash])) { - return static::$safeStorage[$this->hash][$key]; - } - } - - public function __destruct() - { - unset(static::$safeStorage[$this->hash]); - } -} diff --git a/crmeb/vendor/league/flysystem/src/UnreadableFileException.php b/crmeb/vendor/league/flysystem/src/UnreadableFileException.php deleted file mode 100644 index e66803383..000000000 --- a/crmeb/vendor/league/flysystem/src/UnreadableFileException.php +++ /dev/null @@ -1,18 +0,0 @@ -getRealPath() - ) - ); - } -} diff --git a/crmeb/vendor/league/flysystem/src/Util.php b/crmeb/vendor/league/flysystem/src/Util.php deleted file mode 100644 index 9de37775f..000000000 --- a/crmeb/vendor/league/flysystem/src/Util.php +++ /dev/null @@ -1,349 +0,0 @@ - '']; - } - - /** - * Normalize a dirname return value. - * - * @param string $dirname - * - * @return string normalized dirname - */ - public static function normalizeDirname($dirname) - { - return $dirname === '.' ? '' : $dirname; - } - - /** - * Get a normalized dirname from a path. - * - * @param string $path - * - * @return string dirname - */ - public static function dirname($path) - { - return static::normalizeDirname(dirname($path)); - } - - /** - * Map result arrays. - * - * @param array $object - * @param array $map - * - * @return array mapped result - */ - public static function map(array $object, array $map) - { - $result = []; - - foreach ($map as $from => $to) { - if ( ! isset($object[$from])) { - continue; - } - - $result[$to] = $object[$from]; - } - - return $result; - } - - /** - * Normalize path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizePath($path) - { - return static::normalizeRelativePath($path); - } - - /** - * Normalize relative directories in a path. - * - * @param string $path - * - * @throws LogicException - * - * @return string - */ - public static function normalizeRelativePath($path) - { - $path = str_replace('\\', '/', $path); - $path = static::removeFunkyWhiteSpace($path); - - $parts = []; - - foreach (explode('/', $path) as $part) { - switch ($part) { - case '': - case '.': - break; - - case '..': - if (empty($parts)) { - throw new LogicException( - 'Path is outside of the defined root, path: [' . $path . ']' - ); - } - array_pop($parts); - break; - - default: - $parts[] = $part; - break; - } - } - - return implode('/', $parts); - } - - /** - * Removes unprintable characters and invalid unicode characters. - * - * @param string $path - * - * @return string $path - */ - protected static function removeFunkyWhiteSpace($path) - { - // We do this check in a loop, since removing invalid unicode characters - // can lead to new characters being created. - while (preg_match('#\p{C}+|^\./#u', $path)) { - $path = preg_replace('#\p{C}+|^\./#u', '', $path); - } - - return $path; - } - - /** - * Normalize prefix. - * - * @param string $prefix - * @param string $separator - * - * @return string normalized path - */ - public static function normalizePrefix($prefix, $separator) - { - return rtrim($prefix, $separator) . $separator; - } - - /** - * Get content size. - * - * @param string $contents - * - * @return int content size - */ - public static function contentSize($contents) - { - return defined('MB_OVERLOAD_STRING') ? mb_strlen($contents, '8bit') : strlen($contents); - } - - /** - * Guess MIME Type based on the path of the file and it's content. - * - * @param string $path - * @param string|resource $content - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function guessMimeType($path, $content) - { - $mimeType = MimeType::detectByContent($content); - - if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { - return $mimeType; - } - - return MimeType::detectByFilename($path); - } - - /** - * Emulate directories. - * - * @param array $listing - * - * @return array listing with emulated directories - */ - public static function emulateDirectories(array $listing) - { - $directories = []; - $listedDirectories = []; - - foreach ($listing as $object) { - list($directories, $listedDirectories) = static::emulateObjectDirectories($object, $directories, $listedDirectories); - } - - $directories = array_diff(array_unique($directories), array_unique($listedDirectories)); - - foreach ($directories as $directory) { - $listing[] = static::pathinfo($directory) + ['type' => 'dir']; - } - - return $listing; - } - - /** - * Ensure a Config instance. - * - * @param null|array|Config $config - * - * @return Config config instance - * - * @throw LogicException - */ - public static function ensureConfig($config) - { - if ($config === null) { - return new Config(); - } - - if ($config instanceof Config) { - return $config; - } - - if (is_array($config)) { - return new Config($config); - } - - throw new LogicException('A config should either be an array or a Flysystem\Config object.'); - } - - /** - * Rewind a stream. - * - * @param resource $resource - */ - public static function rewindStream($resource) - { - if (ftell($resource) !== 0 && static::isSeekableStream($resource)) { - rewind($resource); - } - } - - public static function isSeekableStream($resource) - { - $metadata = stream_get_meta_data($resource); - - return $metadata['seekable']; - } - - /** - * Get the size of a stream. - * - * @param resource $resource - * - * @return int stream size - */ - public static function getStreamSize($resource) - { - $stat = fstat($resource); - - return $stat['size']; - } - - /** - * Emulate the directories of a single object. - * - * @param array $object - * @param array $directories - * @param array $listedDirectories - * - * @return array - */ - protected static function emulateObjectDirectories(array $object, array $directories, array $listedDirectories) - { - if ($object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - } - - if ( ! isset($object['dirname']) || trim($object['dirname']) === '') { - return [$directories, $listedDirectories]; - } - - $parent = $object['dirname']; - - while (isset($parent) && trim($parent) !== '' && ! in_array($parent, $directories)) { - $directories[] = $parent; - $parent = static::dirname($parent); - } - - if (isset($object['type']) && $object['type'] === 'dir') { - $listedDirectories[] = $object['path']; - - return [$directories, $listedDirectories]; - } - - return [$directories, $listedDirectories]; - } - - /** - * Returns the trailing name component of the path. - * - * @param string $path - * - * @return string - */ - private static function basename($path) - { - $separators = DIRECTORY_SEPARATOR === '/' ? '/' : '\/'; - - $path = rtrim($path, $separators); - - $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); - - if (DIRECTORY_SEPARATOR === '/') { - return $basename; - } - // @codeCoverageIgnoreStart - // Extra Windows path munging. This is tested via AppVeyor, but code - // coverage is not reported. - - // Handle relative paths with drive letters. c:file.txt. - while (preg_match('#^[a-zA-Z]{1}:[^\\\/]#', $basename)) { - $basename = substr($basename, 2); - } - - // Remove colon for standalone drive letter names. - if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) { - $basename = rtrim($basename, ':'); - } - - return $basename; - // @codeCoverageIgnoreEnd - } -} diff --git a/crmeb/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/crmeb/vendor/league/flysystem/src/Util/ContentListingFormatter.php deleted file mode 100644 index ae0d3b91d..000000000 --- a/crmeb/vendor/league/flysystem/src/Util/ContentListingFormatter.php +++ /dev/null @@ -1,122 +0,0 @@ -directory = rtrim($directory, '/'); - $this->recursive = $recursive; - $this->caseSensitive = $caseSensitive; - } - - /** - * Format contents listing. - * - * @param array $listing - * - * @return array - */ - public function formatListing(array $listing) - { - $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); - - return $this->sortListing(array_values($listing)); - } - - private function addPathInfo(array $entry) - { - return $entry + Util::pathinfo($entry['path']); - } - - /** - * Determine if the entry is out of scope. - * - * @param array $entry - * - * @return bool - */ - private function isEntryOutOfScope(array $entry) - { - if (empty($entry['path']) && $entry['path'] !== '0') { - return false; - } - - if ($this->recursive) { - return $this->residesInDirectory($entry); - } - - return $this->isDirectChild($entry); - } - - /** - * Check if the entry resides within the parent directory. - * - * @param array $entry - * - * @return bool - */ - private function residesInDirectory(array $entry) - { - if ($this->directory === '') { - return true; - } - - return $this->caseSensitive - ? strpos($entry['path'], $this->directory . '/') === 0 - : stripos($entry['path'], $this->directory . '/') === 0; - } - - /** - * Check if the entry is a direct child of the directory. - * - * @param array $entry - * - * @return bool - */ - private function isDirectChild(array $entry) - { - return $this->caseSensitive - ? $entry['dirname'] === $this->directory - : strcasecmp($this->directory, $entry['dirname']) === 0; - } - - /** - * @param array $listing - * - * @return array - */ - private function sortListing(array $listing) - { - usort($listing, function ($a, $b) { - return strcasecmp($a['path'], $b['path']); - }); - - return $listing; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Util/MimeType.php b/crmeb/vendor/league/flysystem/src/Util/MimeType.php deleted file mode 100644 index 02f67ac5e..000000000 --- a/crmeb/vendor/league/flysystem/src/Util/MimeType.php +++ /dev/null @@ -1,245 +0,0 @@ - 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/csv', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'xlt' => 'application/vnd.ms-excel', - 'xla' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pot' => 'application/vnd.ms-powerpoint', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppa' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'rdf' => 'application/rdf+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'dmn' => 'application/octet-stream', - 'bpmn' => 'application/octet-stream', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - 'tex' => 'application/x-tex', - 'latex' => 'application/x-latex', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - ]; - - /** - * Detects MIME Type based on given content. - * - * @param mixed $content - * - * @return string|null MIME Type or NULL if no mime type detected - */ - public static function detectByContent($content) - { - if ( ! class_exists('finfo') || ! is_string($content)) { - return null; - } - try { - $finfo = new finfo(FILEINFO_MIME_TYPE); - - return $finfo->buffer($content) ?: null; - // @codeCoverageIgnoreStart - } catch (ErrorException $e) { - // This is caused by an array to string conversion error. - } - } // @codeCoverageIgnoreEnd - - /** - * Detects MIME Type based on file extension. - * - * @param string $extension - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFileExtension($extension) - { - return isset(static::$extensionToMimeTypeMap[$extension]) - ? static::$extensionToMimeTypeMap[$extension] - : 'text/plain'; - } - - /** - * @param string $filename - * - * @return string|null MIME Type or NULL if no extension detected - */ - public static function detectByFilename($filename) - { - $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - - return empty($extension) ? 'text/plain' : static::detectByFileExtension($extension); - } - - /** - * @return array Map of file extension to MIME Type - */ - public static function getExtensionToMimeTypeMap() - { - return static::$extensionToMimeTypeMap; - } -} diff --git a/crmeb/vendor/league/flysystem/src/Util/StreamHasher.php b/crmeb/vendor/league/flysystem/src/Util/StreamHasher.php deleted file mode 100644 index 938ec5db7..000000000 --- a/crmeb/vendor/league/flysystem/src/Util/StreamHasher.php +++ /dev/null @@ -1,36 +0,0 @@ -algo = $algo; - } - - /** - * @param resource $resource - * - * @return string - */ - public function hash($resource) - { - rewind($resource); - $context = hash_init($this->algo); - hash_update_stream($context, $resource); - fclose($resource); - - return hash_final($context); - } -} diff --git a/crmeb/vendor/opis/closure/.github/workflows/tests.yml b/crmeb/vendor/opis/closure/.github/workflows/tests.yml deleted file mode 100644 index b71e6e4aa..000000000 --- a/crmeb/vendor/opis/closure/.github/workflows/tests.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "Tests" -on: - push: - paths-ignore: - - '**.md' - pull_request: - paths-ignore: - - '**.md' -jobs: - tests: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - php: [5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4] - stability: [prefer-stable] - - name: PHP ${{ matrix.php }} - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: ~/.composer/cache/files - key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - - name: Update composer - run: composer self-update - - - name: Install dependencies - run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress - - - name: Execute tests - run: vendor/bin/phpunit --verbose \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/CHANGELOG.md b/crmeb/vendor/opis/closure/CHANGELOG.md deleted file mode 100644 index 44370bff4..000000000 --- a/crmeb/vendor/opis/closure/CHANGELOG.md +++ /dev/null @@ -1,220 +0,0 @@ -CHANGELOG ---------- - -### v3.5.1, 2019.11.30 - -- Bugfix. See #47 - -### v3.5.0, 2019.11.29 - -- Added support for short closures (arrow functions) -- Added `isShortClosure` method to `Opis\Closure\ReflectionClosure` - -### v3.4.2, 2019.11.29 - -- Added `stream_set_option()` - -### v3.4.1, 2019.10.19 - -- Fixed a [bug](https://github.com/opis/closure/issues/40) that prevented serialization to work correctly. - -### v3.4.0, 2019.09.03 - -- Added `createClosure` static method in `Opis\Closure\SerializableClosure`. -This method creates a new closure from arbitrary code, emulating `create_function`, -but without using eval - -### v3.3.1, 2019.07.10 - -- Use `sha1` instead of `md5` for hashing file names in `Opis\Closure\ReflectionClosure` class - -### v3.3.0, 2019.05.31 - -- Fixed a bug that prevented signed closures to properly work when the serialized string -contains invalid UTF-8 chars. Starting with this version `json_encode` is no longer used -when signing a closure. Backward compatibility is maintained and all closures that were -previously signed using the old method will continue to work. - -### v3.2.0, 2019.05.05 - -- Since an unsigned closure can be unserialized when no security provider is set, -there is no reason to treat differently a signed closure in the same situation. -Therefore, the `Opis\Closure\SecurityException` exception is no longer thrown when -unserializing a signed closure, if no security provider is set. - -### v3.1.6, 2019.02.22 - -- Fixed a bug that occurred when trying to set properties of classes that were not defined in user-land. -Those properties are now ignored. - -### v3.1.5, 2019.01.14 - -- Improved parser - -### v3.1.4, 2019.01.14 - -- Added support for static methods that are named using PHP keywords or magic constants. -Ex: `A::new()`, `A::use()`, `A::if()`, `A::function()`, `A::__DIR__()`, etc. -- Used `@internal` to mark classes & methods that are for internal use only and -backward compatibility is not guaranteed. - -### v3.1.3, 2019.01.07 - -- Fixed a bug that prevented traits to be correctly resolved when used by an -anonymous class -- Fixed a bug that occurred when `$this` keyword was used inside an anonymous class - -### v3.1.2, 2018.12.16 - -* Fixed a bug regarding comma trail in group-use statements. See [issue 23](https://github.com/opis/closure/issues/23) - -### v3.1.1, 2018.10.02 - -* Fixed a bug where `parent` keyword was treated like a class-name and scope was not added to the -serialized closure -* Fixed a bug where return type was not properly handled for nested closures -* Support for anonymous classes was improved - -### v3.1.0, 2018.09.20 - -* Added `transformUseVariables` and `resolveUseVariables` to -`Opis\Closure\SerializableClosure` class. -* Added `removeSecurityProvider` static method to -`Opis\Closure\SerializableClosure` class. -* Fixed some security related issues where a user was able to unserialize an unsigned -closure, even when a security provider was in use. - -### v3.0.12, 2018.02.23 - -* Bugfix. See [issue 20](https://github.com/opis/closure/issues/20) - -### v3.0.11, 2018.01.22 - -* Bugfix. See [issue 18](https://github.com/opis/closure/issues/18) - -### v3.0.10, 2018.01.04 - -* Improved support for PHP 7.1 & 7.2 - -### v3.0.9, 2018.01.04 - -* Fixed a bug where the return type was not properly resolved. -See [issue 17](https://github.com/opis/closure/issues/17) -* Added more tests - -### v3.0.8, 2017.12.18 - -* Fixed a bug. See [issue 16](https://github.com/opis/closure/issues/16) - -### v3.0.7, 2017.10.31 - -* Bugfix: static properties are ignored now, since they are not serializable - -### v3.0.6, 2017.10.06 - -* Fixed a bug introduced by accident in 3.0.5 - -### v3.0.5, 2017.09.18 - -* Fixed a bug related to nested references - -### v3.0.4, 2017.09.18 - -* \[*internal*\] Refactored `SerializableClosure::mapPointers` method -* \[*internal*\] Added a new optional argument to `SerializableClosure::unwrapClosures` -* \[*internal*\] Removed `SerializableClosure::getClosurePointer` method -* Fixed various bugs - -### v3.0.3, 2017.09.06 - -* Fixed a bug related to nested object references -* \[*internal*\] `Opis\Closure\ClosureScope` now extends `SplObjectStorage` -* \[*internal*\] The `storage` property was removed from `Opis\Closure\ClosureScope` -* \[*internal*\] The `instances` and `objects` properties were removed from `Opis\Closure\ClosureContext` - -### v3.0.2, 2017.08.28 - -* Fixed a bug where `$this` object was not handled properly inside the -`SerializableClosre::serialize` method. - -### v3.0.1, 2017.04.13 - -* Fixed a bug in 'ignore_next' state - -### v3.0.0, 2017.04.07 - -* Dropped PHP 5.3 support -* Moved source files from `lib` to `src` folder -* Removed second parameter from `Opis\Closure\SerializableClosure::from` method and from constructor -* Removed `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` classes -* Refactored how signed closures were handled -* Added `wrapClosures` and `unwrapClosures` static methods to `Opis\Closure\SerializableClosure` class -* Added `Opis\Colosure\serialize` and `Opis\Closure\unserialize` functions -* Improved serialization. You can now serialize arbitrary objects and the library will automatically wrap all closures - -### v2.4.0, 2016.12.16 - -* The parser was refactored and improved -* Refactored `Opis\Closure\SerializableClosure::__invoke` method -* `Opis\Closure\{ISecurityProvider, SecurityProvider}` were added -* `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` were deprecated -and they will be removed in the next major version -* `setSecretKey` and `addSecurityProvider` static methods were added to `Opis\Closure\SerializableClosure` - -### v2.3.2, 2016.12.15 - -* Fixed a bug that prevented namespace resolution to be done properly - -### v2.3.1, 2016.12.13 - -* Hotfix. See [PR](https://github.com/opis/closure/pull/7) - -### v2.3.0, 2016.11.17 - -* Added `isBindingRequired` and `isScopeRequired` to the `Opis\Closure\ReflectionClosure` class -* Automatically detects when the scope and/or the bound object of a closure needs to be serialized. - -### v2.2.1, 2016.08.20 - -* Fixed a bug in `Opis\Closure\ReflectionClosure::fetchItems` - -### v2.2.0, 2016.07.26 - -* Fixed CS -* `Opis\Closure\ClosureContext`, `Opis\Closure\ClosureScope`, `Opis\Closure\SelfReference` - and `Opis\Closure\SecurityException` classes were moved into separate files -* Added support for PHP7 syntax -* Fixed some bugs in `Opis\Closure\ReflectionClosure` class -* Improved closure parser -* Added an analyzer for SuperClosure library - -### v2.1.0, 2015.09.30 - -* Added support for the missing `__METHOD__`, `__FUNCTION__` and `__TRAIT__` magic constants -* Added some security related classes and interfaces: `Opis\Closure\SecurityProviderInterface`, -`Opis\Closure\DefaultSecurityProvider`, `Opis\Closure\SecureClosure`, `Opis\Closure\SecurityException`. -* Fiexed a bug in `Opis\Closure\ReflectionClosure::getClasses` method -* Other minor bugfixes -* Added support for static closures -* Added public `isStatic` method to `Opis\Closure\ReflectionClosure` class - - -### v2.0.1, 2015.09.23 - -* Removed `branch-alias` property from `composer.json` -* Bugfix. See [issue #6](https://github.com/opis/closure/issues/6) - -### v2.0.0, 2015.07.31 - -* The closure parser was improved -* Class names are now automatically resolved -* Added support for the `#trackme` directive which allows tracking closure's residing source - -### v1.3.0, 2014.10.18 - -* Added autoload file -* Changed README file - -### Opis Closure 1.2.2 - -* Started changelog diff --git a/crmeb/vendor/opis/closure/LICENSE b/crmeb/vendor/opis/closure/LICENSE deleted file mode 100644 index 9c0a19ba2..000000000 --- a/crmeb/vendor/opis/closure/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018-2019 Zindex Software - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/crmeb/vendor/opis/closure/NOTICE b/crmeb/vendor/opis/closure/NOTICE deleted file mode 100644 index ae5caa628..000000000 --- a/crmeb/vendor/opis/closure/NOTICE +++ /dev/null @@ -1,9 +0,0 @@ -Opis Closure -Copyright 2018-2019 Zindex Software - -This product includes software developed at -Zindex Software (http://zindex.software). - -This software was originally developed by Marius Sarca and Sorin Sarca -(Copyright 2014-2018). The copyright info was changed with the permission -of the original authors. \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/README.md b/crmeb/vendor/opis/closure/README.md deleted file mode 100644 index b98d68dbd..000000000 --- a/crmeb/vendor/opis/closure/README.md +++ /dev/null @@ -1,98 +0,0 @@ -Opis Closure -==================== -[![Build Status](https://travis-ci.org/opis/closure.png)](https://travis-ci.org/opis/closure) -[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure) -[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure) -[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure) - -Serializable closures ---------------------- -**Opis Closure** is a library that aims to overcome PHP's limitations regarding closure -serialization by providing a wrapper that will make all closures serializable. - -**The library's key features:** - -- Serialize any closure -- Serialize arbitrary objects -- Doesn't use `eval` for closure serialization or unserialization -- Works with any PHP version that has support for closures -- Supports PHP 7 syntax -- Handles all variables referenced/imported in `use()` and automatically wraps all referenced/imported closures for -proper serialization -- Handles recursive closures -- Handles magic constants like `__FILE__`, `__DIR__`, `__LINE__`, `__NAMESPACE__`, `__CLASS__`, -`__TRAIT__`, `__METHOD__` and `__FUNCTION__`. -- Automatically resolves all class names, function names and constant names used inside the closure -- Track closure's residing source by using the `#trackme` directive -- Simple and very fast parser -- Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly -- You can serialize/unserialize any closure unlimited times, even those previously unserialized -(this is possible because `eval()` is not used for unserialization) -- Handles static closures -- Supports cryptographically signed closures -- Provides a reflector that can give you information about the serialized closure -- Provides an analyzer for *SuperClosure* library -- Automatically detects when the scope and/or the bound object of a closure needs to be serialized -in order for the closure to work after deserialization - -### Documentation - -The full documentation for this library can be found [here][documentation]. - -### License - -**Opis Closure** is licensed under the [MIT License (MIT)][license]. - -### Requirements - -* PHP ^5.4 || ^7.0 - -## Installation - -**Opis Closure** is available on [Packagist] and it can be installed from a -command line interface by using [Composer]. - -```bash -composer require opis/closure -``` - -Or you could directly reference it into your `composer.json` file as a dependency - -```json -{ - "require": { - "opis/closure": "^3.5" - } -} -``` - -### Migrating from 2.x - -If your project needs to support PHP 5.3 you can continue using the `2.x` version -of **Opis Closure**. Otherwise, assuming you are not using one of the removed/refactored classes or features(see -[CHANGELOG]), migrating to version `3.x` is simply a matter of updating your `composer.json` file. - -### Semantic versioning - -**Opis Closure** follows [semantic versioning][SemVer] specifications. - -### Arbitrary object serialization - -This feature was primarily introduced in order to support serializing an object bound -to a closure and available via `$this`. The implementation is far from being perfect -and it's really hard to make it work flawless. I will try to improve this, but I can -not guarantee anything. So my advice regarding the `Opis\Closure\serialize|unserialize` -functions is to use them with caution. - -### SuperClosure support - -**Opis Closure** is shipped with an analyzer(`Opis\Closure\Analyzer`) which -aims to provide *Opis Closure*'s parsing precision and speed to [SuperClosure]. - -[documentation]: https://www.opis.io/closure "Opis Closure" -[license]: http://opensource.org/licenses/MIT "MIT License" -[Packagist]: https://packagist.org/packages/opis/closure "Packagist" -[Composer]: https://getcomposer.org "Composer" -[SuperClosure]: https://github.com/jeremeamia/super_closure "SuperClosure" -[SemVer]: http://semver.org/ "Semantic versioning" -[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog" \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/autoload.php b/crmeb/vendor/opis/closure/autoload.php deleted file mode 100644 index a928014fd..000000000 --- a/crmeb/vendor/opis/closure/autoload.php +++ /dev/null @@ -1,39 +0,0 @@ -getClosureScopeClass(); - - $data = [ - 'reflection' => $reflection, - 'code' => $reflection->getCode(), - 'hasThis' => $reflection->isBindingRequired(), - 'context' => $reflection->getUseVariables(), - 'hasRefs' => false, - 'binding' => $reflection->getClosureThis(), - 'scope' => $scope ? $scope->getName() : null, - 'isStatic' => $reflection->isStatic(), - ]; - - return $data; - } - - /** - * @param array $data - * @return mixed - */ - protected function determineCode(array &$data) - { - return null; - } - - /** - * @param array $data - * @return mixed - */ - protected function determineContext(array &$data) - { - return null; - } - -} diff --git a/crmeb/vendor/opis/closure/src/ClosureContext.php b/crmeb/vendor/opis/closure/src/ClosureContext.php deleted file mode 100644 index d68cf9887..000000000 --- a/crmeb/vendor/opis/closure/src/ClosureContext.php +++ /dev/null @@ -1,34 +0,0 @@ -scope = new ClosureScope(); - $this->locks = 0; - } -} \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/src/ClosureScope.php b/crmeb/vendor/opis/closure/src/ClosureScope.php deleted file mode 100644 index 71ad4148f..000000000 --- a/crmeb/vendor/opis/closure/src/ClosureScope.php +++ /dev/null @@ -1,25 +0,0 @@ -content = "length = strlen($this->content); - return true; - } - - public function stream_read($count) - { - $value = substr($this->content, $this->pointer, $count); - $this->pointer += $count; - return $value; - } - - public function stream_eof() - { - return $this->pointer >= $this->length; - } - - public function stream_set_option($option, $arg1, $arg2) - { - return false; - } - - public function stream_stat() - { - $stat = stat(__FILE__); - $stat[7] = $stat['size'] = $this->length; - return $stat; - } - - public function url_stat($path, $flags) - { - $stat = stat(__FILE__); - $stat[7] = $stat['size'] = $this->length; - return $stat; - } - - public function stream_seek($offset, $whence = SEEK_SET) - { - $crt = $this->pointer; - - switch ($whence) { - case SEEK_SET: - $this->pointer = $offset; - break; - case SEEK_CUR: - $this->pointer += $offset; - break; - case SEEK_END: - $this->pointer = $this->length + $offset; - break; - } - - if ($this->pointer < 0 || $this->pointer >= $this->length) { - $this->pointer = $crt; - return false; - } - - return true; - } - - public function stream_tell() - { - return $this->pointer; - } - - public static function register() - { - if (!static::$isRegistered) { - static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__); - } - } - -} diff --git a/crmeb/vendor/opis/closure/src/ISecurityProvider.php b/crmeb/vendor/opis/closure/src/ISecurityProvider.php deleted file mode 100644 index d3b0a2931..000000000 --- a/crmeb/vendor/opis/closure/src/ISecurityProvider.php +++ /dev/null @@ -1,25 +0,0 @@ -code = $code; - parent::__construct($closure); - } - - /** - * @return bool - */ - public function isStatic() - { - if ($this->isStaticClosure === null) { - $this->isStaticClosure = strtolower(substr($this->getCode(), 0, 6)) === 'static'; - } - - return $this->isStaticClosure; - } - - public function isShortClosure() - { - if ($this->isShortClosure === null) { - $code = $this->getCode(); - if ($this->isStatic()) { - $code = substr($code, 6); - } - $this->isShortClosure = strtolower(substr(trim($code), 0, 2)) === 'fn'; - } - - return $this->isShortClosure; - } - - /** - * @return string - */ - public function getCode() - { - if($this->code !== null){ - return $this->code; - } - - $fileName = $this->getFileName(); - $line = $this->getStartLine() - 1; - - $match = ClosureStream::STREAM_PROTO . '://'; - - if ($line === 1 && substr($fileName, 0, strlen($match)) === $match) { - return $this->code = substr($fileName, strlen($match)); - } - - $className = null; - $fn = false; - - - if (null !== $className = $this->getClosureScopeClass()) { - $className = '\\' . trim($className->getName(), '\\'); - } - - - if($php7 = PHP_MAJOR_VERSION === 7){ - switch (PHP_MINOR_VERSION){ - case 0: - $php7_types = array('string', 'int', 'bool', 'float'); - break; - case 1: - $php7_types = array('string', 'int', 'bool', 'float', 'void'); - break; - case 2: - default: - $php7_types = array('string', 'int', 'bool', 'float', 'void', 'object'); - } - $fn = PHP_MINOR_VERSION === 4; - } - - $ns = $this->getNamespaceName(); - $nsf = $ns == '' ? '' : ($ns[0] == '\\' ? $ns : '\\' . $ns); - - $_file = var_export($fileName, true); - $_dir = var_export(dirname($fileName), true); - $_namespace = var_export($ns, true); - $_class = var_export(trim($className, '\\'), true); - $_function = $ns . ($ns == '' ? '' : '\\') . '{closure}'; - $_method = ($className == '' ? '' : trim($className, '\\') . '::') . $_function; - $_function = var_export($_function, true); - $_method = var_export($_method, true); - $_trait = null; - - $tokens = $this->getTokens(); - $state = $lastState = 'start'; - $inside_anonymous = false; - $isShortClosure = false; - $anonymous_mark = 0; - $open = 0; - $code = ''; - $id_start = $id_start_ci = $id_name = $context = ''; - $classes = $functions = $constants = null; - $use = array(); - $lineAdd = 0; - $isUsingScope = false; - $isUsingThisObject = false; - - for($i = 0, $l = count($tokens); $i < $l; $i++) { - $token = $tokens[$i]; - switch ($state) { - case 'start': - if ($token[0] === T_FUNCTION || $token[0] === T_STATIC) { - $code .= $token[1]; - $state = $token[0] === T_FUNCTION ? 'function' : 'static'; - } elseif ($fn && $token[0] === T_FN) { - $isShortClosure = true; - $code .= $token[1]; - $state = 'closure_args'; - } - break; - case 'static': - if ($token[0] === T_WHITESPACE || $token[0] === T_COMMENT || $token[0] === T_FUNCTION) { - $code .= $token[1]; - if ($token[0] === T_FUNCTION) { - $state = 'function'; - } - } elseif ($fn && $token[0] === T_FN) { - $isShortClosure = true; - $code .= $token[1]; - $state = 'closure_args'; - } else { - $code = ''; - $state = 'start'; - } - break; - case 'function': - switch ($token[0]){ - case T_STRING: - $code = ''; - $state = 'named_function'; - break; - case '(': - $code .= '('; - $state = 'closure_args'; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - } - break; - case 'named_function': - if($token[0] === T_FUNCTION || $token[0] === T_STATIC){ - $code = $token[1]; - $state = $token[0] === T_FUNCTION ? 'function' : 'static'; - } elseif ($fn && $token[0] === T_FN) { - $isShortClosure = true; - $code .= $token[1]; - $state = 'closure_args'; - } - break; - case 'closure_args': - switch ($token[0]){ - case T_NS_SEPARATOR: - case T_STRING: - $id_start = $token[1]; - $id_start_ci = strtolower($id_start); - $id_name = ''; - $context = 'args'; - $state = 'id_name'; - $lastState = 'closure_args'; - break; - case T_USE: - $code .= $token[1]; - $state = 'use'; - break; - case T_DOUBLE_ARROW: - $code .= $token[1]; - if ($isShortClosure) { - $state = 'closure'; - } - break; - case '=': - $code .= $token; - $lastState = 'closure_args'; - $state = 'ignore_next'; - break; - case ':': - $code .= ':'; - $state = 'return'; - break; - case '{': - $code .= '{'; - $state = 'closure'; - $open++; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - } - break; - case 'use': - switch ($token[0]){ - case T_VARIABLE: - $use[] = substr($token[1], 1); - $code .= $token[1]; - break; - case '{': - $code .= '{'; - $state = 'closure'; - $open++; - break; - case ':': - $code .= ':'; - $state = 'return'; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - break; - } - break; - case 'return': - switch ($token[0]){ - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - $code .= $token[1]; - break; - case T_NS_SEPARATOR: - case T_STRING: - $id_start = $token[1]; - $id_start_ci = strtolower($id_start); - $id_name = ''; - $context = 'return_type'; - $state = 'id_name'; - $lastState = 'return'; - break 2; - case T_DOUBLE_ARROW: - $code .= $token[1]; - if ($isShortClosure) { - $state = 'closure'; - } - break; - case '{': - $code .= '{'; - $state = 'closure'; - $open++; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - break; - } - break; - case 'closure': - switch ($token[0]){ - case T_CURLY_OPEN: - case T_DOLLAR_OPEN_CURLY_BRACES: - case T_STRING_VARNAME: - case '{': - $code .= '{'; - $open++; - break; - case '}': - $code .= '}'; - if(--$open === 0 && !$isShortClosure){ - break 3; - } elseif ($inside_anonymous) { - $inside_anonymous = !($open === $anonymous_mark); - } - break; - case '(': - case '[': - $code .= $token[0]; - if ($isShortClosure) { - $open++; - } - break; - case ')': - case ']': - if ($isShortClosure) { - if ($open === 0) { - break 3; - } - --$open; - } - $code .= $token[0]; - break; - case ',': - case ';': - if ($isShortClosure && $open === 0) { - break 3; - } - $code .= $token[0]; - break; - case T_LINE: - $code .= $token[2] - $line + $lineAdd; - break; - case T_FILE: - $code .= $_file; - break; - case T_DIR: - $code .= $_dir; - break; - case T_NS_C: - $code .= $_namespace; - break; - case T_CLASS_C: - $code .= $_class; - break; - case T_FUNC_C: - $code .= $_function; - break; - case T_METHOD_C: - $code .= $_method; - break; - case T_COMMENT: - if (substr($token[1], 0, 8) === '#trackme') { - $timestamp = time(); - $code .= '/**' . PHP_EOL; - $code .= '* Date : ' . date(DATE_W3C, $timestamp) . PHP_EOL; - $code .= '* Timestamp : ' . $timestamp . PHP_EOL; - $code .= '* Line : ' . ($line + 1) . PHP_EOL; - $code .= '* File : ' . $_file . PHP_EOL . '*/' . PHP_EOL; - $lineAdd += 5; - } else { - $code .= $token[1]; - } - break; - case T_VARIABLE: - if($token[1] == '$this' && !$inside_anonymous){ - $isUsingThisObject = true; - } - $code .= $token[1]; - break; - case T_STATIC: - $isUsingScope = true; - $code .= $token[1]; - break; - case T_NS_SEPARATOR: - case T_STRING: - $id_start = $token[1]; - $id_start_ci = strtolower($id_start); - $id_name = ''; - $context = 'root'; - $state = 'id_name'; - $lastState = 'closure'; - break 2; - case T_NEW: - $code .= $token[1]; - $context = 'new'; - $state = 'id_start'; - $lastState = 'closure'; - break 2; - case T_USE: - $code .= $token[1]; - $context = 'use'; - $state = 'id_start'; - $lastState = 'closure'; - break; - case T_INSTANCEOF: - $code .= $token[1]; - $context = 'instanceof'; - $state = 'id_start'; - $lastState = 'closure'; - break; - case T_OBJECT_OPERATOR: - case T_DOUBLE_COLON: - $code .= $token[1]; - $lastState = 'closure'; - $state = 'ignore_next'; - break; - case T_FUNCTION: - $code .= $token[1]; - $state = 'closure_args'; - break; - case T_TRAIT_C: - if ($_trait === null) { - $startLine = $this->getStartLine(); - $endLine = $this->getEndLine(); - $structures = $this->getStructures(); - - $_trait = ''; - - foreach ($structures as &$struct) { - if ($struct['type'] === 'trait' && - $struct['start'] <= $startLine && - $struct['end'] >= $endLine - ) { - $_trait = ($ns == '' ? '' : $ns . '\\') . $struct['name']; - break; - } - } - - $_trait = var_export($_trait, true); - } - - $code .= $_trait; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - } - break; - case 'ignore_next': - switch ($token[0]){ - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - $code .= $token[1]; - break; - case T_CLASS: - case T_NEW: - case T_STATIC: - case T_VARIABLE: - case T_STRING: - case T_CLASS_C: - case T_FILE: - case T_DIR: - case T_METHOD_C: - case T_FUNC_C: - case T_FUNCTION: - case T_INSTANCEOF: - case T_LINE: - case T_NS_C: - case T_TRAIT_C: - case T_USE: - $code .= $token[1]; - $state = $lastState; - break; - default: - $state = $lastState; - $i--; - } - break; - case 'id_start': - switch ($token[0]){ - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - $code .= $token[1]; - break; - case T_NS_SEPARATOR: - case T_STRING: - case T_STATIC: - $id_start = $token[1]; - $id_start_ci = strtolower($id_start); - $id_name = ''; - $state = 'id_name'; - break 2; - case T_VARIABLE: - $code .= $token[1]; - $state = $lastState; - break; - case T_CLASS: - $code .= $token[1]; - $state = 'anonymous'; - break; - default: - $i--;//reprocess last - $state = 'id_name'; - } - break; - case 'id_name': - switch ($token[0]){ - case T_NS_SEPARATOR: - case T_STRING: - $id_name .= $token[1]; - break; - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - $id_name .= $token[1]; - break; - case '(': - if ($isShortClosure) { - $open++; - } - if($context === 'new' || false !== strpos($id_name, '\\')){ - if($id_start !== '\\'){ - if ($classes === null) { - $classes = $this->getClasses(); - } - if (isset($classes[$id_start_ci])) { - $id_start = $classes[$id_start_ci]; - } - if($id_start[0] !== '\\'){ - $id_start = $nsf . '\\' . $id_start; - } - } - } else { - if($id_start !== '\\'){ - if($functions === null){ - $functions = $this->getFunctions(); - } - if(isset($functions[$id_start_ci])){ - $id_start = $functions[$id_start_ci]; - } - } - } - $code .= $id_start . $id_name . '('; - $state = $lastState; - break; - case T_VARIABLE: - case T_DOUBLE_COLON: - if($id_start !== '\\') { - if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ - $isUsingScope = true; - } elseif (!($php7 && in_array($id_start_ci, $php7_types))){ - if ($classes === null) { - $classes = $this->getClasses(); - } - if (isset($classes[$id_start_ci])) { - $id_start = $classes[$id_start_ci]; - } - if($id_start[0] !== '\\'){ - $id_start = $nsf . '\\' . $id_start; - } - } - } - $code .= $id_start . $id_name . $token[1]; - $state = $token[0] === T_DOUBLE_COLON ? 'ignore_next' : $lastState; - break; - default: - if($id_start !== '\\'){ - if($context === 'use' || - $context === 'instanceof' || - $context === 'args' || - $context === 'return_type' || - $context === 'extends' - ){ - if($id_start_ci === 'self' || $id_start_ci === 'static' || $id_start_ci === 'parent'){ - $isUsingScope = true; - } elseif (!($php7 && in_array($id_start_ci, $php7_types))){ - if($classes === null){ - $classes = $this->getClasses(); - } - if(isset($classes[$id_start_ci])){ - $id_start = $classes[$id_start_ci]; - } - if($id_start[0] !== '\\'){ - $id_start = $nsf . '\\' . $id_start; - } - } - } else { - if($constants === null){ - $constants = $this->getConstants(); - } - if(isset($constants[$id_start])){ - $id_start = $constants[$id_start]; - } - } - } - $code .= $id_start . $id_name; - $state = $lastState; - $i--;//reprocess last token - } - break; - case 'anonymous': - switch ($token[0]) { - case T_NS_SEPARATOR: - case T_STRING: - $id_start = $token[1]; - $id_start_ci = strtolower($id_start); - $id_name = ''; - $state = 'id_name'; - $context = 'extends'; - $lastState = 'anonymous'; - break; - case '{': - $state = 'closure'; - if (!$inside_anonymous) { - $inside_anonymous = true; - $anonymous_mark = $open; - } - $i--; - break; - default: - $code .= is_array($token) ? $token[1] : $token; - } - break; - } - } - - if ($isShortClosure) { - $code .= ';'; - $this->useVariables = $this->getStaticVariables(); - } else { - $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); - } - - $this->isShortClosure = $isShortClosure; - $this->isBindingRequired = $isUsingThisObject; - $this->isScopeRequired = $isUsingScope; - $this->code = $code; - - return $this->code; - } - - /** - * @return array - */ - public function getUseVariables() - { - if($this->useVariables !== null){ - return $this->useVariables; - } - - $tokens = $this->getTokens(); - $use = array(); - $state = 'start'; - - foreach ($tokens as &$token) { - $is_array = is_array($token); - - switch ($state) { - case 'start': - if ($is_array && $token[0] === T_USE) { - $state = 'use'; - } - break; - case 'use': - if ($is_array) { - if ($token[0] === T_VARIABLE) { - $use[] = substr($token[1], 1); - } - } elseif ($token == ')') { - break 2; - } - break; - } - } - - $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); - - return $this->useVariables; - } - - /** - * return bool - */ - public function isBindingRequired() - { - if($this->isBindingRequired === null){ - $this->getCode(); - } - - return $this->isBindingRequired; - } - - /** - * return bool - */ - public function isScopeRequired() - { - if($this->isScopeRequired === null){ - $this->getCode(); - } - - return $this->isScopeRequired; - } - - /** - * @return string - */ - protected function getHashedFileName() - { - if ($this->hashedName === null) { - $this->hashedName = sha1($this->getFileName()); - } - - return $this->hashedName; - } - - /** - * @return array - */ - protected function getFileTokens() - { - $key = $this->getHashedFileName(); - - if (!isset(static::$files[$key])) { - static::$files[$key] = token_get_all(file_get_contents($this->getFileName())); - } - - return static::$files[$key]; - } - - /** - * @return array - */ - protected function getTokens() - { - if ($this->tokens === null) { - $tokens = $this->getFileTokens(); - $startLine = $this->getStartLine(); - $endLine = $this->getEndLine(); - $results = array(); - $start = false; - - foreach ($tokens as &$token) { - if (!is_array($token)) { - if ($start) { - $results[] = $token; - } - - continue; - } - - $line = $token[2]; - - if ($line <= $endLine) { - if ($line >= $startLine) { - $start = true; - $results[] = $token; - } - - continue; - } - - break; - } - - $this->tokens = $results; - } - - return $this->tokens; - } - - /** - * @return array - */ - protected function getClasses() - { - $key = $this->getHashedFileName(); - - if (!isset(static::$classes[$key])) { - $this->fetchItems(); - } - - return static::$classes[$key]; - } - - /** - * @return array - */ - protected function getFunctions() - { - $key = $this->getHashedFileName(); - - if (!isset(static::$functions[$key])) { - $this->fetchItems(); - } - - return static::$functions[$key]; - } - - /** - * @return array - */ - protected function getConstants() - { - $key = $this->getHashedFileName(); - - if (!isset(static::$constants[$key])) { - $this->fetchItems(); - } - - return static::$constants[$key]; - } - - /** - * @return array - */ - protected function getStructures() - { - $key = $this->getHashedFileName(); - - if (!isset(static::$structures[$key])) { - $this->fetchItems(); - } - - return static::$structures[$key]; - } - - protected function fetchItems() - { - $key = $this->getHashedFileName(); - - $classes = array(); - $functions = array(); - $constants = array(); - $structures = array(); - $tokens = $this->getFileTokens(); - - $open = 0; - $state = 'start'; - $lastState = ''; - $prefix = ''; - $name = ''; - $alias = ''; - $isFunc = $isConst = false; - - $startLine = $endLine = 0; - $structType = $structName = ''; - $structIgnore = false; - - foreach ($tokens as $token) { - - switch ($state) { - case 'start': - switch ($token[0]) { - case T_CLASS: - case T_INTERFACE: - case T_TRAIT: - $state = 'before_structure'; - $startLine = $token[2]; - $structType = $token[0] == T_CLASS - ? 'class' - : ($token[0] == T_INTERFACE ? 'interface' : 'trait'); - break; - case T_USE: - $state = 'use'; - $prefix = $name = $alias = ''; - $isFunc = $isConst = false; - break; - case T_FUNCTION: - $state = 'structure'; - $structIgnore = true; - break; - case T_NEW: - $state = 'new'; - break; - case T_OBJECT_OPERATOR: - case T_DOUBLE_COLON: - $state = 'invoke'; - break; - } - break; - case 'use': - switch ($token[0]) { - case T_FUNCTION: - $isFunc = true; - break; - case T_CONST: - $isConst = true; - break; - case T_NS_SEPARATOR: - $name .= $token[1]; - break; - case T_STRING: - $name .= $token[1]; - $alias = $token[1]; - break; - case T_AS: - $lastState = 'use'; - $state = 'alias'; - break; - case '{': - $prefix = $name; - $name = $alias = ''; - $state = 'use-group'; - break; - case ',': - case ';': - if ($name === '' || $name[0] !== '\\') { - $name = '\\' . $name; - } - - if ($alias !== '') { - if ($isFunc) { - $functions[strtolower($alias)] = $name; - } elseif ($isConst) { - $constants[$alias] = $name; - } else { - $classes[strtolower($alias)] = $name; - } - } - $name = $alias = ''; - $state = $token === ';' ? 'start' : 'use'; - break; - } - break; - case 'use-group': - switch ($token[0]) { - case T_NS_SEPARATOR: - $name .= $token[1]; - break; - case T_STRING: - $name .= $token[1]; - $alias = $token[1]; - break; - case T_AS: - $lastState = 'use-group'; - $state = 'alias'; - break; - case ',': - case '}': - - if ($prefix === '' || $prefix[0] !== '\\') { - $prefix = '\\' . $prefix; - } - - if ($alias !== '') { - if ($isFunc) { - $functions[strtolower($alias)] = $prefix . $name; - } elseif ($isConst) { - $constants[$alias] = $prefix . $name; - } else { - $classes[strtolower($alias)] = $prefix . $name; - } - } - $name = $alias = ''; - $state = $token === '}' ? 'use' : 'use-group'; - break; - } - break; - case 'alias': - if ($token[0] === T_STRING) { - $alias = $token[1]; - $state = $lastState; - } - break; - case 'new': - switch ($token[0]) { - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - break 2; - case T_CLASS: - $state = 'structure'; - $structIgnore = true; - break; - default: - $state = 'start'; - } - break; - case 'invoke': - switch ($token[0]) { - case T_WHITESPACE: - case T_COMMENT: - case T_DOC_COMMENT: - break 2; - default: - $state = 'start'; - } - break; - case 'before_structure': - if ($token[0] == T_STRING) { - $structName = $token[1]; - $state = 'structure'; - } - break; - case 'structure': - switch ($token[0]) { - case '{': - case T_CURLY_OPEN: - case T_DOLLAR_OPEN_CURLY_BRACES: - case T_STRING_VARNAME: - $open++; - break; - case '}': - if (--$open == 0) { - if(!$structIgnore){ - $structures[] = array( - 'type' => $structType, - 'name' => $structName, - 'start' => $startLine, - 'end' => $endLine, - ); - } - $structIgnore = false; - $state = 'start'; - } - break; - default: - if (is_array($token)) { - $endLine = $token[2]; - } - } - break; - } - } - - static::$classes[$key] = $classes; - static::$functions[$key] = $functions; - static::$constants[$key] = $constants; - static::$structures[$key] = $structures; - } -} diff --git a/crmeb/vendor/opis/closure/src/SecurityException.php b/crmeb/vendor/opis/closure/src/SecurityException.php deleted file mode 100644 index 6a107eec8..000000000 --- a/crmeb/vendor/opis/closure/src/SecurityException.php +++ /dev/null @@ -1,18 +0,0 @@ -secret = $secret; - } - - /** - * @inheritdoc - */ - public function sign($closure) - { - return array( - 'closure' => $closure, - 'hash' => base64_encode(hash_hmac('sha256', $closure, $this->secret, true)), - ); - } - - /** - * @inheritdoc - */ - public function verify(array $data) - { - return base64_encode(hash_hmac('sha256', $data['closure'], $this->secret, true)) === $data['hash']; - } -} \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/src/SelfReference.php b/crmeb/vendor/opis/closure/src/SelfReference.php deleted file mode 100644 index 3c6ec80dd..000000000 --- a/crmeb/vendor/opis/closure/src/SelfReference.php +++ /dev/null @@ -1,31 +0,0 @@ -hash = $hash; - } -} \ No newline at end of file diff --git a/crmeb/vendor/opis/closure/src/SerializableClosure.php b/crmeb/vendor/opis/closure/src/SerializableClosure.php deleted file mode 100644 index c4991cf8e..000000000 --- a/crmeb/vendor/opis/closure/src/SerializableClosure.php +++ /dev/null @@ -1,668 +0,0 @@ -closure = $closure; - if (static::$context !== null) { - $this->scope = static::$context->scope; - $this->scope->toserialize++; - } - } - - /** - * Get the Closure object - * - * @return Closure The wrapped closure - */ - public function getClosure() - { - return $this->closure; - } - - /** - * Get the reflector for closure - * - * @return ReflectionClosure - */ - public function getReflector() - { - if ($this->reflector === null) { - $this->reflector = new ReflectionClosure($this->closure, $this->code); - $this->code = null; - } - - return $this->reflector; - } - - /** - * Implementation of magic method __invoke() - */ - public function __invoke() - { - return call_user_func_array($this->closure, func_get_args()); - } - - /** - * Implementation of Serializable::serialize() - * - * @return string The serialized closure - */ - public function serialize() - { - if ($this->scope === null) { - $this->scope = new ClosureScope(); - $this->scope->toserialize++; - } - - $this->scope->serializations++; - - $scope = $object = null; - $reflector = $this->getReflector(); - - if($reflector->isBindingRequired()){ - $object = $reflector->getClosureThis(); - static::wrapClosures($object, $this->scope); - if($scope = $reflector->getClosureScopeClass()){ - $scope = $scope->name; - } - } elseif($reflector->isScopeRequired()) { - if($scope = $reflector->getClosureScopeClass()){ - $scope = $scope->name; - } - } - - $this->reference = spl_object_hash($this->closure); - - $this->scope[$this->closure] = $this; - - $use = $this->transformUseVariables($reflector->getUseVariables()); - $code = $reflector->getCode(); - - $this->mapByReference($use); - - $ret = \serialize(array( - 'use' => $use, - 'function' => $code, - 'scope' => $scope, - 'this' => $object, - 'self' => $this->reference, - )); - - if (static::$securityProvider !== null) { - $data = static::$securityProvider->sign($ret); - $ret = '@' . $data['hash'] . '.' . $data['closure']; - } - - if (!--$this->scope->serializations && !--$this->scope->toserialize) { - $this->scope = null; - } - - return $ret; - } - - /** - * Transform the use variables before serialization. - * - * @param array $data The Closure's use variables - * @return array - */ - protected function transformUseVariables($data) - { - return $data; - } - - /** - * Implementation of Serializable::unserialize() - * - * @param string $data Serialized data - * @throws SecurityException - */ - public function unserialize($data) - { - ClosureStream::register(); - - if (static::$securityProvider !== null) { - if ($data[0] !== '@') { - throw new SecurityException("The serialized closure is not signed. ". - "Make sure you use a security provider for both serialization and unserialization."); - } - - if ($data[1] !== '{') { - $separator = strpos($data, '.'); - if ($separator === false) { - throw new SecurityException('Invalid signed closure'); - } - $hash = substr($data, 1, $separator - 1); - $closure = substr($data, $separator + 1); - - $data = ['hash' => $hash, 'closure' => $closure]; - - unset($hash, $closure); - } else { - $data = json_decode(substr($data, 1), true); - } - - if (!is_array($data) || !static::$securityProvider->verify($data)) { - throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " . - "Make sure you use the same security provider, with the same settings, " . - "both for serialization and unserialization."); - } - - $data = $data['closure']; - } elseif ($data[0] === '@') { - if ($data[1] !== '{') { - $separator = strpos($data, '.'); - if ($separator === false) { - throw new SecurityException('Invalid signed closure'); - } - $hash = substr($data, 1, $separator - 1); - $closure = substr($data, $separator + 1); - - $data = ['hash' => $hash, 'closure' => $closure]; - - unset($hash, $closure); - } else { - $data = json_decode(substr($data, 1), true); - } - - if (!is_array($data) || !isset($data['closure']) || !isset($data['hash'])) { - throw new SecurityException('Invalid signed closure'); - } - - $data = $data['closure']; - } - - $this->code = \unserialize($data); - - // unset data - unset($data); - - $this->code['objects'] = array(); - - if ($this->code['use']) { - $this->scope = new ClosureScope(); - $this->code['use'] = $this->resolveUseVariables($this->code['use']); - $this->mapPointers($this->code['use']); - extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS); - $this->scope = null; - } - - $this->closure = include(ClosureStream::STREAM_PROTO . '://' . $this->code['function']); - - if($this->code['this'] === $this){ - $this->code['this'] = null; - } - - if ($this->code['scope'] !== null || $this->code['this'] !== null) { - $this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']); - } - - if(!empty($this->code['objects'])){ - foreach ($this->code['objects'] as $item){ - $item['property']->setValue($item['instance'], $item['object']->getClosure()); - } - } - - $this->code = $this->code['function']; - } - - /** - * Resolve the use variables after unserialization. - * - * @param array $data The Closure's transformed use variables - * @return array - */ - protected function resolveUseVariables($data) - { - return $data; - } - - /** - * Wraps a closure and sets the serialization context (if any) - * - * @param Closure $closure Closure to be wrapped - * - * @return self The wrapped closure - */ - public static function from(Closure $closure) - { - if (static::$context === null) { - $instance = new static($closure); - } elseif (isset(static::$context->scope[$closure])) { - $instance = static::$context->scope[$closure]; - } else { - $instance = new static($closure); - static::$context->scope[$closure] = $instance; - } - - return $instance; - } - - /** - * Increments the context lock counter or creates a new context if none exist - */ - public static function enterContext() - { - if (static::$context === null) { - static::$context = new ClosureContext(); - } - - static::$context->locks++; - } - - /** - * Decrements the context lock counter and destroy the context when it reaches to 0 - */ - public static function exitContext() - { - if (static::$context !== null && !--static::$context->locks) { - static::$context = null; - } - } - - /** - * @param string $secret - */ - public static function setSecretKey($secret) - { - if(static::$securityProvider === null){ - static::$securityProvider = new SecurityProvider($secret); - } - } - - /** - * @param ISecurityProvider $securityProvider - */ - public static function addSecurityProvider(ISecurityProvider $securityProvider) - { - static::$securityProvider = $securityProvider; - } - - /** - * Remove security provider - */ - public static function removeSecurityProvider() - { - static::$securityProvider = null; - } - - /** - * @return null|ISecurityProvider - */ - public static function getSecurityProvider() - { - return static::$securityProvider; - } - - /** - * Wrap closures - * - * @internal - * @param $data - * @param ClosureScope|SplObjectStorage|null $storage - */ - public static function wrapClosures(&$data, SplObjectStorage $storage = null) - { - if($storage === null){ - $storage = static::$context->scope; - } - - if($data instanceof Closure){ - $data = static::from($data); - } elseif (is_array($data)){ - if(isset($data[self::ARRAY_RECURSIVE_KEY])){ - return; - } - $data[self::ARRAY_RECURSIVE_KEY] = true; - foreach ($data as $key => &$value){ - if($key === self::ARRAY_RECURSIVE_KEY){ - continue; - } - static::wrapClosures($value, $storage); - } - unset($value); - unset($data[self::ARRAY_RECURSIVE_KEY]); - } elseif($data instanceof \stdClass){ - if(isset($storage[$data])){ - $data = $storage[$data]; - return; - } - $data = $storage[$data] = clone($data); - foreach ($data as &$value){ - static::wrapClosures($value, $storage); - } - unset($value); - } elseif (is_object($data) && ! $data instanceof static){ - if(isset($storage[$data])){ - $data = $storage[$data]; - return; - } - $instance = $data; - $reflection = new ReflectionObject($instance); - if(!$reflection->isUserDefined()){ - $storage[$instance] = $data; - return; - } - $storage[$instance] = $data = $reflection->newInstanceWithoutConstructor(); - - do{ - if(!$reflection->isUserDefined()){ - break; - } - foreach ($reflection->getProperties() as $property){ - if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){ - continue; - } - $property->setAccessible(true); - $value = $property->getValue($instance); - if(is_array($value) || is_object($value)){ - static::wrapClosures($value, $storage); - } - $property->setValue($data, $value); - }; - } while($reflection = $reflection->getParentClass()); - } - } - - /** - * Unwrap closures - * - * @internal - * @param $data - * @param SplObjectStorage|null $storage - */ - public static function unwrapClosures(&$data, SplObjectStorage $storage = null) - { - if($storage === null){ - $storage = static::$context->scope; - } - - if($data instanceof static){ - $data = $data->getClosure(); - } elseif (is_array($data)){ - if(isset($data[self::ARRAY_RECURSIVE_KEY])){ - return; - } - $data[self::ARRAY_RECURSIVE_KEY] = true; - foreach ($data as $key => &$value){ - if($key === self::ARRAY_RECURSIVE_KEY){ - continue; - } - static::unwrapClosures($value, $storage); - } - unset($data[self::ARRAY_RECURSIVE_KEY]); - }elseif ($data instanceof \stdClass){ - if(isset($storage[$data])){ - return; - } - $storage[$data] = true; - foreach ($data as &$property){ - static::unwrapClosures($property, $storage); - } - } elseif (is_object($data) && !($data instanceof Closure)){ - if(isset($storage[$data])){ - return; - } - $storage[$data] = true; - $reflection = new ReflectionObject($data); - - do{ - if(!$reflection->isUserDefined()){ - break; - } - foreach ($reflection->getProperties() as $property){ - if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){ - continue; - } - $property->setAccessible(true); - $value = $property->getValue($data); - if(is_array($value) || is_object($value)){ - static::unwrapClosures($value, $storage); - $property->setValue($data, $value); - } - }; - } while($reflection = $reflection->getParentClass()); - } - } - - /** - * Creates a new closure from arbitrary code, - * emulating create_function, but without using eval - * - * @param string$args - * @param string $code - * @return Closure - */ - public static function createClosure($args, $code) - { - ClosureStream::register(); - return include(ClosureStream::STREAM_PROTO . '://function(' . $args. '){' . $code . '};'); - } - - /** - * Internal method used to map closure pointers - * @internal - * @param $data - */ - protected function mapPointers(&$data) - { - $scope = $this->scope; - - if ($data instanceof static) { - $data = &$data->closure; - } elseif (is_array($data)) { - if(isset($data[self::ARRAY_RECURSIVE_KEY])){ - return; - } - $data[self::ARRAY_RECURSIVE_KEY] = true; - foreach ($data as $key => &$value){ - if($key === self::ARRAY_RECURSIVE_KEY){ - continue; - } elseif ($value instanceof static) { - $data[$key] = &$value->closure; - } elseif ($value instanceof SelfReference && $value->hash === $this->code['self']){ - $data[$key] = &$this->closure; - } else { - $this->mapPointers($value); - } - } - unset($value); - unset($data[self::ARRAY_RECURSIVE_KEY]); - } elseif ($data instanceof \stdClass) { - if(isset($scope[$data])){ - return; - } - $scope[$data] = true; - foreach ($data as $key => &$value){ - if ($value instanceof SelfReference && $value->hash === $this->code['self']){ - $data->{$key} = &$this->closure; - } elseif(is_array($value) || is_object($value)) { - $this->mapPointers($value); - } - } - unset($value); - } elseif (is_object($data) && !($data instanceof Closure)){ - if(isset($scope[$data])){ - return; - } - $scope[$data] = true; - $reflection = new ReflectionObject($data); - do{ - if(!$reflection->isUserDefined()){ - break; - } - foreach ($reflection->getProperties() as $property){ - if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){ - continue; - } - $property->setAccessible(true); - $item = $property->getValue($data); - if ($item instanceof SerializableClosure || ($item instanceof SelfReference && $item->hash === $this->code['self'])) { - $this->code['objects'][] = array( - 'instance' => $data, - 'property' => $property, - 'object' => $item instanceof SelfReference ? $this : $item, - ); - } elseif (is_array($item) || is_object($item)) { - $this->mapPointers($item); - $property->setValue($data, $item); - } - } - } while($reflection = $reflection->getParentClass()); - } - } - - /** - * Internal method used to map closures by reference - * - * @internal - * @param mixed &$data - */ - protected function mapByReference(&$data) - { - if ($data instanceof Closure) { - if($data === $this->closure){ - $data = new SelfReference($this->reference); - return; - } - - if (isset($this->scope[$data])) { - $data = $this->scope[$data]; - return; - } - - $instance = new static($data); - - if (static::$context !== null) { - static::$context->scope->toserialize--; - } else { - $instance->scope = $this->scope; - } - - $data = $this->scope[$data] = $instance; - } elseif (is_array($data)) { - if(isset($data[self::ARRAY_RECURSIVE_KEY])){ - return; - } - $data[self::ARRAY_RECURSIVE_KEY] = true; - foreach ($data as $key => &$value){ - if($key === self::ARRAY_RECURSIVE_KEY){ - continue; - } - $this->mapByReference($value); - } - unset($value); - unset($data[self::ARRAY_RECURSIVE_KEY]); - } elseif ($data instanceof \stdClass) { - if(isset($this->scope[$data])){ - $data = $this->scope[$data]; - return; - } - $instance = $data; - $this->scope[$instance] = $data = clone($data); - - foreach ($data as &$value){ - $this->mapByReference($value); - } - unset($value); - } elseif (is_object($data) && !$data instanceof SerializableClosure){ - if(isset($this->scope[$data])){ - $data = $this->scope[$data]; - return; - } - - $instance = $data; - $reflection = new ReflectionObject($data); - if(!$reflection->isUserDefined()){ - $this->scope[$instance] = $data; - return; - } - $this->scope[$instance] = $data = $reflection->newInstanceWithoutConstructor(); - - do{ - if(!$reflection->isUserDefined()){ - break; - } - foreach ($reflection->getProperties() as $property){ - if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){ - continue; - } - $property->setAccessible(true); - $value = $property->getValue($instance); - if(is_array($value) || is_object($value)){ - $this->mapByReference($value); - } - $property->setValue($data, $value); - } - } while($reflection = $reflection->getParentClass()); - } - } - -} diff --git a/crmeb/vendor/services.php b/crmeb/vendor/services.php index a52b07a6e..399cb3a6c 100644 --- a/crmeb/vendor/services.php +++ b/crmeb/vendor/services.php @@ -1,5 +1,5 @@ 'think\\captcha\\CaptchaService', diff --git a/crmeb/vendor/topthink/framework/.gitignore b/crmeb/vendor/topthink/framework/.gitignore index b267fbae4..b2fd3b979 100644 --- a/crmeb/vendor/topthink/framework/.gitignore +++ b/crmeb/vendor/topthink/framework/.gitignore @@ -4,4 +4,7 @@ composer.lock .DS_Store Thumbs.db /.idea -/.vscode \ No newline at end of file +/.vscode +/.settings +/.buildpath +/.project \ No newline at end of file diff --git a/crmeb/vendor/topthink/framework/.travis.yml b/crmeb/vendor/topthink/framework/.travis.yml index 73e6681ff..abaa2711b 100644 --- a/crmeb/vendor/topthink/framework/.travis.yml +++ b/crmeb/vendor/topthink/framework/.travis.yml @@ -4,9 +4,9 @@ language: php matrix: fast_finish: true include: - - php: 7.1 - php: 7.2 - php: 7.3 + - php: 8.0 cache: directories: @@ -19,6 +19,7 @@ services: before_install: - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo 'xdebug.mode = coverage' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - printf "\n" | pecl install -f redis - travis_retry composer self-update - mysql -e 'CREATE DATABASE test;' @@ -31,4 +32,4 @@ script: after_script: - travis_retry wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.xml \ No newline at end of file + - php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.xml diff --git a/crmeb/vendor/topthink/framework/README.md b/crmeb/vendor/topthink/framework/README.md index be0bb4e68..dd38e34cd 100644 --- a/crmeb/vendor/topthink/framework/README.md +++ b/crmeb/vendor/topthink/framework/README.md @@ -1,6 +1,6 @@ ![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221) -ThinkPHP 6.0 +ThinkPHP 6.1 =============== [![Build Status](https://travis-ci.org/top-think/framework.svg?branch=6.0)](https://travis-ci.org/top-think/framework) @@ -11,9 +11,8 @@ ThinkPHP 6.0 [![PHP Version](https://img.shields.io/badge/php-%3E%3D7.1-8892BF.svg)](http://www.php.net/) [![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework) -ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。 -[官方应用服务市场](https://www.thinkphp.cn/service) | [`ThinkPHP`开发者扶持计划](https://sites.thinkphp.cn/1782366) +[官方服务](https://www.topthink.com) | [`ThinkAPI`——官方统一API](https://doc.topthink.com/think-api) ## 主要新特性 @@ -22,7 +21,6 @@ ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。 * 原生多应用支持 * 系统服务注入支持 * ORM作为独立组件使用 -* 增加Filesystem * 全新的事件系统 * 模板引擎分离出核心 * 内部功能中间件化 @@ -35,7 +33,7 @@ ThinkPHP6.0底层架构采用PHP7.1改写和进一步优化。 * 统一和精简大量用法 -> ThinkPHP6.0的运行环境要求PHP7.1+。 +> ThinkPHP6.1的运行环境要求PHP7.2.5+,最高兼容PHP8.2 ## 安装 @@ -79,7 +77,7 @@ ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 本项目包含的第三方源码和二进制文件之版权信息另行标注。 -版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn) All rights reserved。 +版权所有Copyright © 2006-2021 by ThinkPHP (http://thinkphp.cn) All rights reserved。 ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 diff --git a/crmeb/vendor/topthink/framework/composer.json b/crmeb/vendor/topthink/framework/composer.json index 1405162ee..2d9685eeb 100644 --- a/crmeb/vendor/topthink/framework/composer.json +++ b/crmeb/vendor/topthink/framework/composer.json @@ -19,22 +19,21 @@ } ], "require": { - "php": ">=7.1.0", + "php": ">=7.2.5", "ext-json": "*", "ext-mbstring": "*", - "league/flysystem": "^1.0", - "league/flysystem-cached-adapter": "^1.0", - "opis/closure": "^3.1", "psr/log": "~1.0", "psr/container": "~1.0", "psr/simple-cache": "^1.0", - "topthink/think-orm": "^2.0", + "psr/http-message": "^1.0", + "topthink/think-orm": "^2.0|^3.0", "topthink/think-helper": "^3.1.1" }, "require-dev": { "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.2", - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^7.0", + "guzzlehttp/psr7": "^2.1.0" }, "autoload": { "files": [], diff --git a/crmeb/vendor/topthink/framework/src/helper.php b/crmeb/vendor/topthink/framework/src/helper.php index 8b2899889..caba0ae08 100644 --- a/crmeb/vendor/topthink/framework/src/helper.php +++ b/crmeb/vendor/topthink/framework/src/helper.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -58,10 +58,11 @@ if (!function_exists('abort')) { if (!function_exists('app')) { /** * 快速获取容器中的实例 支持依赖注入 - * @param string $name 类名或标识 默认获取当前应用实例 - * @param array $args 参数 - * @param bool $newInstance 是否每次创建新的实例 - * @return object|App + * @template T + * @param string|class-string $name 类名或标识 默认获取当前应用实例 + * @param array $args 参数 + * @param bool $newInstance 是否每次创建新的实例 + * @return T|object|App */ function app(string $name = '', array $args = [], bool $newInstance = false) { @@ -149,7 +150,7 @@ if (!function_exists('cookie')) { { if (is_null($value)) { // 删除 - Cookie::delete($name); + Cookie::delete($name, $option ?: []); } elseif ('' === $value) { // 获取 return 0 === strpos($name, '?') ? Cookie::has(substr($name, 1)) : Cookie::get($name); diff --git a/crmeb/vendor/topthink/framework/src/lang/zh-cn.php b/crmeb/vendor/topthink/framework/src/lang/zh-cn.php index 83d8a1e89..a546330a0 100644 --- a/crmeb/vendor/topthink/framework/src/lang/zh-cn.php +++ b/crmeb/vendor/topthink/framework/src/lang/zh-cn.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/App.php b/crmeb/vendor/topthink/framework/src/think/App.php index 094339501..9f309c074 100644 --- a/crmeb/vendor/topthink/framework/src/think/App.php +++ b/crmeb/vendor/topthink/framework/src/think/App.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -35,11 +35,10 @@ use think\initializer\RegisterService; * @property Cookie $cookie * @property Session $session * @property Validate $validate - * @property Filesystem $filesystem */ class App extends Container { - const VERSION = '6.0.3'; + const VERSION = '6.1.1'; /** * 应用调试模式 @@ -47,6 +46,12 @@ class App extends Container */ protected $appDebug = false; + /** + * 环境变量标识 + * @var string + */ + protected $envName = ''; + /** * 应用开始时间 * @var float @@ -146,7 +151,6 @@ class App extends Container 'session' => Session::class, 'validate' => Validate::class, 'view' => View::class, - 'filesystem' => Filesystem::class, 'think\DbManager' => Db::class, 'think\LogManager' => Log::class, 'think\CacheManager' => Cache::class, @@ -162,7 +166,7 @@ class App extends Container */ public function __construct(string $rootPath = '') { - $this->thinkPath = dirname(__DIR__) . DIRECTORY_SEPARATOR; + $this->thinkPath = realpath(dirname(__DIR__)) . DIRECTORY_SEPARATOR; $this->rootPath = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath(); $this->appPath = $this->rootPath . 'app' . DIRECTORY_SEPARATOR; $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR; @@ -277,6 +281,18 @@ class App extends Container return $this->namespace; } + /** + * 设置环境变量标识 + * @access public + * @param string $name 环境标识 + * @return $this + */ + public function setEnvName(string $name) + { + $this->envName = $name; + return $this; + } + /** * 获取框架版本 * @access public @@ -395,6 +411,22 @@ class App extends Container return $this->beginMem; } + /** + * 加载环境变量定义 + * @access public + * @param string $envName 环境标识 + * @return void + */ + public function loadEnv(string $envName = ''): void + { + // 加载环境变量 + $envFile = $envName ? $this->rootPath . '.env.' . $envName : $this->rootPath . '.env'; + + if (is_file($envFile)) { + $this->env->load($envFile); + } + } + /** * 初始化应用 * @access public @@ -407,10 +439,7 @@ class App extends Container $this->beginTime = microtime(true); $this->beginMem = memory_get_usage(); - // 加载环境变量 - if (is_file($this->rootPath . '.env')) { - $this->env->load($this->rootPath . '.env'); - } + $this->loadEnv($this->envName); $this->configExt = $this->env->get('config_ext', '.php'); @@ -419,13 +448,8 @@ class App extends Container // 加载全局初始化文件 $this->load(); - // 加载框架默认语言包 - $langSet = $this->lang->defaultLangSet(); - - $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php'); - // 加载应用默认语言包 - $this->loadLangPack($langSet); + $this->loadLangPack(); // 监听AppInit $this->event->trigger(AppInit::class); @@ -451,25 +475,13 @@ class App extends Container /** * 加载语言包 - * @param string $langset 语言 * @return void */ - public function loadLangPack($langset) + public function loadLangPack() { - if (empty($langset)) { - return; - } - - // 加载系统语言包 - $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*'); - $this->lang->load($files); - - // 加载扩展(自定义)语言包 - $list = $this->config->get('lang.extend_list', []); - - if (isset($list[$langset])) { - $this->lang->load($list[$langset]); - } + // 加载默认语言包 + $langSet = $this->lang->defaultLangSet(); + $this->lang->switchLangSet($langSet); } /** @@ -590,7 +602,7 @@ class App extends Container * 是否运行在命令行下 * @return bool */ - public function runningInConsole() + public function runningInConsole(): bool { return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; } diff --git a/crmeb/vendor/topthink/framework/src/think/Cache.php b/crmeb/vendor/topthink/framework/src/think/Cache.php index 4bc99c27c..f802b556f 100644 --- a/crmeb/vendor/topthink/framework/src/think/Cache.php +++ b/crmeb/vendor/topthink/framework/src/think/Cache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Config.php b/crmeb/vendor/topthink/framework/src/think/Config.php index 78933adca..9162e82fd 100644 --- a/crmeb/vendor/topthink/framework/src/think/Config.php +++ b/crmeb/vendor/topthink/framework/src/think/Config.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -116,6 +116,10 @@ class Config */ public function has(string $name): bool { + if (false === strpos($name, '.') && !isset($this->config[strtolower($name)])) { + return false; + } + return !is_null($this->get($name)); } diff --git a/crmeb/vendor/topthink/framework/src/think/Console.php b/crmeb/vendor/topthink/framework/src/think/Console.php index a1398d5d9..27f12baad 100644 --- a/crmeb/vendor/topthink/framework/src/think/Console.php +++ b/crmeb/vendor/topthink/framework/src/think/Console.php @@ -57,7 +57,7 @@ class Console protected $catchExceptions = true; protected $autoExit = true; protected $definition; - protected $defaultCommand = 'list'; + protected $defaultCommand = 'list'; protected $defaultCommands = [ 'help' => Help::class, @@ -91,9 +91,7 @@ class Console { $this->app = $app; - if (!$this->app->initialized()) { - $this->app->initialize(); - } + $this->initialize(); $this->definition = $this->getDefaultInputDefinition(); @@ -103,6 +101,62 @@ class Console $this->start(); } + /** + * 初始化 + */ + protected function initialize() + { + if (!$this->app->initialized()) { + $this->app->initialize(); + } + $this->makeRequest(); + } + + /** + * 构造request + */ + protected function makeRequest() + { + $url = $this->app->config->get('app.url', 'http://localhost'); + + $components = parse_url($url); + + $server = $_SERVER; + + if (isset($components['path'])) { + $server = array_merge($server, [ + 'SCRIPT_FILENAME' => $components['path'], + 'SCRIPT_NAME' => $components['path'], + 'REQUEST_URI' => $components['path'], + ]); + } + + if (isset($components['host'])) { + $server['SERVER_NAME'] = $components['host']; + $server['HTTP_HOST'] = $components['host']; + } + + if (isset($components['scheme'])) { + if ('https' === $components['scheme']) { + $server['HTTPS'] = 'on'; + $server['SERVER_PORT'] = 443; + } else { + unset($server['HTTPS']); + $server['SERVER_PORT'] = 80; + } + } + + if (isset($components['port'])) { + $server['SERVER_PORT'] = $components['port']; + $server['HTTP_HOST'] .= ':' . $components['port']; + } + + /** @var Request $request */ + $request = $this->app->make('request'); + + $request->withServer($server); + } + /** * 添加初始化器 * @param Closure $callback @@ -161,7 +215,7 @@ class Console /** * @access public * @param string $command - * @param array $parameters + * @param array $parameters * @param string $driver * @return Output|Buffer */ @@ -226,7 +280,7 @@ class Console /** * 执行指令 * @access public - * @param Input $input + * @param Input $input * @param Output $output * @return int */ @@ -344,7 +398,7 @@ class Console * 添加一个指令 * @access public * @param string|Command $command 指令对象或者指令类名 - * @param string $name 指令名 留空则自动获取 + * @param string $name 指令名 留空则自动获取 * @return Command|void */ public function addCommand($command, string $name = '') @@ -462,7 +516,7 @@ class Console $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]) . '[^:]*'; }, $namespace); - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); if (empty($namespaces)) { $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); @@ -560,7 +614,7 @@ class Console /** * 配置基于用户的参数和选项的输入和输出实例。 * @access protected - * @param Input $input 输入实例 + * @param Input $input 输入实例 * @param Output $output 输出实例 */ protected function configureIO(Input $input, Output $output): void @@ -590,8 +644,8 @@ class Console * 执行指令 * @access protected * @param Command $command 指令实例 - * @param Input $input 输入实例 - * @param Output $output 输出实例 + * @param Input $input 输入实例 + * @param Output $output 输出实例 * @return int * @throws \Exception */ @@ -644,8 +698,8 @@ class Console /** * 返回命名空间部分 * @access public - * @param string $name 指令 - * @param int $limit 部分的命名空间的最大数量 + * @param string $name 指令 + * @param int $limit 部分的命名空间的最大数量 * @return string */ public function extractNamespace(string $name, int $limit = 0): string @@ -659,7 +713,7 @@ class Console /** * 查找可替代的建议 * @access private - * @param string $name + * @param string $name * @param array|\Traversable $collection * @return array */ diff --git a/crmeb/vendor/topthink/framework/src/think/Container.php b/crmeb/vendor/topthink/framework/src/think/Container.php index 215524f1e..f286c73bf 100644 --- a/crmeb/vendor/topthink/framework/src/think/Container.php +++ b/crmeb/vendor/topthink/framework/src/think/Container.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -27,6 +27,7 @@ use ReflectionMethod; use think\exception\ClassNotFoundException; use think\exception\FuncNotFoundException; use think\helper\Str; +use Traversable; /** * 容器管理类 支持PSR-11 @@ -107,11 +108,11 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C /** * 获取容器中的对象实例 不存在则创建 - * @access public - * @param string $abstract 类名或者标识 - * @param array|true $vars 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return object + * @template T + * @param string|class-string $abstract 类名或者标识 + * @param array $vars 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return T|object */ public static function pull(string $abstract, array $vars = [], bool $newInstance = false) { @@ -120,9 +121,9 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C /** * 获取容器中的对象实例 - * @access public - * @param string $abstract 类名或者标识 - * @return object + * @template T + * @param string|class-string $abstract 类名或者标识 + * @return T|object */ public function get($abstract) { @@ -152,8 +153,9 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C $this->instance($abstract, $concrete); } else { $abstract = $this->getAlias($abstract); - - $this->bind[$abstract] = $concrete; + if ($abstract != $concrete) { + $this->bind[$abstract] = $concrete; + } } return $this; @@ -230,11 +232,11 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C /** * 创建类的实例 已经存在则直接获取 - * @access public - * @param string $abstract 类名或者标识 - * @param array $vars 变量 - * @param bool $newInstance 是否每次创建新的实例 - * @return mixed + * @template T + * @param string|class-string $abstract 类名或者标识 + * @param array $vars 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return T|object */ public function make(string $abstract, array $vars = [], bool $newInstance = false) { @@ -379,8 +381,10 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C if ($reflect->hasMethod('__make')) { $method = $reflect->getMethod('__make'); if ($method->isPublic() && $method->isStatic()) { - $args = $this->bindParams($method, $vars); - return $method->invokeArgs(null, $args); + $args = $this->bindParams($method, $vars); + $object = $method->invokeArgs(null, $args); + $this->invokeAfter($class, $object); + return $object; } } @@ -437,17 +441,19 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C $args = []; foreach ($params as $param) { - $name = $param->getName(); - $lowerName = Str::snake($name); - $class = $param->getClass(); + $name = $param->getName(); + $lowerName = Str::snake($name); + $reflectionType = $param->getType(); - if ($class) { - $args[] = $this->getObjectParam($class->getName(), $vars); + if ($param->isVariadic()) { + return array_merge($args, array_values($vars)); + } elseif ($reflectionType && $reflectionType instanceof \ReflectionNamedType && $reflectionType->isBuiltin() === false) { + $args[] = $this->getObjectParam($reflectionType->getName(), $vars); } elseif (1 == $type && !empty($vars)) { $args[] = array_shift($vars); - } elseif (0 == $type && isset($vars[$name])) { + } elseif (0 == $type && array_key_exists($name, $vars)) { $args[] = $vars[$name]; - } elseif (0 == $type && isset($vars[$lowerName])) { + } elseif (0 == $type && array_key_exists($lowerName, $vars)) { $args[] = $vars[$lowerName]; } elseif ($param->isDefaultValueAvailable()) { $args[] = $param->getDefaultValue(); @@ -517,34 +523,38 @@ class Container implements ContainerInterface, ArrayAccess, IteratorAggregate, C $this->delete($name); } - public function offsetExists($key) + #[\ReturnTypeWillChange] + public function offsetExists($key): bool { return $this->exists($key); } + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->make($key); } + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { $this->bind($key, $value); } + #[\ReturnTypeWillChange] public function offsetUnset($key) { $this->delete($key); } //Countable - public function count() + public function count(): int { return count($this->instances); } //IteratorAggregate - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->instances); } diff --git a/crmeb/vendor/topthink/framework/src/think/Cookie.php b/crmeb/vendor/topthink/framework/src/think/Cookie.php index 6eb85b61c..04774a6fd 100644 --- a/crmeb/vendor/topthink/framework/src/think/Cookie.php +++ b/crmeb/vendor/topthink/framework/src/think/Cookie.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -158,11 +158,13 @@ class Cookie * Cookie删除 * @access public * @param string $name cookie名称 + * @param array $options cookie参数 * @return void */ - public function delete(string $name): void + public function delete(string $name, array $options = []): void { - $this->setCookie($name, '', time() - 3600, $this->config); + $config = array_merge($this->config, array_change_key_case($options)); + $this->setCookie($name, '', time() - 3600, $config); } /** diff --git a/crmeb/vendor/topthink/framework/src/think/Db.php b/crmeb/vendor/topthink/framework/src/think/Db.php index fac8d072f..0048874fb 100644 --- a/crmeb/vendor/topthink/framework/src/think/Db.php +++ b/crmeb/vendor/topthink/framework/src/think/Db.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Env.php b/crmeb/vendor/topthink/framework/src/think/Env.php index 05228aaf2..9e1b7f4b9 100644 --- a/crmeb/vendor/topthink/framework/src/think/Env.php +++ b/crmeb/vendor/topthink/framework/src/think/Env.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -26,6 +26,17 @@ class Env implements ArrayAccess */ protected $data = []; + /** + * 数据转换映射 + * @var array + */ + protected $convert = [ + 'true' => true, + 'false' => false, + 'off' => false, + 'on' => true, + ]; + public function __construct() { $this->data = $_ENV; @@ -39,7 +50,7 @@ class Env implements ArrayAccess */ public function load(string $file): void { - $env = parse_ini_file($file, true) ?: []; + $env = parse_ini_file($file, true, INI_SCANNER_RAW) ?: []; $this->set($env); } @@ -57,9 +68,14 @@ class Env implements ArrayAccess } $name = strtoupper(str_replace('.', '_', $name)); - if (isset($this->data[$name])) { - return $this->data[$name]; + $result = $this->data[$name]; + + if (is_string($result) && isset($this->convert[$result])) { + return $this->convert[$result]; + } + + return $result; } return $this->getEnv($name, $default); @@ -159,21 +175,25 @@ class Env implements ArrayAccess } // ArrayAccess + #[\ReturnTypeWillChange] public function offsetSet($name, $value): void { $this->set($name, $value); } + #[\ReturnTypeWillChange] public function offsetExists($name): bool { return $this->__isset($name); } - public function offsetUnset($name) + #[\ReturnTypeWillChange] + public function offsetUnset($name): void { throw new Exception('not support: unset'); } + #[\ReturnTypeWillChange] public function offsetGet($name) { return $this->get($name); diff --git a/crmeb/vendor/topthink/framework/src/think/Event.php b/crmeb/vendor/topthink/framework/src/think/Event.php index edef54cc3..3c70aadf2 100644 --- a/crmeb/vendor/topthink/framework/src/think/Event.php +++ b/crmeb/vendor/topthink/framework/src/think/Event.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -37,6 +37,7 @@ class Event 'HttpEnd' => event\HttpEnd::class, 'RouteLoaded' => event\RouteLoaded::class, 'LogWrite' => event\LogWrite::class, + 'LogRecord' => event\LogRecord::class, ]; /** @@ -215,6 +216,14 @@ class Event $result = []; $listeners = $this->listener[$event] ?? []; + + if (strpos($event, '.')) { + [$prefix, $event] = explode('.', $event, 2); + if (isset($this->listener[$prefix . '.*'])) { + $listeners = array_merge($listeners, $this->listener[$prefix . '.*']); + } + } + $listeners = array_unique($listeners, SORT_REGULAR); foreach ($listeners as $key => $listener) { diff --git a/crmeb/vendor/topthink/framework/src/think/Exception.php b/crmeb/vendor/topthink/framework/src/think/Exception.php index 468e29df9..5cf79548a 100644 --- a/crmeb/vendor/topthink/framework/src/think/Exception.php +++ b/crmeb/vendor/topthink/framework/src/think/Exception.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Facade.php b/crmeb/vendor/topthink/framework/src/think/Facade.php index 79212980b..9a0e33394 100644 --- a/crmeb/vendor/topthink/framework/src/think/Facade.php +++ b/crmeb/vendor/topthink/framework/src/think/Facade.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/File.php b/crmeb/vendor/topthink/framework/src/think/File.php index 77bec891c..59230b5fe 100644 --- a/crmeb/vendor/topthink/framework/src/think/File.php +++ b/crmeb/vendor/topthink/framework/src/think/File.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -30,6 +30,12 @@ class File extends SplFileInfo protected $hashName; + /** + * 保存的文件后缀 + * @var string + */ + protected $extension; + public function __construct(string $path, bool $checkPath = true) { if ($checkPath && !is_file($path)) { @@ -155,6 +161,16 @@ class File extends SplFileInfo return $this->getExtension(); } + /** + * 指定保存文件的扩展名 + * @param string $extension + * @return void + */ + public function setExtension(string $extension): void + { + $this->extension = $extension; + } + /** * 自动生成文件名 * @access public @@ -176,12 +192,13 @@ class File extends SplFileInfo $this->hashName = call_user_func($rule); break; default: - $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)); + $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5(microtime(true) . $this->getPathname()); break; } } } - return $this->hashName . '.' . $this->extension(); + $extension = $this->extension ?? $this->extension(); + return $this->hashName . ($extension ? '.' . $extension : ''); } } diff --git a/crmeb/vendor/topthink/framework/src/think/Filesystem.php b/crmeb/vendor/topthink/framework/src/think/Filesystem.php deleted file mode 100644 index a443f74a2..000000000 --- a/crmeb/vendor/topthink/framework/src/think/Filesystem.php +++ /dev/null @@ -1,89 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think; - -use InvalidArgumentException; -use think\filesystem\Driver; -use think\filesystem\driver\Local; -use think\helper\Arr; - -/** - * Class Filesystem - * @package think - * @mixin Driver - * @mixin Local - */ -class Filesystem extends Manager -{ - protected $namespace = '\\think\\filesystem\\driver\\'; - - /** - * @param null|string $name - * @return Driver - */ - public function disk(string $name = null): Driver - { - return $this->driver($name); - } - - protected function resolveType(string $name) - { - return $this->getDiskConfig($name, 'type', 'local'); - } - - protected function resolveConfig(string $name) - { - return $this->getDiskConfig($name); - } - - /** - * 获取缓存配置 - * @access public - * @param null|string $name 名称 - * @param mixed $default 默认值 - * @return mixed - */ - public function getConfig(string $name = null, $default = null) - { - if (!is_null($name)) { - return $this->app->config->get('filesystem.' . $name, $default); - } - - return $this->app->config->get('filesystem'); - } - - /** - * 获取磁盘配置 - * @param string $disk - * @param null $name - * @param null $default - * @return array - */ - public function getDiskConfig($disk, $name = null, $default = null) - { - if ($config = $this->getConfig("disks.{$disk}")) { - return Arr::get($config, $name, $default); - } - - throw new InvalidArgumentException("Disk [$disk] not found."); - } - - /** - * 默认驱动 - * @return string|null - */ - public function getDefaultDriver() - { - return $this->getConfig('default'); - } -} diff --git a/crmeb/vendor/topthink/framework/src/think/Http.php b/crmeb/vendor/topthink/framework/src/think/Http.php index 6de30b597..4e49c88cb 100644 --- a/crmeb/vendor/topthink/framework/src/think/Http.php +++ b/crmeb/vendor/topthink/framework/src/think/Http.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -42,6 +42,12 @@ class Http */ protected $path; + /** + * 路由路径 + * @var string + */ + protected $routePath; + /** * 是否绑定应用 * @var bool @@ -117,7 +123,6 @@ class Http * 设置路由目录 * @access public * @param string $path 路由定义目录 - * @return string */ public function setRoutePath(string $path): void { @@ -154,6 +159,9 @@ class Http */ public function run(Request $request = null): Response { + //初始化 + $this->initialize(); + //自动创建request对象 $request = $request ?? $this->app->make('request', [], true); $this->app->instance('request', $request); @@ -186,8 +194,6 @@ class Http */ protected function runWithRequest(Request $request) { - $this->initialize(); - // 加载全局中间件 $this->loadMiddleware(); diff --git a/crmeb/vendor/topthink/framework/src/think/Lang.php b/crmeb/vendor/topthink/framework/src/think/Lang.php index be27f5e74..b89108482 100644 --- a/crmeb/vendor/topthink/framework/src/think/Lang.php +++ b/crmeb/vendor/topthink/framework/src/think/Lang.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -18,6 +18,8 @@ namespace think; */ class Lang { + protected $app; + /** * 配置参数 * @var array @@ -62,15 +64,26 @@ class Lang * @access public * @param array $config */ - public function __construct(array $config = []) + public function __construct(App $app, array $config = []) { $this->config = array_merge($this->config, array_change_key_case($config)); $this->range = $this->config['default_lang']; + $this->app = $app; } - public static function __make(Config $config) + public static function __make(App $app, Config $config) { - return new static($config->get('lang')); + return new static($app, $config->get('lang')); + } + + /** + * 获取当前语言配置 + * @access public + * @return array + */ + public function getConfig(): array + { + return $this->config; } /** @@ -104,6 +117,37 @@ class Lang return $this->config['default_lang']; } + /** + * 切换语言 + * @access public + * @param string $langset 语言 + * @return void + */ + public function switchLangSet(string $langset) + { + if (empty($langset)) { + return; + } + + $this->setLangSet($langset); + + // 加载系统语言包 + $this->load([ + $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', + ]); + + // 加载系统语言包 + $files = glob($this->app->getAppPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*'); + $this->load($files); + + // 加载扩展(自定义)语言包 + $list = $this->app->config->get('lang.extend_list', []); + + if (isset($list[$langset])) { + $this->load($list[$langset]); + } + } + /** * 加载语言定义(不区分大小写) * @access public @@ -153,6 +197,18 @@ class Lang if (function_exists('yaml_parse_file')) { $result = yaml_parse_file($file); } + break; + case 'json': + $data = file_get_contents($file); + + if (false !== $data) { + $data = json_decode($data, true); + + if (json_last_error() === JSON_ERROR_NONE) { + $result = $data; + } + } + break; } @@ -190,6 +246,10 @@ class Lang { $range = $range ?: $this->range; + if (!isset($this->lang[$range])) { + $this->switchLangSet($range); + } + // 空参数返回所有定义 if (is_null($name)) { return $this->lang[$range] ?? []; @@ -227,56 +287,4 @@ class Lang return $value; } - /** - * 自动侦测设置获取语言选择 - * @access public - * @param Request $request - * @return string - */ - public function detect(Request $request): string - { - // 自动侦测设置获取语言选择 - $langSet = ''; - - if ($request->get($this->config['detect_var'])) { - // url中设置了语言变量 - $langSet = strtolower($request->get($this->config['detect_var'])); - } elseif ($request->header($this->config['header_var'])) { - // Header中设置了语言变量 - $langSet = strtolower($request->header($this->config['header_var'])); - } elseif ($request->cookie($this->config['cookie_var'])) { - // Cookie中设置了语言变量 - $langSet = strtolower($request->cookie($this->config['cookie_var'])); - } elseif ($request->server('HTTP_ACCEPT_LANGUAGE')) { - // 自动侦测浏览器语言 - $match = preg_match('/^([a-z\d\-]+)/i', $request->server('HTTP_ACCEPT_LANGUAGE'), $matches); - if ($match) { - $langSet = strtolower($matches[1]); - if (isset($this->config['accept_language'][$langSet])) { - $langSet = $this->config['accept_language'][$langSet]; - } - } - } - - if (empty($this->config['allow_lang_list']) || in_array($langSet, $this->config['allow_lang_list'])) { - // 合法的语言 - $this->range = $langSet; - } - - return $this->range; - } - - /** - * 保存当前语言到Cookie - * @access public - * @param Cookie $cookie Cookie对象 - * @return void - */ - public function saveToCookie(Cookie $cookie) - { - if ($this->config['use_cookie']) { - $cookie->set($this->config['cookie_var'], $this->range); - } - } - } diff --git a/crmeb/vendor/topthink/framework/src/think/Log.php b/crmeb/vendor/topthink/framework/src/think/Log.php index e9031c766..c31210ce4 100644 --- a/crmeb/vendor/topthink/framework/src/think/Log.php +++ b/crmeb/vendor/topthink/framework/src/think/Log.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Manager.php b/crmeb/vendor/topthink/framework/src/think/Manager.php index 7845e463e..ca3f6a5a9 100644 --- a/crmeb/vendor/topthink/framework/src/think/Manager.php +++ b/crmeb/vendor/topthink/framework/src/think/Manager.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -48,7 +48,8 @@ abstract class Manager if (is_null($name)) { throw new InvalidArgumentException(sprintf( - 'Unable to resolve NULL driver for [%s].', static::class + 'Unable to resolve NULL driver for [%s].', + static::class )); } diff --git a/crmeb/vendor/topthink/framework/src/think/Middleware.php b/crmeb/vendor/topthink/framework/src/think/Middleware.php index 0868fb2ec..a3db0f2f3 100644 --- a/crmeb/vendor/topthink/framework/src/think/Middleware.php +++ b/crmeb/vendor/topthink/framework/src/think/Middleware.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Pipeline.php b/crmeb/vendor/topthink/framework/src/think/Pipeline.php index 24c5122ae..77151f3ac 100644 --- a/crmeb/vendor/topthink/framework/src/think/Pipeline.php +++ b/crmeb/vendor/topthink/framework/src/think/Pipeline.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -60,7 +60,8 @@ class Pipeline } catch (Throwable | Exception $e) { return $this->handleException($passable, $e); } - }); + } + ); return $pipeline($this->passable); } diff --git a/crmeb/vendor/topthink/framework/src/think/Request.php b/crmeb/vendor/topthink/framework/src/think/Request.php index 0181ab893..99f4f8063 100644 --- a/crmeb/vendor/topthink/framework/src/think/Request.php +++ b/crmeb/vendor/topthink/framework/src/think/Request.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -13,6 +13,7 @@ declare (strict_types = 1); namespace think; use ArrayAccess; +use think\facade\Lang; use think\file\UploadedFile; use think\route\Rule; @@ -408,7 +409,8 @@ class Request implements ArrayAccess $rootDomain = $this->rootDomain(); if ($rootDomain) { - $this->subDomain = rtrim(stristr($this->host(), $rootDomain, true), '.'); + $sub = stristr($this->host(), $rootDomain, true); + $this->subDomain = $sub ? rtrim($sub, '.') : ''; } else { $this->subDomain = ''; } @@ -869,6 +871,26 @@ class Request implements ArrayAccess return $this->input($this->param, $name, $default, $filter); } + /** + * 获取包含文件在内的请求参数 + * @access public + * @param string|array $name 变量名 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function all($name = '', $filter = '') + { + $data = array_merge($this->param(), $this->file() ?: []); + + if (is_array($name)) { + $data = $this->only($name, $data, $filter); + } elseif ($name) { + $data = $data[$name] ?? null; + } + + return $data; + } + /** * 设置路由变量 * @access public @@ -1129,7 +1151,6 @@ class Request implements ArrayAccess { $files = $this->file; if (!empty($files)) { - if (strpos($name, '.')) { [$name, $sub] = explode('.', $name); } @@ -1207,7 +1228,7 @@ class Request implements ArrayAccess 7 => 'file write error', ]; - $msg = $fileUploadErrors[$error]; + $msg = Lang::get($fileUploadErrors[$error]); throw new Exception($msg, $error); } @@ -1216,7 +1237,7 @@ class Request implements ArrayAccess * @access public * @param string $name header名称 * @param string $default 默认值 - * @return string|array + * @return string|array|null */ public function header(string $name = '', string $default = null) { @@ -1289,12 +1310,12 @@ class Request implements ArrayAccess /** * 强制类型转换 - * @access public + * @access protected * @param mixed $data * @param string $type * @return mixed */ - private function typeCast(&$data, string $type) + protected function typeCast(&$data, string $type) { switch (strtolower($type)) { // 数组 @@ -1326,7 +1347,7 @@ class Request implements ArrayAccess /** * 获取数据 - * @access public + * @access protected * @param array $data 数据源 * @param string $name 字段名 * @param mixed $default 默认值 @@ -1395,6 +1416,10 @@ class Request implements ArrayAccess foreach ($filters as $filter) { if (is_callable($filter)) { // 调用函数或者方法过滤 + if (is_null($value)) { + continue; + } + $value = call_user_func($filter, $value); } elseif (is_scalar($value)) { if (is_string($filter) && false !== strpos($filter, '/')) { @@ -1469,7 +1494,7 @@ class Request implements ArrayAccess if (is_int($key)) { $default = null; $key = $val; - if (!isset($data[$key])) { + if (!key_exists($key, $data)) { continue; } } else { @@ -1659,7 +1684,7 @@ class Request implements ArrayAccess $flag = FILTER_FLAG_IPV6; break; default: - $flag = null; + $flag = 0; break; } @@ -2130,19 +2155,23 @@ class Request implements ArrayAccess } // ArrayAccess + #[\ReturnTypeWillChange] public function offsetExists($name): bool { return $this->has($name); } + #[\ReturnTypeWillChange] public function offsetGet($name) { return $this->param($name); } + #[\ReturnTypeWillChange] public function offsetSet($name, $value) {} + #[\ReturnTypeWillChange] public function offsetUnset($name) {} diff --git a/crmeb/vendor/topthink/framework/src/think/Response.php b/crmeb/vendor/topthink/framework/src/think/Response.php index 556696aa5..49f26dc03 100644 --- a/crmeb/vendor/topthink/framework/src/think/Response.php +++ b/crmeb/vendor/topthink/framework/src/think/Response.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -130,16 +130,19 @@ abstract class Response // 处理输出数据 $data = $this->getContent(); - if (!headers_sent() && !empty($this->header)) { - // 发送状态码 - http_response_code($this->code); - // 发送头部信息 - foreach ($this->header as $name => $val) { - header($name . (!is_null($val) ? ':' . $val : '')); + if (!headers_sent()) { + if (!empty($this->header)) { + // 发送状态码 + http_response_code($this->code); + // 发送头部信息 + foreach ($this->header as $name => $val) { + header($name . (!is_null($val) ? ':' . $val : '')); + } + } + + if ($this->cookie) { + $this->cookie->save(); } - } - if ($this->cookie) { - $this->cookie->save(); } $this->sendData($data); @@ -214,7 +217,7 @@ abstract class Response /** * 是否允许请求缓存 * @access public - * @return $this + * @return bool */ public function isAllowCache() { diff --git a/crmeb/vendor/topthink/framework/src/think/Route.php b/crmeb/vendor/topthink/framework/src/think/Route.php index e3be55da9..e45cb33bd 100644 --- a/crmeb/vendor/topthink/framework/src/think/Route.php +++ b/crmeb/vendor/topthink/framework/src/think/Route.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -165,12 +165,14 @@ class Route // 读取路由映射文件 $this->import(include $this->app->getRuntimePath() . 'route.php'); } + + $this->config = array_merge($this->config, $this->app->config->get('route')); + + $this->init(); } protected function init() { - $this->config = array_merge($this->config, $this->app->config->get('route')); - if (!empty($this->config['middleware'])) { $this->app->middleware->import($this->config['middleware'], 'route'); } @@ -423,7 +425,7 @@ class Route * @param string $name 路由标识 * @param string $domain 域名 * @param string $method 请求类型 - * @return RuleItem[] + * @return array */ public function getName(string $name = null, string $domain = null, string $method = '*'): array { @@ -630,6 +632,18 @@ class Route return $this->rule($rule, $route, 'PATCH'); } + /** + * 注册HEAD路由 + * @access public + * @param string $rule 路由规则 + * @param mixed $route 路由地址 + * @return RuleItem + */ + public function head(string $rule, $route): RuleItem + { + return $this->rule($rule, $route, 'HEAD'); + } + /** * 注册OPTIONS路由 * @access public @@ -680,7 +694,19 @@ class Route */ public function redirect(string $rule, string $route = '', int $status = 301): RuleItem { - return $this->rule($rule, function () use ($status, $route) { + return $this->rule($rule, function (Request $request) use ($status, $route) { + $search = $replace = []; + $matches = $request->rule()->getVars(); + + foreach ($matches as $key => $value) { + $search[] = '<' . $key . '>'; + $replace[] = $value; + + $search[] = ':' . $key; + $replace[] = $value; + } + + $route = str_replace($search, $replace, $route); return Response::create($route, 'redirect')->code($status); }, '*'); } @@ -740,7 +766,6 @@ class Route { $this->request = $request; $this->host = $this->request->host(true); - $this->init(); if ($withRoute) { //加载路由 diff --git a/crmeb/vendor/topthink/framework/src/think/Service.php b/crmeb/vendor/topthink/framework/src/think/Service.php index 68c678907..d9e89601a 100644 --- a/crmeb/vendor/topthink/framework/src/think/Service.php +++ b/crmeb/vendor/topthink/framework/src/think/Service.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Session.php b/crmeb/vendor/topthink/framework/src/think/Session.php index c344f0bd6..6c84faf8f 100644 --- a/crmeb/vendor/topthink/framework/src/think/Session.php +++ b/crmeb/vendor/topthink/framework/src/think/Session.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/Validate.php b/crmeb/vendor/topthink/framework/src/think/Validate.php index 42e64e381..078840641 100644 --- a/crmeb/vendor/topthink/framework/src/think/Validate.php +++ b/crmeb/vendor/topthink/framework/src/think/Validate.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -126,10 +126,10 @@ class Validate 'alpha' => '/^[A-Za-z]+$/', 'alphaNum' => '/^[A-Za-z0-9]+$/', 'alphaDash' => '/^[A-Za-z0-9\-\_]+$/', - 'chs' => '/^[\x{4e00}-\x{9fa5}]+$/u', - 'chsAlpha' => '/^[\x{4e00}-\x{9fa5}a-zA-Z]+$/u', - 'chsAlphaNum' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u', - 'chsDash' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-]+$/u', + 'chs' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}]+$/u', + 'chsAlpha' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z]+$/u', + 'chsAlphaNum' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z0-9]+$/u', + 'chsDash' => '/^[\x{4e00}-\x{9fa5}\x{9fa6}-\x{9fef}\x{3400}-\x{4db5}\x{20000}-\x{2ebe0}a-zA-Z0-9\_\-]+$/u', 'mobile' => '/^1[3-9]\d{9}$/', 'idCard' => '/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/', 'zip' => '/\d{6}/', @@ -484,6 +484,7 @@ class Validate foreach ($this->append as $key => $rule) { if (!isset($rules[$key])) { $rules[$key] = $rule; + unset($this->append[$key]); } } @@ -605,6 +606,7 @@ class Validate if (isset($this->append[$field])) { // 追加额外的验证规则 $rules = array_unique(array_merge($rules, $this->append[$field]), SORT_REGULAR); + unset($this->append[$field]); } if (empty($rules)) { @@ -663,7 +665,7 @@ class Validate $i++; } - return $result; + return $result ?? true; } /** @@ -1178,10 +1180,10 @@ class Validate if (is_string($rule) && strpos($rule, ',')) { [$rule, $param] = explode(',', $rule); } elseif (is_array($rule)) { - $param = $rule[1] ?? null; + $param = $rule[1] ?? 0; $rule = $rule[0]; } else { - $param = null; + $param = 0; } return false !== filter_var($value, is_int($rule) ? $rule : filter_id($rule), $param); @@ -1589,7 +1591,7 @@ class Validate * @param string $msg 错误信息 * @param mixed $rule 验证规则数据 * @param string $title 字段描述名 - * @return string + * @return string|array */ protected function parseErrorMsg(string $msg, $rule, string $title) { @@ -1603,6 +1605,11 @@ class Validate return $this->errorMsgIsArray($msg, $rule, $title); } + // rule若是数组则转为字符串 + if (is_array($rule)) { + $rule = implode(',', $rule); + } + if (is_scalar($rule) && false !== strpos($msg, ':')) { // 变量替换 if (is_string($rule) && strpos($rule, ',')) { diff --git a/crmeb/vendor/topthink/framework/src/think/View.php b/crmeb/vendor/topthink/framework/src/think/View.php index c2e7368e5..2e7108840 100644 --- a/crmeb/vendor/topthink/framework/src/think/View.php +++ b/crmeb/vendor/topthink/framework/src/think/View.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -115,7 +115,11 @@ class View extends Manager { // 页面缓存 ob_start(); - ob_implicit_flush(0); + if (PHP_VERSION > 8.0) { + ob_implicit_flush(false); + } else { + ob_implicit_flush(0); + } // 渲染输出 try { diff --git a/crmeb/vendor/topthink/framework/src/think/cache/Driver.php b/crmeb/vendor/topthink/framework/src/think/cache/Driver.php index f4198b4e1..7dc0d30a2 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/Driver.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/Driver.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -130,6 +130,18 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface $this->set($name, $item); } + /** + * 追加TagSet数据 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @return void + */ + public function append(string $name, $value): void + { + $this->push($name, $value); + } + /** * 如果不存在则写入缓存 * @access public @@ -141,7 +153,9 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface public function remember(string $name, $value, $expire = null) { if ($this->has($name)) { - return $this->get($name); + if (($hit = $this->get($name)) !== null) { + return $hit; + } } $time = time(); @@ -185,9 +199,6 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface $key = implode('-', $name); if (!isset($this->tag[$key])) { - $name = array_map(function ($val) { - return $this->getTagKey($val); - }, $name); $this->tag[$key] = new TagSet($name, $this); } @@ -202,7 +213,8 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface */ public function getTagItems(string $tag): array { - return $this->get($tag, []); + $name = $this->getTagKey($tag); + return $this->get($name, []); } /** @@ -239,7 +251,7 @@ abstract class Driver implements CacheInterface, CacheHandlerInterface * @param string $data 缓存数据 * @return mixed */ - protected function unserialize(string $data) + protected function unserialize($data) { if (is_numeric($data)) { return $data; diff --git a/crmeb/vendor/topthink/framework/src/think/cache/TagSet.php b/crmeb/vendor/topthink/framework/src/think/cache/TagSet.php index d890c496a..5ba20769a 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/TagSet.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/TagSet.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -69,7 +69,8 @@ class TagSet $name = $this->handler->getCacheKey($name); foreach ($this->tag as $tag) { - $this->handler->push($tag, $name); + $key = $this->handler->getTagKey($tag); + $this->handler->append($key, $name); } } @@ -120,9 +121,10 @@ class TagSet // 指定标签清除 foreach ($this->tag as $tag) { $names = $this->handler->getTagItems($tag); - $this->handler->clearTag($names); - $this->handler->delete($tag); + + $key = $this->handler->getTagKey($tag); + $this->handler->delete($key); } return true; diff --git a/crmeb/vendor/topthink/framework/src/think/cache/driver/File.php b/crmeb/vendor/topthink/framework/src/think/cache/driver/File.php index e648c2024..b36b06965 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/driver/File.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/driver/File.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -108,7 +108,7 @@ class File extends Driver $content = gzuncompress($content); } - return ['content' => (string)$content, 'expire' => $expire]; + return is_string($content) ? ['content' => $content, 'expire' => $expire] : null; } } diff --git a/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcache.php b/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcache.php index 81b988f68..2fbbb9c72 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcache.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcached.php b/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcached.php index e6c56064e..71edb058f 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcached.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/driver/Memcached.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -191,8 +191,8 @@ class Memcached extends Driver $key = $this->getCacheKey($name); return false === $ttl ? - $this->handler->delete($key) : - $this->handler->delete($key, $ttl); + $this->handler->delete($key) : + $this->handler->delete($key, $ttl); } /** diff --git a/crmeb/vendor/topthink/framework/src/think/cache/driver/Redis.php b/crmeb/vendor/topthink/framework/src/think/cache/driver/Redis.php index 487f66ba3..791b27b88 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/driver/Redis.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/driver/Redis.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -87,7 +87,7 @@ class Redis extends Driver } if (0 != $this->options['select']) { - $this->handler->select($this->options['select']); + $this->handler->select((int) $this->options['select']); } } @@ -112,8 +112,8 @@ class Redis extends Driver public function get($name, $default = null) { $this->readTimes++; - - $value = $this->handler->get($this->getCacheKey($name)); + $key = $this->getCacheKey($name); + $value = $this->handler->get($key); if (false === $value || is_null($value)) { return $default; @@ -161,7 +161,6 @@ class Redis extends Driver public function inc(string $name, int $step = 1) { $this->writeTimes++; - $key = $this->getCacheKey($name); return $this->handler->incrby($key, $step); @@ -177,7 +176,6 @@ class Redis extends Driver public function dec(string $name, int $step = 1) { $this->writeTimes++; - $key = $this->getCacheKey($name); return $this->handler->decrby($key, $step); @@ -193,7 +191,8 @@ class Redis extends Driver { $this->writeTimes++; - $result = $this->handler->del($this->getCacheKey($name)); + $key = $this->getCacheKey($name); + $result = $this->handler->del($key); return $result > 0; } @@ -205,7 +204,6 @@ class Redis extends Driver public function clear(): bool { $this->writeTimes++; - $this->handler->flushDB(); return true; } @@ -223,15 +221,16 @@ class Redis extends Driver } /** - * 追加(数组)缓存数据 + * 追加TagSet数据 * @access public * @param string $name 缓存标识 * @param mixed $value 数据 * @return void */ - public function push(string $name, $value): void + public function append(string $name, $value): void { - $this->handler->sAdd($name, $value); + $key = $this->getCacheKey($name); + $this->handler->sAdd($key, $value); } /** @@ -242,7 +241,9 @@ class Redis extends Driver */ public function getTagItems(string $tag): array { - return $this->handler->sMembers($tag); + $name = $this->getTagKey($tag); + $key = $this->getCacheKey($name); + return $this->handler->sMembers($key); } } diff --git a/crmeb/vendor/topthink/framework/src/think/cache/driver/Wincache.php b/crmeb/vendor/topthink/framework/src/think/cache/driver/Wincache.php index 8b8e26df4..8b3e8b863 100644 --- a/crmeb/vendor/topthink/framework/src/think/cache/driver/Wincache.php +++ b/crmeb/vendor/topthink/framework/src/think/cache/driver/Wincache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/Help.php b/crmeb/vendor/topthink/framework/src/think/console/command/Help.php index d3833b8e2..2e4f2ca76 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/Help.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/Help.php @@ -32,7 +32,8 @@ class Help extends Command $this->setName('help')->setDefinition([ new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), - ])->setDescription('Displays help for a command')->setHelp(<<setDescription('Displays help for a command')->setHelp( + <<%command.name% command displays help for a given command: php %command.full_name% list diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/Lists.php b/crmeb/vendor/topthink/framework/src/think/console/command/Lists.php index 278c2bd46..d20fc751b 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/Lists.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/Lists.php @@ -25,7 +25,8 @@ class Lists extends Command */ protected function configure() { - $this->setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp(<<setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp( + <<%command.name% command lists all commands: php %command.full_name% diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/Make.php b/crmeb/vendor/topthink/framework/src/think/console/command/Make.php index 662b33721..a74e9e8bc 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/Make.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/Make.php @@ -67,7 +67,7 @@ abstract class Make extends Command protected function getPathName(string $name): string { - $name = str_replace('app\\', '', $name); + $name = substr($name, 4); return $this->app->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php'; } diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/RouteList.php b/crmeb/vendor/topthink/framework/src/think/console/command/RouteList.php index ed579b856..e9d4c5d82 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/RouteList.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/RouteList.php @@ -91,14 +91,13 @@ class RouteList extends Command foreach ($routeList as $item) { $item['route'] = $item['route'] instanceof \Closure ? '' : $item['route']; + $row = [$item['rule'], $item['route'], $item['method'], $item['name']]; if ($this->input->hasOption('more')) { - $item = [$item['rule'], $item['route'], $item['method'], $item['name'], $item['domain'], json_encode($item['option']), json_encode($item['pattern'])]; - } else { - $item = [$item['rule'], $item['route'], $item['method'], $item['name']]; + array_push($row, $item['domain'], json_encode($item['option']), json_encode($item['pattern'])); } - $rows[] = $item; + $rows[] = $row; } if ($this->input->getOption('sort')) { diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/RunServer.php b/crmeb/vendor/topthink/framework/src/think/console/command/RunServer.php index 82d2744b9..d507c1d8c 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/RunServer.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/RunServer.php @@ -22,12 +22,27 @@ class RunServer extends Command public function configure() { $this->setName('run') - ->addOption('host', 'H', Option::VALUE_OPTIONAL, - 'The host to server the application on', '0.0.0.0') - ->addOption('port', 'p', Option::VALUE_OPTIONAL, - 'The port to server the application on', 8000) - ->addOption('root', 'r', Option::VALUE_OPTIONAL, - 'The document root of the application', '') + ->addOption( + 'host', + 'H', + Option::VALUE_OPTIONAL, + 'The host to server the application on', + '0.0.0.0' + ) + ->addOption( + 'port', + 'p', + Option::VALUE_OPTIONAL, + 'The port to server the application on', + 8000 + ) + ->addOption( + 'root', + 'r', + Option::VALUE_OPTIONAL, + 'The document root of the application', + '' + ) ->setDescription('PHP Built-in Server for ThinkPHP'); } @@ -48,7 +63,7 @@ class RunServer extends Command escapeshellarg($root . DIRECTORY_SEPARATOR . 'router.php') ); - $output->writeln(sprintf('ThinkPHP Development server is started On ', '0.0.0.0' == $host ? '127.0.0.1' : $host, $port)); + $output->writeln(sprintf('ThinkPHP Development server is started On ', $host, $port)); $output->writeln(sprintf('You can exit with `CTRL-C`')); $output->writeln(sprintf('Document root is: %s', $root)); passthru($command); diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php b/crmeb/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php index c413daa72..e90f43398 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/ServiceDiscover.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -28,11 +28,11 @@ class ServiceDiscover extends Command { if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) { $packages = json_decode(@file_get_contents($path), true); - + // Compatibility with Composer 2.0 if (isset($packages['packages'])) { $packages = $packages['packages']; } - + $services = []; foreach ($packages as $package) { if (!empty($package['extra']['think']['services'])) { diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/VendorPublish.php b/crmeb/vendor/topthink/framework/src/think/console/command/VendorPublish.php index 7b4376216..399876575 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/VendorPublish.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/VendorPublish.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -31,7 +31,10 @@ class VendorPublish extends Command if (is_file($path = $this->app->getRootPath() . 'vendor/composer/installed.json')) { $packages = json_decode(@file_get_contents($path), true); - + // Compatibility with Composer 2.0 + if (isset($packages['packages'])) { + $packages = $packages['packages']; + } foreach ($packages as $package) { //配置 $configDir = $this->app->getConfigPath(); diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Command.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Command.php index 88e665a56..9549a0215 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Command.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Command.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Controller.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Controller.php index 582cffbb6..4a8d226c0 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Controller.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Controller.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Event.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Event.php index a4676d8f6..6b1668984 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Event.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Event.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Listener.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Listener.php index bb2966835..5c9267368 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Listener.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Listener.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Middleware.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Middleware.php index 80f456339..3b68b4a7f 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Middleware.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Middleware.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -31,6 +31,6 @@ class Middleware extends Make protected function getNamespace(string $app): string { - return 'app\\middleware'; + return parent::getNamespace($app) . '\\middleware'; } } diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Model.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Model.php index acb37e7c3..cb7a23c4f 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Model.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Model.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Service.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Service.php index 18bd54eb2..c4bbaa0eb 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Service.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Service.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Subscribe.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Subscribe.php index 4203986e4..a1dc2a820 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Subscribe.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Subscribe.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/Validate.php b/crmeb/vendor/topthink/framework/src/think/console/command/make/Validate.php index 4926e20df..8d3643161 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/Validate.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/Validate.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub index e9121cdd7..3ee2b1cf9 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/command.stub @@ -15,12 +15,12 @@ class {%className%} extends Command { // 指令配置 $this->setName('{%commandName%}') - ->setDescription('the {%commandName%} command'); + ->setDescription('the {%commandName%} command'); } protected function execute(Input $input, Output $output) { - // 指令输出 - $output->writeln('{%commandName%}'); + // 指令输出 + $output->writeln('{%commandName%}'); } } diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/listener.stub b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/listener.stub index d55e7c4ed..03724380b 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/listener.stub +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/listener.stub @@ -13,5 +13,5 @@ class {%className%} public function handle($event) { // - } + } } diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/service.stub b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/service.stub index 6ec93fe84..5d74d15c1 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/service.stub +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/service.stub @@ -3,9 +3,8 @@ declare (strict_types = 1); namespace {%namespace%}; -class {%className%} extends \think\Service +class {%className%} extends \think\Service { - /** * 注册服务 * @@ -16,7 +15,6 @@ class {%className%} extends \think\Service // } - /** * 执行服务 * diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/validate.stub b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/validate.stub index b59697970..d1fedd8d6 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/validate.stub +++ b/crmeb/vendor/topthink/framework/src/think/console/command/make/stubs/validate.stub @@ -9,17 +9,17 @@ class {%className%} extends Validate { /** * 定义验证规则 - * 格式:'字段名' => ['规则1','规则2'...] + * 格式:'字段名' => ['规则1','规则2'...] * * @var array - */ - protected $rule = []; - + */ + protected $rule = []; + /** * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' + * 格式:'字段名.规则名' => '错误信息' * * @var array - */ + */ protected $message = []; } diff --git a/crmeb/vendor/topthink/framework/src/think/console/command/optimize/Route.php b/crmeb/vendor/topthink/framework/src/think/console/command/optimize/Route.php index bd4f79c15..56f7f5a9b 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/command/optimize/Route.php +++ b/crmeb/vendor/topthink/framework/src/think/console/command/optimize/Route.php @@ -46,7 +46,7 @@ class Route extends Command $this->app->route->lazy(false); // 路由检测 - $path = $this->app->getRootPath() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR ; + $path = $this->app->getRootPath() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR; $files = is_dir($path) ? scandir($path) : []; @@ -58,10 +58,9 @@ class Route extends Command //触发路由载入完成事件 $this->app->event->trigger(RouteLoaded::class); + $rules = $this->app->route->getName(); - $content = 'app->route->getName()) . '\');'; - return $content; + return 'isAbstract() && $reflect->isSubclassOf('\think\Model')) { - /** @var \think\Model $model */ - $model = new $class; - $connection = $model->db()->getConnection(); - if ($connection instanceof PDOConnection) { - $table = $model->getTable(); - //预读字段信息 - $connection->getSchemaInfo($table, true); + try { + /** @var \think\Model $model */ + $model = new $class; + $connection = $model->db()->getConnection(); + if ($connection instanceof PDOConnection) { + $table = $model->getTable(); + //预读字段信息 + $connection->getSchemaInfo($table, true); + } + } catch (Exception $e) { + } } } diff --git a/crmeb/vendor/topthink/framework/src/think/console/input/Argument.php b/crmeb/vendor/topthink/framework/src/think/console/input/Argument.php index 4fa3e3cd5..86cca36cb 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/input/Argument.php +++ b/crmeb/vendor/topthink/framework/src/think/console/input/Argument.php @@ -13,14 +13,37 @@ namespace think\console\input; class Argument { - + // 必传参数 const REQUIRED = 1; + + // 可选参数 const OPTIONAL = 2; + + // 数组参数 const IS_ARRAY = 4; + /** + * 参数名 + * @var string + */ private $name; + + /** + * 参数类型 + * @var int + */ private $mode; + + /** + * 参数默认值 + * @var mixed + */ private $default; + + /** + * 参数描述 + * @var string + */ private $description; /** diff --git a/crmeb/vendor/topthink/framework/src/think/console/input/Option.php b/crmeb/vendor/topthink/framework/src/think/console/input/Option.php index e5707c9ae..d7e651442 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/input/Option.php +++ b/crmeb/vendor/topthink/framework/src/think/console/input/Option.php @@ -11,19 +11,50 @@ namespace think\console\input; +/** + * 命令行选项 + * @package think\console\input + */ class Option { - - const VALUE_NONE = 1; + // 无需传值 + const VALUE_NONE = 1; + // 必须传值 const VALUE_REQUIRED = 2; + // 可选传值 const VALUE_OPTIONAL = 4; + // 传数组值 const VALUE_IS_ARRAY = 8; - private $name; - private $shortcut; + /** + * 选项名 + * @var string + */ + private $name = ''; + + /** + * 选项短名称 + * @var string + */ + private $shortcut = ''; + + /** + * 选项类型 + * @var int + */ private $mode; + + /** + * 选项默认值 + * @var mixed + */ private $default; - private $description; + + /** + * 选项描述 + * @var string + */ + private $description = ''; /** * 构造方法 @@ -45,10 +76,10 @@ class Option } if (empty($shortcut)) { - $shortcut = null; + $shortcut = ''; } - if (null !== $shortcut) { + if ('' !== $shortcut) { if (is_array($shortcut)) { $shortcut = implode('|', $shortcut); } @@ -83,7 +114,7 @@ class Option * 获取短名称 * @return string */ - public function getShortcut() + public function getShortcut(): string { return $this->shortcut; } @@ -92,7 +123,7 @@ class Option * 获取选项名 * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -101,7 +132,7 @@ class Option * 是否可以设置值 * @return bool 类型不是 self::VALUE_NONE 的时候返回true,其他均返回false */ - public function acceptValue() + public function acceptValue(): bool { return $this->isValueRequired() || $this->isValueOptional(); } @@ -110,7 +141,7 @@ class Option * 是否必须 * @return bool 类型是 self::VALUE_REQUIRED 的时候返回true,其他均返回false */ - public function isValueRequired() + public function isValueRequired(): bool { return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode); } @@ -119,7 +150,7 @@ class Option * 是否可选 * @return bool 类型是 self::VALUE_OPTIONAL 的时候返回true,其他均返回false */ - public function isValueOptional() + public function isValueOptional(): bool { return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode); } @@ -128,7 +159,7 @@ class Option * 选项值是否接受数组 * @return bool 类型是 self::VALUE_IS_ARRAY 的时候返回true,其他均返回false */ - public function isArray() + public function isArray(): bool { return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode); } @@ -168,7 +199,7 @@ class Option * 获取描述文字 * @return string */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -178,7 +209,7 @@ class Option * @param Option $option * @return bool */ - public function equals(Option $option) + public function equals(Option $option): bool { return $option->getName() === $this->getName() && $option->getShortcut() === $this->getShortcut() diff --git a/crmeb/vendor/topthink/framework/src/think/console/output/Ask.php b/crmeb/vendor/topthink/framework/src/think/console/output/Ask.php index 56821c72d..0058d052c 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/output/Ask.php +++ b/crmeb/vendor/topthink/framework/src/think/console/output/Ask.php @@ -295,7 +295,7 @@ class Ask $width = max(array_map('strlen', array_keys($this->question->getChoices()))); foreach ($this->question->getChoices() as $key => $value) { - $this->output->writeln(sprintf(" [%-${width}s] %s", $key, $value)); + $this->output->writeln(sprintf(" [%-{$width}s] %s", $key, $value)); } } diff --git a/crmeb/vendor/topthink/framework/src/think/console/output/Descriptor.php b/crmeb/vendor/topthink/framework/src/think/console/output/Descriptor.php index e4a9e61b8..84d487c3a 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/output/Descriptor.php +++ b/crmeb/vendor/topthink/framework/src/think/console/output/Descriptor.php @@ -219,7 +219,7 @@ class Descriptor $width = $this->getColumnWidth($description->getNamespaces()); foreach ($description->getCommands() as $command) { - $this->writeText(sprintf("%-${width}s %s", $command->getName(), $command->getDescription()), $options); + $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options); $this->writeText("\n"); } } else { diff --git a/crmeb/vendor/topthink/framework/src/think/console/output/driver/Console.php b/crmeb/vendor/topthink/framework/src/think/console/output/driver/Console.php index 31bdf1f52..3061f5576 100644 --- a/crmeb/vendor/topthink/framework/src/think/console/output/driver/Console.php +++ b/crmeb/vendor/topthink/framework/src/think/console/output/driver/Console.php @@ -214,12 +214,12 @@ class Console /** * 获取终端模式 - * @return string x 或 null + * @return string x */ private function getMode() { if (!function_exists('proc_open')) { - return; + return ''; } $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; @@ -234,7 +234,8 @@ class Console return $matches[2] . 'x' . $matches[1]; } } - return; + + return ''; } private function stringWidth(string $string): int diff --git a/crmeb/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php b/crmeb/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php index e953f663f..da5e69632 100644 --- a/crmeb/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php +++ b/crmeb/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php b/crmeb/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php index 49cfa75d3..1f6f994e8 100644 --- a/crmeb/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php +++ b/crmeb/vendor/topthink/framework/src/think/contract/ModelRelationInterface.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php b/crmeb/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php index caed32221..0b2e41424 100644 --- a/crmeb/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php +++ b/crmeb/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php b/crmeb/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php index f01820dd4..9be93d2e4 100644 --- a/crmeb/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php +++ b/crmeb/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/event/AppInit.php b/crmeb/vendor/topthink/framework/src/think/event/AppInit.php index 83d75e7d4..dda820b5e 100644 --- a/crmeb/vendor/topthink/framework/src/think/event/AppInit.php +++ b/crmeb/vendor/topthink/framework/src/think/event/AppInit.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/event/HttpEnd.php b/crmeb/vendor/topthink/framework/src/think/event/HttpEnd.php index 5296ef175..c40da57d7 100644 --- a/crmeb/vendor/topthink/framework/src/think/event/HttpEnd.php +++ b/crmeb/vendor/topthink/framework/src/think/event/HttpEnd.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/event/HttpRun.php b/crmeb/vendor/topthink/framework/src/think/event/HttpRun.php index a9cd7c397..ce67e93e4 100644 --- a/crmeb/vendor/topthink/framework/src/think/event/HttpRun.php +++ b/crmeb/vendor/topthink/framework/src/think/event/HttpRun.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/event/LogRecord.php b/crmeb/vendor/topthink/framework/src/think/event/LogRecord.php new file mode 100644 index 000000000..237468dd5 --- /dev/null +++ b/crmeb/vendor/topthink/framework/src/think/event/LogRecord.php @@ -0,0 +1,29 @@ + +// +---------------------------------------------------------------------- +namespace think\event; + +/** + * LogRecord事件类 + */ +class LogRecord +{ + /** @var string */ + public $type; + + /** @var string */ + public $message; + + public function __construct($type, $message) + { + $this->type = $type; + $this->message = $message; + } +} diff --git a/crmeb/vendor/topthink/framework/src/think/event/LogWrite.php b/crmeb/vendor/topthink/framework/src/think/event/LogWrite.php index 470e11983..a7873018d 100644 --- a/crmeb/vendor/topthink/framework/src/think/event/LogWrite.php +++ b/crmeb/vendor/topthink/framework/src/think/event/LogWrite.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/event/RouteLoaded.php b/crmeb/vendor/topthink/framework/src/think/event/RouteLoaded.php index eee1f3ef2..ace7992f3 100644 --- a/crmeb/vendor/topthink/framework/src/think/event/RouteLoaded.php +++ b/crmeb/vendor/topthink/framework/src/think/event/RouteLoaded.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php b/crmeb/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php index 2fa1f5811..c4cda77d5 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/ClassNotFoundException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/ErrorException.php b/crmeb/vendor/topthink/framework/src/think/exception/ErrorException.php index 54de0fee2..d1a237803 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/ErrorException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/ErrorException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/FileException.php b/crmeb/vendor/topthink/framework/src/think/exception/FileException.php index 22544728c..228a1898c 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/FileException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/FileException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/Handle.php b/crmeb/vendor/topthink/framework/src/think/exception/Handle.php index 8484b6fa6..1f783bc52 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/Handle.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/Handle.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/HttpException.php b/crmeb/vendor/topthink/framework/src/think/exception/HttpException.php index 74fabfc69..45302e587 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/HttpException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/HttpException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/HttpResponseException.php b/crmeb/vendor/topthink/framework/src/think/exception/HttpResponseException.php index 759254c1f..607813d97 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/HttpResponseException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/HttpResponseException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php b/crmeb/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php index d317278b5..8ccd6f6a7 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/InvalidArgumentException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php b/crmeb/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php index f50dff678..7a2ee8790 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/RouteNotFoundException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/exception/ValidateException.php b/crmeb/vendor/topthink/framework/src/think/exception/ValidateException.php index cc79e1912..89b4e4d58 100644 --- a/crmeb/vendor/topthink/framework/src/think/exception/ValidateException.php +++ b/crmeb/vendor/topthink/framework/src/think/exception/ValidateException.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/App.php b/crmeb/vendor/topthink/framework/src/think/facade/App.php index fe3de4da8..e9f81050e 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/App.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/App.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Cache.php b/crmeb/vendor/topthink/framework/src/think/facade/Cache.php index 425b370b7..aac105d44 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Cache.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Cache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -12,9 +12,9 @@ declare (strict_types = 1); namespace think\facade; -use think\Facade; use think\cache\Driver; use think\cache\TagSet; +use think\Facade; /** * @see \think\Cache diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Config.php b/crmeb/vendor/topthink/framework/src/think/facade/Config.php index 604414af4..4ce73dd6e 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Config.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Config.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Console.php b/crmeb/vendor/topthink/framework/src/think/facade/Console.php index 0d953f2f0..30dd935e9 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Console.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Console.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -12,12 +12,12 @@ declare (strict_types = 1); namespace think\facade; -use think\Facade; use think\console\Command; use think\console\Input; use think\console\input\Definition as InputDefinition; use think\console\Output; use think\console\output\driver\Buffer; +use think\Facade; /** * Class Console diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Cookie.php b/crmeb/vendor/topthink/framework/src/think/facade/Cookie.php index b2956f83a..960f4a3df 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Cookie.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Cookie.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Env.php b/crmeb/vendor/topthink/framework/src/think/facade/Env.php index 721881d77..bed253805 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Env.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Env.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Event.php b/crmeb/vendor/topthink/framework/src/think/facade/Event.php index c65690b18..c09d81667 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Event.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Event.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Filesystem.php b/crmeb/vendor/topthink/framework/src/think/facade/Filesystem.php deleted file mode 100644 index ac0223aee..000000000 --- a/crmeb/vendor/topthink/framework/src/think/facade/Filesystem.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\facade; - -use think\Facade; -use think\filesystem\Driver; - -/** - * Class Filesystem - * @package think\facade - * @mixin \think\Filesystem - * @method static Driver disk(string $name = null) ,null|string - * @method static mixed getConfig(null|string $name = null, mixed $default = null) 获取缓存配置 - * @method static array getDiskConfig(string $disk, null $name = null, null $default = null) 获取磁盘配置 - * @method static string|null getDefaultDriver() 默认驱动 - */ -class Filesystem extends Facade -{ - protected static function getFacadeClass() - { - return 'filesystem'; - } -} diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Lang.php b/crmeb/vendor/topthink/framework/src/think/facade/Lang.php index fa5c6911b..b460fe2f9 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Lang.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Lang.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Log.php b/crmeb/vendor/topthink/framework/src/think/facade/Log.php index eaf104d3e..7c43d37e7 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Log.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Log.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Middleware.php b/crmeb/vendor/topthink/framework/src/think/facade/Middleware.php index 6f1eac598..4203f821e 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Middleware.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Middleware.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Request.php b/crmeb/vendor/topthink/framework/src/think/facade/Request.php index 7c3b18069..6531f4678 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Request.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Request.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Route.php b/crmeb/vendor/topthink/framework/src/think/facade/Route.php index 24ad3c82e..37504cefa 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Route.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Route.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -56,13 +56,14 @@ use think\route\Url as UrlBuild; * @method static RuleItem put(string $rule, mixed $route) 注册PUT路由 * @method static RuleItem delete(string $rule, mixed $route) 注册DELETE路由 * @method static RuleItem patch(string $rule, mixed $route) 注册PATCH路由 + * @method static RuleItem head(string $rule, mixed $route) 注册HEAD路由 * @method static RuleItem options(string $rule, mixed $route) 注册OPTIONS路由 * @method static Resource resource(string $rule, string $route) 注册资源路由 * @method static RuleItem view(string $rule, string $template = '', array $vars = []) 注册视图路由 * @method static RuleItem redirect(string $rule, string $route = '', int $status = 301) 注册重定向路由 * @method static \think\Route rest(string|array $name, array|bool $resource = []) rest方法定义和修改 * @method static array|null getRest(string $name = null) 获取rest方法定义的参数 - * @method static RuleItem miss(string|Closure $route, string $method = '*') 注册未匹配路由规则后的处理 + * @method static RuleItem miss(string|\Closure $route, string $method = '*') 注册未匹配路由规则后的处理 * @method static Response dispatch(\think\Request $request, Closure|bool $withRoute = true) 路由调度 * @method static Dispatch|false check() 检测URL路由 * @method static Dispatch url(string $url) 默认URL解析 diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Session.php b/crmeb/vendor/topthink/framework/src/think/facade/Session.php index 33cbf6303..68bf99362 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Session.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Session.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/Validate.php b/crmeb/vendor/topthink/framework/src/think/facade/Validate.php index 133116d5a..6db6d34a4 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/Validate.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/Validate.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/facade/View.php b/crmeb/vendor/topthink/framework/src/think/facade/View.php index a27463be3..acde3b577 100644 --- a/crmeb/vendor/topthink/framework/src/think/facade/View.php +++ b/crmeb/vendor/topthink/framework/src/think/facade/View.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/file/UploadedFile.php b/crmeb/vendor/topthink/framework/src/think/file/UploadedFile.php index 66d061e14..7dff766e1 100644 --- a/crmeb/vendor/topthink/framework/src/think/file/UploadedFile.php +++ b/crmeb/vendor/topthink/framework/src/think/file/UploadedFile.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/filesystem/CacheStore.php b/crmeb/vendor/topthink/framework/src/think/filesystem/CacheStore.php deleted file mode 100644 index 46659ba7b..000000000 --- a/crmeb/vendor/topthink/framework/src/think/filesystem/CacheStore.php +++ /dev/null @@ -1,54 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem; - -use League\Flysystem\Cached\Storage\AbstractCache; -use Psr\SimpleCache\CacheInterface; - -class CacheStore extends AbstractCache -{ - protected $store; - - protected $key; - - protected $expire; - - public function __construct(CacheInterface $store, $key = 'flysystem', $expire = null) - { - $this->key = $key; - $this->store = $store; - $this->expire = $expire; - } - - /** - * Store the cache. - */ - public function save() - { - $contents = $this->getForStorage(); - - $this->store->set($this->key, $contents, $this->expire); - } - - /** - * Load the cache. - */ - public function load() - { - $contents = $this->store->get($this->key); - - if (!is_null($contents)) { - $this->setFromStorage($contents); - } - } -} diff --git a/crmeb/vendor/topthink/framework/src/think/filesystem/Driver.php b/crmeb/vendor/topthink/framework/src/think/filesystem/Driver.php deleted file mode 100644 index 26826adf8..000000000 --- a/crmeb/vendor/topthink/framework/src/think/filesystem/Driver.php +++ /dev/null @@ -1,133 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Adapter\AbstractAdapter; -use League\Flysystem\Cached\CachedAdapter; -use League\Flysystem\Cached\Storage\Memory as MemoryStore; -use League\Flysystem\Filesystem; -use think\Cache; -use think\File; - -/** - * Class Driver - * @package think\filesystem - * @mixin Filesystem - */ -abstract class Driver -{ - - /** @var Cache */ - protected $cache; - - /** @var Filesystem */ - protected $filesystem; - - /** - * 配置参数 - * @var array - */ - protected $config = []; - - public function __construct(Cache $cache, array $config) - { - $this->cache = $cache; - $this->config = array_merge($this->config, $config); - - $adapter = $this->createAdapter(); - $this->filesystem = $this->createFilesystem($adapter); - } - - protected function createCacheStore($config) - { - if (true === $config) { - return new MemoryStore; - } - - return new CacheStore( - $this->cache->store($config['store']), - $config['prefix'] ?? 'flysystem', - $config['expire'] ?? null - ); - } - - abstract protected function createAdapter(): AdapterInterface; - - protected function createFilesystem(AdapterInterface $adapter): Filesystem - { - if (!empty($this->config['cache'])) { - $adapter = new CachedAdapter($adapter, $this->createCacheStore($this->config['cache'])); - } - - $config = array_intersect_key($this->config, array_flip(['visibility', 'disable_asserts', 'url'])); - - return new Filesystem($adapter, count($config) > 0 ? $config : null); - } - - /** - * 获取文件完整路径 - * @param string $path - * @return string - */ - public function path(string $path): string - { - $adapter = $this->filesystem->getAdapter(); - - if ($adapter instanceof AbstractAdapter) { - return $adapter->applyPathPrefix($path); - } - - return $path; - } - - /** - * 保存文件 - * @param string $path 路径 - * @param File $file 文件 - * @param null|string|\Closure $rule 文件名规则 - * @param array $options 参数 - * @return bool|string - */ - public function putFile(string $path, File $file, $rule = null, array $options = []) - { - return $this->putFileAs($path, $file, $file->hashName($rule), $options); - } - - /** - * 指定文件名保存文件 - * @param string $path 路径 - * @param File $file 文件 - * @param string $name 文件名 - * @param array $options 参数 - * @return bool|string - */ - public function putFileAs(string $path, File $file, string $name, array $options = []) - { - $stream = fopen($file->getRealPath(), 'r'); - $path = trim($path . '/' . $name, '/'); - - $result = $this->putStream($path, $stream, $options); - - if (is_resource($stream)) { - fclose($stream); - } - - return $result ? $path : false; - } - - public function __call($method, $parameters) - { - return $this->filesystem->$method(...$parameters); - } -} diff --git a/crmeb/vendor/topthink/framework/src/think/filesystem/driver/Local.php b/crmeb/vendor/topthink/framework/src/think/filesystem/driver/Local.php deleted file mode 100644 index 60aa71c4c..000000000 --- a/crmeb/vendor/topthink/framework/src/think/filesystem/driver/Local.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- -declare (strict_types = 1); - -namespace think\filesystem\driver; - -use League\Flysystem\AdapterInterface; -use League\Flysystem\Adapter\Local as LocalAdapter; -use think\filesystem\Driver; - -class Local extends Driver -{ - /** - * 配置参数 - * @var array - */ - protected $config = [ - 'root' => '', - ]; - - protected function createAdapter(): AdapterInterface - { - $permissions = $this->config['permissions'] ?? []; - - $links = ($this->config['links'] ?? null) === 'skip' - ? LocalAdapter::SKIP_LINKS - : LocalAdapter::DISALLOW_LINKS; - - return new LocalAdapter( - $this->config['root'], LOCK_EX, $links, $permissions - ); - } -} diff --git a/crmeb/vendor/topthink/framework/src/think/initializer/BootService.php b/crmeb/vendor/topthink/framework/src/think/initializer/BootService.php index ef9b25e52..bab6d3904 100644 --- a/crmeb/vendor/topthink/framework/src/think/initializer/BootService.php +++ b/crmeb/vendor/topthink/framework/src/think/initializer/BootService.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/initializer/Error.php b/crmeb/vendor/topthink/framework/src/think/initializer/Error.php index 27fef6455..201d94732 100644 --- a/crmeb/vendor/topthink/framework/src/think/initializer/Error.php +++ b/crmeb/vendor/topthink/framework/src/think/initializer/Error.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/initializer/RegisterService.php b/crmeb/vendor/topthink/framework/src/think/initializer/RegisterService.php index c63ab355f..b682a0b0e 100644 --- a/crmeb/vendor/topthink/framework/src/think/initializer/RegisterService.php +++ b/crmeb/vendor/topthink/framework/src/think/initializer/RegisterService.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/log/Channel.php b/crmeb/vendor/topthink/framework/src/think/log/Channel.php index 2660a6034..1de96f1a5 100644 --- a/crmeb/vendor/topthink/framework/src/think/log/Channel.php +++ b/crmeb/vendor/topthink/framework/src/think/log/Channel.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -15,6 +15,7 @@ namespace think\log; use Psr\Log\LoggerInterface; use think\contract\LogHandlerInterface; use think\Event; +use think\event\LogRecord; use think\event\LogWrite; class Channel implements LoggerInterface @@ -94,6 +95,9 @@ class Channel implements LoggerInterface if (!empty($msg) || 0 === $msg) { $this->log[$type][] = $msg; + if ($this->event) { + $this->event->trigger(new LogRecord($type, $msg)); + } } if (!$this->lazy || !$lazy) { diff --git a/crmeb/vendor/topthink/framework/src/think/log/ChannelSet.php b/crmeb/vendor/topthink/framework/src/think/log/ChannelSet.php index e38811c00..6dcb0bdb0 100644 --- a/crmeb/vendor/topthink/framework/src/think/log/ChannelSet.php +++ b/crmeb/vendor/topthink/framework/src/think/log/ChannelSet.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/log/driver/File.php b/crmeb/vendor/topthink/framework/src/think/log/driver/File.php index 6f075b95a..1f726b00d 100644 --- a/crmeb/vendor/topthink/framework/src/think/log/driver/File.php +++ b/crmeb/vendor/topthink/framework/src/think/log/driver/File.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -82,8 +82,8 @@ class File implements LogHandlerInterface } $message[] = $this->config['json'] ? - json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : - sprintf($this->config['format'], $time, $type, $msg); + json_encode(['time' => $time, 'type' => $type, 'msg' => $msg], $this->config['json_options']) : + sprintf($this->config['format'], $time, $type, $msg); } if (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level'])) { @@ -139,7 +139,9 @@ class File implements LogHandlerInterface try { if (count($files) > $this->config['max_files']) { + set_error_handler(function ($errno, $errstr, $errfile, $errline) {}); unlink($files[0]); + restore_error_handler(); } } catch (\Exception $e) { // diff --git a/crmeb/vendor/topthink/framework/src/think/log/driver/Socket.php b/crmeb/vendor/topthink/framework/src/think/log/driver/Socket.php index b78ebfb5b..2cfb94339 100644 --- a/crmeb/vendor/topthink/framework/src/think/log/driver/Socket.php +++ b/crmeb/vendor/topthink/framework/src/think/log/driver/Socket.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006-2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -41,6 +41,11 @@ class Socket implements LogHandlerInterface 'expand_level' => ['debug'], // 日志头渲染回调 'format_head' => null, + // curl opt + 'curl_opt' => [ + CURLOPT_CONNECTTIMEOUT => 1, + CURLOPT_TIMEOUT => 10, + ], ]; protected $css = [ @@ -292,8 +297,8 @@ class Socket implements LogHandlerInterface curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $message); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->config['curl_opt'][CURLOPT_CONNECTTIMEOUT] ?? 1); + curl_setopt($ch, CURLOPT_TIMEOUT, $this->config['curl_opt'][CURLOPT_TIMEOUT] ?? 10); $headers = [ "Content-Type: application/json;charset=UTF-8", diff --git a/crmeb/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php b/crmeb/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php index 68c3ace71..b7ab842c4 100644 --- a/crmeb/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php +++ b/crmeb/vendor/topthink/framework/src/think/middleware/AllowCrossDomain.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -44,7 +44,7 @@ class AllowCrossDomain * @param array $header * @return Response */ - public function handle($request, Closure $next, ?array $header = []) + public function handle($request, Closure $next, ? array $header = []) { $header = !empty($header) ? array_merge($this->header, $header) : $this->header; diff --git a/crmeb/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php b/crmeb/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php index f2d8a62df..b1143519c 100644 --- a/crmeb/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php +++ b/crmeb/vendor/topthink/framework/src/think/middleware/CheckRequestCache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -61,17 +61,24 @@ class CheckRequestCache public function handle($request, Closure $next, $cache = null) { if ($request->isGet() && false !== $cache) { - $cache = $cache ?: $this->getRequestCache($request); + if (false === $this->config['request_cache_key']) { + // 关闭当前缓存 + $cache = false; + } + + $cache = $cache ?? $this->getRequestCache($request); if ($cache) { if (is_array($cache)) { - [$key, $expire, $tag] = $cache; + [$key, $expire, $tag] = array_pad($cache, 3, null); } else { - $key = str_replace('|', '/', $request->url()); + $key = md5($request->url(true)); $expire = $cache; $tag = null; } + $key = $this->parseCacheKey($request, $key); + if (strtotime($request->server('HTTP_IF_MODIFIED_SINCE', '')) + $expire > $request->server('REQUEST_TIME')) { // 读取缓存 return Response::create()->code(304); @@ -111,6 +118,24 @@ class CheckRequestCache $except = $this->config['request_cache_except']; $tag = $this->config['request_cache_tag']; + foreach ($except as $rule) { + if (0 === stripos($request->url(), $rule)) { + return; + } + } + + return [$key, $expire, $tag]; + } + + /** + * 读取当前地址的请求缓存信息 + * @access protected + * @param Request $request + * @param mixed $key + * @return null|string + */ + protected function parseCacheKey($request, $key) + { if ($key instanceof \Closure) { $key = call_user_func($key, $request); } @@ -120,12 +145,6 @@ class CheckRequestCache return; } - foreach ($except as $rule) { - if (0 === stripos($request->url(), $rule)) { - return; - } - } - if (true === $key) { // 自动缓存功能 $key = '__URL__'; @@ -140,9 +159,10 @@ class CheckRequestCache if (false !== strpos($key, ':')) { $param = $request->param(); + foreach ($param as $item => $val) { if (is_string($val) && false !== strpos($key, ':' . $item)) { - $key = str_replace(':' . $item, $val, $key); + $key = str_replace(':' . $item, (string) $val, $key); } } } elseif (strpos($key, ']')) { @@ -158,6 +178,6 @@ class CheckRequestCache $key = $fun($key); } - return [$key, $expire, $tag]; + return $key; } } diff --git a/crmeb/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php b/crmeb/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php index f507903cb..efbb77b17 100644 --- a/crmeb/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php +++ b/crmeb/vendor/topthink/framework/src/think/middleware/FormTokenCheck.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/middleware/LoadLangPack.php b/crmeb/vendor/topthink/framework/src/think/middleware/LoadLangPack.php index c9e7a9d3f..af0324b83 100644 --- a/crmeb/vendor/topthink/framework/src/think/middleware/LoadLangPack.php +++ b/crmeb/vendor/topthink/framework/src/think/middleware/LoadLangPack.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -14,6 +14,8 @@ namespace think\middleware; use Closure; use think\App; +use think\Config; +use think\Cookie; use think\Lang; use think\Request; use think\Response; @@ -24,13 +26,14 @@ use think\Response; class LoadLangPack { protected $app; - protected $lang; + protected $config; - public function __construct(App $app, Lang $lang) + public function __construct(App $app, Lang $lang, Config $config) { - $this->app = $app; - $this->lang = $lang; + $this->app = $app; + $this->lang = $lang; + $this->config = $lang->getConfig(); } /** @@ -43,19 +46,73 @@ class LoadLangPack public function handle($request, Closure $next) { // 自动侦测当前语言 - $langset = $this->lang->detect($request); + $langset = $this->detect($request); if ($this->lang->defaultLangSet() != $langset) { - // 加载系统语言包 - $this->lang->load([ - $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', - ]); - - $this->app->LoadLangPack($langset); + $this->lang->switchLangSet($langset); } - $this->lang->saveToCookie($this->app->cookie); + $this->saveToCookie($this->app->cookie, $langset); return $next($request); } + + /** + * 自动侦测设置获取语言选择 + * @access protected + * @param Request $request + * @return string + */ + protected function detect(Request $request): string + { + // 自动侦测设置获取语言选择 + $langSet = ''; + + if ($request->get($this->config['detect_var'])) { + // url中设置了语言变量 + $langSet = $request->get($this->config['detect_var']); + } elseif ($request->header($this->config['header_var'])) { + // Header中设置了语言变量 + $langSet = $request->header($this->config['header_var']); + } elseif ($request->cookie($this->config['cookie_var'])) { + // Cookie中设置了语言变量 + $langSet = $request->cookie($this->config['cookie_var']); + } elseif ($request->server('HTTP_ACCEPT_LANGUAGE')) { + // 自动侦测浏览器语言 + $langSet = $request->server('HTTP_ACCEPT_LANGUAGE'); + } + + if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) { + $langSet = strtolower($matches[1]); + if (isset($this->config['accept_language'][$langSet])) { + $langSet = $this->config['accept_language'][$langSet]; + } + } else { + $langSet = $this->lang->getLangSet(); + } + + if (empty($this->config['allow_lang_list']) || in_array($langSet, $this->config['allow_lang_list'])) { + // 合法的语言 + $this->lang->setLangSet($langSet); + } else { + $langSet = $this->lang->getLangSet(); + } + + return $langSet; + } + + /** + * 保存当前语言到Cookie + * @access protected + * @param Cookie $cookie Cookie对象 + * @param string $langSet 语言 + * @return void + */ + protected function saveToCookie(Cookie $cookie, string $langSet) + { + if ($this->config['use_cookie']) { + $cookie->set($this->config['cookie_var'], $langSet); + } + } + } diff --git a/crmeb/vendor/topthink/framework/src/think/middleware/SessionInit.php b/crmeb/vendor/topthink/framework/src/think/middleware/SessionInit.php index 8c2a7b448..3cb2fad96 100644 --- a/crmeb/vendor/topthink/framework/src/think/middleware/SessionInit.php +++ b/crmeb/vendor/topthink/framework/src/think/middleware/SessionInit.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/response/File.php b/crmeb/vendor/topthink/framework/src/think/response/File.php index 45d7196ce..1e45f2f48 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/File.php +++ b/crmeb/vendor/topthink/framework/src/think/response/File.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -44,7 +44,9 @@ class File extends Response throw new Exception('file not exists:' . $data); } - ob_end_clean(); + while (ob_get_level() > 0) { + ob_end_clean(); + } if (!empty($this->name)) { $name = $this->name; diff --git a/crmeb/vendor/topthink/framework/src/think/response/Html.php b/crmeb/vendor/topthink/framework/src/think/response/Html.php index dbf23c78b..c158f7815 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/Html.php +++ b/crmeb/vendor/topthink/framework/src/think/response/Html.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/response/Json.php b/crmeb/vendor/topthink/framework/src/think/response/Json.php index 85d2d228b..a84501f55 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/Json.php +++ b/crmeb/vendor/topthink/framework/src/think/response/Json.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/response/Jsonp.php b/crmeb/vendor/topthink/framework/src/think/response/Jsonp.php index 35f26f2c3..81d3a06e1 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/Jsonp.php +++ b/crmeb/vendor/topthink/framework/src/think/response/Jsonp.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/response/Redirect.php b/crmeb/vendor/topthink/framework/src/think/response/Redirect.php index 3d201aadf..ee067be00 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/Redirect.php +++ b/crmeb/vendor/topthink/framework/src/think/response/Redirect.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -74,9 +74,9 @@ class Redirect extends Response * @access public * @return $this */ - public function remember() + public function remember($complete = false) { - $this->session->set('redirect_url', $this->request->url()); + $this->session->set('redirect_url', $this->request->url($complete)); return $this; } diff --git a/crmeb/vendor/topthink/framework/src/think/response/View.php b/crmeb/vendor/topthink/framework/src/think/response/View.php index 0b1ae88ce..2c116c778 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/View.php +++ b/crmeb/vendor/topthink/framework/src/think/response/View.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -86,8 +86,10 @@ class View extends Response protected function output($data): string { // 渲染模板输出 - return $this->view->filter($this->filter) - ->fetch($data, $this->vars, $this->isContent); + $this->view->filter($this->filter); + return $this->isContent ? + $this->view->display($data, $this->vars) : + $this->view->fetch($data, $this->vars); } /** diff --git a/crmeb/vendor/topthink/framework/src/think/response/Xml.php b/crmeb/vendor/topthink/framework/src/think/response/Xml.php index 359754873..bddbb48b5 100644 --- a/crmeb/vendor/topthink/framework/src/think/response/Xml.php +++ b/crmeb/vendor/topthink/framework/src/think/response/Xml.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/route/Dispatch.php b/crmeb/vendor/topthink/framework/src/think/route/Dispatch.php index 9884a476c..58666b50c 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/Dispatch.php +++ b/crmeb/vendor/topthink/framework/src/think/route/Dispatch.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -12,6 +12,7 @@ declare (strict_types = 1); namespace think\route; +use Psr\Http\Message\ResponseInterface; use think\App; use think\Container; use think\Request; @@ -94,6 +95,12 @@ abstract class Dispatch { if ($data instanceof Response) { $response = $data; + } elseif ($data instanceof ResponseInterface) { + $response = Response::create((string) $data->getBody(), 'html', $data->getStatusCode()); + + foreach ($data->getHeaders() as $header => $values) { + $response->header([$header => implode(", ", $values)]); + } } elseif (!is_null($data)) { // 默认自动识别响应输出类型 $type = $this->request->isJson() ? 'json' : 'html'; diff --git a/crmeb/vendor/topthink/framework/src/think/route/Domain.php b/crmeb/vendor/topthink/framework/src/think/route/Domain.php index 8c04af003..84f1d463b 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/Domain.php +++ b/crmeb/vendor/topthink/framework/src/think/route/Domain.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/route/Resource.php b/crmeb/vendor/topthink/framework/src/think/route/Resource.php index 01565fc73..5185cdc35 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/Resource.php +++ b/crmeb/vendor/topthink/framework/src/think/route/Resource.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -132,7 +132,7 @@ class Resource extends RuleGroup $ruleItem = $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]); - foreach (['model', 'validate', 'middleware'] as $name) { + foreach (['model', 'validate', 'middleware', 'pattern'] as $name) { if (isset($this->$name[$key])) { call_user_func_array([$ruleItem, $name], (array) $this->$name[$key]); } @@ -213,7 +213,7 @@ class Resource extends RuleGroup } /** - * 绑定资源模型 + * 绑定资源中间件 * @access public * @param array|string $name 资源类型或者中间件定义 * @param array|string $middleware 中间件定义 diff --git a/crmeb/vendor/topthink/framework/src/think/route/Rule.php b/crmeb/vendor/topthink/framework/src/think/route/Rule.php index 05213934c..2d864cd25 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/Rule.php +++ b/crmeb/vendor/topthink/framework/src/think/route/Rule.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -237,11 +237,17 @@ abstract class Rule */ public function getPattern(string $name = '') { - if ('' === $name) { - return $this->pattern; + $pattern = $this->pattern; + + if ($this->parent) { + $pattern = array_merge($this->parent->getPattern(), $pattern); } - return $this->pattern[$name] ?? null; + if ('' === $name) { + return $pattern; + } + + return $pattern[$name] ?? null; } /** @@ -253,11 +259,26 @@ abstract class Rule */ public function getOption(string $name = '', $default = null) { - if ('' === $name) { - return $this->option; + $option = $this->option; + + if ($this->parent) { + $parentOption = $this->parent->getOption(); + + // 合并分组参数 + foreach ($this->mergeOptions as $item) { + if (isset($parentOption[$item]) && isset($option[$item])) { + $option[$item] = array_merge($parentOption[$item], $option[$item]); + } + } + + $option = array_merge($parentOption, $option); } - return $this->option[$name] ?? $default; + if ('' === $name) { + return $option; + } + + return $option[$name] ?? $default; } /** @@ -511,6 +532,17 @@ abstract class Rule return $this->setOption('view', $view); } + /** + * 通过闭包检查路由是否匹配 + * @access public + * @param callable $match 闭包 + * @return $this + */ + public function match(callable $match) + { + return $this->setOption('match', $match); + } + /** * 设置路由完整匹配 * @access public @@ -551,26 +583,6 @@ abstract class Rule return $this; } - /** - * 合并分组参数 - * @access public - * @return array - */ - public function mergeGroupOptions(): array - { - $parentOption = $this->parent->getOption(); - // 合并分组参数 - foreach ($this->mergeOptions as $item) { - if (isset($parentOption[$item]) && isset($this->option[$item])) { - $this->option[$item] = array_merge($parentOption[$item], $this->option[$item]); - } - } - - $this->option = array_merge($parentOption, $this->option); - - return $this->option; - } - /** * 解析匹配到的规则路由 * @access public @@ -590,24 +602,31 @@ abstract class Rule } // 替换路由地址中的变量 - if (is_string($route) && !empty($matches)) { - $search = $replace = []; + $extraParams = true; + $search = $replace = []; + $depr = $this->router->config('pathinfo_depr'); + foreach ($matches as $key => $value) { + $search[] = '<' . $key . '>'; + $replace[] = $value; - foreach ($matches as $key => $value) { - $search[] = '<' . $key . '>'; - $replace[] = $value; + $search[] = ':' . $key; + $replace[] = $value; - $search[] = ':' . $key; - $replace[] = $value; + if (strpos($value, $depr)) { + $extraParams = false; } + } + if (is_string($route)) { $route = str_replace($search, $replace, $route); } // 解析额外参数 - $count = substr_count($rule, '/'); - $url = array_slice(explode('|', $url), $count + 1); - $this->parseUrlParams(implode('|', $url), $matches); + if ($extraParams) { + $count = substr_count($rule, '/'); + $url = array_slice(explode('|', $url), $count + 1); + $this->parseUrlParams(implode('|', $url), $matches); + } $this->vars = $matches; @@ -630,7 +649,7 @@ abstract class Rule } elseif ($route instanceof Closure) { // 执行闭包 $result = new CallbackDispatch($request, $this, $route, $this->vars); - } elseif (false !== strpos($route, '@') || false !== strpos($route, '::')) { + } elseif (false !== strpos($route, '@') || false !== strpos($route, '::') || false !== strpos($route, '\\')) { // 路由到类的方法 $route = str_replace('::', '@', $route); $result = $this->dispatchMethod($request, $route); @@ -686,6 +705,13 @@ abstract class Rule */ protected function checkOption(array $option, Request $request): bool { + // 检查当前路由是否匹配 + if (isset($option['match']) && is_callable($option['match'])) { + if (false === $option['match']($this, $request)) { + return false; + } + } + // 请求类型检测 if (!empty($option['method'])) { if (is_string($option['method']) && false === stripos($option['method'], $request->method())) { @@ -784,7 +810,11 @@ abstract class Rule protected function buildRuleRegex(string $rule, array $match, array $pattern = [], array $option = [], bool $completeMatch = false, string $suffix = ''): string { foreach ($match as $name) { - $replace[] = $this->buildNameRegex($name, $pattern, $suffix); + $value = $this->buildNameRegex($name, $pattern, $suffix); + if ($value) { + $origin[] = $name; + $replace[] = $value; + } } // 是否区分 / 地址访问 @@ -797,11 +827,11 @@ abstract class Rule } } - $regex = str_replace(array_unique($match), array_unique($replace), $rule); - $regex = str_replace([')?/', ')/', ')?-', ')-', '\\\\/'], [')\/', ')\/', ')\-', ')\-', '\/'], $regex); + $regex = isset($replace) ? str_replace($origin, $replace, $rule) : $rule; + $regex = str_replace([')?/', ')?-'], [')/', ')-'], $regex); if (isset($hasSlash)) { - $regex .= '\/'; + $regex .= '/'; } return $regex . ($completeMatch ? '$' : ''); @@ -821,7 +851,7 @@ abstract class Rule $slash = substr($name, 0, 1); if (in_array($slash, ['/', '-'])) { - $prefix = '\\' . $slash; + $prefix = $slash; $name = substr($name, 1); $slash = substr($name, 0, 1); } else { @@ -829,7 +859,7 @@ abstract class Rule } if ('<' != $slash) { - return $prefix . preg_quote($name, '/'); + return ''; } if (strpos($name, '?')) { diff --git a/crmeb/vendor/topthink/framework/src/think/route/RuleGroup.php b/crmeb/vendor/topthink/framework/src/think/route/RuleGroup.php index 3d5e9bc82..cd9ddbd1b 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/RuleGroup.php +++ b/crmeb/vendor/topthink/framework/src/think/route/RuleGroup.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -147,19 +147,13 @@ class RuleGroup extends Rule // 获取当前路由规则 $method = strtolower($request->method()); $rules = $this->getRules($method); + $option = $this->getOption(); - if ($this->parent) { - // 合并分组参数 - $this->mergeGroupOptions(); - // 合并分组变量规则 - $this->pattern = array_merge($this->parent->getPattern(), $this->pattern); + if (isset($option['complete_match'])) { + $completeMatch = $option['complete_match']; } - if (isset($this->option['complete_match'])) { - $completeMatch = $this->option['complete_match']; - } - - if (!empty($this->option['merge_rule_regex'])) { + if (!empty($option['merge_rule_regex'])) { // 合并路由正则规则进行路由匹配检查 $result = $this->checkMergeRuleRegex($request, $rules, $url, $completeMatch); @@ -177,9 +171,11 @@ class RuleGroup extends Rule } } - if ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { + if (!empty($option['dispatcher'])) { + $result = $this->parseRule($request, '', $option['dispatcher'], $url, $option); + } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { // 未匹配所有路由的路由规则处理 - $result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); + $result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption()); } else { $result = false; } @@ -250,6 +246,11 @@ class RuleGroup extends Rule */ public function parseGroupRule($rule): void { + if (is_string($rule) && is_subclass_of($rule, Dispatch::class)) { + $this->dispatcher($rule); + return; + } + $origin = $this->router->getGroup(); $this->router->setGroup($this); @@ -323,7 +324,7 @@ class RuleGroup extends Rule } try { - $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); + $result = preg_match('~^(?:' . implode('|', $regex) . ')~u', $url, $match); } catch (\Exception $e) { throw new Exception('route pattern error'); } @@ -472,6 +473,17 @@ class RuleGroup extends Rule return $this->setOption('merge_rule_regex', $merge); } + /** + * 设置分组的Dispatch调度 + * @access public + * @param string $dispatch 调度类 + * @return $this + */ + public function dispatcher(string $dispatch) + { + return $this->setOption('dispatcher', $dispatch); + } + /** * 获取完整分组Name * @access public @@ -495,7 +507,7 @@ class RuleGroup extends Rule } return array_filter($this->rules, function ($item) use ($method) { - return $method == $item[0] || $item[0] == '*'; + return $method == $item[0] || '*' == $item[0]; }); } diff --git a/crmeb/vendor/topthink/framework/src/think/route/RuleItem.php b/crmeb/vendor/topthink/framework/src/think/route/RuleItem.php index f7f72ba1f..e4e324689 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/RuleItem.php +++ b/crmeb/vendor/topthink/framework/src/think/route/RuleItem.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -191,12 +191,12 @@ class RuleItem extends Rule } // 合并分组参数 - $option = $this->mergeGroupOptions(); - - $url = $this->urlSuffixCheck($request, $url, $option); + $option = $this->getOption(); + $pattern = $this->getPattern(); + $url = $this->urlSuffixCheck($request, $url, $option); if (is_null($match)) { - $match = $this->match($url, $option, $completeMatch); + $match = $this->checkMatch($url, $option, $pattern, $completeMatch); } if (false !== $match) { @@ -248,17 +248,17 @@ class RuleItem extends Rule * @access private * @param string $url URL地址 * @param array $option 路由参数 - * @param bool $completeMatch 路由是否完全匹配 + * @param array $pattern 变量规则 + * @param bool $completeMatch 是否完全匹配 * @return array|false */ - private function match(string $url, array $option, bool $completeMatch) + private function checkMatch(string $url, array $option, array $pattern, bool $completeMatch) { if (isset($option['complete_match'])) { $completeMatch = $option['complete_match']; } - $depr = $this->router->config('pathinfo_depr'); - $pattern = array_merge($this->parent->getPattern(), $this->pattern); + $depr = $this->router->config('pathinfo_depr'); // 检查完整规则定义 if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) { @@ -292,7 +292,7 @@ class RuleItem extends Rule $regex = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $completeMatch); try { - if (!preg_match('/^' . $regex . '/u', $url, $match)) { + if (!preg_match('~^' . $regex . '~u', $url, $match)) { return false; } } catch (\Exception $e) { diff --git a/crmeb/vendor/topthink/framework/src/think/route/RuleName.php b/crmeb/vendor/topthink/framework/src/think/route/RuleName.php index 9b1088aed..0684367cd 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/RuleName.php +++ b/crmeb/vendor/topthink/framework/src/think/route/RuleName.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -46,10 +46,11 @@ class RuleName public function setName(string $name, RuleItem $ruleItem, bool $first = false): void { $name = strtolower($name); + $item = $this->getRuleItemInfo($ruleItem); if ($first && isset($this->item[$name])) { - array_unshift($this->item[$name], $ruleItem); + array_unshift($this->item[$name], $item); } else { - $this->item[$name][] = $ruleItem; + $this->item[$name][] = $item; } } @@ -179,8 +180,8 @@ class RuleName $result = $this->item[$name]; } else { foreach ($this->item[$name] as $item) { - $itemDomain = $item->getDomain(); - $itemMethod = $item->getMethod(); + $itemDomain = $item['domain']; + $itemMethod = $item['method']; if (($itemDomain == $domain || '-' == $itemDomain) && ('*' == $itemMethod || '*' == $method || $method == $itemMethod)) { $result[] = $item; @@ -192,4 +193,19 @@ class RuleName return $result; } + /** + * 获取路由信息 + * @access protected + * @param RuleItem $item 路由规则 + * @return array + */ + protected function getRuleItemInfo(RuleItem $item): array + { + return [ + 'rule' => $item->getRule(), + 'domain' => $item->getDomain(), + 'method' => $item->getMethod(), + 'suffix' => $item->getSuffix(), + ]; + } } diff --git a/crmeb/vendor/topthink/framework/src/think/route/Url.php b/crmeb/vendor/topthink/framework/src/think/route/Url.php index d0d808b25..b3f8b9f5e 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/Url.php +++ b/crmeb/vendor/topthink/framework/src/think/route/Url.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -302,10 +302,10 @@ class Url $port = $request->port(); foreach ($rule as $item) { - $url = $item->getRule(); + $url = $item['rule']; $pattern = $this->parseVar($url); - $domain = $item->getDomain(); - $suffix = $item->getSuffix(); + $domain = $item['domain']; + $suffix = $item['suffix']; if ('-' == $domain) { $domain = is_string($allowDomain) ? $allowDomain : $request->host(true); @@ -320,7 +320,7 @@ class Url } if (empty($pattern)) { - return [rtrim($url, '?/-'), $domain, $suffix]; + return [rtrim($url, '?-'), $domain, $suffix]; } $type = $this->route->config('url_common_param'); @@ -328,14 +328,14 @@ class Url foreach ($pattern as $key => $val) { if (isset($vars[$key])) { - $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url); + $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? (string) $vars[$key] : urlencode((string) $vars[$key]), $url); $keys[] = $key; $url = str_replace(['/?', '-?'], ['/', '-'], $url); - $result = [rtrim($url, '?/-'), $domain, $suffix]; + $result = [rtrim($url, '?-'), $domain, $suffix]; } elseif (2 == $val) { $url = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url); $url = str_replace(['/?', '-?'], ['/', '-'], $url); - $result = [rtrim($url, '?/-'), $domain, $suffix]; + $result = [rtrim($url, '?-'), $domain, $suffix]; } else { $result = null; $keys = []; @@ -353,6 +353,11 @@ class Url return []; } + /** + * 生成URL地址 + * @access public + * @return string + */ public function build() { // 解析URL @@ -473,7 +478,7 @@ class Url // 添加参数 if ($this->route->config('url_common_param')) { $vars = http_build_query($vars); - $url .= $suffix . '?' . $vars . $anchor; + $url .= $suffix . ($vars ? '?' . $vars : '') . $anchor; } else { foreach ($vars as $var => $val) { $val = (string) $val; diff --git a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Callback.php b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Callback.php index 7658c3dff..2044ef8e7 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Callback.php +++ b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Callback.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php index 9182dec22..f18512cb0 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php +++ b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Controller.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -113,6 +113,13 @@ class Controller extends Dispatch }); } + protected function parseActions($actions) + { + return array_map(function ($item) { + return strtolower($item); + }, is_string($actions) ? explode(",", $actions) : $actions); + } + /** * 使用反射机制注册控制器中间件 * @access public @@ -128,30 +135,34 @@ class Controller extends Dispatch $reflectionProperty->setAccessible(true); $middlewares = $reflectionProperty->getValue($controller); + $action = $this->request->action(true); foreach ($middlewares as $key => $val) { if (!is_int($key)) { - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { - return strtolower($item); - }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { - continue; - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { - return strtolower($item); - }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { - continue; - } else { - $val = $key; + $middleware = $key; + $options = $val; + } elseif (isset($val['middleware'])) { + $middleware = $val['middleware']; + $options = $val['options'] ?? []; + } else { + $middleware = $val; + $options = []; + } + + if (isset($options['only']) && !in_array($action, $this->parseActions($options['only']))) { + continue; + } elseif (isset($options['except']) && in_array($action, $this->parseActions($options['except']))) { + continue; + } + + if (is_string($middleware) && strpos($middleware, ':')) { + $middleware = explode(':', $middleware); + if (count($middleware) > 1) { + $middleware = [$middleware[0], array_slice($middleware, 1)]; } } - if (is_string($val) && strpos($val, ':')) { - $val = explode(':', $val); - if (count($val) > 1) { - $val = [$val[0], array_slice($val, 1)]; - } - } - - $this->app->middleware->controller($val); + $this->app->middleware->controller($middleware); } } } diff --git a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Url.php b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Url.php index eb89f5410..147f5cb75 100644 --- a/crmeb/vendor/topthink/framework/src/think/route/dispatch/Url.php +++ b/crmeb/vendor/topthink/framework/src/think/route/dispatch/Url.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/service/ModelService.php b/crmeb/vendor/topthink/framework/src/think/service/ModelService.php index a212a58ec..b517c4e05 100644 --- a/crmeb/vendor/topthink/framework/src/think/service/ModelService.php +++ b/crmeb/vendor/topthink/framework/src/think/service/ModelService.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -42,6 +42,12 @@ class ModelService extends Service $model->setDateFormat($config->get('database.datetime_format', 'Y-m-d H:i:s')); } + $timeField = $config->get('database.datetime_field'); + if (!empty($timeField)) { + [$createTime, $updateTime] = explode(',', $timeField); + $model->setTimeField($createTime, $updateTime); + } + }); } } diff --git a/crmeb/vendor/topthink/framework/src/think/service/PaginatorService.php b/crmeb/vendor/topthink/framework/src/think/service/PaginatorService.php index b13dc1dfb..a01977d01 100644 --- a/crmeb/vendor/topthink/framework/src/think/service/PaginatorService.php +++ b/crmeb/vendor/topthink/framework/src/think/service/PaginatorService.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/service/ValidateService.php b/crmeb/vendor/topthink/framework/src/think/service/ValidateService.php index d96dea010..94d7638a6 100644 --- a/crmeb/vendor/topthink/framework/src/think/service/ValidateService.php +++ b/crmeb/vendor/topthink/framework/src/think/service/ValidateService.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/session/Store.php b/crmeb/vendor/topthink/framework/src/think/session/Store.php index 03ece29e3..49e1ba909 100644 --- a/crmeb/vendor/topthink/framework/src/think/session/Store.php +++ b/crmeb/vendor/topthink/framework/src/think/session/Store.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/session/driver/Cache.php b/crmeb/vendor/topthink/framework/src/think/session/driver/Cache.php index c25e2efee..4fabc799a 100644 --- a/crmeb/vendor/topthink/framework/src/think/session/driver/Cache.php +++ b/crmeb/vendor/topthink/framework/src/think/session/driver/Cache.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/think/session/driver/File.php b/crmeb/vendor/topthink/framework/src/think/session/driver/File.php index 991f2cc93..788f3230e 100644 --- a/crmeb/vendor/topthink/framework/src/think/session/driver/File.php +++ b/crmeb/vendor/topthink/framework/src/think/session/driver/File.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -39,7 +39,7 @@ class File implements SessionHandlerInterface $this->config = array_merge($this->config, $config); if (empty($this->config['path'])) { - $this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR; + $this->config['path'] = $app->getRuntimePath() . 'session' . DIRECTORY_SEPARATOR; } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { $this->config['path'] .= DIRECTORY_SEPARATOR; } diff --git a/crmeb/vendor/topthink/framework/src/think/validate/ValidateRule.php b/crmeb/vendor/topthink/framework/src/think/validate/ValidateRule.php index 05e275fe3..18e5ea332 100644 --- a/crmeb/vendor/topthink/framework/src/think/validate/ValidateRule.php +++ b/crmeb/vendor/topthink/framework/src/think/validate/ValidateRule.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- @@ -15,62 +15,62 @@ namespace think\validate; /** * Class ValidateRule * @package think\validate - * @method ValidateRule confirm(mixed $rule, string $msg = '') static 验证是否和某个字段的值一致 - * @method ValidateRule different(mixed $rule, string $msg = '') static 验证是否和某个字段的值是否不同 - * @method ValidateRule egt(mixed $rule, string $msg = '') static 验证是否大于等于某个值 - * @method ValidateRule gt(mixed $rule, string $msg = '') static 验证是否大于某个值 - * @method ValidateRule elt(mixed $rule, string $msg = '') static 验证是否小于等于某个值 - * @method ValidateRule lt(mixed $rule, string $msg = '') static 验证是否小于某个值 - * @method ValidateRule eg(mixed $rule, string $msg = '') static 验证是否等于某个值 - * @method ValidateRule in(mixed $rule, string $msg = '') static 验证是否在范围内 - * @method ValidateRule notIn(mixed $rule, string $msg = '') static 验证是否不在某个范围 - * @method ValidateRule between(mixed $rule, string $msg = '') static 验证是否在某个区间 - * @method ValidateRule notBetween(mixed $rule, string $msg = '') static 验证是否不在某个区间 - * @method ValidateRule length(mixed $rule, string $msg = '') static 验证数据长度 - * @method ValidateRule max(mixed $rule, string $msg = '') static 验证数据最大长度 - * @method ValidateRule min(mixed $rule, string $msg = '') static 验证数据最小长度 - * @method ValidateRule after(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule before(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule expire(mixed $rule, string $msg = '') static 验证有效期 - * @method ValidateRule allowIp(mixed $rule, string $msg = '') static 验证IP许可 - * @method ValidateRule denyIp(mixed $rule, string $msg = '') static 验证IP禁用 - * @method ValidateRule regex(mixed $rule, string $msg = '') static 使用正则验证数据 - * @method ValidateRule token(mixed $rule='__token__', string $msg = '') static 验证表单令牌 - * @method ValidateRule is(mixed $rule, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isRequire(mixed $rule = null, string $msg = '') static 验证字段必须 - * @method ValidateRule isNumber(mixed $rule = null, string $msg = '') static 验证字段值是否为数字 - * @method ValidateRule isArray(mixed $rule = null, string $msg = '') static 验证字段值是否为数组 - * @method ValidateRule isInteger(mixed $rule = null, string $msg = '') static 验证字段值是否为整形 - * @method ValidateRule isFloat(mixed $rule = null, string $msg = '') static 验证字段值是否为浮点数 - * @method ValidateRule isMobile(mixed $rule = null, string $msg = '') static 验证字段值是否为手机 - * @method ValidateRule isIdCard(mixed $rule = null, string $msg = '') static 验证字段值是否为身份证号码 - * @method ValidateRule isChs(mixed $rule = null, string $msg = '') static 验证字段值是否为中文 - * @method ValidateRule isChsDash(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母及下划线 - * @method ValidateRule isChsAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为中文和字母 - * @method ValidateRule isChsAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母和数字 - * @method ValidateRule isDate(mixed $rule = null, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isBool(mixed $rule = null, string $msg = '') static 验证字段值是否为布尔值 - * @method ValidateRule isAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为字母 - * @method ValidateRule isAlphaDash(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和下划线 - * @method ValidateRule isAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和数字 - * @method ValidateRule isAccepted(mixed $rule = null, string $msg = '') static 验证字段值是否为yes, on, 或是 1 - * @method ValidateRule isEmail(mixed $rule = null, string $msg = '') static 验证字段值是否为有效邮箱格式 - * @method ValidateRule isUrl(mixed $rule = null, string $msg = '') static 验证字段值是否为有效URL地址 - * @method ValidateRule activeUrl(mixed $rule, string $msg = '') static 验证是否为合格的域名或者IP - * @method ValidateRule ip(mixed $rule, string $msg = '') static 验证是否有效IP - * @method ValidateRule fileExt(mixed $rule, string $msg = '') static 验证文件后缀 - * @method ValidateRule fileMime(mixed $rule, string $msg = '') static 验证文件类型 - * @method ValidateRule fileSize(mixed $rule, string $msg = '') static 验证文件大小 - * @method ValidateRule image(mixed $rule, string $msg = '') static 验证图像文件 - * @method ValidateRule method(mixed $rule, string $msg = '') static 验证请求类型 - * @method ValidateRule dateFormat(mixed $rule, string $msg = '') static 验证时间和日期是否符合指定格式 - * @method ValidateRule unique(mixed $rule, string $msg = '') static 验证是否唯一 - * @method ValidateRule behavior(mixed $rule, string $msg = '') static 使用行为类验证 - * @method ValidateRule filter(mixed $rule, string $msg = '') static 使用filter_var方式验证 - * @method ValidateRule requireIf(mixed $rule, string $msg = '') static 验证某个字段等于某个值的时候必须 - * @method ValidateRule requireCallback(mixed $rule, string $msg = '') static 通过回调方法验证某个字段是否必须 - * @method ValidateRule requireWith(mixed $rule, string $msg = '') static 验证某个字段有值的情况下必须 - * @method ValidateRule must(mixed $rule = null, string $msg = '') static 必须验证 + * @method static ValidateRule confirm(mixed $rule, string $msg = '') 验证是否和某个字段的值一致 + * @method static ValidateRule different(mixed $rule, string $msg = '') 验证是否和某个字段的值是否不同 + * @method static ValidateRule egt(mixed $rule, string $msg = '') 验证是否大于等于某个值 + * @method static ValidateRule gt(mixed $rule, string $msg = '') 验证是否大于某个值 + * @method static ValidateRule elt(mixed $rule, string $msg = '') 验证是否小于等于某个值 + * @method static ValidateRule lt(mixed $rule, string $msg = '') 验证是否小于某个值 + * @method static ValidateRule eg(mixed $rule, string $msg = '') 验证是否等于某个值 + * @method static ValidateRule in(mixed $rule, string $msg = '') 验证是否在范围内 + * @method static ValidateRule notIn(mixed $rule, string $msg = '') 验证是否不在某个范围 + * @method static ValidateRule between(mixed $rule, string $msg = '') 验证是否在某个区间 + * @method static ValidateRule notBetween(mixed $rule, string $msg = '') 验证是否不在某个区间 + * @method static ValidateRule length(mixed $rule, string $msg = '') 验证数据长度 + * @method static ValidateRule max(mixed $rule, string $msg = '') 验证数据最大长度 + * @method static ValidateRule min(mixed $rule, string $msg = '') 验证数据最小长度 + * @method static ValidateRule after(mixed $rule, string $msg = '') 验证日期 + * @method static ValidateRule before(mixed $rule, string $msg = '') 验证日期 + * @method static ValidateRule expire(mixed $rule, string $msg = '') 验证有效期 + * @method static ValidateRule allowIp(mixed $rule, string $msg = '') 验证IP许可 + * @method static ValidateRule denyIp(mixed $rule, string $msg = '') 验证IP禁用 + * @method static ValidateRule regex(mixed $rule, string $msg = '') 使用正则验证数据 + * @method static ValidateRule token(mixed $rule='__token__', string $msg = '') 验证表单令牌 + * @method static ValidateRule is(mixed $rule, string $msg = '') 验证字段值是否为有效格式 + * @method static ValidateRule isRequire(mixed $rule = null, string $msg = '') 验证字段必须 + * @method static ValidateRule isNumber(mixed $rule = null, string $msg = '') 验证字段值是否为数字 + * @method static ValidateRule isArray(mixed $rule = null, string $msg = '') 验证字段值是否为数组 + * @method static ValidateRule isInteger(mixed $rule = null, string $msg = '') 验证字段值是否为整形 + * @method static ValidateRule isFloat(mixed $rule = null, string $msg = '') 验证字段值是否为浮点数 + * @method static ValidateRule isMobile(mixed $rule = null, string $msg = '') 验证字段值是否为手机 + * @method static ValidateRule isIdCard(mixed $rule = null, string $msg = '') 验证字段值是否为身份证号码 + * @method static ValidateRule isChs(mixed $rule = null, string $msg = '') 验证字段值是否为中文 + * @method static ValidateRule isChsDash(mixed $rule = null, string $msg = '') 验证字段值是否为中文字母及下划线 + * @method static ValidateRule isChsAlpha(mixed $rule = null, string $msg = '') 验证字段值是否为中文和字母 + * @method static ValidateRule isChsAlphaNum(mixed $rule = null, string $msg = '') 验证字段值是否为中文字母和数字 + * @method static ValidateRule isDate(mixed $rule = null, string $msg = '') 验证字段值是否为有效格式 + * @method static ValidateRule isBool(mixed $rule = null, string $msg = '') 验证字段值是否为布尔值 + * @method static ValidateRule isAlpha(mixed $rule = null, string $msg = '') 验证字段值是否为字母 + * @method static ValidateRule isAlphaDash(mixed $rule = null, string $msg = '') 验证字段值是否为字母和下划线 + * @method static ValidateRule isAlphaNum(mixed $rule = null, string $msg = '') 验证字段值是否为字母和数字 + * @method static ValidateRule isAccepted(mixed $rule = null, string $msg = '') 验证字段值是否为yes, on, 或是 1 + * @method static ValidateRule isEmail(mixed $rule = null, string $msg = '') 验证字段值是否为有效邮箱格式 + * @method static ValidateRule isUrl(mixed $rule = null, string $msg = '') 验证字段值是否为有效URL地址 + * @method static ValidateRule activeUrl(mixed $rule, string $msg = '') 验证是否为合格的域名或者IP + * @method static ValidateRule ip(mixed $rule, string $msg = '') 验证是否有效IP + * @method static ValidateRule fileExt(mixed $rule, string $msg = '') 验证文件后缀 + * @method static ValidateRule fileMime(mixed $rule, string $msg = '') 验证文件类型 + * @method static ValidateRule fileSize(mixed $rule, string $msg = '') 验证文件大小 + * @method static ValidateRule image(mixed $rule, string $msg = '') 验证图像文件 + * @method static ValidateRule method(mixed $rule, string $msg = '') 验证请求类型 + * @method static ValidateRule dateFormat(mixed $rule, string $msg = '') 验证时间和日期是否符合指定格式 + * @method static ValidateRule unique(mixed $rule, string $msg = '') 验证是否唯一 + * @method static ValidateRule behavior(mixed $rule, string $msg = '') 使用行为类验证 + * @method static ValidateRule filter(mixed $rule, string $msg = '') 使用filter_var方式验证 + * @method static ValidateRule requireIf(mixed $rule, string $msg = '') 验证某个字段等于某个值的时候必须 + * @method static ValidateRule requireCallback(mixed $rule, string $msg = '') 通过回调方法验证某个字段是否必须 + * @method static ValidateRule requireWith(mixed $rule, string $msg = '') 验证某个字段有值的情况下必须 + * @method static ValidateRule must(mixed $rule = null, string $msg = '') 必须验证 */ class ValidateRule { diff --git a/crmeb/vendor/topthink/framework/src/think/view/driver/Php.php b/crmeb/vendor/topthink/framework/src/think/view/driver/Php.php index 0713a56c4..9e6e54aa3 100644 --- a/crmeb/vendor/topthink/framework/src/think/view/driver/Php.php +++ b/crmeb/vendor/topthink/framework/src/think/view/driver/Php.php @@ -2,7 +2,7 @@ // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- -// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. +// | Copyright (c) 2006~2021 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- diff --git a/crmeb/vendor/topthink/framework/src/tpl/think_exception.tpl b/crmeb/vendor/topthink/framework/src/tpl/think_exception.tpl index 7766caf57..6ea9677cd 100644 --- a/crmeb/vendor/topthink/framework/src/tpl/think_exception.tpl +++ b/crmeb/vendor/topthink/framework/src/tpl/think_exception.tpl @@ -492,7 +492,7 @@ if (!function_exists('echo_value')) { } })(); - $.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function(){ + $.getScript('//cdn.bootcdn.net/ajax/libs/prettify/r298/prettify.min.js', function(){ prettyPrint(); }); })(); diff --git a/crmeb/vendor/topthink/framework/tests/ContainerTest.php b/crmeb/vendor/topthink/framework/tests/ContainerTest.php index 72ff1d071..e27deb088 100644 --- a/crmeb/vendor/topthink/framework/tests/ContainerTest.php +++ b/crmeb/vendor/topthink/framework/tests/ContainerTest.php @@ -149,6 +149,7 @@ class ContainerTest extends TestCase $container->bind('name2', $object); + $container->bind('name3', Taylor::class); $container->bind('name3', Taylor::class); $container->name4 = $object; diff --git a/crmeb/vendor/topthink/framework/tests/DispatchTest.php b/crmeb/vendor/topthink/framework/tests/DispatchTest.php new file mode 100644 index 000000000..2b9e41399 --- /dev/null +++ b/crmeb/vendor/topthink/framework/tests/DispatchTest.php @@ -0,0 +1,32 @@ + ['tp', 'thinkphp'], 'psr' => 'psr-7'], '123'); + } + }; + + $response = $dispatch->run(); + + $this->assertInstanceOf(\think\Response::class, $response); + $this->assertEquals('123', $response->getContent()); + $this->assertEquals('tp, thinkphp', $response->getHeader('framework')); + $this->assertEquals('psr-7', $response->getHeader('psr')); + } +} diff --git a/crmeb/vendor/topthink/framework/tests/EnvTest.php b/crmeb/vendor/topthink/framework/tests/EnvTest.php index cf2e65f85..9b3b615c2 100644 --- a/crmeb/vendor/topthink/framework/tests/EnvTest.php +++ b/crmeb/vendor/topthink/framework/tests/EnvTest.php @@ -21,8 +21,6 @@ class EnvTest extends TestCase $this->assertEquals('value1', $env->get('key1')); $this->assertEquals('value2', $env->get('key2')); - - $this->assertSame(['KEY1' => 'value1', 'KEY2' => 'value2'], $env->get()); } public function testServerEnv() diff --git a/crmeb/vendor/topthink/framework/tests/FilesystemTest.php b/crmeb/vendor/topthink/framework/tests/FilesystemTest.php deleted file mode 100644 index df5ffe209..000000000 --- a/crmeb/vendor/topthink/framework/tests/FilesystemTest.php +++ /dev/null @@ -1,131 +0,0 @@ -app = m::mock(App::class)->makePartial(); - Container::setInstance($this->app); - $this->app->shouldReceive('make')->with(App::class)->andReturn($this->app); - $this->config = m::mock(Config::class); - $this->config->shouldReceive('get')->with('filesystem.default', null)->andReturn('local'); - $this->app->shouldReceive('get')->with('config')->andReturn($this->config); - $this->filesystem = new Filesystem($this->app); - - $this->root = vfsStream::setup('rootDir'); - } - - protected function tearDown(): void - { - m::close(); - } - - public function testDisk() - { - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - ]); - - $this->config->shouldReceive('get')->with('filesystem.disks.foo', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - ]); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk()); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk('foo')); - } - - public function testCache() - { - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => 'local', - 'root' => $this->root->url(), - 'cache' => true, - ]); - - $this->assertInstanceOf(Local::class, $this->filesystem->disk()); - - $this->config->shouldReceive('get')->with('filesystem.disks.cache', null)->andReturn([ - 'type' => NullDriver::class, - 'root' => $this->root->url(), - 'cache' => [ - 'store' => 'flysystem', - ], - ]); - - $cache = m::mock(Cache::class); - - $cacheDriver = m::mock(File::class); - - $cache->shouldReceive('store')->once()->with('flysystem')->andReturn($cacheDriver); - - $this->app->shouldReceive('make')->with(Cache::class)->andReturn($cache); - - $cacheDriver->shouldReceive('get')->with('flysystem')->once()->andReturn(null); - - $cacheDriver->shouldReceive('set')->withAnyArgs(); - - $this->filesystem->disk('cache')->put('test.txt', 'aa'); - } - - public function testPutFile() - { - $root = vfsStream::setup('rootDir', null, [ - 'foo.jpg' => 'hello', - ]); - - $this->config->shouldReceive('get')->with('filesystem.disks.local', null)->andReturn([ - 'type' => NullDriver::class, - 'root' => $root->url(), - 'cache' => true, - ]); - - $file = m::mock(\think\File::class); - - $file->shouldReceive('hashName')->with(null)->once()->andReturn('foo.jpg'); - - $file->shouldReceive('getRealPath')->once()->andReturn($root->getChild('foo.jpg')->url()); - - $this->filesystem->putFile('test', $file); - } -} - -class NullDriver extends Driver -{ - protected function createAdapter(): AdapterInterface - { - return new NullAdapter(); - } -} diff --git a/crmeb/vendor/topthink/framework/tests/HttpTest.php b/crmeb/vendor/topthink/framework/tests/HttpTest.php index 8b6f28fd6..c3e0abd33 100644 --- a/crmeb/vendor/topthink/framework/tests/HttpTest.php +++ b/crmeb/vendor/topthink/framework/tests/HttpTest.php @@ -123,6 +123,7 @@ class HttpTest extends TestCase $response = m::mock(Response::class); $this->app->shouldReceive('instance')->once()->with('request', $request); + $this->app->shouldReceive('initialize')->once(); $exception = new Exception(); diff --git a/crmeb/vendor/topthink/framework/tests/RouteTest.php b/crmeb/vendor/topthink/framework/tests/RouteTest.php index e587131b6..6a7f8ee24 100644 --- a/crmeb/vendor/topthink/framework/tests/RouteTest.php +++ b/crmeb/vendor/topthink/framework/tests/RouteTest.php @@ -194,6 +194,10 @@ class RouteTest extends TestCase $this->createMiddleware()->mockery_getName() . ":params1:params2", $this->createMiddleware(0)->mockery_getName() => ['except' => 'bar'], $this->createMiddleware()->mockery_getName() => ['only' => 'bar'], + [ + 'middleware' => [$this->createMiddleware()->mockery_getName(), [new \stdClass()]], + 'options' => ['only' => 'bar'], + ], ]; $this->app->shouldReceive('parseClass')->with('controller', 'Foo')->andReturn($controller->mockery_getName()); @@ -211,7 +215,8 @@ class RouteTest extends TestCase $controller = m::mock(FooClass::class); $controller->shouldReceive('index')->andReturn('bar'); - $this->app->shouldReceive('parseClass')->once()->with('controller', 'Foo')->andReturn($controller->mockery_getName()); + $this->app->shouldReceive('parseClass')->once()->with('controller', 'Foo') + ->andReturn($controller->mockery_getName()); $this->app->shouldReceive('make')->with($controller->mockery_getName(), [], true)->andReturn($controller); $request = $this->makeRequest('foo'); @@ -223,7 +228,8 @@ class RouteTest extends TestCase { $this->route->redirect('foo', 'http://localhost', 302); - $request = $this->makeRequest('foo'); + $request = $this->makeRequest('foo'); + $this->app->shouldReceive('make')->with(Request::class)->andReturn($request); $response = $this->route->dispatch($request); $this->assertInstanceOf(Redirect::class, $response);