schemaSetup = $schemaSetup; $this->connection = $resourceConnection->getConnection(); } /** * @inheritDoc */ public function apply(): RemoveDeprecatedIpTablesFromDatabase { $this->schemaSetup->startSetup(); foreach ($this->getTablesToDelete() as $table) { $this->connection->dropTable($this->connection->getTableName($table)); } $this->schemaSetup->endSetup(); return $this; } /** * @inheritDoc */ public static function getDependencies(): array { return []; } /** * @inheritDoc */ public function getAliases(): array { return []; } /** * @return array */ private function getTablesToDelete(): array { $tablesToDelete = $this->connection->query( "SHOW TABLES LIKE '{$this->connection->getTableName('prgeoiplookup_maxmindgeoip_city_blocks')}%'" )->fetchAll(PDO::FETCH_COLUMN); $tablesToDelete[] = 'prgeoiplookup_maxmindgeoip_city_locations'; $tablesToDelete[] = 'prgeoiplookup_iptocountry'; $tablesToDelete[] = 'prgeoiplookup_installed_versions'; return $tablesToDelete; } }