Fix slow queries in migrateActors.php
MariaDB really doesn't like the complicated OR in the join condition for
the actor table, it winds up scanning the whole actor table to find the
match. After trying several different options, the best bet seems to be
to use subqueries to get the actor_id.
MariaDB also doesn't like the DISTINCTed query for log_search, it gets
confused if the selected fields contain other fields much like it
historically gets confused when GROUP BY contains fields that are
constant in the WHERE clause. So we'll do the select from log_search in
a subquery and then join with actor, and inject the constant ls_field
into the rows as a constant field.
Bug: T188327
Change-Id: I979c040441f83bdf36e2f4031152559391233e5f