mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
initTrackerUrl when fresh install
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Nexus\Install;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\TrackerUrl;
|
||||
use App\Models\User;
|
||||
use App\Repositories\SearchBoxRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
@@ -763,4 +764,22 @@ class Install
|
||||
$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")) {
|
||||
$this->runMigrate("database/migrations/2025_06_19_194137_create_tracker_urls_table.php");
|
||||
$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->initTrackerUrl();
|
||||
NexusDB::cache_del("nexus_plugin_store_all");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ if ($currentStep == 4) {
|
||||
$install->runDatabaseSeeder();
|
||||
$install->saveSettings($settings);
|
||||
$install->migrateSearchBoxModeRelated();
|
||||
$install->initTrackerUrl();
|
||||
$install->nextStep();
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user