User:AtyndallBot/pseudocode

From Wikipedia, the free encyclopedia

This page contains the pseudocode of AtyndallBot's functions (if approved). This code will be converted to PHP when ready. If you have an queries about the code, feel free to contact Atyndall.

[edit] Assess and Delete function

This function will not be developed because

  1. I could never get it approved as an admin
  2. MetsBot already performs that function
//Psudocode of AtyndallBot performing image deletion task

Login to Wikipedia using account AtyndallBot

FOREVER {
        Access category "Category:All images with the same name on Wikimedia Commons"
        Generate list of Image names
        Count images, add value to $amount
        Make $i = 1
        REPEAT UNTIL $i == $amount {
                Access image $i on list
                Add image name to varible $wikipediaimagename
                Find out name of user who placed {{nowcommons}} template
                Add template placer's name to $templateuser
                Check for non-free licences (regexes found in nonfree.include.php)
                        IF FOUND {
                                Place {{AtyndallBotAssessed|Failed}}
                                Remove {{nowcommons}} template
                                Post message $templateuser's talkpage (messages found in messages.include.php)
                                Move to next image
                                }
                        ELSE CONTINUE
                Check for free licences (regexes found in free.include.php)
                        IF NOT FOUND {
                                Post message to adder of templates userpage (messages found in messages.include.php)
                                Move to next image
                                }
                        ELSE CONTINUE
                Find out link to main file
                Find out link to commons page
                Access commons page
                Find out link to main file on commons
                Run MD5 hash on main file on Wikipedia ($wikiMD5)
                Run MD5 hash on main file on Commons ($commonsMD5)
                Compare $wikiMD5 and $commonsMD5
                        IF NOT EQUAL {
                                Post message to adder of templates userpage (messages found in messages.include.php)
                                Move to next image
                                }
                        ELSE CONTINUE
                Delete Wikipedia image with reason "Exact duplicate of [[:Image:$1]] on Commons"
                Increment $i by one ($i++)
                }
}