ArchWiki:ボット

提供: ArchWiki
2020年4月30日 (木) 01:55時点におけるNy-a (トーク | 投稿記録)による版 (→‎タスク: 訳出(版 16124 での同期部分))
ナビゲーションに移動 検索に移動

関連記事

ボットメンテナンスチーム の重要なツールで、日々の業務から複雑な一度限りの更新まで、繰り返しのタスクを簡単に実行することができます。ボットによる編集は wiki への全ての貢献の8%以上を占めています。このような編集は手動で行うにはとても退屈でしょう。

現在以下のボットが使用されています。

ソフトウェア

ボットは MediaWiki API を使って wiki サーバーに接続します。ウィキメディア財団 によって作られた、この API を使うたくさんのボットがありますが、それらは普通他の wiki で使えるように十分一般化されていなかったり、ArchWiki のスタイルガイドと衝突したりします。そのため、ArchWiki 特有のボットツールを作っていますが、外部から評価すると同じ弱点があるでしょう。

Wiki Monkey

Wiki Monkey プロジェクトの目的は、web ブラウザで直接 wiki ページを改良することで効率的な編集を補助することです。ユーザースクリプトとして動作し、編集ページで繰り返しのタスクを半自動で実行したり、カテゴリリンク元 といったページリストのページから完全に自動で実行したりできます。Wiki Monkey は 特別:最近の更新特別:新しいページ のためのフィルターといったヘルパーも追加します。詳しくは ドキュメント を参照してください。

wiki-scripts

wiki-scripts プロジェクトは、MediaWiki API のための小さなライブラリのような抽象化で構成されたたくさんの Python スクリプトを含んでいます。含まれているスクリプトの目的は、wiki の編集なしに情報を集めることから、自動化された複雑な編集を行うことにまで及びます。これらは #タスク で説明されています。wiki-script による編集は、自動でも手動でも、wiki-scripts タグ が付けられ、最近の更新のリストで フィルター することができます。

タスク

このセクションでは ArchWiki ボットにより繰り返し実行されるタスクについて説明します。概要と、運用中のボットスクリプトの機能のドキュメントを提供します。ボットの編集は標準で 特別:最近の更新 から隠されていることに注意してください。これらの編集を含めると、通常の貢献を追ったり参加したりすることがかなり難しくなるためです。

二重リダイレクト

Fixing double redirects is the oldest automated task. It can be done for example with a Python script or Wiki Monkey's dedicated plugin.

目次

The 目次 page and its "translations" are maintained by using the toc.py script. The script can be run daily, its execution takes couple of seconds.

The script assumes the following entry point to be present on the page:

{| id="wiki-scripts-toc-table"
...
|}

The content of this table is replaced with an updated version generated by the script, the rest of the page is left intact. The script recognizes the following optional attributes for configuration:

  • data-toc-languages specifies the languages to be shown on the page. It is a comma-separated list of language tags, at most 2 can be specified. Defaults to the language of the current page, i.e. ru for en:Table of contents (Русский).
  • data-toc-alsoin specifies the translation of the "also in" phrase. The format is tag1:text, tag2:text, ....

For example (from en:Table of contents (Русский)):

{| id="wiki-scripts-toc-table" data-toc-languages="ru,en" data-toc-alsoin="ru:Также в"
...
|}

Users can also translate the category names in the table by editing the links on the wiki page and the script will preserve them on updates.

統計

The ArchWiki:統計 page is maintained by the statistics.py script. Currently only the User statistics section is autogenerated, the rest is updated manually. The update takes about 15 seconds and should be run daily.

The script works by obtaining metadata of all revisions and user accounts from the API and caching it locally for better performance. The edit counts are determined by manually counting user contributions without relying on MediaWiki counters.

ノート: Some improvements are discussed in en:ArchWiki talk:Statistics#Improvements.

パッケージテンプレート

The update-package-templates.py script parses the content of all pages and updates the Pkg, Grp and AUR templates. The package name is actually not changed by the script, but e.g. for packages that have been recently moved from AUR to the official repositories, the link is updated from テンプレート:AUR to テンプレート:Pkg. Invalid package links are marked with テンプレート:Broken package link along with a sometimes useful hint showing the package status.

The script uses localized versions of テンプレート:Broken package link and テンプレート:aur-mirror when they exist and falls back to the English versions. Other than that there is no server-side configuration.

After each run, but at most once per 7 days, the script creates a detailed report of broken links at en:User:Lahwaacz.bot/Reports/archpkgs.

言語間リンク

The interlanguage.py script does the following:

  • Checks if the language of categories assigned to each page matches the language of the page itself.
  • Creates missing localized categories, mirroring the English category tree.
  • Updates the interlanguage links on all content pages using this algorithm.

The execution time depends on the amount of updates, it is usually less than a minute and about 30 seconds when there are no updates.