mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
fix: correct know file issues
This commit is contained in:
parent
d54eabb617
commit
1f31c6b585
@ -4,6 +4,8 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Google\Cloud\Storage\StorageClient;
|
use Google\Cloud\Storage\StorageClient;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Symfony\Component\Process\Process;
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
class BackupDatabase extends Command
|
class BackupDatabase extends Command
|
||||||
@ -85,14 +87,14 @@ class BackupDatabase extends Command
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// 输出文件链接
|
// 输出文件链接
|
||||||
\Log::channel('backup')->info("🎉:数据库备份已上传到 Google Cloud Storage: $objectName");
|
Log::channel('backup')->info("🎉:数据库备份已上传到 Google Cloud Storage: $objectName");
|
||||||
$this->info("🎉:数据库备份已上传到 Google Cloud Storage: $objectName");
|
$this->info("🎉:数据库备份已上传到 Google Cloud Storage: $objectName");
|
||||||
\File::delete($compressedBackupPath);
|
File::delete($compressedBackupPath);
|
||||||
}
|
}
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
\Log::channel('backup')->error("😔:数据库备份失败 \n" . $e);
|
Log::channel('backup')->error("😔:数据库备份失败 \n" . $e);
|
||||||
$this->error("😔:数据库备份失败\n" . $e);
|
$this->error("😔:数据库备份失败\n" . $e);
|
||||||
\File::delete($compressedBackupPath);
|
File::delete($compressedBackupPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class ExportV2Log extends Command
|
class ExportV2Log extends Command
|
||||||
{
|
{
|
||||||
@ -20,7 +21,7 @@ class ExportV2Log extends Command
|
|||||||
$days = $this->argument('days');
|
$days = $this->argument('days');
|
||||||
$date = Carbon::now()->subDays($days)->startOfDay();
|
$date = Carbon::now()->subDays($days)->startOfDay();
|
||||||
|
|
||||||
$logs = \DB::table('v2_log')
|
$logs = DB::table('v2_log')
|
||||||
->where('created_at', '>=', $date->timestamp)
|
->where('created_at', '>=', $date->timestamp)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ namespace App\Console\Commands;
|
|||||||
|
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class MigrateFromV2b extends Command
|
class MigrateFromV2b extends Command
|
||||||
{
|
{
|
||||||
@ -132,7 +134,7 @@ class MigrateFromV2b extends Command
|
|||||||
try {
|
try {
|
||||||
foreach ($sqlCommands[$version] as $sqlCommand) {
|
foreach ($sqlCommands[$version] as $sqlCommand) {
|
||||||
// Execute SQL command
|
// Execute SQL command
|
||||||
\DB::statement($sqlCommand);
|
DB::statement($sqlCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info('1️⃣、数据库差异矫正成功');
|
$this->info('1️⃣、数据库差异矫正成功');
|
||||||
@ -158,7 +160,7 @@ class MigrateFromV2b extends Command
|
|||||||
|
|
||||||
public function MigrateV2ConfigToV2Settings()
|
public function MigrateV2ConfigToV2Settings()
|
||||||
{
|
{
|
||||||
\Artisan::call('config:clear');
|
Artisan::call('config:clear');
|
||||||
$configValue = config('v2board') ?? [];
|
$configValue = config('v2board') ?? [];
|
||||||
|
|
||||||
foreach ($configValue as $k => $v) {
|
foreach ($configValue as $k => $v) {
|
||||||
@ -176,7 +178,7 @@ class MigrateFromV2b extends Command
|
|||||||
]);
|
]);
|
||||||
$this->info("配置 {$k} 迁移成功");
|
$this->info("配置 {$k} 迁移成功");
|
||||||
}
|
}
|
||||||
\Artisan::call('config:cache');
|
Artisan::call('config:cache');
|
||||||
|
|
||||||
$this->info('所有配置迁移完成');
|
$this->info('所有配置迁移完成');
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@ use Illuminate\Encryption\Encrypter;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
use Illuminate\Support\Env;
|
use Illuminate\Support\Env;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
use function Laravel\Prompts\confirm;
|
use function Laravel\Prompts\confirm;
|
||||||
use function Laravel\Prompts\text;
|
use function Laravel\Prompts\text;
|
||||||
use function Laravel\Prompts\note;
|
use function Laravel\Prompts\note;
|
||||||
@ -55,7 +59,7 @@ class XboardInstall extends Command
|
|||||||
$this->info(" / /\ \ | |_) | (_) | (_| | | | (_| | ");
|
$this->info(" / /\ \ | |_) | (_) | (_| | | | (_| | ");
|
||||||
$this->info("/_/ \_\|____/ \___/ \__,_|_| \__,_| ");
|
$this->info("/_/ \_\|____/ \___/ \__,_|_| \__,_| ");
|
||||||
if (
|
if (
|
||||||
(\File::exists(base_path() . '/.env') && $this->getEnvValue('INSTALLED'))
|
(File::exists(base_path() . '/.env') && $this->getEnvValue('INSTALLED'))
|
||||||
|| (env('INSTALLED', false) && $isDocker)
|
|| (env('INSTALLED', false) && $isDocker)
|
||||||
) {
|
) {
|
||||||
$securePath = admin_setting('secure_path', admin_setting('frontend_admin_path', hash('crc32b', config('app.key'))));
|
$securePath = admin_setting('secure_path', admin_setting('frontend_admin_path', hash('crc32b', config('app.key'))));
|
||||||
@ -86,11 +90,11 @@ class XboardInstall extends Command
|
|||||||
'DB_PASSWORD' => '',
|
'DB_PASSWORD' => '',
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
\Config::set("database.default", 'sqlite');
|
Config::set("database.default", 'sqlite');
|
||||||
\Config::set("database.connections.sqlite.database", base_path($envConfig['DB_DATABASE']));
|
Config::set("database.connections.sqlite.database", base_path($envConfig['DB_DATABASE']));
|
||||||
\DB::purge('sqlite');
|
DB::purge('sqlite');
|
||||||
\DB::connection('sqlite')->getPdo();
|
DB::connection('sqlite')->getPdo();
|
||||||
if (!blank(\DB::connection('sqlite')->getPdo()->query("SELECT name FROM sqlite_master WHERE type='table'")->fetchAll(\PDO::FETCH_COLUMN))) {
|
if (!blank(DB::connection('sqlite')->getPdo()->query("SELECT name FROM sqlite_master WHERE type='table'")->fetchAll(\PDO::FETCH_COLUMN))) {
|
||||||
if (confirm(label: '检测到数据库中已经存在数据,是否要清空数据库以便安装新的数据?', default: false, yes: '清空', no: '退出安装')) {
|
if (confirm(label: '检测到数据库中已经存在数据,是否要清空数据库以便安装新的数据?', default: false, yes: '清空', no: '退出安装')) {
|
||||||
$this->info('正在清空数据库请稍等');
|
$this->info('正在清空数据库请稍等');
|
||||||
$this->call('db:wipe', ['--force' => true]);
|
$this->call('db:wipe', ['--force' => true]);
|
||||||
@ -115,16 +119,16 @@ class XboardInstall extends Command
|
|||||||
'DB_PASSWORD' => text(label: '请输入数据库密码', required: false),
|
'DB_PASSWORD' => text(label: '请输入数据库密码', required: false),
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
\Config::set("database.default", 'mysql');
|
Config::set("database.default", 'mysql');
|
||||||
\Config::set("database.connections.mysql.host", $envConfig['DB_HOST']);
|
Config::set("database.connections.mysql.host", $envConfig['DB_HOST']);
|
||||||
\Config::set("database.connections.mysql.port", $envConfig['DB_PORT']);
|
Config::set("database.connections.mysql.port", $envConfig['DB_PORT']);
|
||||||
\Config::set("database.connections.mysql.database", $envConfig['DB_DATABASE']);
|
Config::set("database.connections.mysql.database", $envConfig['DB_DATABASE']);
|
||||||
\Config::set("database.connections.mysql.username", $envConfig['DB_USERNAME']);
|
Config::set("database.connections.mysql.username", $envConfig['DB_USERNAME']);
|
||||||
\Config::set("database.connections.mysql.password", $envConfig['DB_PASSWORD']);
|
Config::set("database.connections.mysql.password", $envConfig['DB_PASSWORD']);
|
||||||
\DB::purge('mysql');
|
DB::purge('mysql');
|
||||||
\DB::connection('mysql')->getPdo();
|
DB::connection('mysql')->getPdo();
|
||||||
$isMysqlValid = true;
|
$isMysqlValid = true;
|
||||||
if (!blank(\DB::connection('mysql')->select('SHOW TABLES'))) {
|
if (!blank(DB::connection('mysql')->select('SHOW TABLES'))) {
|
||||||
if (confirm(label: '检测到数据库中已经存在数据,是否要清空数据库以便安装新的数据?', default: false, yes: '清空', no: '不清空')) {
|
if (confirm(label: '检测到数据库中已经存在数据,是否要清空数据库以便安装新的数据?', default: false, yes: '清空', no: '不清空')) {
|
||||||
$this->info('正在清空数据库请稍等');
|
$this->info('正在清空数据库请稍等');
|
||||||
$this->call('db:wipe', ['--force' => true]);
|
$this->call('db:wipe', ['--force' => true]);
|
||||||
@ -192,10 +196,10 @@ class XboardInstall extends Command
|
|||||||
$this->saveToEnv($envConfig);
|
$this->saveToEnv($envConfig);
|
||||||
|
|
||||||
$this->call('config:cache');
|
$this->call('config:cache');
|
||||||
\Artisan::call('cache:clear');
|
Artisan::call('cache:clear');
|
||||||
$this->info('正在导入数据库请稍等...');
|
$this->info('正在导入数据库请稍等...');
|
||||||
\Artisan::call("migrate", ['--force' => true]);
|
Artisan::call("migrate", ['--force' => true]);
|
||||||
$this->info(\Artisan::output());
|
$this->info(Artisan::output());
|
||||||
$this->info('数据库导入完成');
|
$this->info('数据库导入完成');
|
||||||
$this->info('开始注册管理员账号');
|
$this->info('开始注册管理员账号');
|
||||||
if (!$this->registerAdmin($email, $password)) {
|
if (!$this->registerAdmin($email, $password)) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use App\Models\Plan;
|
|
||||||
|
|
||||||
return new class extends Migration {
|
return new class extends Migration {
|
||||||
/**
|
/**
|
||||||
@ -39,7 +37,7 @@ return new class extends Migration {
|
|||||||
->count();
|
->count();
|
||||||
|
|
||||||
if ($unconvertedCount > 0) {
|
if ($unconvertedCount > 0) {
|
||||||
\Log::warning("Found {$unconvertedCount} orders with unconverted period values");
|
Log::warning("Found {$unconvertedCount} orders with unconverted period values");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,4 +53,4 @@ return new class extends Migration {
|
|||||||
->update(['period' => $oldPeriod]);
|
->update(['period' => $oldPeriod]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Broadcast Channels
|
| Broadcast Channels
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use App\Services\ThemeService;
|
use App\Services\ThemeService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user