update dependencies basic

This commit is contained in:
xiaomlove
2024-12-25 22:30:55 +08:00
parent b9f5641985
commit 183d362076
14 changed files with 3628 additions and 4306 deletions

View File

@@ -31,6 +31,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command('cache:prune-stale-tags')->hourly();
$schedule->command('exam:assign_cronjob')->everyMinute()->withoutOverlapping(); $schedule->command('exam:assign_cronjob')->everyMinute()->withoutOverlapping();
$schedule->command('exam:checkout_cronjob')->everyFiveMinutes()->withoutOverlapping(); $schedule->command('exam:checkout_cronjob')->everyFiveMinutes()->withoutOverlapping();
$schedule->command('exam:update_progress --bulk=1')->hourly()->withoutOverlapping(); $schedule->command('exam:update_progress --bulk=1')->hourly()->withoutOverlapping();

View File

@@ -55,9 +55,9 @@ class Handler extends ExceptionHandler
}); });
//Other Only handle in json request //Other Only handle in json request
if (!request()->expectsJson()) { // if (!request()->expectsJson()) {
return; // return;
} // }
$this->renderable(function (AuthenticationException $e) { $this->renderable(function (AuthenticationException $e) {
return response()->json(fail($e->getMessage(), ['guards' => $e->guards()]), 401); return response()->json(fail($e->getMessage(), ['guards' => $e->guards()]), 401);

View File

@@ -17,7 +17,7 @@ class Kernel extends HttpKernel
protected $middleware = [ protected $middleware = [
// \App\Http\Middleware\TrustHosts::class, // \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class, \Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class, \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,

View File

@@ -23,9 +23,6 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function register() public function register()
{ {
if (class_exists(Passport::class)) {
Passport::ignoreMigrations();
}
do_action('nexus_register'); do_action('nexus_register');
} }

View File

@@ -55,7 +55,7 @@ class AuthServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
$this->registerPolicies(); // $this->registerPolicies();
if (class_exists(Passport::class)) { if (class_exists(Passport::class)) {
Passport::useClientModel(OauthClient::class); Passport::useClientModel(OauthClient::class);
} }

View File

@@ -48,7 +48,7 @@ class CommentRepository extends BaseRepository
$target->save(); $target->save();
$userUpdate = [ $userUpdate = [
'seedbonus' => DB::raw('seedbonus + ' . Setting::get('bonus.addcomment')), 'seedbonus' => NexusDB::raw('seedbonus + ' . Setting::get('bonus.addcomment')),
'last_comment' => Carbon::now(), 'last_comment' => Carbon::now(),
]; ];
$user->update($userUpdate); $user->update($userUpdate);

View File

@@ -50,7 +50,7 @@ class DashboardRepository extends BaseRepository
$result[$name] = [ $result[$name] = [
'name' => $name, 'name' => $name,
'text' => nexus_trans("dashboard.system_info.$name"), 'text' => nexus_trans("dashboard.system_info.$name"),
'value' => DB::select(DB::raw('select version() as info'))[0]->info, 'value' => NexusDB::select('select version() as info')[0]['info'],
]; ];
// $name = 'os'; // $name = 'os';
// $result[$name] = [ // $result[$name] = [

View File

@@ -486,7 +486,7 @@ class HitAndRunRepository extends BaseRepository
private function getCommentUpdateRaw($comment): \Illuminate\Database\Query\Expression private function getCommentUpdateRaw($comment): \Illuminate\Database\Query\Expression
{ {
return DB::raw(sprintf("if (comment = '', '%s', concat('\n', '%s', comment))", $comment, $comment)); return NexusDB::raw(sprintf("if (comment = '', '%s', concat('\n', '%s', comment))", $comment, $comment));
} }
private function getCanPardonStatus(): array private function getCanPardonStatus(): array

View File

@@ -21,7 +21,7 @@
] ]
}, },
"require": { "require": {
"php": "^8.0", "php": "^8.2",
"ext-bcmath": "*", "ext-bcmath": "*",
"ext-curl": "*", "ext-curl": "*",
"ext-gd": "*", "ext-gd": "*",
@@ -35,38 +35,34 @@
"ext-zend-opcache": "*", "ext-zend-opcache": "*",
"doctrine/dbal": "^3.1", "doctrine/dbal": "^3.1",
"elasticsearch/elasticsearch": "^7.16", "elasticsearch/elasticsearch": "^7.16",
"filament/filament": "2.17.14", "filament/filament": "^3.2",
"flowframe/laravel-trend": "^0.1.1", "flowframe/laravel-trend": "^0.3",
"fruitcake/laravel-cors": "^2.0",
"geoip2/geoip2": "~2.0", "geoip2/geoip2": "~2.0",
"hashids/hashids": "^4.1", "google/auth": "1.44.0",
"imdbphp/imdbphp": "^7.0", "imdbphp/imdbphp": "^8.0",
"irazasyed/telegram-bot-sdk": "^3.11", "irazasyed/telegram-bot-sdk": "^3.11",
"laravel/framework": "v9.52.17", "laravel/framework": "^11.0",
"laravel/octane": "^1.2", "laravel/passport": "^12.0",
"laravel/passport": "^11.10", "laravel/sanctum": "^4.0",
"laravel/sanctum": "^2.10",
"laravel/tinker": "^2.5", "laravel/tinker": "^2.5",
"league/flysystem-ftp": "^3.0",
"league/flysystem-sftp-v3": "^3.0", "league/flysystem-sftp-v3": "^3.0",
"masbug/flysystem-google-drive-ext": "^2.0", "masbug/flysystem-google-drive-ext": "^2.0",
"meilisearch/meilisearch-php": "^1.0", "meilisearch/meilisearch-php": "^1.0",
"orangehill/iseed": "^3.0", "orangehill/iseed": "^3.0",
"phpgangsta/googleauthenticator": "dev-master", "phpgangsta/googleauthenticator": "dev-master",
"rhilip/bencode": "^2.0", "rhilip/bencode": "^2.0",
"rlanvin/php-ip": "^3.0", "rlanvin/php-ip": "^3.0"
"spiral/roadrunner": "^2.8"
}, },
"require-dev": { "require-dev": {
"spatie/laravel-ignition": "^1.0",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"kitloong/laravel-migrations-generator": "^5.0", "filament/upgrade": "^3.2",
"laravel/sail": "^1.0.1", "kitloong/laravel-migrations-generator": "^7.0",
"laravel-lang/lang": "^10.2", "laravel-lang/lang": "^15.10",
"laravel-lang/publisher": "^12.0", "laravel-lang/publisher": "^16.0",
"mockery/mockery": "^1.4.2", "mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^6.1", "nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^9.3.3" "phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {

7615
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,228 +0,0 @@
<?php
use Laravel\Octane\Contracts\OperationTerminated;
use Laravel\Octane\Events\RequestHandled;
use Laravel\Octane\Events\RequestReceived;
use Laravel\Octane\Events\RequestTerminated;
use Laravel\Octane\Events\TaskReceived;
use Laravel\Octane\Events\TaskTerminated;
use Laravel\Octane\Events\TickReceived;
use Laravel\Octane\Events\TickTerminated;
use Laravel\Octane\Events\WorkerErrorOccurred;
use Laravel\Octane\Events\WorkerStarting;
use Laravel\Octane\Events\WorkerStopping;
use Laravel\Octane\Listeners\CollectGarbage;
use Laravel\Octane\Listeners\DisconnectFromDatabases;
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
use Laravel\Octane\Listeners\ReportException;
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
use Laravel\Octane\Octane;
return [
/*
|--------------------------------------------------------------------------
| Octane Server
|--------------------------------------------------------------------------
|
| This value determines the default "server" that will be used by Octane
| when starting, restarting, or stopping your server via the CLI. You
| are free to change this to the supported server of your choosing.
|
| Supported: "roadrunner", "swoole"
|
*/
'server' => env('OCTANE_SERVER', 'roadrunner'),
/*
|--------------------------------------------------------------------------
| Force HTTPS
|--------------------------------------------------------------------------
|
| When this configuration value is set to "true", Octane will inform the
| framework that all absolute links must be generated using the HTTPS
| protocol. Otherwise your links may be generated using plain HTTP.
|
*/
'https' => env('OCTANE_HTTPS', false),
/*
|--------------------------------------------------------------------------
| Octane Listeners
|--------------------------------------------------------------------------
|
| All of the event listeners for Octane's events are defined below. These
| listeners are responsible for resetting your application's state for
| the next request. You may even add your own listeners to the list.
|
*/
'listeners' => [
WorkerStarting::class => [
EnsureUploadedFilesAreValid::class,
EnsureUploadedFilesCanBeMoved::class,
],
RequestReceived::class => [
...Octane::prepareApplicationForNextOperation(),
...Octane::prepareApplicationForNextRequest(),
\App\Listeners\ResetNexus::class,
],
RequestHandled::class => [
],
RequestTerminated::class => [
],
TaskReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TaskTerminated::class => [
//
],
TickReceived::class => [
...Octane::prepareApplicationForNextOperation(),
//
],
TickTerminated::class => [
//
],
OperationTerminated::class => [
FlushTemporaryContainerInstances::class,
// DisconnectFromDatabases::class,
// CollectGarbage::class,
],
WorkerErrorOccurred::class => [
ReportException::class,
StopWorkerIfNecessary::class,
],
WorkerStopping::class => [
//
],
],
/*
|--------------------------------------------------------------------------
| Warm / Flush Bindings
|--------------------------------------------------------------------------
|
| The bindings listed below will either be pre-warmed when a worker boots
| or they will be flushed before every new request. Flushing a binding
| will force the container to resolve that binding again when asked.
|
*/
'warm' => [
...Octane::defaultServicesToWarm(),
],
'flush' => [
//
],
/*
|--------------------------------------------------------------------------
| Octane Cache Table
|--------------------------------------------------------------------------
|
| While using Swoole, you may leverage the Octane cache, which is powered
| by a Swoole table. You may set the maximum number of rows as well as
| the number of bytes per row using the configuration options below.
|
*/
'cache' => [
'rows' => 1000,
'bytes' => 10000,
],
/*
|--------------------------------------------------------------------------
| Octane Swoole Tables
|--------------------------------------------------------------------------
|
| While using Swoole, you may define additional tables as required by the
| application. These tables can be used to store data that needs to be
| quickly accessed by other workers on the particular Swoole server.
|
*/
'tables' => [
'example:1000' => [
'name' => 'string:1000',
'votes' => 'int',
],
],
/*
|--------------------------------------------------------------------------
| File Watching
|--------------------------------------------------------------------------
|
| The following list of files and directories will be watched when using
| the --watch option offered by Octane. If any of the directories and
| files are changed, Octane will automatically reload your workers.
|
*/
'watch' => [
'app',
'bootstrap',
'config',
'database',
'public/**/*.php',
'resources/**/*.php',
'routes',
'composer.lock',
'.env',
'include/**/*.php',
],
/*
|--------------------------------------------------------------------------
| Garbage Collection Threshold
|--------------------------------------------------------------------------
|
| When executing long-lived PHP scripts such as Octane, memory can build
| up before being cleared by PHP. You can force Octane to run garbage
| collection if your application consumes this amount of megabytes.
|
*/
'garbage' => 50,
/*
|--------------------------------------------------------------------------
| Maximum Execution Time
|--------------------------------------------------------------------------
|
| The following setting configures the maximum execution time for requests
| being handled by Octane. You may set this value to 0 to indicate that
| there isn't a specific time limit on Octane request execution time.
|
*/
'max_execution_time' => 30,
'swoole' => [
'options' => [
'log_file' => env('LOG_FILE', '/tmp/nexus.log'),
'package_max_length' => 10 * 1024 * 1024,
],
],
];

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('personal_access_tokens', function (Blueprint $table) {
$table->timestamp('expires_at')->nullable()->after('last_used_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('personal_access_tokens', function (Blueprint $table) {
//
});
}
};

View File

@@ -51,7 +51,10 @@ class Plugin
private function bootPlugins() private function bootPlugins()
{ {
foreach (self::$providers as $name => $providers) { foreach (self::$providers as $providers) {
if (!isset($providers['providers'])) {
continue;
}
$provider = $providers['providers'][0]; $provider = $providers['providers'][0];
$parts = explode('\\', $provider); $parts = explode('\\', $provider);
if ($parts[0] == 'NexusPlugin') { if ($parts[0] == 'NexusPlugin') {

View File

@@ -12,7 +12,7 @@
<directory suffix="Test.php">./tests/Feature</directory> <directory suffix="Test.php">./tests/Feature</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<coverage processUncoveredFiles="true"> <coverage>
<include> <include>
<directory suffix=".php">./app</directory> <directory suffix=".php">./app</directory>
</include> </include>