-
-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathConfigIntegrity.php
More file actions
73 lines (67 loc) · 2 KB
/
ConfigIntegrity.php
File metadata and controls
73 lines (67 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* SPDX-License-Identifier: MIT
* Copyright (c) 2017-2018 Tobias Reich
* Copyright (c) 2018-2025 LycheeOrg.
*/
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
/**
* Small update of the database to avoid sneaky people setting all the levels to 0 and thus skipping some checks...
*/
class ConfigIntegrity
{
public const SE_FIELDS = [
'default_user_quota',
'metrics_enabled',
'disable_small_download',
'disable_small2x_download',
'disable_medium_download',
'disable_medium2x_download',
'timeline_photos_granularity',
'timeline_albums_granularity',
'timeline_left_border_enabled',
'timeline_photo_date_format_year',
'timeline_photo_date_format_month',
'timeline_photo_date_format_day',
'timeline_photo_date_format_hour',
'timeline_album_date_format_year',
'timeline_album_date_format_month',
'timeline_album_date_format_day',
'number_albums_per_row_mobile',
'client_side_favourite_enabled',
'cache_ttl',
'secure_image_link_enabled',
'exif_disabled_for_all',
'file_name_hidden',
'low_number_of_shoots_per_day',
'medium_number_of_shoots_per_day',
'high_number_of_shoots_per_day',
'metrics_enabled',
'metrics_logged_in_users_enabed',
'metrics_access',
'live_metrics_enabled',
'live_metrics_access',
'live_metrics_max_time',
'enable_colour_extractions',
'colour_extraction_driver',
];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
*
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, \Closure $next)
{
try {
DB::table('configs')->whereIn('key', self::SE_FIELDS)->update(['level' => 1]);
} catch (\Exception $e) {
// Do nothing: we are not installed yet, so we fail silently.
}
return $next($request);
}
}