From f43a88d5e65b1f71b64a5276c5b9a68059a0de17 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 23 Mar 2018 16:45:43 +0100 Subject: [PATCH] Add per default the apps2 directory in config.php during installation --- lib/private/Setup.php | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 76bbe6b1a886..9dd4275bfa05 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -373,15 +373,49 @@ public function install($options) { Setup::updateHtaccess(); Setup::protectDataDirectory(); - //try to write logtimezone + // try to write logtimezone if (date_default_timezone_get()) { $config->setSystemValue('logtimezone', date_default_timezone_get()); } self::installBackgroundJobs(); - //and we are done $config->setSystemValue('installed', true); + + // adding the apps2 directory by default + $appsDir = \OC::$SERVERROOT . '/apps'; + $apps2Dir = \OC::$SERVERROOT . '/apps2'; + $apps2Exists = (file_exists($apps2Dir) || is_link($apps2Dir)); + (bool)$apps2Key = \OC::$server->getSystemConfig()->getValue('apps_paths', false); + + // try to create the apps2 directory + // should already be done by the presetup scrips (see documentation) + if (!$apps2Exists) { + @mkdir($apps2Dir); + } + + // add the key only of not existent (protect possible overwriting) + if (!$apps2Key) { + $z = array( + 'apps_path' => array( + 0 => array( + "path" => $appsDir, + "url" => "/apps", + "writable" => "false" + ), + 1 => array( + "path" => $apps2Dir, + "url" => "/apps2", + "writable" => "true" + ) + ) + ); + + $config->setSystemValues($z); + } + + // finished initial setup + } return $error;