mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-05-18 06:37:28 +08:00
improve initTrackerUrl()
This commit is contained in:
@@ -764,11 +764,25 @@ class Install
|
|||||||
$searchBoxRep->migrateToModeRelated();
|
$searchBoxRep->migrateToModeRelated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initTrackerUrl(): void
|
/**
|
||||||
|
* 初始化,注意这里不能使用 get_tracker_schema_and_host()。里面会调用 TrackerUrl, 这本来就是要往里面插入数据
|
||||||
|
*
|
||||||
|
* @param string $scene install or update
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initTrackerUrl(string $scene): void
|
||||||
{
|
{
|
||||||
$announceUrl = get_setting("security.https_announce_url");
|
if ($scene == "update") {
|
||||||
|
$announceUrl = get_setting("security.https_announce_url");
|
||||||
|
if (empty($announceUrl)) {
|
||||||
|
$announceUrl = get_setting("basic.announce_url");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (empty($announceUrl)) {
|
if (empty($announceUrl)) {
|
||||||
$announceUrl = get_setting("basic.announce_url");
|
$announceUrl = sprintf(
|
||||||
|
"%s/%s",
|
||||||
|
trim($_SERVER['HTTP_HOST'], '/'), trim(DEFAULT_TRACKER_URI, '/')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!str_starts_with($announceUrl, "http")) {
|
if (!str_starts_with($announceUrl, "http")) {
|
||||||
$announceUrl = (isHttps() ? "https://" : "http://"). $announceUrl;
|
$announceUrl = (isHttps() ? "https://" : "http://"). $announceUrl;
|
||||||
|
|||||||
Reference in New Issue
Block a user