[Pkg-owncloud-commits] [owncloud] 04/153: Inject config object
David Prévot
taffit at moszumanska.debian.org
Tue May 27 03:05:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 202e26647e534065271db153fde7207922fa2ecd
Author: Bart Visscher <bartv at thisnet.nl>
Date: Tue Dec 24 13:36:32 2013 +0100
Inject config object
---
core/command/db/convertfromsqlite.php | 33 +++++++++++++++++++++++----------
core/register_command.php | 2 +-
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/core/command/db/convertfromsqlite.php b/core/command/db/convertfromsqlite.php
index fb11409..de65fe9 100644
--- a/core/command/db/convertfromsqlite.php
+++ b/core/command/db/convertfromsqlite.php
@@ -16,6 +16,19 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ConvertFromSqlite extends Command {
+ /**
+ * @var \OC\Config $config
+ */
+ protected $config;
+
+ /**
+ * @param \OC\Config $config
+ */
+ public function __construct($config) {
+ $this->config = $config;
+ parent::__construct();
+ }
+
protected function configure() {
$this
->setName('db:convert-from-sqlite')
@@ -63,8 +76,8 @@ class ConvertFromSqlite extends Command {
);
protected function execute(InputInterface $input, OutputInterface $output) {
// connect 'from' database
- $datadir = \OC_Config::getValue( "datadirectory", \OC::$SERVERROOT.'/data' );
- $name = \OC_Config::getValue( "dbname", "owncloud" );
+ $datadir = $this->config->getValue( "datadirectory", \OC::$SERVERROOT.'/data' );
+ $name = $this->config->getValue( "dbname", "owncloud" );
$dbfile = $datadir.'/'.$name.'.db';
$connectionParams = array(
'path' => $dbfile,
@@ -139,7 +152,7 @@ class ConvertFromSqlite extends Command {
}
}
// enable maintenance mode to prevent changes
- \OC_Config::setValue('maintenance', true);
+ $this->config->setValue('maintenance', true);
try {
// copy table rows
$tables = array_intersect($toTables, $fromTables);
@@ -152,16 +165,16 @@ class ConvertFromSqlite extends Command {
if ($input->getOption('port')) {
$dbhost = $hostname.':'.$input->getOption('port');
}
- \OC_Config::setValue('dbtype', $type);
- \OC_Config::setValue('dbname', $dbname);
- \OC_Config::setValue('dbhost', $dbhost);
- \OC_Config::setValue('dbuser', $username);
- \OC_Config::setValue('dbpassword', $password);
+ $this->config->setValue('dbtype', $type);
+ $this->config->setValue('dbname', $dbname);
+ $this->config->setValue('dbhost', $dbhost);
+ $this->config->setValue('dbuser', $username);
+ $this->config->setValue('dbpassword', $password);
} catch(Exception $e) {
- \OC_Config::setValue('maintenance', false);
+ $this->config->setValue('maintenance', false);
throw $e;
}
- \OC_Config::setValue('maintenance', false);
+ $this->config->setValue('maintenance', false);
}
private function getTables($db) {
diff --git a/core/register_command.php b/core/register_command.php
index 419747e..350a817 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -9,7 +9,7 @@
/** @var $application Symfony\Component\Console\Application */
$application->add(new OC\Core\Command\Status);
$application->add(new OC\Core\Command\Db\GenerateChangeScript());
-$application->add(new OC\Core\Command\Db\ConvertFromSqlite());
+$application->add(new OC\Core\Command\Db\ConvertFromSqlite(OC_Config::getObject()));
$application->add(new OC\Core\Command\Upgrade());
$application->add(new OC\Core\Command\Maintenance\SingleUser());
$application->add(new OC\Core\Command\App\Disable());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list