Skip to content

Instantly share code, notes, and snippets.

@FunPika
Forked from stwalkerster/acc_extlinks
Last active January 2, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FunPika/8293677 to your computer and use it in GitHub Desktop.
Save FunPika/8293677 to your computer and use it in GitHub Desktop.
+-----------------+
| ipb_address |
+-----------------+
| 198.38.10.1 |
| 80.239.242.0/23 |
| 23.241.74.200 |
+-----------------+
3 rows in set (0.86 sec)
SELECT
pages.page_namespace,
pages.page_title,
restrictions.pr_level as editprotect
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;
SELECT ipb_address FROM `ipblocks` WHERE ipb_reason LIKE '%toolserver.org/~acc%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment