]> source.dussan.org Git - nextcloud-server.git/commitdiff
No need for the CssManager
authorRoeland Jago Douma <roeland@famdouma.nl>
Wed, 30 Nov 2016 15:14:00 +0000 (16:14 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Fri, 6 Jan 2017 08:42:14 +0000 (09:42 +0100)
* It is a simple wrapper we can always add it later if needed

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
core/Application.php
core/Controller/CssController.php
lib/private/AppFramework/DependencyInjection/DIContainer.php
lib/private/CssManager.php [deleted file]

index ec93c50b445c35cc661ba94e7f6ae4650628e5fd..dad7546dcb8616d6497f2aecc4cb852c480c8673 100644 (file)
 
 namespace OC\Core;
 
-use OC\AppFramework\Utility\SimpleContainer;
-use OC\CssManager;
 use OC\Security\IdentityProof\Manager;
 use OCP\AppFramework\App;
-use OCP\Files\IAppData;
+use OC\Core\Controller\CssController;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\IRequest;
 use OCP\Util;
 
 /**
@@ -58,8 +58,13 @@ class Application extends App {
                                \OC::$server->getCrypto()
                        );
                });
-               $container->registerService(CssManager::class, function () {
-                       return new CssManager(\OC::$server->getAppDataDir('css'));
+               $container->registerService(CssController::class, function () use ($container) {
+                       return new CssController(
+                               $container->query('appName'),
+                               $container->query(IRequest::class),
+                               \OC::$server->getAppDataDir('css'),
+                               $container->query(ITimeFactory::class)
+                       );
                });
        }
 }
index eb5e8d55b26c92671d2a65e64be5fab043f9ed75..e547987902da76b27f6b27ee37bd7adb3b0a488c 100644 (file)
@@ -27,30 +27,29 @@ use OCP\AppFramework\Controller;
 use OCP\AppFramework\Http;
 use OCP\AppFramework\Http\NotFoundResponse;
 use OCP\AppFramework\Http\FileDisplayResponse;
+use OCP\Files\IAppData;
 use OCP\Files\NotFoundException;
 use OCP\IRequest;
-
+use OCP\Notification\IApp;
 
 class CssController extends Controller {
 
-       /** @var CssManager */
-       protected $cssManager;
+       /** @var IAppData */
+       protected $appData;
 
        /** @var TimeFactory */
        protected $timeFactory;
 
-
-
        /**
         * @param string $appName
         * @param IRequest $request
-        * @param CssManager $cssManager
+        * @param IAppData $appData
         * @param TimeFactory $timeFactory
         */
-       public function __construct($appName, IRequest $request, CssManager $cssManager, TimeFactory $timeFactory) {
+       public function __construct($appName, IRequest $request, IAppData $appData, TimeFactory $timeFactory) {
                parent::__construct($appName, $request);
 
-               $this->cssManager = $cssManager;
+               $this->appData = $appData;
                $this->timeFactory = $timeFactory;
        }
 
@@ -64,7 +63,8 @@ class CssController extends Controller {
         */
        public function getCss($fileName, $appName) {
                try {
-                       $cssFile = $this->cssManager->getCss($fileName, $appName);
+                       $folder = $this->appData->getFolder($appName);
+                       $cssFile = $folder->getFile($fileName);
                } catch(NotFoundException $e) {
                        return new NotFoundResponse();
                }
index 3e514ca533d77f956ba3dab7e7088e3598ac79dc..ac42960f54d6b28fa9711779d5ea3a38b84e6455 100644 (file)
@@ -95,10 +95,6 @@ class DIContainer extends SimpleContainer implements IAppContainer {
                        return $this->getServer()->getAvatarManager();
                });
 
-               $this->registerService('OCP\\ICssManager', function($c) {
-                       return $this->getServer()->getCssManager();
-               });
-
                $this->registerService('OCP\\Activity\\IManager', function($c) {
                        return $this->getServer()->getActivityManager();
                });
diff --git a/lib/private/CssManager.php b/lib/private/CssManager.php
deleted file mode 100644 (file)
index e0f710b..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016, John Molakvoæ (skjnldsv@protonmail.com)
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OC;
-
-use OCP\Files\IAppData;
-use OCP\Files\NotFoundException;
-use OCP\Files\SimpleFS\ISimpleFile;
-
-/**
- * This class implements methods to access SCSS cached files
- * @since 11.0.0
- */
-
-class CssManager {
-
-       /** @var IAppData */
-       private $appData;
-
-       /**
-        * CssManager constructor.
-        *
-        * @param IAppData $appData
-        */
-       public function __construct(IAppData $appData) {
-               $this->appData = $appData;
-       }
-
-       /**
-        * Get the css file and return ISimpleFile
-        *
-        * @param string $fileName css filename with extension
-        * @param string $appName css app name
-        * @return ISimpleFile
-        * @throws NotFoundException
-        */
-       public function getCss($fileName, $appName) {
-               $folder = $this->appData->getFolder($appName);
-               return $folder->getFile($fileName);
-       }
-}