Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to Laravel 11 #7193

Merged
merged 25 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ set_conf() {
setenv "QUEUE_CONNECTION" "sync"
setenv "SESSION_DRIVER" "database"
setenv "MAIL_MAILER" "log"
setenv "MAIL_FROM_ADDRESS" "from@mail.com"
setenv "MAIL_REPLY_TO_ADDRESS" "reply@mail.com"
}

composer_install() {
Expand Down
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ indent_size = 2
[*.md]
trim_trailing_whitespace = false

[*.yml]
[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
34 changes: 17 additions & 17 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ APP_KEY=
APP_DEBUG=true

# The URL of your application.
APP_URL=localhost:8000
APP_URL=http://localhost:8000

# Database to store information
# The documentation is here: https://laravel.com/docs/10.x/database
# You can also see the different values you can use in config/database.php
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=full_path_to_the_sqlite_database
DB_USERNAME=monica
DB_PASSWORD=secret
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=monica
# DB_USERNAME=monica
# DB_PASSWORD=secret

# Database for SQLite - used for local development
# Database for tests - used for local development
DB_TEST_DRIVER=sqlite
DB_TEST_DATABASE=full_path_to_the_sqlite_database
DB_TEST_HOST=127.0.0.1
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=root
# DB_TEST_DATABASE=monica
# DB_TEST_HOST=127.0.0.1
# DB_TEST_USERNAME=root
# DB_TEST_PASSWORD=root

# Frequency of creation of new log files. Logs are written when an error occurs.
# Refer to config/logging.php for the possible values.
Expand All @@ -59,26 +59,26 @@ LOG_CHANNEL=stack
#. Queue: sync, database, beanstalkd, sqs, redis
# If Queue is not set to 'sync', you'll have to set a queue worker
# See https://laravel.com/docs/5.7/queues#running-the-queue-worker
CACHE_DRIVER=file
CACHE_STORE=database
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_DRIVER=database

# Redis, if you need it for the queues
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Mailing
MAIL_MAILER=smtp
# Set the MAIL_MAILER to 'smtp' if you want to send emails.
MAIL_MAILER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="${APP_NAME}"
MAIL_REPLY_TO_ADDRESS=
MAIL_REPLY_TO_ADDRESS=hello@example.com
MAIL_REPLY_TO_NAME="${APP_NAME}"

# Search
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
uses: monicahq/workflows/.github/workflows/static.yml@v2
with:
php-version: 8.3
with: phpstan
2 changes: 2 additions & 0 deletions app/Console/Commands/GetVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'monica:getversion')]
class GetVersion extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/Local/MonicaLocalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
use Illuminate\Support\Str;
use Illuminate\Translation\MessageSelector;
use Stichoza\GoogleTranslate\GoogleTranslate;
use Symfony\Component\Console\Attribute\AsCommand;

use function Safe\json_decode;
use function Safe\json_encode;

/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'monica:localize')]
class MonicaLocalize extends Command
{
private GoogleTranslate $googleTranslate;
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/Local/SetupDummyAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
use Faker\Factory as Faker;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Symfony\Component\Console\Attribute\AsCommand;

/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'monica:dummy')]
class SetupDummyAccount extends Command
{
use ConfirmableTrait;
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/Local/UpdateAddressBookSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use App\Domains\Contact\DavClient\Jobs\SynchronizeAddressBooks;
use App\Models\AddressBookSubscription;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'monica:updateaddressbooksubscription')]
class UpdateAddressBookSubscription extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/NewAddressBookSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use App\Models\Vault;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'monica:newaddressbooksubscription')]
class NewAddressBookSubscription extends Command
{
/**
Expand Down
4 changes: 4 additions & 0 deletions app/Console/Commands/SetupApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'monica:setup')]
class SetupApplication extends Command
{
use ConfirmableTrait;
Expand Down Expand Up @@ -68,10 +70,12 @@ protected function clearConfig(): void
$this->artisan('✓ Clear config cache', 'config:clear');
$this->artisan('✓ Resetting route cache', 'route:cache');
$this->artisan('✓ Resetting view cache', 'view:clear');
$this->artisan('✓ Resetting event cache', 'event:cache');
} else {
$this->artisan('✓ Clear config cache', 'config:clear');
$this->artisan('✓ Clear route cache', 'route:clear');
$this->artisan('✓ Clear view cache', 'view:clear');
$this->artisan('✓ Clear event cache', 'event:clear');
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/SetupDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Support\Facades\File;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Output\OutputInterface;

use function Safe\passthru;
Expand All @@ -13,6 +14,7 @@
/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'scribe:setup')]
class SetupDocumentation extends Command
{
use ConfirmableTrait;
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/SetupScout.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @codeCoverageIgnore
*/
#[AsCommand(name: 'scout:setup')]
class SetupScout extends Command
{
use ConfirmableTrait;
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/TestReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Notification;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'test:send-reminders')]
class TestReminders extends Command
{
/**
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/WaitForDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
use Illuminate\Console\Command;
use Illuminate\Database\Connectors\ConnectionFactory;
use Illuminate\Database\SQLiteDatabaseDoesNotExistException;
use Symfony\Component\Console\Attribute\AsCommand;

use function Safe\chgrp;
use function Safe\chown;
use function Safe\touch;

#[AsCommand(name: 'waitfordb')]
class WaitForDb extends Command
{
/**
Expand Down
87 changes: 0 additions & 87 deletions app/Console/Kernel.php

This file was deleted.

29 changes: 29 additions & 0 deletions app/Console/Scheduling/Schedule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Console\Scheduling;

use Illuminate\Support\Facades\Schedule as ScheduleFacade;

/**
* @method static void command(string $command, string $frequency = null)
* @method static void job(string $command, string $frequency = null, int $args = 0)
*/
class Schedule
{
/**
* Handle dynamic, static calls to the object.
*/
public static function __callStatic(string $method, array $args): void
{
$command = array_shift($args);
$frequency = array_shift($args);
ScheduleFacade::$method($command)->when(function () use ($command, $frequency, $args) {
$event = CronEvent::command($command);
if ($frequency !== null) {
$event = $event->{$frequency}(...$args);
}

return $event->isDue();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private function schedule(): void

$notificationChannels = $this->user->notificationChannels;
foreach ($notificationChannels as $channel) {
$this->upcomingDate->shiftTimezone($this->user->timezone);
$this->upcomingDate->shiftTimezone($this->user->timezone ?? config('app.timezone'));
$this->upcomingDate->hour = $channel->preferred_time->hour;
$this->upcomingDate->minute = $channel->preferred_time->minute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private function schedule(): void
}
}

$upcomingDate->shiftTimezone($this->userNotificationChannel->user->timezone);
$upcomingDate->shiftTimezone($this->userNotificationChannel->user->timezone ?? config('app.timezone'));
$upcomingDate->hour = $this->userNotificationChannel->preferred_time->hour;
$upcomingDate->minute = $this->userNotificationChannel->preferred_time->minute;

Expand Down
Loading