|
...
|
...
|
@@ -73,6 +73,7 @@ class ProjectUpdate extends Command |
|
|
|
$api_type = $task->api_type;
|
|
|
|
$api_url_arr = explode('?', $task->api_url);
|
|
|
|
$api_url = $api_url_arr[0];
|
|
|
|
$domain_arr = parse_url($api_url);
|
|
|
|
|
|
|
|
$page_size = 20;
|
|
|
|
|
|
...
|
...
|
@@ -81,26 +82,12 @@ class ProjectUpdate extends Command |
|
|
|
$task->status = UpdateLog::STATUS_ING;//同步中
|
|
|
|
$task->save();
|
|
|
|
|
|
|
|
$domain_arr = parse_url($api_url);
|
|
|
|
//获取网站配置
|
|
|
|
$link_type = 0;
|
|
|
|
$web_url_domain = $domain_arr['host'];
|
|
|
|
$home_url = $domain_arr['host'];
|
|
|
|
$url_web_config = 'https://' . $domain_arr['host'] . '/wp-content/cache/user_config.text';
|
|
|
|
$data_config = curl_c($url_web_config);
|
|
|
|
if ($data_config) {
|
|
|
|
$link_type = $data_config['link_type'] ?? 0;
|
|
|
|
|
|
|
|
$web_url_arr = parse_url($data_config['web_url_domain'] ?? '');
|
|
|
|
if (isset($web_url_arr['host'])) {
|
|
|
|
$web_url_domain = $web_url_arr['host'];
|
|
|
|
}
|
|
|
|
//获取站点原始域名信息
|
|
|
|
$old_info = getOldDomain($project_id, $domain_arr['host']);
|
|
|
|
$link_type = $old_info['link_type'];
|
|
|
|
$web_url_domain = $old_info['web_url_domain'];
|
|
|
|
$home_url = $old_info['home_url'];
|
|
|
|
|
|
|
|
$home_url_arr = parse_url($data_config['home_url'] ?? '');
|
|
|
|
if (isset($home_url_arr['host'])) {
|
|
|
|
$home_url = $home_url_arr['host'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取所有语种
|
|
|
|
$language_list = [];
|
|
|
|
$url_language = 'https://' . $domain_arr['host'] . '/wp-content/plugins/proofreading/json/user_language.json';
|
|
...
|
...
|
@@ -108,6 +95,7 @@ class ProjectUpdate extends Command |
|
|
|
if ($data_language) {
|
|
|
|
$language_list = array_column($data_language, 'short');
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取所有页面
|
|
|
|
$page_list = [];
|
|
|
|
$url_page = 'https://' . $domain_arr['host'] . '/wp-content/cache/pages_list.json';
|
|
...
|
...
|
@@ -623,8 +611,11 @@ class ProjectUpdate extends Command |
|
|
|
|
|
|
|
$url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path;
|
|
|
|
|
|
|
|
if ((empty($host) || $host == $web_url_domain || $host == $home_url) && $path) {
|
|
|
|
|
|
|
|
if (
|
|
|
|
(empty($scheme) || $scheme == 'https' || $scheme == 'http')
|
|
|
|
&& (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false))
|
|
|
|
&& $path
|
|
|
|
) {
|
|
|
|
$source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first();
|
|
|
|
if (!$source) {
|
|
|
|
$new_url = CosService::uploadRemote($project_id, 'image_product', $url_complete);
|
...
|
...
|
|