User:Thegeneralbot/unusedfiles
From The Urban Dead Wiki
Jump to navigationJump to search
Below is a description of the methodology (I.e. Step takes) of the unused images tagging script.
- Parse into memory a list of the first 60 pages in Special:Unusedfiles
- Load each page and check
- Whether the {{Orphanedimage}} template is in the page - if it is then skip and load the next page.
- Whether the last time an image was uploaded was less than a week ago - if it is then skip and load the next page.
- If neither of the above two cases are true then get the text of the page
- Scan the text for the presence of Category:Unused Images
- If the category is presemt then replace it with the {{Orphanedimage}} template and save the page
- If the category tag is not in the page then append the {{Orphanedimage}} template and save the page.
- If there were more than 60 pages in Special:Unusedfiles then load the next 60 pages and repeat the process - continue until there are no more pages in the list (rarely needed).
- Fetch list of pages in Category:Unused Images and parse into memory.
- Fetch list of pages in Special:Unusedfiles and parse into memory
- For each page in Category:Unused Images, check if it's also in Special:Unusedfiles.
- If a page is in both then skip and continue to the next page
- Otherwise:
- Get the text of the page.
- Remove any instances of {{Orphanedimage}} in the page text.
- Remove any instances of the Category:Unused Images
- If there were more than 60 pages in Category:Unused Images then load the next 60 pages and repeat the process - continue until there are no more pages in the list (rarely needed).