Code cleanup.

This commit is contained in:
James Cole
2021-03-28 11:46:23 +02:00
parent 2c575f3ca5
commit b5eeacc128
124 changed files with 1568 additions and 1384 deletions

View File

@@ -49,7 +49,7 @@ class UpdateController extends Controller
parent::__construct();
$this->middleware(
static function ($request, $next) {
app('view')->share('title', (string) trans('firefly.administration'));
app('view')->share('title', (string)trans('firefly.administration'));
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
return $next($request);
@@ -67,22 +67,22 @@ class UpdateController extends Controller
*/
public function index()
{
$subTitle = (string) trans('firefly.update_check_title');
$subTitle = (string)trans('firefly.update_check_title');
$subTitleIcon = 'fa-star';
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$channel = app('fireflyconfig')->get('update_channel', 'stable');
$selected = $permission->data;
$channelSelected = $channel->data;
$options = [
-1 => (string) trans('firefly.updates_ask_me_later'),
0 => (string) trans('firefly.updates_do_not_check'),
1 => (string) trans('firefly.updates_enable_check'),
-1 => (string)trans('firefly.updates_ask_me_later'),
0 => (string)trans('firefly.updates_do_not_check'),
1 => (string)trans('firefly.updates_enable_check'),
];
$channelOptions = [
'stable' => (string) trans('firefly.update_channel_stable'),
'beta' => (string) trans('firefly.update_channel_beta'),
'alpha' => (string) trans('firefly.update_channel_alpha'),
'stable' => (string)trans('firefly.update_channel_stable'),
'beta' => (string)trans('firefly.update_channel_beta'),
'alpha' => (string)trans('firefly.update_channel_alpha'),
];
return prefixView('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
@@ -97,18 +97,18 @@ class UpdateController extends Controller
*/
public function post(Request $request)
{
$checkForUpdates = (int) $request->get('check_for_updates');
$checkForUpdates = (int)$request->get('check_for_updates');
$channel = $request->get('update_channel');
$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';
// store as telemetry
app('telemetry')->feature('admin.update.channel', $channel);
app('telemetry')->feature('admin.update.permission', (string) $checkForUpdates);
app('telemetry')->feature('admin.update.permission', (string)$checkForUpdates);
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
app('fireflyconfig')->set('last_update_check', time());
app('fireflyconfig')->set('update_channel', $channel);
session()->flash('success', (string) trans('firefly.configuration_updated'));
session()->flash('success', (string)trans('firefly.configuration_updated'));
return redirect(route('admin.update-check'));
}