Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions lib/Fetcher/ExAppArchiveFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,32 +95,36 @@ public function installTranslations(string $appId, string $dirTranslations): str
}

public function getExAppFolder(string $appId): ?string {
$appsPaths = $this->config->getSystemValue('apps_paths');
$existingPath = '';
foreach ($appsPaths as $appPath) {
if ($appPath['writable'] && file_exists($appPath['path'] . '/' . $appId)) {
$existingPath = $appPath['path'] . '/' . $appId;
}
}
if (!empty($existingPath)) {
return $existingPath;
}
$appsPaths = $this->config->getSystemValue('apps_paths', []);
foreach ($appsPaths as $appPath) {
if ($appPath['writable']) {
if (mkdir($appPath['path'] . '/' . $appId)) {
return $appPath['path'] . '/' . $appId;
$fullAppPath = $appPath['path'] . '/' . $appId;
if (is_dir($fullAppPath) || mkdir($fullAppPath)) {
return $fullAppPath;
}
}
}
// Fallback to default ExApp folder
$defaultExAppFolder = \OC::$SERVERROOT . '/apps/' . $appId;
if (is_dir($defaultExAppFolder)) {
return $defaultExAppFolder;
}
return null;
}

public function removeExAppFolder(string $appId): void {
foreach ($this->config->getSystemValue('apps_paths', []) as $appPath) {
if ($appPath['writable']) {
if (file_exists($appPath['path'] . '/' . $appId)) {
$this->rmdirr($appPath['path'] . '/' . $appId);
}
$appsPaths = $this->config->getSystemValue('apps_paths', []);
if (empty($appsPaths)) {
// fallback check of default ExApp folder
$defaultExAppFolder = \OC::$SERVERROOT . '/apps/' . $appId;
if (is_dir($defaultExAppFolder)) {
$this->rmdirr($defaultExAppFolder);
}
return;
}
foreach ($appsPaths as $appPath) {
if ($appPath['writable'] && is_dir($appPath['path'] . '/' . $appId)) {
$this->rmdirr($appPath['path'] . '/' . $appId);
}
}
}
Expand Down
Loading