From 3abcd13979660309f9a6d672d3dc64a7c6d784ab Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 11 Feb 2014 18:01:41 +0100 Subject: [PATCH] Allow converting from any db type --- .../db/{convertfromsqlite.php => converttype.php} | 15 ++++----------- core/register_command.php | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) rename core/command/db/{convertfromsqlite.php => converttype.php} (92%) diff --git a/core/command/db/convertfromsqlite.php b/core/command/db/converttype.php similarity index 92% rename from core/command/db/convertfromsqlite.php rename to core/command/db/converttype.php index 7170658038..38527d3d55 100644 --- a/core/command/db/convertfromsqlite.php +++ b/core/command/db/converttype.php @@ -15,7 +15,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class ConvertFromSqlite extends Command { +class ConvertType extends Command { /** * @var \OC\Config $config */ @@ -31,8 +31,8 @@ class ConvertFromSqlite extends Command { protected function configure() { $this - ->setName('db:convert-from-sqlite') - ->setDescription('Convert the owncloud sqlite database to the newly configured one') + ->setName('db:convert-type') + ->setDescription('Convert the owncloud database to the newly configured one') ->addArgument( 'type', InputArgument::REQUIRED, @@ -82,14 +82,7 @@ class ConvertFromSqlite extends Command { ); protected function execute(InputInterface $input, OutputInterface $output) { // connect 'from' database - $datadir = $this->config->getValue( "datadirectory", \OC::$SERVERROOT.'/data' ); - $name = $this->config->getValue( "dbname", "owncloud" ); - $dbfile = $datadir.'/'.$name.'.db'; - $connectionParams = array( - 'path' => $dbfile, - 'driver' => 'pdo_sqlite', - ); - $fromDB = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); + $fromDB = \OC_DB::getConnection(); // connect 'to' database $type = $input->getArgument('type'); diff --git a/core/register_command.php b/core/register_command.php index 736953094b..a3833214c2 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(OC_Config::getObject())); +$application->add(new OC\Core\Command\Db\ConvertType(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());