diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-07-10 11:31:59 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-07-10 11:31:59 +0200 |
commit | edf096a09f1e2de5206d5e718fdf483514d568c5 (patch) | |
tree | c1357199da404d0d94eab27f1854cd3bdda4ea51 | |
parent | 12c0cfc977fae691fd09fe916d533397ee448d46 (diff) | |
download | nextcloud-server-fix/cleanup-getinstallpath.tar.gz nextcloud-server-fix/cleanup-getinstallpath.zip |
chore: Check if apps directory is really writable in Installerfix/cleanup-getinstallpath
...rather than checkServer.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | lib/private/Installer.php | 10 | ||||
-rw-r--r-- | lib/private/legacy/OC_Util.php | 14 |
2 files changed, 10 insertions, 14 deletions
diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 6b736bc104a..91d20a129ae 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -171,10 +171,20 @@ class Installer { /** * Get the path where to install apps + * + * @throws \RuntimeException if an app folder is marked as writable but is missing permissions */ public function getInstallPath(): ?string { foreach (\OC::$APPSROOTS as $dir) { if (isset($dir['writable']) && $dir['writable'] === true) { + // Check if there is a writable install folder. + if (!is_writable($dir['path']) + || !is_readable($dir['path']) + ) { + throw new \RuntimeException( + 'Cannot write into "apps" directory. This can usually be fixed by giving the web server write access to the apps directory or disabling the App Store in the config file.' + ); + } return $dir['path']; } } diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index da89365478c..ebca1105838 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -343,20 +343,6 @@ class OC_Util { } } - // Check if there is a writable install folder. - if ($config->getValue('appstoreenabled', true)) { - $installPath = \OCP\Server::get(\OC\Installer::class)->getInstallPath(); - if ($installPath === null - || !is_writable($installPath) - || !is_readable($installPath) - ) { - $errors[] = [ - 'error' => $l->t('Cannot write into "apps" directory.'), - 'hint' => $l->t('This can usually be fixed by giving the web server write access to the apps directory' - . ' or disabling the App Store in the config file.') - ]; - } - } // Create root dir. if ($config->getValue('installed', false)) { if (!is_dir($CONFIG_DATADIRECTORY)) { |