diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-11-13 13:34:11 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-11-18 12:36:03 +0100 |
commit | 260a084d27a0015053f7d1c68652d1c573da950d (patch) | |
tree | a8580bd98630d4b1b143207962b8fd2abe809952 /lib/repair | |
parent | d0a30b0e55799e8f5348ee558346d6ebf32cedda (diff) | |
download | nextcloud-server-260a084d27a0015053f7d1c68652d1c573da950d.tar.gz nextcloud-server-260a084d27a0015053f7d1c68652d1c573da950d.zip |
Add repair steps for legacy config files
Remove all ports from the trusted domains
Conflicts:
lib/private/repair.php
lib/repair/repairconfig.php
Diffstat (limited to 'lib/repair')
-rw-r--r-- | lib/repair/repairconfig.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/repair/repairconfig.php b/lib/repair/repairconfig.php index e09d8e8fe7a..e9b322da826 100644 --- a/lib/repair/repairconfig.php +++ b/lib/repair/repairconfig.php @@ -12,8 +12,16 @@ use OC\Hooks\BasicEmitter; use OC\RepairStep; use Sabre\DAV\Exception; +/** + * Class RepairConfig + * + * @package OC\Repair + */ class RepairConfig extends BasicEmitter implements RepairStep { + /** + * @return string + */ public function getName() { return 'Repair config'; } @@ -23,6 +31,7 @@ class RepairConfig extends BasicEmitter implements RepairStep { */ public function run() { $this->addSecret(); + $this->removePortsFromTrustedDomains(); } /** @@ -34,4 +43,24 @@ class RepairConfig extends BasicEmitter implements RepairStep { \OC::$server->getConfig()->setSystemValue('secret', $secret); } } + + + /** + * Remove ports from existing trusted domains in config.php + */ + private function removePortsFromTrustedDomains() { + $trustedDomains = \OC::$server->getConfig()->getSystemValue('trusted_domains', array()); + $newTrustedDomains = array(); + foreach($trustedDomains as $domain) { + $pos = strrpos($domain, ':'); + if ($pos !== false) { + $port = substr($domain, $pos + 1); + if (is_numeric($port)) { + $domain = substr($domain, 0, $pos); + } + } + $newTrustedDomains[] = $domain; + } + \OC::$server->getConfig()->setSystemValue('trusted_domains', $newTrustedDomains); + } } |