summaryrefslogtreecommitdiffstats
path: root/lib/private/Setup.php
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2018-09-10 22:45:40 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2018-09-10 22:45:40 +0200
commit603a578a1c9baab2c9eda08d5a316ed25a0163bf (patch)
tree1d050a159ab95c22c91900dfcf3c8d7d10bde84e /lib/private/Setup.php
parent62c03beb1d2dc133542c088e6c72b201211ccfba (diff)
downloadnextcloud-server-603a578a1c9baab2c9eda08d5a316ed25a0163bf.tar.gz
nextcloud-server-603a578a1c9baab2c9eda08d5a316ed25a0163bf.zip
Change return false to throw new
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/Setup.php')
-rw-r--r--lib/private/Setup.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index a31d746a062..4b6f2d54583 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -43,6 +43,7 @@ namespace OC;
use bantu\IniGetWrapper\IniGetWrapper;
use Exception;
+use InvalidArgumentException;
use OC\App\AppStore\Bundles\BundleFetcher;
use OC\Authentication\Token\DefaultTokenCleanupJob;
use OC\Authentication\Token\DefaultTokenProvider;
@@ -434,18 +435,19 @@ class Setup {
* Find webroot from config
*
* @param SystemConfig $config
- * @return bool|string
+ * @return string
+ * @throws InvalidArgumentException when invalid value for overwrite.cli.url
*/
- public static function findWebRoot(SystemConfig $config) {
+ public static function findWebRoot(SystemConfig $config): string {
// For CLI read the value from overwrite.cli.url
if (\OC::$CLI) {
$webRoot = $config->getValue('overwrite.cli.url', '');
if ($webRoot === '') {
- return false;
+ throw new InvalidArgumentException('overwrite.cli.url is empty');
}
$webRoot = parse_url($webRoot, PHP_URL_PATH);
if ($webRoot === null) {
- return false;
+ throw new InvalidArgumentException('invalid value for overwrite.cli.url');
}
$webRoot = rtrim($webRoot, '/');
} else {
@@ -463,7 +465,12 @@ class Setup {
*/
public static function updateHtaccess() {
$config = \OC::$server->getSystemConfig();
- $webRoot = self::findWebRoot($config);
+
+ try {
+ $webRoot = self::findWebRoot($config);
+ } catch (InvalidArgumentException $e) {
+ return false;
+ }
$setupHelper = new \OC\Setup(
$config,