Skip to content

Commit 7111f65

Browse files
authored
Minor changes in prevision for Livewire. (#2026)
1 parent 4c4745f commit 7111f65

File tree

12 files changed

+68
-90
lines changed

12 files changed

+68
-90
lines changed

.github/workflows/.env.mariadb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
APP_NAME=Lychee
22
APP_URL=https://localhost
3-
APP_ENV=testing
3+
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
66

.github/workflows/.env.postgresql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
APP_NAME=Lychee
22
APP_URL=https://localhost
3-
APP_ENV=testing
3+
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
66

.github/workflows/.env.sqlite

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
APP_NAME=Lychee
22
APP_URL=https://localhost
3-
APP_ENV=testing
3+
APP_ENV=dev
44
APP_KEY=SomeRandomString
55
APP_DEBUG=true
66

.github/workflows/CICD.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
access_token: ${{ github.token }}
3131

3232
php_syntax_errors:
33-
name: 1️⃣ PHP - Syntax errors
33+
name: 1️⃣ PHP 8.1 - Syntax errors
3434
runs-on: ubuntu-latest
3535
needs:
3636
- kill_previous
@@ -50,15 +50,15 @@ jobs:
5050
run: vendor/bin/parallel-lint --exclude .git --exclude vendor .
5151

5252
code_style_errors:
53-
name: 2️⃣ PHP - Code Style errors
53+
name: 2️⃣ PHP 8.1 - Code Style errors
5454
runs-on: ubuntu-latest
5555
needs:
5656
- php_syntax_errors
5757
steps:
5858
- name: Set up PHP
5959
uses: shivammathur/setup-php@v2
6060
with:
61-
php-version: latest
61+
php-version: 8.1
6262

6363
- name: Checkout code
6464
uses: actions/checkout@v3
@@ -91,7 +91,7 @@ jobs:
9191
run: vendor/bin/phpstan analyze
9292

9393
tests:
94-
name: 2️⃣ PHP ${{ matrix.php-version }} - ${{ matrix.sql-versions }}
94+
name: 2️⃣ PHP ${{ matrix.php-version }} - ${{ matrix.sql-versions }} -- ${{ matrix.test-suite }}
9595
needs:
9696
- php_syntax_errors
9797
runs-on: ubuntu-latest
@@ -104,6 +104,8 @@ jobs:
104104
- mariadb
105105
- postgresql
106106
- sqlite
107+
test-suite:
108+
- Feature
107109
# Service containers to run with `container-job`
108110
services:
109111
# Label used to access the service container
@@ -162,11 +164,11 @@ jobs:
162164
php artisan optimize
163165
php artisan migrate
164166
165-
- name: Apply tests
166-
run: XDEBUG_MODE=coverage vendor/bin/phpunit
167+
- name: Apply tests ${{ matrix.test-suite }}
168+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite ${{ matrix.test-suite }}
167169

168170
- name: Codecov
169-
uses: codecov/codecov-action@v1
171+
uses: codecov/codecov-action@v3
170172

171173
- name: Make sure we can go backward
172174
run: php artisan migrate:rollback
@@ -180,7 +182,6 @@ jobs:
180182
matrix:
181183
php-version:
182184
- 8.1
183-
- 8.2
184185
sql-versions:
185186
- mariadb
186187
- postgresql

.gitignore

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
/node_modules
1+
# We don't care about those
2+
node_modules
23
build/*
34

5+
# Those are personal
46
public/dist/user.css
7+
public/dist/custom.js
58

9+
# Pictures we do not commit
610
public/uploads/**
711

12+
# Storage stuff: useless
813
/storage/*.key
914
/storage/clockwork/
15+
16+
# Those are generated
1017
/vendor
18+
19+
# IDE & Cache stuff
1120
/.idea
1221
/.vscode
1322
/.vagrant
1423
Homestead.json
1524
Homestead.yaml
1625
npm-debug.log
1726
yarn-error.log
18-
.env
19-
.env.*
20-
21-
aliases
22-
23-
Lychee/*
2427
.phpunit*
2528
_ide*
26-
2729
.php_cs.cache
2830
.php-cs-fixer.cache
29-
3031
*.log
3132
clover.xml
3233
*.swp
@@ -37,6 +38,20 @@ installed.log
3738
storage/bootstrap/cache/*
3839
storage/image-jobs/*
3940

41+
# used by Vite
42+
public/hot
43+
4044
sync/*
45+
46+
# Local DB for easy deployment
4147
backup.sql
42-
reset.sh
48+
*-bck
49+
50+
# Make sure we don't commit secrets
51+
.env
52+
.env.*
53+
54+
aliases
55+
56+
# Building stuff for releaseses
57+
Lychee/*

app/Actions/Diagnostics/Pipes/Checks/IniSettingsCheck.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public function handle(array &$data, \Closure $next): array
2323
// Load settings
2424
$settings = Configs::get();
2525

26-
if ($this->convert_size(ini_get('upload_max_filesize')) < $this->convert_size('30M')) {
26+
if (Helpers::convertSize(ini_get('upload_max_filesize')) < Helpers::convertSize(('30M'))) {
2727
$data[] = 'Warning: You may experience problems when uploading a photo of large size. Take a look in the FAQ for details.';
2828
}
29-
if ($this->convert_size(ini_get('post_max_size')) < $this->convert_size('100M')) {
29+
if (Helpers::convertSize(ini_get('post_max_size')) < Helpers::convertSize(('100M'))) {
3030
$data[] = 'Warning: You may experience problems when uploading a photo of large size. Take a look in the FAQ for details.';
3131
}
3232
$max_execution_time = intval(ini_get('max_execution_time'));
@@ -93,27 +93,4 @@ public function handle(array &$data, \Closure $next): array
9393

9494
return $next($data);
9595
}
96-
97-
/**
98-
* Return true if the upload_max_filesize is bellow what we want.
99-
*/
100-
private function convert_size(string $size): int
101-
{
102-
$size = trim($size);
103-
$last = strtolower($size[strlen($size) - 1]);
104-
$size = intval($size);
105-
106-
switch ($last) {
107-
case 'g':
108-
$size *= 1024;
109-
// no break
110-
case 'm':
111-
$size *= 1024;
112-
// no break
113-
case 'k':
114-
$size *= 1024;
115-
}
116-
117-
return $size;
118-
}
11996
}

app/Actions/Photo/Duplicate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function do(EloquentCollection $photos, ?Album $album): BaseCollection
2727
foreach ($photos as $photo) {
2828
$duplicate = $photo->replicate();
2929
$duplicate->album_id = $album?->id;
30+
$duplicate->setRelation('album', $album);
3031
if ($album !== null) {
3132
$duplicate->owner_id = $album->owner_id;
3233
}

app/Assets/Helpers.php

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99

1010
class Helpers
1111
{
12-
private int $numTab = 0;
13-
14-
/**
15-
* Initialize the Facade.
16-
*/
17-
public function __construct()
18-
{
19-
$this->numTab = 0;
20-
}
21-
2212
/**
2313
* Add UnixTimeStamp to file path suffix.
2414
*
@@ -153,34 +143,6 @@ public function gcd(int $a, int $b): int
153143
return ($a % $b) !== 0 ? $this->gcd($b, $a % $b) : $b;
154144
}
155145

156-
/**
157-
* Return incrementing numbers.
158-
*/
159-
public function data_index(): int
160-
{
161-
$this->numTab++;
162-
163-
return $this->numTab;
164-
}
165-
166-
/**
167-
* Reset and return incrementing numbers.
168-
*/
169-
public function data_index_r(): int
170-
{
171-
$this->numTab = 1;
172-
173-
return $this->numTab;
174-
}
175-
176-
/**
177-
* Reset the incrementing number.
178-
*/
179-
public function data_index_set(int $idx = 0): void
180-
{
181-
$this->numTab = $idx;
182-
}
183-
184146
/**
185147
* From https://www.php.net/manual/en/function.disk-total-space.php.
186148
*
@@ -232,4 +194,27 @@ public function secondsToHMS(int|float $d): string
232194
. ($m > 0 ? $m . 'm' : '')
233195
. ($s > 0 || ($h === 0 && $m === 0) ? $s . 's' : '');
234196
}
197+
198+
/**
199+
* Return true if the upload_max_filesize is bellow what we want.
200+
*/
201+
public function convertSize(string $size): int
202+
{
203+
$size = trim($size);
204+
$last = strtolower($size[strlen($size) - 1]);
205+
$size = intval($size);
206+
207+
switch ($last) {
208+
case 'g':
209+
$size *= 1024;
210+
// no break
211+
case 'm':
212+
$size *= 1024;
213+
// no break
214+
case 'k':
215+
$size *= 1024;
216+
}
217+
218+
return $size;
219+
}
235220
}

app/Facades/Helpers.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
* @method static bool hasPermissions(string $path)
1818
* @method static bool hasFullPermissions(string $path)
1919
* @method static int gcd(int $a, int $b)
20-
* @method static int data_index()
21-
* @method static int data_index_r()
22-
* @method static void data_index_set(int $idx = 0)
2320
* @method static bool isExecAvailable()
2421
* @method static string secondsToHMS(int|float $d)
22+
* @method static int convertSize(string $size)
2523
*/
2624
class Helpers extends Facade
2725
{

app/Http/Resources/Collections/AlbumForestResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
class AlbumForestResource extends JsonResource
1313
{
1414
public function __construct(
15-
private Collection $albums,
16-
private ?Collection $sharedAlbums = null
15+
public Collection $albums,
16+
public ?Collection $sharedAlbums = null
1717
) {
1818
// Laravel applies a shortcut when this value === null but not when it is something else.
1919
parent::__construct('must_not_be_null');

0 commit comments

Comments
 (0)