Skip to content

Commit e0f5174

Browse files
authored
Merge pull request #1558 from NNTmux/laravel11
Laravel11
2 parents 83122f9 + 2c3b95c commit e0f5174

263 files changed

Lines changed: 5227 additions & 2943 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,24 @@ ADMIN_EMAIL=
4545
APP_NAME=NNTmux
4646
APP_ENV=production
4747
APP_DEBUG=false
48+
APP_TIMEZONE=UTC
4849
APP_URL=
49-
APP_TZ=Europe/Paris
50+
51+
APP_LOCALE=en
52+
APP_FALLBACK_LOCALE=en
53+
APP_FAKER_LOCALE=en_US
54+
55+
APP_MAINTENANCE_DRIVER=file
56+
APP_MAINTENANCE_STORE=database
57+
58+
BCRYPT_ROUNDS=12
5059
APP_KEY=
5160
LOG_CHANNEL=stack
61+
LOG_STACK=single
5262
PASSWORD_HASH=argon2id
5363

54-
BROADCAST_DRIVER=log
55-
CACHE_DRIVER=redis
64+
BROADCAST_CONNECTION=log
65+
CACHE_STORE=redis
5666
QUEUE_CONNECTION=sync
5767

5868
REDIS_HOST=127.0.0.1
@@ -61,10 +71,11 @@ REDIS_PORT=6379
6171
REDIS_CLIENT=phpredis
6272

6373
SESSION_DRIVER=redis
64-
SESSION_DOMAIN=
74+
SESSION_DOMAIN=null
6575
SESSION_SECURE_COOKIE=false
6676
SESSION_ENCRYPT=false
6777
SESSION_COOKIE=nntmux
78+
SESSION_PATH=/
6879

6980
MAIL_DRIVER=smtp
7081
MAIL_HOST=smtp.mailtrap.io

.github/workflows/laravel.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ on: [push]
44

55
jobs:
66
tests:
7-
name: Run tests
87
runs-on: ubuntu-latest
8+
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: [ 8.2, 8.3 ]
13+
14+
name: PHP ${{ matrix.php }}
915
services:
1016
mysql:
1117
image: mariadb:10
@@ -18,25 +24,24 @@ jobs:
1824
- 3306:3306
1925
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2026
steps:
21-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2228

2329
- name: Setup PHP
2430
uses: shivammathur/setup-php@v2
2531
with:
26-
php-version: '8.2'
27-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, soap, intl, gd, exif, iconv
32+
php-version: ${{ matrix.php }}
33+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
2834
coverage: none
2935

3036
- name: Copy env file
3137
run:
3238
cp .env.test .env
3339

3440
- name: Run composer install
35-
run: composer install -n --prefer-dist
41+
run: composer install --prefer-dist --no-interaction --no-progress
3642

37-
- name: Prepare Laravel Application
38-
run:
39-
php artisan key:generate
43+
- name: Generate app key
44+
run: php artisan key:generate
4045

4146
- name: Run tests
42-
run: php artisan test
47+
run: vendor/bin/phpunit

.php-cs-fixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
->in(config_path())
1111
->in(database_path())
1212
->notPath(database_path('migrations'))
13-
->in(resource_path('lang'))
13+
->in(base_path('lang'))
1414
->in(base_path('routes'))
1515
->in(base_path('tests'))
1616
->in(base_path('Blacklight'))

Blacklight/Backfill.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function backfillAllGroups(string $groupName = '', int|string $articles =
103103
$counter++;
104104
}
105105

106-
$dMessage = 'Backfilling completed in '.now()->diffInSeconds($allTime).' seconds.';
106+
$dMessage = 'Backfilling completed in '.now()->diffInSeconds($allTime, true).' seconds.';
107107

108108
if ($this->_echoCLI) {
109109
$this->colorCli->primary($dMessage);

Blacklight/Binaries.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function updateAllGroups(int $maxHeaders = 100000): void
227227
$counter++;
228228
}
229229

230-
$endTime = now()->diffInSeconds($allTime);
230+
$endTime = now()->diffInSeconds($allTime, true);
231231
$this->log(
232232
'Updating completed in '.$endTime.Str::plural(' second', $endTime),
233233
__FUNCTION__,
@@ -458,7 +458,7 @@ public function updateGroup(array $groupMySQL, int $maxHeaders = 0): void
458458
}
459459

460460
if ($this->_echoCLI) {
461-
$endGroup = now()->diffInSeconds($startGroup);
461+
$endGroup = now()->diffInSeconds($startGroup, true);
462462
$this->colorCli->primary(
463463
PHP_EOL.'Group '.$groupMySQL['name'].' processed in '.
464464
$endGroup.Str::plural(' second', $endGroup)
@@ -547,7 +547,7 @@ public function scan(array $groupMySQL, int $first, int $last, string $type = 'u
547547
$this->startCleaning = now();
548548

549549
// End of the getting data from usenet.
550-
$this->timeHeaders = $this->startCleaning->diffInSeconds($this->startLoop);
550+
$this->timeHeaders = $this->startCleaning->diffInSeconds($this->startLoop, true);
551551

552552
// Check if we got headers.
553553
$msgCount = \count($headers);
@@ -636,7 +636,7 @@ public function scan(array $groupMySQL, int $first, int $last, string $type = 'u
636636
$this->startPR = now();
637637

638638
// End of inserting.
639-
$this->timeInsert = $this->startPR->diffInSeconds($this->startUpdate);
639+
$this->timeInsert = $this->startPR->diffInSeconds($this->startUpdate, true);
640640

641641
if ($partRepair && \count($headersRepaired) > 0) {
642642
$this->removeRepairedParts($headersRepaired, $this->groupMySQL['id']);
@@ -853,7 +853,7 @@ protected function storeHeaders(array $headers = []): void
853853
$this->startUpdate = now();
854854

855855
// End of processing headers.
856-
$this->timeCleaning = $this->startUpdate->diffInSeconds($this->startCleaning);
856+
$this->timeCleaning = $this->startUpdate->diffInSeconds($this->startCleaning, true);
857857
$binariesQuery = $binariesCheck = 'INSERT INTO binaries (id, partsize, currentparts) VALUES ';
858858
foreach ($binariesUpdate as $binaryID => $binary) {
859859
$binariesQuery .= '('.$binaryID.','.$binary['Size'].','.$binary['Parts'].'),';
@@ -944,9 +944,9 @@ protected function outputHeaderDuration(): void
944944
$this->colorCli->primaryOver(' to process collections, ').
945945
$this->colorCli->alternateOver($this->timeInsert.'s').
946946
$this->colorCli->primaryOver(' to insert binaries/parts, ').
947-
$this->colorCli->alternateOver($currentMicroTime->diffInSeconds($this->startPR).'s').
947+
$this->colorCli->alternateOver($currentMicroTime->diffInSeconds($this->startPR, true).'s').
948948
$this->colorCli->primaryOver(' for part repair, ').
949-
$this->colorCli->alternateOver($currentMicroTime->diffInSeconds($this->startLoop).'s').
949+
$this->colorCli->alternateOver($currentMicroTime->diffInSeconds($this->startLoop, true).'s').
950950
$this->colorCli->primary(' total.');
951951
}
952952
}
@@ -1236,7 +1236,7 @@ public function daytopost(int $days, array $data): string
12361236
if ($this->_echoCLI) {
12371237
$this->colorCli->primary(
12381238
PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime).
1239-
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime)).'days.'
1239+
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime), true).'days.'
12401240
);
12411241
}
12421242

Blacklight/Music.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public function processMusicReleases(bool $local = false)
452452

453453
// Sleep to not flood amazon.
454454
$sleeptime = $this->sleeptime / 1000;
455-
$diff = now()->diffInSeconds($startTime);
455+
$diff = now()->diffInSeconds($startTime, true);
456456
if ($sleeptime - $diff > 0 && $usedAmazon === true) {
457457
sleep($sleeptime - $diff);
458458
}

Blacklight/NameFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ public function getPreFileNames(array $args = []): void
11251125
$this->colorCLI->climate()->info('Renamed Releases: ['.number_format($counted).'] '.(new ConsoleTools())->percentString(++$counter, $total));
11261126
}
11271127
}
1128-
$this->colorCLI->climate()->info(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timeStart).' seconds'.'.');
1128+
$this->colorCLI->climate()->info(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timeStart, true).' seconds'.'.');
11291129
} else {
11301130
$this->colorCLI->climate()->info('Nothing to do.');
11311131
}

Blacklight/ReleaseRemover.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function removeByCriteria(array $arguments): bool|string
119119

120120
if ($this->echoCLI) {
121121
$this->colorCLI->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
122-
$this->colorCLI->header(now()->diffInSeconds($timeStart).' seconds', true);
122+
$this->colorCLI->header(now()->diffInSeconds($timeStart, true).' seconds', true);
123123
}
124124

125125
return true;
@@ -239,7 +239,7 @@ public function removeCrap(bool $delete, int|string $time, string $type = '', in
239239

240240
if ($this->echoCLI) {
241241
$this->colorCLI->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
242-
$this->colorCLI->header(now()->diffInSeconds($timeStart).' seconds', true);
242+
$this->colorCLI->header(now()->diffInSeconds($timeStart, true).' seconds', true);
243243
}
244244

245245
return true;

Blacklight/libraries/Forking.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private function safeBackfill(): void
323323
if ($backfill_days === 1) {
324324
$backfilldays = 'g.backfill_target';
325325
} elseif ($backfill_days === 2) {
326-
$backfilldays = now()->diffInDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('..safebackfilldate')));
326+
$backfilldays = now()->diffInDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('..safebackfilldate')), true);
327327
}
328328

329329
$data = DB::select(

Blacklight/processing/ProcessReleases.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function processIncompleteCollections($groupID): void
236236
}
237237
$count = $countQuery->count('id');
238238

239-
$totalTime = now()->diffInSeconds($startTime);
239+
$totalTime = now()->diffInSeconds($startTime, true);
240240

241241
$this->colorCLI->primary(
242242
($count ?? 0).' collections were found to be complete. Time: '.
@@ -282,7 +282,7 @@ public function processCollectionSizes($groupID): void
282282
$checked.' collections set to filecheck = 3(size calculated)',
283283
true
284284
);
285-
$totalTime = now()->diffInSeconds($startTime);
285+
$totalTime = now()->diffInSeconds($startTime, true);
286286
$this->colorCLI->primary($totalTime.Str::plural(' second', $totalTime), true);
287287
}
288288
}, 10);
@@ -366,7 +366,7 @@ public function deleteUnwantedCollections($groupID): void
366366
}
367367
}
368368

369-
$totalTime = now()->diffInSeconds($startTime);
369+
$totalTime = now()->diffInSeconds($startTime, true);
370370

371371
if ($this->echoCLI) {
372372
$this->colorCLI->primary('Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).' collections: '.PHP_EOL.$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.' with less files than site/group settings in: '.$totalTime.Str::plural(' second', $totalTime), true);
@@ -535,7 +535,7 @@ public function createReleases(int|string $groupID): array
535535
}
536536
}
537537

538-
$totalTime = now()->diffInSeconds($startTime);
538+
$totalTime = now()->diffInSeconds($startTime, true);
539539

540540
if ($this->echoCLI) {
541541
$this->colorCLI->primary(
@@ -587,7 +587,7 @@ public function createNZBs(int|string $groupID): int
587587
}
588588
}
589589

590-
$totalTime = now()->diffInSeconds($startTime);
590+
$totalTime = now()->diffInSeconds($startTime, true);
591591

592592
if ($this->echoCLI) {
593593
$this->colorCLI->primary(
@@ -625,7 +625,7 @@ public function categorizeReleases(int $categorize, int|string $groupID = ''): v
625625
$groupID
626626
);
627627

628-
$totalTime = now()->diffInSeconds($startTime);
628+
$totalTime = now()->diffInSeconds($startTime, true);
629629

630630
if ($this->echoCLI) {
631631
$this->colorCLI->primary($totalTime.Str::plural(' second', $totalTime));
@@ -682,7 +682,7 @@ public function deleteCollections($groupID): void
682682
}
683683
$firstQuery = $fourthQuery = now();
684684

685-
$totalTime = $firstQuery->diffInSeconds($startTime);
685+
$totalTime = $firstQuery->diffInSeconds($startTime, true);
686686

687687
if ($this->echoCLI) {
688688
$this->colorCLI->primary(
@@ -729,8 +729,8 @@ public function deleteCollections($groupID): void
729729
}
730730
$deletedCount += $deleted;
731731

732-
$colDelTime = now()->diffInSeconds($fourthQuery);
733-
$totalTime = $fourthQuery->diffInSeconds($startTime);
732+
$colDelTime = now()->diffInSeconds($fourthQuery, true);
733+
$totalTime = $fourthQuery->diffInSeconds($startTime, true);
734734

735735
if ($this->echoCLI) {
736736
$this->colorCLI->primary('Finished deleting '.$deleted.' collections missed after NZB creation in '.$colDelTime.Str::plural(' second', $colDelTime).PHP_EOL.'Removed '.number_format($deletedCount).' parts/binaries/collection rows in '.$totalTime.Str::plural(' second', $totalTime), true);

0 commit comments

Comments
 (0)