Skip to content

Instantly share code, notes, and snippets.

@stwalkerster
Forked from FunPika/acc_extlinks
Last active January 2, 2016 10:59
Show Gist options
  • Save stwalkerster/8293571 to your computer and use it in GitHub Desktop.
Save stwalkerster/8293571 to your computer and use it in GitHub Desktop.
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