diff options
author | tbelau666 <thomas.belau@gmx.de> | 2014-11-30 23:17:09 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-12-22 10:45:32 +0100 |
commit | ad8d55c3274e81dd4fd92b41ac5d6ef5c39febf3 (patch) | |
tree | 02d1ebe0f029d0bfa0371b9961e2a47988c719ba /lib/private/db/mdb2schemawriter.php | |
parent | 5d296aa6b1fca69cfa14cc29eeb5f757a4b7dfad (diff) | |
download | nextcloud-server-ad8d55c3274e81dd4fd92b41ac5d6ef5c39febf3.tar.gz nextcloud-server-ad8d55c3274e81dd4fd92b41ac5d6ef5c39febf3.zip |
Use Doctrines filter by table name
Doctrine's SchemaManager can filter table names by regular expression.
On this way it picks up only ownClouds's tables in a database.
by tbelau666
Diffstat (limited to 'lib/private/db/mdb2schemawriter.php')
-rw-r--r-- | lib/private/db/mdb2schemawriter.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/db/mdb2schemawriter.php b/lib/private/db/mdb2schemawriter.php index a2a62a81475..3c91f3c784a 100644 --- a/lib/private/db/mdb2schemawriter.php +++ b/lib/private/db/mdb2schemawriter.php @@ -13,13 +13,17 @@ class OC_DB_MDB2SchemaWriter { * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $sm * @return bool */ - static public function saveSchemaToFile($file, $sm) { + static public function saveSchemaToFile($file, $conn) { $xml = new SimpleXMLElement('<database/>'); $xml->addChild('name', OC_Config::getValue( "dbname", "owncloud" )); $xml->addChild('create', 'true'); $xml->addChild('overwrite', 'false'); $xml->addChild('charset', 'utf8'); - foreach ($sm->listTables() as $table) { + + $conn->getConfiguration()-> + setFilterSchemaAssetsExpression('/^'.\OCP\Config::getSystemValue('dbtableprefix'.'/')); + + foreach ($conn->getSchemaManager()->listTables() as $table) { self::saveTable($table, $xml->addChild('table')); } file_put_contents($file, $xml->asXML()); |