diff --git a/core/Application.php b/core/Application.php index ec93c50b44..dad7546dcb 100644 --- a/core/Application.php +++ b/core/Application.php @@ -30,11 +30,11 @@ 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) + ); }); } } diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index eb5e8d55b2..e547987902 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -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(); } diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 3e514ca533..ac42960f54 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -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 index e0f710b8d7..0000000000 --- a/lib/private/CssManager.php +++ /dev/null @@ -1,59 +0,0 @@ -. - * - */ - -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); - } -}