+ setting()->put($key, $value);
+ }
+
+ // Update logo image if set
+ if ($request->hasFile('app_logo')) {
+ $logoFile = $request->file('app_logo');
+ $this->imageRepo->destroyByType('system');
+ $image = $this->imageRepo->saveNew($logoFile, 'system', 0, null, 86);
+ setting()->put('app-logo', $image->url);
+ }
+
+ // Clear logo image if requested
+ if ($request->get('app_logo_reset', null)) {
+ $this->imageRepo->destroyByType('system');
+ setting()->remove('app-logo');
+ }
+
+ $this->showSuccessNotification(trans('settings.settings_save_success'));
+ $redirectLocation = '/settings#' . $request->get('section', '');
+ return redirect(rtrim($redirectLocation, '#'));
+ }
+
+ /**
+ * Show the page for application maintenance.
+ */
+ public function showMaintenance()
+ {
+ $this->checkPermission('settings-manage');
+ $this->setPageTitle(trans('settings.maint'));
+
+ // Get application version
+ $version = trim(file_get_contents(base_path('version')));
+
+ return view('settings.maintenance', ['version' => $version]);
+ }
+
+ /**
+ * Action to clean-up images in the system.
+ */
+ public function cleanupImages(Request $request, ImageService $imageService)
+ {
+ $this->checkPermission('settings-manage');
+
+ $checkRevisions = !($request->get('ignore_revisions', 'false') === 'true');
+ $dryRun = !($request->has('confirm'));
+
+ $imagesToDelete = $imageService->deleteUnusedImages($checkRevisions, $dryRun);
+ $deleteCount = count($imagesToDelete);
+ if ($deleteCount === 0) {
+ $this->showWarningNotification(trans('settings.maint_image_cleanup_nothing_found'));
+ return redirect('/settings/maintenance')->withInput();