Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
select
pages.page_namespace,
pages.page_title,
restrictions.pr_level as editprotect,
mrestrictions.pr_level as moveprotect
FROM
(SELECT
page_id, page_namespace, page_title
FROM
`externallinks`
JOIN `page` ON page_id = el_from
WHERE
(el_to LIKE 'http://toolserver.org/~acc%'
OR el_to LIKE 'https://toolserver.org/~acc%')
AND page_namespace > 3
AND page_title NOT LIKE '%Archive%'
AND page_title NOT LIKE '%adminship%'
AND page_title NOT LIKE '%eletion%'
AND page_title NOT LIKE '%Abuse%' UNION DISTINCT SELECT
page_id, page_namespace, page_title
FROM
`iwlinks`
JOIN `page` ON page_id = iwl_from
WHERE
iwl_prefix = 'tools'
AND iwl_title LIKE '~acc%'
AND page_namespace > 3
AND page_title NOT LIKE '%Archive%'
AND page_title NOT LIKE '%adminship%'
AND page_title NOT LIKE '%eletion%'
AND page_title NOT LIKE '%Abuse%'
ORDER BY page_namespace) pages
LEFT OUTER JOIN
(SELECT
*
FROM
page_restrictions
WHERE
pr_type = 'edit') restrictions ON restrictions.pr_page = pages.page_id
LEFT OUTER JOIN
(SELECT
*
FROM
page_restrictions
WHERE
pr_type = 'move') mrestrictions ON mrestrictions.pr_page = pages.page_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment