diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index c626f24bcc31f9b3a643288db71a10aa728d0e85..5b9432d631ba194578c0a1cb3e3ff514c99df25d 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -9,6 +9,7 @@
 namespace OC\Core\Command;
 
 use OC\Updater;
+use OCP\IConfig;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
@@ -24,6 +25,18 @@ class Upgrade extends Command {
 
 	public $upgradeFailed = false;
 
+	/**
+	 * @var IConfig
+	 */
+	private $config;
+
+	/**
+	 * @param IConfig $config
+	 */
+	public function __construct(IConfig $config) {
+		$this->config = $config;
+	}
+
 	protected function configure() {
 		$this
 			->setName('upgrade')
@@ -106,7 +119,7 @@ class Upgrade extends Command {
 			$this->postUpgradeCheck($input, $output);
 
 			return self::ERROR_SUCCESS;
-		} else if(\OC_Config::getValue('maintenance', false)) {
+		} else if($this->config->getSystemValue('maintenance', false)) {
 			//Possible scenario: ownCloud core is updated but an app failed
 			$output->writeln('<warning>ownCloud is in maintenance mode</warning>');
 			$output->write('<comment>Maybe an upgrade is already in process. Please check the '
@@ -128,7 +141,7 @@ class Upgrade extends Command {
 	 * @param OutputInterface $output output interface
 	 */
 	protected function postUpgradeCheck(InputInterface $input, OutputInterface $output) {
-		$trustedDomains = \OC_Config::getValue('trusted_domains', array());
+		$trustedDomains = $this->config->getSystemValue('trusted_domains', array());
 		if (empty($trustedDomains)) {
 			$output->write(
 				'<warning>The setting "trusted_domains" could not be ' .
diff --git a/core/register_command.php b/core/register_command.php
index b02988bbdd8108c9269547261372403f8924c5a3..aaf10d946b263b22d1b6f9e6cb9d76f36ce95b71 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -12,7 +12,7 @@ $repair = new \OC\Repair(\OC\Repair::getRepairSteps());
 $application->add(new OC\Core\Command\Status);
 $application->add(new OC\Core\Command\Db\GenerateChangeScript());
 $application->add(new OC\Core\Command\Db\ConvertType(OC_Config::getObject(), new \OC\DB\ConnectionFactory()));
-$application->add(new OC\Core\Command\Upgrade());
+$application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig()));
 $application->add(new OC\Core\Command\Maintenance\SingleUser());
 $application->add(new OC\Core\Command\Maintenance\Mode(OC_Config::getObject()));
 $application->add(new OC\Core\Command\App\Disable());