diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-03-28 14:56:31 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-04-19 20:14:40 +0200 |
commit | b385f1c7d58561d41c952748e85e77806dc9de06 (patch) | |
tree | d433213d2ce6e8ff7bf3554845586391cf50c517 /apps/theming/lib | |
parent | 7f9dabd984282c1ed5d62132c6137a8e88dea925 (diff) | |
download | nextcloud-server-b385f1c7d58561d41c952748e85e77806dc9de06.tar.gz nextcloud-server-b385f1c7d58561d41c952748e85e77806dc9de06.zip |
Fix theming tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 11 | ||||
-rw-r--r-- | apps/theming/lib/ImageManager.php | 12 |
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(); |