After some tedious and silly debugging I confirmed that the queries still work, but there were some silly bugs caused by Labs incompatibilities.
- Reference to the toolserver.namespace table: replaced with [[https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools/Overview#Databases| s51892_toolserverdb_p]].
- Access denied to table ".page" and so on: caused by using the dbname SELECT dbname, lang, family, url, slice FROM meta_p.wiki WHERE is_closed = 0; which does not work in Labs:
MariaDB [meta_p]> SELECT dbname FROM meta_p.wiki WHERE is_closed = 0 limit 1; +-------------+ | dbname | +-------------+ | srwikibooks | +-------------+ 1 row in set (0.00 sec)
but Labs requires the _p suffix to be used in queries. I added the suffix explicitly in each query just to be clearer.
- The loop had a $adomain = $row['domain']; which had to be $adomain = $row['url']; because that's the name of the column in meta_p.
There can be improvements (to be filed in this component) but for now the thing seems to work well. :)