|
@@ -123,14 +123,14 @@ discard block |
|
|
block discarded – undo |
|
123
|
123
|
|
|
124
|
124
|
public function listCreators(): array { |
|
125
|
125
|
$types = $this->getTypes(); |
|
126
|
|
- usort($types, function (TemplateFileCreator $a, TemplateFileCreator $b) { |
|
|
126
|
+ usort($types, function(TemplateFileCreator $a, TemplateFileCreator $b) { |
|
127
|
127
|
return $a->getOrder() - $b->getOrder(); |
|
128
|
128
|
}); |
|
129
|
129
|
return $types; |
|
130
|
130
|
} |
|
131
|
131
|
|
|
132
|
132
|
public function listTemplates(): array { |
|
133
|
|
- return array_map(function (TemplateFileCreator $entry) { |
|
|
133
|
+ return array_map(function(TemplateFileCreator $entry) { |
|
134
|
134
|
return array_merge($entry->jsonSerialize(), [ |
|
135
|
135
|
'templates' => $this->getTemplateFiles($entry) |
|
136
|
136
|
]); |
|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
$template = $userFolder->get($templateId); |
|
157
|
157
|
$template->copy($targetFile->getPath()); |
|
158
|
158
|
} else { |
|
159
|
|
- $matchingProvider = array_filter($this->getRegisteredProviders(), function (ICustomTemplateProvider $provider) use ($templateType) { |
|
|
159
|
+ $matchingProvider = array_filter($this->getRegisteredProviders(), function(ICustomTemplateProvider $provider) use ($templateType) { |
|
160
|
160
|
return $templateType === get_class($provider); |
|
161
|
161
|
}); |
|
162
|
162
|
$provider = array_shift($matchingProvider); |
|
@@ -257,8 +257,8 @@ discard block |
|
|
block discarded – undo |
|
257
|
257
|
$this->userId = $userId; |
|
258
|
258
|
} |
|
259
|
259
|
|
|
260
|
|
- $defaultSkeletonDirectory = \OC::$SERVERROOT . '/core/skeleton'; |
|
261
|
|
- $defaultTemplateDirectory = \OC::$SERVERROOT . '/core/skeleton/Templates'; |
|
|
260
|
+ $defaultSkeletonDirectory = \OC::$SERVERROOT.'/core/skeleton'; |
|
|
261
|
+ $defaultTemplateDirectory = \OC::$SERVERROOT.'/core/skeleton/Templates'; |
|
262
|
262
|
$skeletonPath = $this->config->getSystemValue('skeletondirectory', $defaultSkeletonDirectory); |
|
263
|
263
|
$skeletonTemplatePath = $this->config->getSystemValue('templatedirectory', $defaultTemplateDirectory); |
|
264
|
264
|
$isDefaultSkeleton = $skeletonPath === $defaultSkeletonDirectory; |
|
@@ -268,7 +268,7 @@ discard block |
|
|
block discarded – undo |
|
268
|
268
|
try { |
|
269
|
269
|
$l10n = $this->l10nFactory->get('lib', $userLang); |
|
270
|
270
|
$userFolder = $this->rootFolder->getUserFolder($this->userId); |
|
271
|
|
- $userTemplatePath = $path ?? $l10n->t('Templates') . '/'; |
|
|
271
|
+ $userTemplatePath = $path ?? $l10n->t('Templates').'/'; |
|
272
|
272
|
|
|
273
|
273
|
// Initial user setup without a provided path |
|
274
|
274
|
if ($path === null) { |
|
@@ -277,7 +277,7 @@ discard block |
|
|
block discarded – undo |
|
277
|
277
|
if (!$userFolder->nodeExists('Templates')) { |
|
278
|
278
|
return ''; |
|
279
|
279
|
} |
|
280
|
|
- $newPath = Filesystem::normalizePath($userFolder->getPath() . '/' . $userTemplatePath); |
|
|
280
|
+ $newPath = Filesystem::normalizePath($userFolder->getPath().'/'.$userTemplatePath); |
|
281
|
281
|
if ($newPath !== $userFolder->get('Templates')->getPath()) { |
|
282
|
282
|
$userFolder->get('Templates')->move($newPath); |
|
283
|
283
|
} |
|
@@ -315,7 +315,7 @@ discard block |
|
|
block discarded – undo |
|
315
|
315
|
} |
|
316
|
316
|
|
|
317
|
317
|
if ($path !== null && $isDefaultSkeleton && $isDefaultTemplates && $folderIsEmpty) { |
|
318
|
|
- $localizedSkeletonPath = $this->getLocalizedTemplatePath($skeletonPath . '/Templates', $userLang); |
|
|
318
|
+ $localizedSkeletonPath = $this->getLocalizedTemplatePath($skeletonPath.'/Templates', $userLang); |
|
319
|
319
|
if (!empty($localizedSkeletonPath) && file_exists($localizedSkeletonPath)) { |
|
320
|
320
|
\OC_Util::copyr($localizedSkeletonPath, $folder); |
|
321
|
321
|
$userFolder->getStorage()->getScanner()->scan($folder->getInternalPath(), Scanner::SCAN_RECURSIVE); |
|
@@ -327,7 +327,7 @@ discard block |
|
|
block discarded – undo |
|
327
|
327
|
$this->setTemplatePath($path ?? ''); |
|
328
|
328
|
return $this->getTemplatePath(); |
|
329
|
329
|
} catch (\Throwable $e) { |
|
330
|
|
- $this->logger->error('Failed to initialize templates directory to user language ' . $userLang . ' for ' . $userId, ['app' => 'files_templates', 'exception' => $e]); |
|
|
330
|
+ $this->logger->error('Failed to initialize templates directory to user language '.$userLang.' for '.$userId, ['app' => 'files_templates', 'exception' => $e]); |
|
331
|
331
|
} |
|
332
|
332
|
$this->setTemplatePath(''); |
|
333
|
333
|
return $this->getTemplatePath(); |