refreshLinks.php: Get IDs in batches in deleteLinksFromNonexistent()
... instead of making an unbuffered query, which is discouraged in the
doc comment for DatabaseBase::bufferResults().
Also used NOT IN for the antijoin instead of LEFT JOIN...IS NULL; when
combined with DISTINCT, the latter causes MySQL to use a temporary
table rather than an appropriate index, according to EXPLAIN. (Using
GROUP BY instead of DISTINCT also avoids this problem. I don't know why.)
Bug: T44180
Change-Id: Idca85fac7dd7879f9fbef2712b6aa83343099e02