This commit is contained in:
david 2021-03-04 23:39:19 +08:00
parent cd7b9be2a8
commit 34e8594892
4 changed files with 305 additions and 278 deletions

View File

@ -107,6 +107,7 @@
<div class="layui-form-item">
<label class="layui-form-label required">排除目录</label>
<div class="layui-input-block">
<input type="hidden" name="path_filter" id="path_filter" lay-verify="path_filter" class="layui-input">
<div id="path_filter_view"></div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> </div>
</div>
@ -114,6 +115,7 @@
<div class="layui-form-item">
<label class="layui-form-label required">选择目录</label>
<div class="layui-input-block">
<input type="hidden" name="path_selector" id="path_selector" lay-verify="path_selector" class="layui-input">
<div id="path_selector_view"></div>
<div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-tips"></i> () </div>
</div>
@ -172,30 +174,30 @@
<!-- 模板辅种任务 [站点] 复选框 -->
<script id="reseed_sites_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="checkbox" name="sites[{{item}}]" title="{{item}}" checked>
{{# }); }}
{{# layui.each(d, function(index, item){ }}
<input type="checkbox" name="sites[{{item}}]" title="{{item}}" checked>
{{# }); }}
</script>
<!-- 模板辅种任务 [下载器] 复选框 -->
<script id="reseed_clients_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="checkbox" name="clients[{{item.uuid}}]" title="{{ item.name }}" checked>
{{# }); }}
{{# layui.each(d, function(index, item){ }}
<input type="checkbox" name="clients[{{item.uuid}}]" title="{{ item.name }}" checked>
{{# }); }}
</script>
<!-- 模板转移任务来源 [下载器] 单选框 -->
<script id="form_clients_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="radio" name="form_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
{{# layui.each(d, function(index, item){ }}
<input type="radio" name="form_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
</script>
<!-- 模板转移任务目标 [下载器] 单选框 -->
<script id="to_clients_tpl" type="text/html">
{{# layui.each(d, function(index, item){ }}
<input type="radio" name="to_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
{{# layui.each(d, function(index, item){ }}
<input type="radio" name="to_clients" value="{{item.uuid}}" title="{{ item.name }}">
{{# }); }}
</script>
<!-- 模板计划任务 [执行周期] 组合 -->
@ -277,6 +279,10 @@
,taskClearLogs: '/Task/clearLogs'
};
const path_filter = 'path_filter'
,path_selector = 'path_selector'
,_height = 250;
/**
* 任务类型 选择框
* @param {string} type 任务类型
@ -450,11 +456,10 @@
return;
}
console.log(d);
let _height = 250;
//过滤器
transfer.render({
elem: '#path_filter_view'
,id: 'path_filter'
elem: '#' + path_filter + '_view'
,id: path_filter
,parseData: function(res){
return {
"value": res.uuid
@ -466,6 +471,7 @@
}
,title: ['全部目录', '排除目录']
,data: d.data.items
,value: formData !== null && formData.path_filter ? formData.path_filter.split(",") : []
,height: _height
,text: {
none: '无数据'
@ -473,13 +479,13 @@
}
,onchange: function(obj, index){
var arr = ['左边', '右边'];
layer.msg('来自 <strong>'+ arr[index] + '</strong> 的数据:'+ JSON.stringify(obj));
console.log('来自 <strong>'+ arr[index] + '</strong> 的数据:',JSON.stringify(obj));
}
});
//选择器
transfer.render({
elem: '#path_selector_view'
,id: 'path_selector'
elem: '#' + path_selector + '_view'
,id: path_selector
,parseData: function(res){
return {
"value": res.uuid
@ -491,6 +497,7 @@
}
,title: ['全部目录', '选择目录']
,data: d.data.items
,value: formData !== null && formData.path_selector ? formData.path_selector.split(",") : []
,height: _height
,text: {
none: '无数据'
@ -498,7 +505,7 @@
}
,onchange: function(obj, index){
var arr = ['左边', '右边'];
layer.msg('来自 <strong>'+ arr[index] + '</strong> 的数据:'+ JSON.stringify(obj));
console.log('来自 <strong>'+ arr[index] + '</strong> 的数据:',JSON.stringify(obj));
}
});
});
@ -753,6 +760,19 @@
*/
form.render();
//自定义验证规则
form.verify({
path_filter: function (value) {
let elem = getById(path_filter)
,obj = transfer.getData(path_filter);
elem.value = obj ? obj.map(v => {return v.value}).toString() : '';
}
,path_selector: function (value) {
let elem = getById(path_selector)
,obj = transfer.getData(path_selector);
elem.value = obj ? obj.map(v => {return v.value}).toString() : '';
}
});
//监听选择:类型
form.on('select(type)', function(data){
crontab_sel_action(data.value, 'add');

View File

@ -13,12 +13,12 @@
<tip>填写自己管理账号的名称</tip>
</div>
</div>
<div class="layui-form-item">
<!-- <div class="layui-form-item">
<label class="layui-form-label required">手机</label>
<div class="layui-input-block">
<input type="number" name="phone" lay-verify="required" lay-reqtext="手机不能为空" placeholder="请输入手机" value="" class="layui-input">
</div>
</div>
</div> -->
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">

View File

@ -21,22 +21,22 @@ class AutoReseed
* 配置
* @var array
*/
private static $conf = [];
protected static $conf = [];
/**
* RPC连接
* @var array
*/
private static $links = [];
protected static $links = [];
/**
* 客户端
* @var array
*/
protected static $clients = [];
/**
* 站点
* @var array
*/
private static $sites = [];
/**
* 客户端
* @var array
*/
private static $clients = [];
/**
* 用户选择辅种的站点
* @var array
@ -88,23 +88,19 @@ class AutoReseed
/**
* @var null | Curl
*/
private static $curl = null;
protected static $curl = null;
protected static $pid_file = '';
/**
* 退出状态码
* @var int
*/
public static $ExitCode = 0;
/**
* 客户端转移做种 格式:['客户端key', '移动参数move']
* @var null
*/
private static $move = null;
/**
* 微信通知消息体
* @var array
*/
private static $wechatMsg = array(
protected static $wechatMsg = array(
'hashCount' => 0, // 提交给服务器的hash总数
'sitesCount' => 0, // 可辅种站点总数
'reseedCount' => 0, // 返回的总数据
@ -120,7 +116,7 @@ class AutoReseed
* 错误通知消息体
* @var array
*/
private static $errNotify = array(
protected static $errNotify = array(
'sign' => '',
'site' => '',
'sid' => 0,
@ -415,12 +411,6 @@ class AutoReseed
*/
public static function call()
{
// 命令行参数
global $argv;
$is_move = isset($argv[2]) ? $argv[2] : 'null';
if (self::$move !== null) {
self::move();
}
self::reseed();
self::wechatMessage();
exit(self::$ExitCode);
@ -455,9 +445,9 @@ class AutoReseed
self::$wechatMsg['hashCount'] += count($hashString);
// 此处优化大于5000条做种时设置超时
if (count($hashString) > 5000) {
$connecttimeout = isset(self::$conf['default']['CONNECTTIMEOUT']) && self::$conf['default']['CONNECTTIMEOUT'] > 60 ? self::$conf['default']['CONNECTTIMEOUT'] : 60;
$_timeout = isset(self::$conf['default']['CONNECTTIMEOUT']) && self::$conf['default']['CONNECTTIMEOUT'] > 60 ? self::$conf['default']['CONNECTTIMEOUT'] : 60;
$timeout = isset(self::$conf['default']['TIMEOUT']) && self::$conf['default']['TIMEOUT'] > 600 ? self::$conf['default']['TIMEOUT'] : 600;
self::$curl->setOpt(CURLOPT_CONNECTTIMEOUT, $connecttimeout);
self::$curl->setOpt(CURLOPT_CONNECTTIMEOUT, $_timeout);
self::$curl->setOpt(CURLOPT_TIMEOUT, $timeout);
$hashJson = $hashArray['hash'];
$infoHash = json_decode($hashJson, true); // Json转数组
@ -981,240 +971,6 @@ class AutoReseed
return $signString;
}
/**
* IYUUAutoReseed做种客户端转移
*/
private static function move()
{
//遍历客户端
foreach (self::$links as $k => $v) {
if (self::$move[0] == $k) {
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过!".PHP_EOL.PHP_EOL;
continue;
}
if (empty(self::$links[$k])) {
echo "clients_".$k." 用户名或密码未配置,已跳过".PHP_EOL.PHP_EOL;
continue;
}
echo "正在从下载器 clients_".$k." 获取种子哈希……".PHP_EOL;
$move = []; // 客户端做种列表 传址
$hashArray = self::$links[$k]['rpc']->all($move);
if (empty($hashArray)) {
// 失败
continue;
} else {
$infohash_Dir = $hashArray['hashString'];
// 写日志
wlog($hashArray, 'move'.$k);
}
// 前置过滤移除转移成功的hash
$rs = self::hashFilter($infohash_Dir);
if ($rs) {
echo "clients_".$k." 全部转移成功,本次无需转移!".PHP_EOL.PHP_EOL;
continue;
}
//遍历当前客户端种子
foreach ($infohash_Dir as $info_hash => $downloadDir) {
// 调用路径过滤
if (self::pathFilter($downloadDir)) {
continue;
}
// 做种实际路径与相对路径之间互转
echo '转换前:'.$downloadDir.PHP_EOL;
$downloadDir = self::pathReplace($downloadDir);
echo '转换后:'.$downloadDir.PHP_EOL;
if (is_null($downloadDir)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("全局配置的move数组内路径转换参数配置错误请重新配置".PHP_EOL);
}
// 种子目录:脚本要能够读取到
$path = self::$links[$k]['BT_backup'];
$torrentPath = '';
// 待删除种子
$torrentDelete = '';
// 获取种子原文件的实际路径
switch ($v['type']) {
case 'transmission':
// 优先使用API提供的种子路径
$torrentPath = $move[$info_hash]['torrentFile'];
$torrentDelete = $move[$info_hash]['id'];
// API提供的种子路径不存在时使用配置内指定的BT_backup路径
if (!is_file($torrentPath)) {
$torrentPath = str_replace("\\", "/", $torrentPath);
$torrentPath = $path . strrchr($torrentPath, '/');
}
break;
case 'qBittorrent':
if (empty($path)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("clients_".$k." 未设置种子的BT_backup目录无法完成转移");
}
$torrentPath = $path .DS. $info_hash . '.torrent';
$torrentDelete = $info_hash;
break;
default:
break;
}
if (!is_file($torrentPath)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("clients_".$k." 的种子文件{$torrentPath}不存在,无法完成转移!");
}
echo '存在种子:'.$torrentPath.PHP_EOL;
$torrent = file_get_contents($torrentPath);
// 正式开始转移
echo "种子已推送给下载器,正在转移做种...".PHP_EOL;
// 目标下载器类型
$rpcKey = self::$move[0];
$type = self::$links[$rpcKey]['type'];
$extra_options = array();
// 转移后,是否开始?
$extra_options['paused'] = isset(self::$conf['default']['move']['paused']) && self::$conf['default']['move']['paused'] ? true : false;
if ($type == 'qBittorrent') {
if (isset(self::$conf['default']['move']['skip_check']) && self::$conf['default']['move']['skip_check'] === 1) {
$extra_options['skip_checking'] = "true"; //转移成功,跳校验
}
}
// 添加转移任务成功返回true
$ret = self::add(self::$move[0], $torrent, $downloadDir, $extra_options);
/**
* 转移成功的种子写日志
*/
$log = $info_hash.PHP_EOL.$torrentPath.PHP_EOL.$downloadDir.PHP_EOL.PHP_EOL;
if ($ret) {
//转移成功时,删除做种,不删资源
if (isset(self::$conf['default']['move']['delete_torrent']) && self::$conf['default']['move']['delete_torrent'] === 1) {
self::$links[$k]['rpc']->delete($torrentDelete);
}
// 转移成功的种子以infohash为文件名写入缓存
wlog($log, $info_hash, self::$cacheMove);
wlog($log, 'MoveSuccess'.$k);
self::$wechatMsg['MoveSuccess']++;
} else {
// 失败的种子
wlog($log, 'MoveError'.$k);
self::$wechatMsg['MoveError']++;
}
}
}
}
/**
* 过滤已转移的种子hash
* @param array $infohash_Dir infohash与路径对应的字典
* @return bool true 过滤 | false 不过滤
*/
private static function hashFilter(&$infohash_Dir = array())
{
foreach ($infohash_Dir as $info_hash => $dir) {
if (is_file(self::$cacheMove . $info_hash.'.txt')) {
unset($infohash_Dir[$info_hash]);
echo '-------当前种子上次已成功转移,前置过滤已跳过! ' .PHP_EOL.PHP_EOL;
}
}
return empty($infohash_Dir) ? true : false;
}
/**
* 实际路径与相对路径之间互相转换
* @param string $path
* @return string | null string转换成功
*/
private static function pathReplace($path = '')
{
$type = intval(self::$conf['default']['move']['type']);
$pathArray = self::$conf['default']['move']['path'];
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
switch ($type) {
case 1: // 减
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) {
return substr($path, strlen($key));
}
}
break;
case 2: // 加
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) { // 没用$path == $key判断是为了提高兼容性
return $val . $path;
}
}
break;
case 3: // 替换
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) { // 没用$path == $key判断是为了提高兼容性
return $val . substr($path, strlen($key));
}
}
break;
default: // 不变
return $path;
break;
}
return null;
}
/**
* 处理转移种子时所设置的过滤器、选择器
* @param string $path
* @return bool true 过滤 | false 不过滤
*/
private static function pathFilter(&$path = '')
{
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
// 转移过滤器、选择器 David/2020年7月11日
$path_filter = !empty(self::$conf['default']['move']['path_filter']) ? self::$conf['default']['move']['path_filter'] : null;
$path_selector = !empty(self::$conf['default']['move']['path_selector']) ? self::$conf['default']['move']['path_selector'] : null;
if (\is_null($path_filter) && \is_null($path_selector)) {
return false;
}
if (\is_null($path_filter)) {
//选择器
if (\is_array($path_selector)) {
foreach ($path_selector as $pathName) {
if (strpos($path, $pathName)===0) { // 没用$path == $key判断是为了提高兼容性
return false;
}
}
echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL;
return true;
}
} elseif (\is_null($path_selector)) {
//过滤器
if (\is_array($path_filter)) {
foreach ($path_filter as $pathName) {
if (strpos($path, $pathName)===0) { // 没用$path == $key判断是为了提高兼容性
echo '已跳过!转移过滤器匹配到:'.$path.PHP_EOL;
return true;
}
}
return false;
}
} else {
//同时设置过滤器、选择器
if (\is_array($path_filter) && \is_array($path_selector)) {
//先过滤器
foreach ($path_filter as $pathName) {
if (strpos($path, $pathName)===0) {
echo '已跳过!转移过滤器匹配到:'.$path.PHP_EOL;
return true;
}
}
//后选择器
foreach ($path_selector as $pathName) {
if (strpos($path, $pathName)===0) {
return false;
}
}
echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL;
return true;
}
}
return false;
}
/**
* 微信模板消息拼接方法
* @return string 发送情况json

251
src/Reseed/MoveTorrent.php Normal file
View File

@ -0,0 +1,251 @@
<?php
namespace IYUU\Reseed;
use Curl\Curl;
use IYUU\Client\AbstractClient;
use IYUU\Library\IFile;
use IYUU\Library\Table;
use app\domain\Reseed as domainReseed;
use app\domain\Crontab as domainCrontab;
class MoveTorrent extends AutoReseed
{
/**
* 客户端转移做种 格式:['客户端key', '移动参数move']
* @var null
*/
private static $move = null;
/**
* IYUUAutoReseed做种客户端转移
*/
private static function move()
{
//遍历客户端
foreach (self::$links as $k => $v) {
if (self::$move[0] == $k) {
echo "clients_".$k."是目标转移客户端,避免冲突,已跳过!".PHP_EOL.PHP_EOL;
continue;
}
if (empty(self::$links[$k])) {
echo "clients_".$k." 用户名或密码未配置,已跳过".PHP_EOL.PHP_EOL;
continue;
}
echo "正在从下载器 clients_".$k." 获取种子哈希……".PHP_EOL;
$move = []; // 客户端做种列表 传址
$hashArray = self::$links[$k]['rpc']->all($move);
if (empty($hashArray)) {
// 失败
continue;
} else {
$infohash_Dir = $hashArray['hashString'];
// 写日志
wlog($hashArray, 'move'.$k);
}
// 前置过滤移除转移成功的hash
$rs = self::hashFilter($infohash_Dir);
if ($rs) {
echo "clients_".$k." 全部转移成功,本次无需转移!".PHP_EOL.PHP_EOL;
continue;
}
//遍历当前客户端种子
foreach ($infohash_Dir as $info_hash => $downloadDir) {
// 调用路径过滤
if (self::pathFilter($downloadDir)) {
continue;
}
// 做种实际路径与相对路径之间互转
echo '转换前:'.$downloadDir.PHP_EOL;
$downloadDir = self::pathReplace($downloadDir);
echo '转换后:'.$downloadDir.PHP_EOL;
if (is_null($downloadDir)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("全局配置的move数组内路径转换参数配置错误请重新配置".PHP_EOL);
}
// 种子目录:脚本要能够读取到
$path = self::$links[$k]['BT_backup'];
$torrentPath = '';
// 待删除种子
$torrentDelete = '';
// 获取种子原文件的实际路径
switch ($v['type']) {
case 'transmission':
// 优先使用API提供的种子路径
$torrentPath = $move[$info_hash]['torrentFile'];
$torrentDelete = $move[$info_hash]['id'];
// API提供的种子路径不存在时使用配置内指定的BT_backup路径
if (!is_file($torrentPath)) {
$torrentPath = str_replace("\\", "/", $torrentPath);
$torrentPath = $path . strrchr($torrentPath, '/');
}
break;
case 'qBittorrent':
if (empty($path)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("clients_".$k." 未设置种子的BT_backup目录无法完成转移");
}
$torrentPath = $path .DS. $info_hash . '.torrent';
$torrentDelete = $info_hash;
break;
default:
break;
}
if (!is_file($torrentPath)) {
echo 'IYUU自动转移做种客户端--使用教程 https://www.iyuu.cn/archives/351/'.PHP_EOL;
die("clients_".$k." 的种子文件{$torrentPath}不存在,无法完成转移!");
}
echo '存在种子:'.$torrentPath.PHP_EOL;
$torrent = file_get_contents($torrentPath);
// 正式开始转移
echo "种子已推送给下载器,正在转移做种...".PHP_EOL;
// 目标下载器类型
$rpcKey = self::$move[0];
$type = self::$links[$rpcKey]['type'];
$extra_options = array();
// 转移后,是否开始?
$extra_options['paused'] = isset(self::$conf['default']['move']['paused']) && self::$conf['default']['move']['paused'] ? true : false;
if ($type == 'qBittorrent') {
if (isset(self::$conf['default']['move']['skip_check']) && self::$conf['default']['move']['skip_check'] === 1) {
$extra_options['skip_checking'] = "true"; //转移成功,跳校验
}
}
// 添加转移任务成功返回true
$ret = self::add(self::$move[0], $torrent, $downloadDir, $extra_options);
/**
* 转移成功的种子写日志
*/
$log = $info_hash.PHP_EOL.$torrentPath.PHP_EOL.$downloadDir.PHP_EOL.PHP_EOL;
if ($ret) {
//转移成功时,删除做种,不删资源
if (isset(self::$conf['default']['move']['delete_torrent']) && self::$conf['default']['move']['delete_torrent'] === 1) {
self::$links[$k]['rpc']->delete($torrentDelete);
}
// 转移成功的种子以infohash为文件名写入缓存
wlog($log, $info_hash, self::$cacheMove);
wlog($log, 'MoveSuccess'.$k);
self::$wechatMsg['MoveSuccess']++;
} else {
// 失败的种子
wlog($log, 'MoveError'.$k);
self::$wechatMsg['MoveError']++;
}
}
}
}
/**
* 过滤已转移的种子hash
* @param array $infohash_Dir infohash与路径对应的字典
* @return bool true 过滤 | false 不过滤
*/
private static function hashFilter(&$infohash_Dir = array())
{
foreach ($infohash_Dir as $info_hash => $dir) {
if (is_file(self::$cacheMove . $info_hash.'.txt')) {
unset($infohash_Dir[$info_hash]);
echo '-------当前种子上次已成功转移,前置过滤已跳过! ' .PHP_EOL.PHP_EOL;
}
}
return empty($infohash_Dir) ? true : false;
}
/**
* 实际路径与相对路径之间互相转换
* @param string $path
* @return string | null string转换成功
*/
private static function pathReplace($path = '')
{
$type = intval(self::$conf['default']['move']['type']);
$pathArray = self::$conf['default']['move']['path'];
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
switch ($type) {
case 1: // 减
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) {
return substr($path, strlen($key));
}
}
break;
case 2: // 加
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) { // 没用$path == $key判断是为了提高兼容性
return $val . $path;
}
}
break;
case 3: // 替换
foreach ($pathArray as $key => $val) {
if (strpos($path, $key)===0) { // 没用$path == $key判断是为了提高兼容性
return $val . substr($path, strlen($key));
}
}
break;
default: // 不变
return $path;
break;
}
return null;
}
/**
* 处理转移种子时所设置的过滤器、选择器
* @param string $path
* @return bool true 过滤 | false 不过滤
*/
private static function pathFilter(&$path = '')
{
$path = rtrim($path, DIRECTORY_SEPARATOR); // 提高Windows转移兼容性
// 转移过滤器、选择器 David/2020年7月11日
$path_filter = !empty(self::$conf['default']['move']['path_filter']) ? self::$conf['default']['move']['path_filter'] : null;
$path_selector = !empty(self::$conf['default']['move']['path_selector']) ? self::$conf['default']['move']['path_selector'] : null;
if (\is_null($path_filter) && \is_null($path_selector)) {
return false;
}
if (\is_null($path_filter)) {
//选择器
if (\is_array($path_selector)) {
foreach ($path_selector as $pathName) {
if (strpos($path, $pathName)===0) { // 没用$path == $key判断是为了提高兼容性
return false;
}
}
echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL;
return true;
}
} elseif (\is_null($path_selector)) {
//过滤器
if (\is_array($path_filter)) {
foreach ($path_filter as $pathName) {
if (strpos($path, $pathName)===0) { // 没用$path == $key判断是为了提高兼容性
echo '已跳过!转移过滤器匹配到:'.$path.PHP_EOL;
return true;
}
}
return false;
}
} else {
//同时设置过滤器、选择器
if (\is_array($path_filter) && \is_array($path_selector)) {
//先过滤器
foreach ($path_filter as $pathName) {
if (strpos($path, $pathName)===0) {
echo '已跳过!转移过滤器匹配到:'.$path.PHP_EOL;
return true;
}
}
//后选择器
foreach ($path_selector as $pathName) {
if (strpos($path, $pathName)===0) {
return false;
}
}
echo '已跳过!转移选择器未匹配到:'.$path.PHP_EOL;
return true;
}
}
return false;
}
}