N+1 fix: Look up Articles, Revisions and Users in batches of 100 when importing revisions
N+1 fix: Look up Articles, Revisions and Users in batches of 100 when importing revisions

When importing revisions, you need Articles, all revisions for that Article, and all Users mentioned in Revisions.

Instead of a one-by-one process, this way aims to get all Articles, Users and Revisions in batches of 100 Articles. This means that each batch of 100 Articles should only cause 4 SQL queries, rather than the previous ~300.

This commit depends on the unique index being added in the previous commit. Without it, Article.import would insert duplicate rows. We rely on on_duplicate_key_update to take care of the updating functionality in the previous code.

Also, rather than use the database to tell us if an article title has 4 byte Unicode characters, we check that ourselves in Ruby.

WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard