Fix Nextcloud 12 compatibility

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-09-11 11:14:33 +02:00
parent 6fd01c3993
commit e88a4a0b3d
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 7 additions and 2 deletions

View File

@ -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)) {