From 7aa1f8936dcee49c5aca250083d98267197bb850 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 30 Aug 2026 22:51:39 +0930 Subject: [PATCH] Revert "Merge pull request #6981 from pixelfed/chore/laravel12-skeleton-uplift" This reverts commit 39384e2f9339505a776964bffdac5cf15ba4f2f8, reversing changes made to f76bcfa3f9478cadb2c5bc8bfeb04dacf89788fb. --- artisan | 49 ++++++++-- composer.json | 8 +- config/app.php | 96 +++++++++++++------ config/cache.php | 8 +- config/database.php | 6 -- config/logging.php | 28 ++---- config/mail.php | 1 - config/queue.php | 44 +++------ config/session.php | 16 ++-- .../{seeders => seeds}/DatabaseSeeder.php | 6 +- public/index.php | 61 ++++++++++-- 11 files changed, 202 insertions(+), 121 deletions(-) rename database/{seeders => seeds}/DatabaseSeeder.php (76%) diff --git a/artisan b/artisan index c35e31d6a..5c23e2e24 100644 --- a/artisan +++ b/artisan @@ -1,18 +1,53 @@ #!/usr/bin/env php handleCommand(new ArgvInput); +/* +|-------------------------------------------------------------------------- +| Run The Artisan Application +|-------------------------------------------------------------------------- +| +| When we run the console application, the current CLI command will be +| executed in this console and the response sent back to a terminal +| or another output device for the developers. Here goes nothing! +| +*/ + +$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); + +$status = $kernel->handle( + $input = new Symfony\Component\Console\Input\ArgvInput, + new Symfony\Component\Console\Output\ConsoleOutput +); + +/* +|-------------------------------------------------------------------------- +| Shutdown The Application +|-------------------------------------------------------------------------- +| +| Once Artisan has finished running, we will fire off the shutdown events +| so that any final work may be done by the application before we shut +| down the process. This is the last thing to happen to the request. +| +*/ + +$kernel->terminate($input, $status); exit($status); diff --git a/composer.json b/composer.json index 09ef1818b..184ffb399 100644 --- a/composer.json +++ b/composer.json @@ -59,10 +59,12 @@ "vimeo/psalm": "^6.5" }, "autoload": { + "classmap": [ + "database/seeds", + "database/factories" + ], "psr-4": { - "App\\": "app/", - "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" + "App\\": "app/" }, "files": [ "app/helpers.php" diff --git a/config/app.php b/config/app.php index 42c0cc558..a6f5dbb1c 100644 --- a/config/app.php +++ b/config/app.php @@ -1,7 +1,39 @@ 'AES-256-CBC', - 'previous_keys' => [ - ...array_filter( - explode(',', (string) env('APP_PREVIOUS_KEYS', '')) - ), - ], - - /* - |-------------------------------------------------------------------------- - | Maintenance Mode Driver - |-------------------------------------------------------------------------- - | - | These configuration options determine the driver used to determine and - | manage Laravel's "maintenance mode" status. The "cache" driver will - | allow maintenance mode to be controlled across multiple machines. - | - | Supported drivers: "file", "cache" - | - */ - - 'maintenance' => [ - 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), - 'store' => env('APP_MAINTENANCE_STORE', 'database'), - ], - 'short_description' => env('PF_SHORT_DESCRIPTION', 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.'), 'description' => env('PF_DESCRIPTION', 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.'), 'rules' => env('PF_RULES', null), @@ -157,8 +165,42 @@ return [ | */ - 'aliases' => Facade::defaultAliases()->merge([ + 'aliases' => [ + 'App' => App::class, + 'Artisan' => Artisan::class, + 'Auth' => Auth::class, + 'Blade' => Blade::class, + 'Broadcast' => Broadcast::class, + 'Bus' => Bus::class, + 'Cache' => Cache::class, + 'Config' => Config::class, + 'Cookie' => Cookie::class, + 'Crypt' => Crypt::class, + 'DB' => DB::class, + 'Event' => Event::class, + 'File' => File::class, + 'Gate' => Gate::class, + 'Hash' => Hash::class, + 'Lang' => Lang::class, + 'Log' => Log::class, + 'Mail' => Mail::class, + 'Notification' => Notification::class, + 'Password' => Password::class, + 'Queue' => Queue::class, + 'Redirect' => Redirect::class, + 'Redis' => Redis::class, + 'Request' => Request::class, + 'Response' => Response::class, + 'Route' => Route::class, + 'Schema' => Schema::class, + 'Session' => Session::class, + 'Storage' => Storage::class, + 'URL' => URL::class, + 'Validator' => Validator::class, + 'View' => View::class, + 'Str' => Str::class, + 'PrettyNumber' => PrettyNumber::class, - ])->toArray(), + ], ]; diff --git a/config/cache.php b/config/cache.php index aa17afc6a..212623523 100644 --- a/config/cache.php +++ b/config/cache.php @@ -43,9 +43,9 @@ return [ 'database' => [ 'driver' => 'database', - 'table' => env('DB_CACHE_TABLE', 'cache'), - 'connection' => env('DB_CACHE_CONNECTION'), - 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), + 'table' => 'cache', + 'connection' => null, + 'lock_connection' => null, ], 'file' => [ @@ -75,7 +75,7 @@ return [ 'redis' => [ 'driver' => 'redis', - 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), + 'lock_connection' => 'default', 'client' => env('REDIS_CLIENT', 'predis'), 'default' => [ diff --git a/config/database.php b/config/database.php index e2131ccb4..89ce75525 100644 --- a/config/database.php +++ b/config/database.php @@ -54,9 +54,6 @@ return [ 'prefix' => '', 'strict' => env('DB_STRICT', false), 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - (class_exists('Pdo\Mysql') ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), - ]) : [], 'dump' => [ 'use_single_transaction', 'skip_lock_tables', @@ -141,7 +138,6 @@ return [ 'scheme' => env('REDIS_SCHEME', 'tcp'), 'path' => env('REDIS_PATH'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'username' => env('REDIS_USERNAME', null), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE', 0), @@ -151,7 +147,6 @@ return [ 'scheme' => env('REDIS_SCHEME', 'tcp'), 'path' => env('REDIS_PATH'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'username' => env('REDIS_USERNAME', null), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE_SESSION', 1), @@ -161,7 +156,6 @@ return [ 'scheme' => env('REDIS_SCHEME', 'tcp'), 'path' => env('REDIS_PATH'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'username' => env('REDIS_USERNAME', null), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => env('REDIS_DATABASE_PULSE', 2), diff --git a/config/logging.php b/config/logging.php index 451b4ccf3..001bf2d10 100644 --- a/config/logging.php +++ b/config/logging.php @@ -18,22 +18,6 @@ return [ 'default' => env('LOG_CHANNEL', 'stack'), - /* - |-------------------------------------------------------------------------- - | Deprecations Log Channel - |-------------------------------------------------------------------------- - | - | This option controls the log channel that should be used to log warnings - | regarding deprecated PHP and library features. This allows you to get - | your application ready for upcoming major versions of dependencies. - | - */ - - 'deprecations' => [ - 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => env('LOG_DEPRECATIONS_TRACE', false), - ], - /* |-------------------------------------------------------------------------- | Log Channels @@ -65,16 +49,16 @@ return [ 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => env('LOG_DAILY_DAYS', 14), + 'level' => 'debug', + 'days' => 14, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), - 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), - 'level' => env('LOG_LEVEL', 'critical'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => 'critical', ], 'stderr' => [ @@ -94,7 +78,7 @@ return [ 'errorlog' => [ 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), + 'level' => 'debug', ], 'null' => [ diff --git a/config/mail.php b/config/mail.php index 63af8ffcd..175e9a79a 100644 --- a/config/mail.php +++ b/config/mail.php @@ -36,7 +36,6 @@ return [ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', - 'scheme' => env('MAIL_SCHEME'), 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', '127.0.0.1'), 'port' => env('MAIL_PORT', 2525), diff --git a/config/queue.php b/config/queue.php index 5ab37999a..c3e6507b9 100644 --- a/config/queue.php +++ b/config/queue.php @@ -36,57 +36,38 @@ return [ 'database' => [ 'driver' => 'database', - 'connection' => env('DB_QUEUE_CONNECTION'), - 'table' => env('DB_QUEUE_TABLE', 'jobs'), - 'queue' => env('DB_QUEUE', 'default'), - 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', - 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), - 'queue' => env('BEANSTALKD_QUEUE', 'default'), - 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), - 'block_for' => 0, + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => env('SQS_KEY', env('AWS_ACCESS_KEY_ID', 'your-public-key')), - 'secret' => env('SQS_SECRET', env('AWS_SECRET_ACCESS_KEY', 'your-secret-key')), + 'key' => env('SQS_KEY', 'your-public-key'), + 'secret' => env('SQS_SECRET', 'your-secret-key'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'your-queue-name'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('SQS_REGION', env('AWS_DEFAULT_REGION', 'us-east-1')), + 'region' => env('SQS_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', - 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 1800), + 'connection' => 'default', + 'queue' => 'default', + 'retry_after' => 1800, 'block_for' => null, 'after_commit' => true, ], ], - /* - |-------------------------------------------------------------------------- - | Job Batching - |-------------------------------------------------------------------------- - | - | The following options configure the database and table that store job - | batching information. These options can be updated to any database - | connection and table which has been defined by your application. - | - */ - - 'batching' => [ - 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'job_batches', - ], - /* |-------------------------------------------------------------------------- | Failed Queue Jobs @@ -99,7 +80,6 @@ return [ */ 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], diff --git a/config/session.php b/config/session.php index e234c1117..d3e982bd4 100644 --- a/config/session.php +++ b/config/session.php @@ -31,7 +31,7 @@ return [ 'lifetime' => env('SESSION_LIFETIME', 86400), - 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), + 'expire_on_close' => false, /* |-------------------------------------------------------------------------- @@ -44,7 +44,7 @@ return [ | */ - 'encrypt' => env('SESSION_ENCRYPT', false), + 'encrypt' => false, /* |-------------------------------------------------------------------------- @@ -83,7 +83,7 @@ return [ | */ - 'table' => env('SESSION_TABLE', 'sessions'), + 'table' => 'sessions', /* |-------------------------------------------------------------------------- @@ -122,7 +122,7 @@ return [ | */ - 'cookie' => env('SESSION_COOKIE', 'pxfs'), + 'cookie' => 'pxfs', /* |-------------------------------------------------------------------------- @@ -135,7 +135,7 @@ return [ | */ - 'path' => env('SESSION_PATH', '/'), + 'path' => '/', /* |-------------------------------------------------------------------------- @@ -174,7 +174,7 @@ return [ | */ - 'http_only' => env('SESSION_HTTP_ONLY', true), + 'http_only' => true, /* |-------------------------------------------------------------------------- @@ -189,7 +189,7 @@ return [ | */ - 'same_site' => env('SESSION_SAME_SITE_COOKIES', env('SESSION_SAME_SITE', 'lax')), + 'same_site' => env('SESSION_SAME_SITE_COOKIES', 'lax'), /* |-------------------------------------------------------------------------- @@ -202,6 +202,6 @@ return [ | */ - 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false), + 'partitioned' => false, ]; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php similarity index 76% rename from database/seeders/DatabaseSeeder.php rename to database/seeds/DatabaseSeeder.php index bef7c2c29..91cb6d1c2 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -1,15 +1,15 @@ call(UsersTableSeeder::class); } diff --git a/public/index.php b/public/index.php index ee8f07e99..34614ee2c 100644 --- a/public/index.php +++ b/public/index.php @@ -1,20 +1,65 @@ + */ define('LARAVEL_START', microtime(true)); -// Determine if the application is in maintenance mode... -if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { - require $maintenance; +if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) { + require __DIR__.'/../storage/framework/maintenance.php'; } -// Register the Composer autoloader... +/* +|-------------------------------------------------------------------------- +| Register The Auto Loader +|-------------------------------------------------------------------------- +| +| Composer provides a convenient, automatically generated class loader for +| our application. We just need to utilize it! We'll simply require it +| into the script here so that we don't have to worry about manual +| loading any of our classes later on. It feels great to relax. +| +*/ + require __DIR__.'/../vendor/autoload.php'; -// Bootstrap Laravel and handle the request... -/** @var Application $app */ +/* +|-------------------------------------------------------------------------- +| Turn On The Lights +|-------------------------------------------------------------------------- +| +| We need to illuminate PHP development, so let us turn on the lights. +| This bootstraps the framework and gets it ready for use, then it +| will load up this application so that we can run it and send +| the responses back to the browser and delight our users. +| +*/ + $app = require_once __DIR__.'/../bootstrap/app.php'; -$app->handleRequest(Request::capture()); +/* +|-------------------------------------------------------------------------- +| Run The Application +|-------------------------------------------------------------------------- +| +| Once we have the application, we can handle the incoming request +| through the kernel, and send the associated response back to +| the client's browser allowing them to enjoy the creative +| and wonderful application we have prepared for them. +| +*/ + +$kernel = $app->make(Kernel::class); + +$response = $kernel->handle( + $request = Request::capture() +); + +$response->send(); + +$kernel->terminate($request, $response);