Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Controller/ThemingController.php11
-rw-r--r--apps/theming/lib/ImageManager.php12
2 files changed, 15 insertions, 8 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 2f0bfdd05ca..421af051998 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -100,6 +100,7 @@ class ThemingController extends Controller {
* @param SCSSCacher $scssCacher
* @param IURLGenerator $urlGenerator
* @param IAppManager $appManager
+ * @param ImageManager $imageManager
*/
public function __construct(
$appName,
@@ -313,12 +314,7 @@ class ThemingController extends Controller {
if (strpos($setting, 'Mime') !== -1) {
$imageKey = str_replace('Mime', '', $setting);
- try {
- $file = $this->appData->getFolder('images')->getFile($imageKey);
- $file->delete();
- } catch (NotFoundException $e) {
- } catch (NotPermittedException $e) {
- }
+ $this->imageManager->delete($imageKey);
}
return new DataResponse(
@@ -344,8 +340,7 @@ class ThemingController extends Controller {
*/
public function getImage(string $key) {
try {
- /** @var File $file */
- $file = $this->appData->getFolder('images')->getFile($key);
+ $file = $this->imageManager->getImage($key);
} catch (NotFoundException $e) {
return new NotFoundResponse();
}
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php
index d268552bf94..830ed7f34a9 100644
--- a/apps/theming/lib/ImageManager.php
+++ b/apps/theming/lib/ImageManager.php
@@ -158,8 +158,20 @@ class ImageManager {
return $file;
}
+ public function delete(string $key) {
+ try {
+ $file = $this->appData->getFolder('images')->getFile($key);
+ $file->delete();
+ } catch (NotFoundException $e) {
+ } catch (NotPermittedException $e) {
+ }
+ }
+
/**
* remove cached files that are not required any longer
+ *
+ * @throws NotPermittedException
+ * @throws NotFoundException
*/
public function cleanup() {
$currentFolder = $this->getCacheFolder();