diff options
author | Janis Köhr <janis.koehr@novatec-gmbh.de> | 2019-09-16 21:14:11 +0200 |
---|---|---|
committer | Janis Köhr <janis.koehr@novatec-gmbh.de> | 2019-09-16 21:14:11 +0200 |
commit | d75fbab5d21cade3174466bf9a80d42da1f42a44 (patch) | |
tree | 4e15732e8f925ca7ac1ef9bddf5de8a8854f2d9e /apps/accessibility/lib | |
parent | 4a1ce954648d6803bf50a19a3177d6871056dd79 (diff) | |
download | nextcloud-server-d75fbab5d21cade3174466bf9a80d42da1f42a44.tar.gz nextcloud-server-d75fbab5d21cade3174466bf9a80d42da1f42a44.zip |
Removed duplicate defintion of app name and rebased/rebuilt.
Signed-off-by: Janis Köhr <janis.koehr@novatec-gmbh.de>
Diffstat (limited to 'apps/accessibility/lib')
-rw-r--r-- | apps/accessibility/lib/AppInfo/Application.php | 12 | ||||
-rw-r--r-- | apps/accessibility/lib/Migration/RepairUserConfig.php | 12 |
2 files changed, 11 insertions, 13 deletions
diff --git a/apps/accessibility/lib/AppInfo/Application.php b/apps/accessibility/lib/AppInfo/Application.php index e87341b6c1c..e884acad0af 100644 --- a/apps/accessibility/lib/AppInfo/Application.php +++ b/apps/accessibility/lib/AppInfo/Application.php @@ -31,7 +31,7 @@ use OCP\IURLGenerator; class Application extends App { /** @var string */ - protected $appName = 'accessibility'; + public const APP_NAME = 'accessibility'; /** @var IConfig */ private $config; @@ -43,7 +43,7 @@ class Application extends App { private $urlGenerator; public function __construct() { - parent::__construct($this->appName); + parent::__construct(self::APP_NAME); $this->config = \OC::$server->getConfig(); $this->userSession = \OC::$server->getUserSession(); $this->urlGenerator = \OC::$server->getURLGenerator(); @@ -53,11 +53,11 @@ class Application extends App { // Inject the fake css on all pages if enabled and user is logged $loggedUser = $this->userSession->getUser(); if (!is_null($loggedUser)) { - $userValues = $this->config->getUserKeys($loggedUser->getUID(), $this->appName); + $userValues = $this->config->getUserKeys($loggedUser->getUID(), self::APP_NAME); // we want to check if any theme or font is enabled. if (count($userValues) > 0) { - $hash = $this->config->getUserValue($loggedUser->getUID(), $this->appName, 'icons-css', md5(implode('-', $userValues))); - $linkToCSS = $this->urlGenerator->linkToRoute($this->appName . '.accessibility.getCss', ['md5' => $hash]); + $hash = $this->config->getUserValue($loggedUser->getUID(), self::APP_NAME, 'icons-css', md5(implode('-', $userValues))); + $linkToCSS = $this->urlGenerator->linkToRoute(self::APP_NAME . '.accessibility.getCss', ['md5' => $hash]); \OCP\Util::addHeader('link', ['rel' => 'stylesheet', 'href' => $linkToCSS]); } } @@ -65,7 +65,7 @@ class Application extends App { public function injectJavascript() { $linkToJs = $this->urlGenerator->linkToRoute( - $this->appName . '.accessibility.getJavascript', + self::APP_NAME . '.accessibility.getJavascript', [ 'v' => \OC::$server->getConfig()->getAppValue('accessibility', 'cachebuster', '0'), ] diff --git a/apps/accessibility/lib/Migration/RepairUserConfig.php b/apps/accessibility/lib/Migration/RepairUserConfig.php index 0f80927839d..bd409f94d47 100644 --- a/apps/accessibility/lib/Migration/RepairUserConfig.php +++ b/apps/accessibility/lib/Migration/RepairUserConfig.php @@ -22,6 +22,7 @@ declare (strict_types = 1); namespace OCA\Accessibility\Migration; +use OCA\Accessibility\AppInfo\Application; use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; @@ -30,9 +31,6 @@ use OCP\Migration\IRepairStep; class RepairUserConfig implements IRepairStep { - /** @var string */ - private const APP_NAME = 'accessibility'; - /** @var IUserManager */ protected $userManager; @@ -72,13 +70,13 @@ class RepairUserConfig implements IRepairStep { public function run(IOutput $output) { $output->startProgress(); $this->userManager->callForSeenUsers(function(IUser $user) use ($output) { - $theme = $this->config->getUserValue($user->getUID(), self::APP_NAME, 'theme', false); + $theme = $this->config->getUserValue($user->getUID(), Application::APP_NAME, 'theme', false); if ($theme === 'themedark') { - $this->config->setUserValue($user->getUID(), self::APP_NAME, 'theme', 'dark'); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'theme', 'dark'); } if ($theme === 'themehighcontrast') { - $this->config->setUserValue($user->getUID(), self::APP_NAME, 'highcontrast', 'highcontrast'); - $this->config->deleteUserValue($user->getUID(), self::APP_NAME, 'theme'); + $this->config->setUserValue($user->getUID(), Application::APP_NAME, 'highcontrast', 'highcontrast'); + $this->config->deleteUserValue($user->getUID(), Application::APP_NAME, 'theme'); } $output->advance(); }); |