mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-26 21:37:22 +08:00
initTrackerUrl when fresh install
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace Nexus\Install;
|
namespace Nexus\Install;
|
||||||
|
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
|
use App\Models\TrackerUrl;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Repositories\SearchBoxRepository;
|
use App\Repositories\SearchBoxRepository;
|
||||||
use App\Repositories\UserRepository;
|
use App\Repositories\UserRepository;
|
||||||
@@ -763,4 +764,22 @@ class Install
|
|||||||
$searchBoxRep->migrateToModeRelated();
|
$searchBoxRep->migrateToModeRelated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initTrackerUrl(): void
|
||||||
|
{
|
||||||
|
$announceUrl = get_setting("security.https_announce_url");
|
||||||
|
if (empty($announceUrl)) {
|
||||||
|
$announceUrl = get_setting("basic.announce_url");
|
||||||
|
}
|
||||||
|
if (!str_starts_with($announceUrl, "http")) {
|
||||||
|
$announceUrl = (isHttps() ? "https://" : "http://"). $announceUrl;
|
||||||
|
}
|
||||||
|
TrackerUrl::query()->create([
|
||||||
|
"url" => $announceUrl,
|
||||||
|
"enabled" => 1,
|
||||||
|
"is_default" => 1,
|
||||||
|
]);
|
||||||
|
TrackerUrl::saveUrlCache();
|
||||||
|
$this->doLog("[initTrackerUrl] $announceUrl success.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,19 +364,7 @@ class Update extends Install
|
|||||||
}
|
}
|
||||||
if (!Schema::hasTable("tracker_urls")) {
|
if (!Schema::hasTable("tracker_urls")) {
|
||||||
$this->runMigrate("database/migrations/2025_06_19_194137_create_tracker_urls_table.php");
|
$this->runMigrate("database/migrations/2025_06_19_194137_create_tracker_urls_table.php");
|
||||||
$announceUrl = get_setting("security.https_announce_url");
|
$this->initTrackerUrl();
|
||||||
if (empty($announceUrl)) {
|
|
||||||
$announceUrl = get_setting("basic.announce_url");
|
|
||||||
}
|
|
||||||
if (!str_starts_with($announceUrl, "http")) {
|
|
||||||
$announceUrl = (isHttps() ? "https://" : "http://"). $announceUrl;
|
|
||||||
}
|
|
||||||
TrackerUrl::query()->create([
|
|
||||||
"url" => $announceUrl,
|
|
||||||
"enabled" => 1,
|
|
||||||
"is_default" => 1,
|
|
||||||
]);
|
|
||||||
TrackerUrl::saveUrlCache();
|
|
||||||
NexusDB::cache_del("nexus_plugin_store_all");
|
NexusDB::cache_del("nexus_plugin_store_all");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ if ($currentStep == 4) {
|
|||||||
$install->runDatabaseSeeder();
|
$install->runDatabaseSeeder();
|
||||||
$install->saveSettings($settings);
|
$install->saveSettings($settings);
|
||||||
$install->migrateSearchBoxModeRelated();
|
$install->migrateSearchBoxModeRelated();
|
||||||
|
$install->initTrackerUrl();
|
||||||
$install->nextStep();
|
$install->nextStep();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user