Unnecessray database query and loop in dbDelta
|Reported by:||inxilpro||Owned by:|
The dbDelta function currently queries the database for all tables using SHOW TABLES, loops through that data, and then queries the database again to DESCRIBE the tables it is upgrading. This causes some issues with advanced database setups where sharding is in place (not all tables are on the same database), but more importantly, it's completely unnecessary. The function is already hitting the database for each table that it's comparing, so the loop can be removed, and the table's existence can be checked after the DESCRIBE query is run. I threw together a quick patch, but I haven't tested it yet. When I get a chance, I'll post any additional comments.