User:LinkFA-Bot/function

This bot (written in PHP) is using a local MySQL - database with (currently) 3 tables, just to keep the number of queries it has to do low.

Detailed explanation of the bot's work

The database tables

This bot (written in PHP) is using a local MySQL - database with (currently) 3 tables, just to keep the number of queries it has to do low.

LinkFA_config
The config-table keeps the current phase or state of the bot, so when it's stopped, it can continue where it left off.
LinkFA_linking_articles
A list of articles using the Link FA template (or the respective template on the wikipedia), and a marker for each article whether said article has been checked or not.
LinkFA_featured_articles
A list of articles marked as 'featured' in any wikipedia-language.

A bot run

The following steps are basically what the bot does on a full run. The order does not exactly match the code, but fit to the program logic.

Preparation

  • Empty the database-tables LinkFA_linking_articles and LinkFA_featured_articles
  • Gather all articles from all wikipedia languages we are supposed to work on that are using the template Link FA and add them to LinkFA_linking_articles
  • Read all links from the Templates. For all links, gather all articles using the template and add those to LinkFA_featured_articles
  • Read all links from Categories. For all links, gather all articles within those categories and add those to LinkFA_featured_articles
  • Go to mode Check

Check

  • Get one article from LinkFA_linking_articles that has not been marked 'done' yet. (Sorted alphabetically ascending by title, language version ignored for sorting). If there is none left, go to mode Search
  • Get the text of the latest revision
  • mark the current article as 'done'
  • gather all interwiki links of the article
  • For each interwiki link, check whether the destination is included in LinkFA_featured_articles. If yes, the interwiki link should be marked.
  • Gather all occurrences of Link FA from the article
  • Compare the "should be marked" list with the "is marked" list - if they are equal, skip to the next article
  • For all Markups that would be erased, check whether the link only points to a redirect and - if so - try to resolve that and check the link again.
  • Remove all Link FA markups from the article text
  • Add those Link FA markups that were found to be needed to the article, right above the interwiki link block itself
  • save the article
  • Get a not yet 'checked' article from LinkFA_featured_articles. If there's none left, the bot is done.
  • Mark the article as 'checked'
  • Check the article's interwiki - links and search for a link to any of the wikis the bot works on. If there's none, the bot just skips the article (creating an interwiki - link - net is left to the pros).
  • If there's an article linked in that points to an article we didn't encounter during the 'Check' phase, and the found article already has a backlink to the featured article we're working on, run a Check on the found article.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.