diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-01-15 16:24:31 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-01-26 14:02:31 +0100 |
commit | b24b198a83de78c2288482cdf915f15c131653dc (patch) | |
tree | 31b46555145529b6e295bfeb0159303a64530bcb /lib/private/l10n | |
parent | 8f9cc515593e396d57ec47b836b48411828d8efa (diff) | |
download | nextcloud-server-b24b198a83de78c2288482cdf915f15c131653dc.tar.gz nextcloud-server-b24b198a83de78c2288482cdf915f15c131653dc.zip |
Add tests for the factory
Diffstat (limited to 'lib/private/l10n')
-rw-r--r-- | lib/private/l10n/factory.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php index 3044cf09519..40ad4f5ef59 100644 --- a/lib/private/l10n/factory.php +++ b/lib/private/l10n/factory.php @@ -176,7 +176,7 @@ class Factory implements IFactory { } $languages = $this->findAvailableLanguages($app); - return array_search($lang, $languages); + return array_search($lang, $languages) !== false; } /** @@ -238,7 +238,7 @@ class Factory implements IFactory { $i18nDir = $this->findL10nDir($app); $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; - if((\OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/core/l10n/') + if ((\OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/core/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/lib/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC::$SERVERROOT . '/settings/l10n/') || \OC_Helper::isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') @@ -267,15 +267,15 @@ class Factory implements IFactory { * @return string directory */ protected function findL10nDir($app = null) { - if ($app) { - // Check if the app is in the app folder - if (\OC_App::getAppPath($app) && file_exists(\OC_App::getAppPath($app) . '/l10n/')) { - return \OC_App::getAppPath($app) . '/l10n/'; - } else { + if (in_array($app, ['core', 'lib', 'settings'])) { + if (file_exists(\OC::$SERVERROOT . '/' . $app . '/l10n/')) { return \OC::$SERVERROOT . '/' . $app . '/l10n/'; } + } else if ($app && \OC_App::getAppPath($app) !== false) { + // Check if the app is in the app folder + return \OC_App::getAppPath($app) . '/l10n/'; } - return \OC::$SERVERROOT.'/core/l10n/'; + return \OC::$SERVERROOT . '/core/l10n/'; } |