mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
Merge branch '1.9' into php8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.11');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-10-31');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-11-02');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -223,10 +223,6 @@ function formatAdUrl($adid, $url, $content, $newWindow=true)
|
||||
return formatUrl("adredir.php?id=".$adid."&url=".rawurlencode($url), $newWindow, $content);
|
||||
}
|
||||
function formatUrl($url, $newWindow = false, $text = '', $linkClass = '') {
|
||||
$src = filter_src($url);
|
||||
if (empty($src)) {
|
||||
return "";
|
||||
}
|
||||
if (!$text) {
|
||||
$text = $url;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -765,4 +766,36 @@ class Install
|
||||
$searchBoxRep->migrateToModeRelated();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化,注意这里不能使用 get_tracker_schema_and_host()。里面会调用 TrackerUrl, 这本来就是要往里面插入数据
|
||||
*
|
||||
* @param string $scene install or update
|
||||
* @return void
|
||||
*/
|
||||
public function initTrackerUrl(string $scene): void
|
||||
{
|
||||
if ($scene == "update") {
|
||||
$announceUrl = get_setting("security.https_announce_url");
|
||||
if (empty($announceUrl)) {
|
||||
$announceUrl = get_setting("basic.announce_url");
|
||||
}
|
||||
}
|
||||
if (empty($announceUrl)) {
|
||||
$announceUrl = sprintf(
|
||||
"%s/%s",
|
||||
trim($_SERVER['HTTP_HOST'], '/'), trim(DEFAULT_TRACKER_URI, '/')
|
||||
);
|
||||
}
|
||||
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('update');
|
||||
NexusDB::cache_del("nexus_plugin_store_all");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ if ($currentStep == 4) {
|
||||
$install->runDatabaseSeeder();
|
||||
$install->saveSettings($settings);
|
||||
$install->migrateSearchBoxModeRelated();
|
||||
$install->initTrackerUrl('install');
|
||||
$install->nextStep();
|
||||
} catch (\Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user