Allow converting from any db type

This commit is contained in:
Bart Visscher 2014-02-11 18:01:41 +01:00
parent eede20c5ac
commit 3abcd13979
2 changed files with 5 additions and 12 deletions

View File

@ -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');

View File

@ -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());