summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2017-12-08 18:19:01 +0100
committerGitHub <noreply@github.com>2017-12-08 18:19:01 +0100
commit83509b0fd34b7e74079efab8b26c584b22b48b91 (patch)
tree618d63f9030d1e8064f7622b2d1bb913e1ccaeab /lib/private/legacy
parent6aac1ffa33a0e1c9acad5eb78854c92dc0e1178a (diff)
parent8ffd4428bbe5791e5353bd9d60d0a3127adcb332 (diff)
downloadnextcloud-server-83509b0fd34b7e74079efab8b26c584b22b48b91.tar.gz
nextcloud-server-83509b0fd34b7e74079efab8b26c584b22b48b91.zip
Merge pull request #7334 from nextcloud/feature/noid/language-depending-skeleton-directory
Allow `{lang}` as a placeholder in the skeleton directory
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/util.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 2fc6ba52d4e..5cc83c0c304 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -379,7 +379,23 @@ class OC_Util {
*/
public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) {
- $skeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
+ $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
+ $userLang = \OC::$server->getL10NFactory()->findLanguage();
+ $skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
+
+ if (!file_exists($skeletonDirectory)) {
+ $dialectStart = strpos($userLang, '_');
+ if ($dialectStart !== false) {
+ $skeletonDirectory = str_replace('{lang}', substr($userLang, 0, $dialectStart), $plainSkeletonDirectory);
+ }
+ if ($dialectStart === false || !file_exists($skeletonDirectory)) {
+ $skeletonDirectory = str_replace('{lang}', 'default', $plainSkeletonDirectory);
+ }
+ if (!file_exists($skeletonDirectory)) {
+ $skeletonDirectory = '';
+ }
+ }
+
$instanceId = \OC::$server->getConfig()->getSystemValue('instanceid', '');
if ($instanceId === null) {