Skip to content
Closed
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
24 changes: 18 additions & 6 deletions lib/Fetcher/ExAppArchiveFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function installTranslations(string $appId, string $dirTranslations): str
}

public function getExAppFolder(string $appId): ?string {
$appsPaths = $this->config->getSystemValue('apps_paths');
$appsPaths = $this->config->getSystemValue('apps_paths', []);
$existingPath = '';
foreach ($appsPaths as $appPath) {
if ($appPath['writable'] && file_exists($appPath['path'] . '/' . $appId)) {
Expand All @@ -107,15 +107,27 @@ public function getExAppFolder(string $appId): ?string {
}
}
}
// 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'] && file_exists($appPath['path'] . '/' . $appId)) {
$this->rmdirr($appPath['path'] . '/' . $appId);
}
}
}
Expand Down
Loading