getTable('twofactor_totp_secrets'); if ($table->hasColumn('verified')) { $this->hasVerfiedColumn = true; } return null; } /** * @param IOutput $output * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @psalm-param Closure():ISchemaWrapper $schemaClosure * @param array $options */ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { if ($this->hasVerfiedColumn) { // There is a 'verified' column which comes from owncloud // If verified is set to 0 then the twofactor auth was not properly enabled and we should remove those entries $qb = $this->db->getQueryBuilder(); $qb->delete('twofactor_totp_secrets') ->where($qb->expr()->eq('verified', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT))) ->executeStatement(); } } }