From e88a4a0b3d5ec7977458eb8190d5100222ae27ef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Sep 2017 11:14:33 +0200 Subject: [PATCH] Fix Nextcloud 12 compatibility Signed-off-by: Joas Schilling --- lib/private/Repair/Owncloud/SaveAccountsTableData.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index c9e67356fb..909cb3be72 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -23,6 +23,8 @@ namespace OC\Repair\Owncloud; +use OC\DB\Connection; +use OC\DB\MDB2SchemaManager; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IConfig; use OCP\IDBConnection; @@ -38,7 +40,7 @@ class SaveAccountsTableData implements IRepairStep { const BATCH_SIZE = 75; - /** @var IDBConnection */ + /** @var IDBConnection|Connection */ protected $db; /** @var IConfig */ @@ -84,7 +86,10 @@ class SaveAccountsTableData implements IRepairStep { * @return bool */ protected function shouldRun() { - $schema = $this->db->createSchema(); + // This is the equivalent of the new migration code that is used in 13+ + $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; + $this->db->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression); + $schema = $this->db->getSchemaManager()->createSchema(); $tableName = $this->config->getSystemValue('dbtableprefix', 'oc_') . 'accounts'; if (!$schema->hasTable($tableName)) {