Merge pull request #1081 from nextcloud/backport-660-config-path-from-env

[stable10] Allow the config dir to be specified via the enviroment
This commit is contained in:
Lukas Reschke 2016-08-26 14:56:31 +02:00 committed by GitHub
commit 977c49ae6d
4 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,7 @@ class SetupController {
* @param Setup $setupHelper * @param Setup $setupHelper
*/ */
function __construct(Setup $setupHelper) { function __construct(Setup $setupHelper) {
$this->autoConfigFile = \OC::$SERVERROOT.'/config/autoconfig.php'; $this->autoConfigFile = \OC::$configDir.'autoconfig.php';
$this->setupHelper = $setupHelper; $this->setupHelper = $setupHelper;
} }

View File

@ -90,7 +90,7 @@ try {
exit(0); exit(0);
} }
$user = posix_getpwuid(posix_getuid()); $user = posix_getpwuid(posix_getuid());
$configUser = posix_getpwuid(fileowner(OC::$SERVERROOT . '/config/config.php')); $configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
if ($user['name'] !== $configUser['name']) { if ($user['name'] !== $configUser['name']) {
echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL; echo "Console has to be executed with the same user as the web server is operated" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL; echo "Current user: " . $user['name'] . PHP_EOL;

View File

@ -123,6 +123,8 @@ class OC {
self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
} elseif(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { } elseif(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) {
self::$configDir = OC::$SERVERROOT . '/tests/config/'; self::$configDir = OC::$SERVERROOT . '/tests/config/';
} elseif($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
self::$configDir = rtrim($dir, '/') . '/';
} else { } else {
self::$configDir = OC::$SERVERROOT . '/config/'; self::$configDir = OC::$SERVERROOT . '/config/';
} }
@ -216,7 +218,7 @@ class OC {
// set the right include path // set the right include path
set_include_path( set_include_path(
OC::$SERVERROOT . '/lib/private' . PATH_SEPARATOR . OC::$SERVERROOT . '/lib/private' . PATH_SEPARATOR .
OC::$SERVERROOT . '/config' . PATH_SEPARATOR . self::$configDir . PATH_SEPARATOR .
OC::$SERVERROOT . '/3rdparty' . PATH_SEPARATOR . OC::$SERVERROOT . '/3rdparty' . PATH_SEPARATOR .
implode(PATH_SEPARATOR, $paths) . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths) . PATH_SEPARATOR .
get_include_path() . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR .

View File

@ -615,7 +615,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('MimeTypeDetector', function (Server $c) { $this->registerService('MimeTypeDetector', function (Server $c) {
return new \OC\Files\Type\Detection( return new \OC\Files\Type\Detection(
$c->getURLGenerator(), $c->getURLGenerator(),
\OC::$SERVERROOT . '/config/', \OC::$configDir,
\OC::$SERVERROOT . '/resources/config/' \OC::$SERVERROOT . '/resources/config/'
); );
}); });