Fork of New orphan finder (enwp) by Bri
This query is marked as a draft This query has been published by Bri.

SQL

x
 
# user variables
SET @TITLE_REGEX = '^[A-Z]';
SET @LISTS_ONLY = True;
SET @IGNORE_2_LINK_ARTICLES = True; # ignore orphans that BattyBot will find (doesn't work yet)
# don't change these constants
SET @ARTICLE_SPACE = 0;
# query
SELECT 
  # human readable result:
  # DISTINCT page.page_title as "Tagged orphan", 
  # machine readable result:
DISTINCT CONCAT("*[[",page.page_title,"]]") as Page,
CONCAT("Not an orphan; linked from [[",REPLACE(pageFrom.page_title,"_"," "),"]]") as "Note",
COUNT(page.page_title) as "Inlinks"
FROM page,revision, pagelinks
INNER JOIN page as pageFrom ON pl_from = pageFrom.page_id
WHERE not pageFrom.page_is_redirect
and pl_from not in (select pp_page from page_props where pp_propname="disambiguation")
and page.page_title REGEXP @TITLE_REGEX
and rev_page=page.page_id
and page.page_latest = rev_id
and page.page_title=pl_title # not actually orphaned
and page.page_id in (select cl_from from categorylinks where cl_to LIKE "All_orphaned_articles") # but tagged as orphaned
and not pageFrom.page_id in (select cl_from from categorylinks where cl_to = "Given_names" or cl_to = "Surnames")
and ((not @LISTS_ONLY) OR pageFrom.page_title like 'List_of_%')
#and ((not @IGNORE_2_LINK_ARTICLES) OR (select COUNT(page.page_title) as pp_inlinks) >= 2)
and pl_namespace=@ARTICLE_SPACE and pl_from_namespace=@ARTICLE_SPACE 
and page.page_namespace = @ARTICLE_SPACE
and not page.page_is_redirect
group by page.page_title
order by page.page_title 
limit 3000; # approximately 8,500 exist as of 2024-04-08
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...