]> BookStack Code Mirror - bookstack/blobdiff - app/Settings/AppSettingsStore.php
Tests: Updated comment test to account for new editor usage
[bookstack] / app / Settings / AppSettingsStore.php
index 8d7b73c1cfaf037df6a01e6b0babd10197677a68..e6fc466baa2e20d67110aebdf5e9e12e8f4a7576 100644 (file)
@@ -2,16 +2,16 @@
 
 namespace BookStack\Settings;
 
+use BookStack\Uploads\FaviconHandler;
 use BookStack\Uploads\ImageRepo;
 use Illuminate\Http\Request;
 
 class AppSettingsStore
 {
-    protected ImageRepo $imageRepo;
-
-    public function __construct(ImageRepo $imageRepo)
-    {
-        $this->imageRepo = $imageRepo;
+    public function __construct(
+        protected ImageRepo $imageRepo,
+        protected FaviconHandler $faviconHandler,
+    ) {
     }
 
     public function storeFromUpdateRequest(Request $request, string $category)
@@ -39,6 +39,8 @@ class AppSettingsStore
                 $icon = $this->imageRepo->saveNew($iconFile, 'system', 0, $size, $size);
                 setting()->put('app-icon-' . $size, $icon->url);
             }
+
+            $this->faviconHandler->saveForUploadedImage($iconFile);
         }
 
         // Clear icon image if requested
@@ -49,6 +51,8 @@ class AppSettingsStore
                 $this->destroyExistingSettingImage('app-icon-' . $size);
                 setting()->remove('app-icon-' . $size);
             }
+
+            $this->faviconHandler->restoreOriginal();
         }
     }