+ Add tips for repo server cannot connect.

This commit is contained in:
caoyanyi
2024-02-28 15:00:35 +08:00
parent 2adb01a442
commit 23bfe399aa
2 changed files with 10 additions and 3 deletions
+4 -2
View File
@@ -379,11 +379,13 @@ class adminModel extends model
* @access public
* @return bool
*/
public function checkInternet(): bool
public function checkInternet($url = ''): bool
{
if(empty($url)) $url = $this->config->admin->apiSite;
$timeout = 1;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->config->admin->apiSite);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);