Jump to content

Extension:MassEditRegex

From mediawiki.org
This page is a translated version of the page Extension:MassEditRegex and the translation is 68% complete.
MediaWiki 拡張機能マニュアル
MassEditRegex
リリースの状態: 安定
実装 ページの操作 , 特別ページ
説明 正規表現を使用して複数のページを一度に編集できるようにする。
作者 Adam Nielsen (Malvineousトーク)
最新バージョン 8.4.1
MediaWiki >= 1.40.0
データベースの変更 いいえ
  • $wgAjaxExportList
  • masseditregex
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
translatewiki.net で翻訳を利用できる場合は、MassEditRegex 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

MassEditRegex 拡張機能は、管理者が正規表現を使用して、複数のページのコンテンツに対して一括編集を行えるようにします。 これは、テンプレートの名前変更、カテゴリへのページ追加、または誤字の修正など、簡単な編集に適しています (これらすべては複数の正規表現を指定することで、同じ編集操作で実行できます)。


使用法

拡張機能をインストールし、MassEditRegex を使用するための masseditregex の権限が付与されたら、「Special:MassEditRegex」に移動し、編集フォームに記入してください。 この拡張機能を使用するには、正規表現の知識が必要です。

警告 警告: If an admin uses an evil regex (for example- ^(([a-z])+.)+[A-Z]([a-z])+$) to perform replacements on a page with bad text (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa! for the example regex) (which does not match with the regex) using their browser then MassEditRegex hangs forever, causing a self-Regex Denial-of-Service.

特徴

  • ページの繰り返し処理はクライアント側で行うことができるため、多数のページを編集する際の PHP の最大実行時間の問題はなくなります。
  • 1 つ以上の正規表現を使用して、単一のステップで各ページを変換します。
  • 編集は「ボット」として表示されるため、通常の編集一覧には表示されません (利用者がボット編集を表示する設定にしない限り)。
  • masseditregex の権限を持つ利用者のみが変更を行えます。
  • 新しい「すべて編集」タブがカテゴリ ページや Special:WhatLinksHere に表示され、すべての列挙されたページを一度に編集できます。
  • 編集するページは次のように指定できます:
    • ページ名のリスト
    • ページ名の接頭辞のリスト(例えば、「Test」は「Testing」や「Tested」というページに一致します)
    • カテゴリのリスト(カテゴリ内のすべてのページが編集されます)
    • 被リンクのリスト(リスト内のページにリンクしているページが編集対象になります)

インストール

設定

この拡張機能には、「masseditregex」という利用者権限が追加されており、どの利用者グループがこの拡張機能を使用できるかを細かく制御できます。 既定では、どの利用者グループにも割り当てられていません。 「masseditregexeditor」のような利用者グループに割り当てたい場合は、インストール手順(3)で「LocalSettings.php」ファイルに追加した行の直後に以下のコードを追加してください:

$wgGroupPermissions['masseditregexeditor']['masseditregex'] = true;

あるいは、次の行を追加して、「sysop」などの既存の利用者グループに権限を付与することもできます:

$wgGroupPermissions['sysop']['masseditregex'] = true;

Tips

Adding content to the top of the page:

  • Detect any first character at the beginning of a page: → Search for: /^(.)/
  • Prepend my content to the char found at the beginning of a page, including a line break: → Replace with: MyContent\n$1

既知の問題点

Server-side execution is the default as it (should) be faster.

However, editing large numbers of pages will cause server timeouts due to PHP limits on script execution time. To work around this (and perhaps to get better feedback on progress), you can tick "execute in browser" to have the job tracking done on the client side. This should mean timeouts are no longer a problem.

Page not found

In (at least) MediaWiki 1.31 and later, when the regex you provide is invalid, it will falsely indicate that all of the pages you selected for replacement are not found.

Replacement in certain namespaces

If you would like to replace text only in certain namespaces, e.g., "File" and enter this with the page prefix option, you will get the following note: "Error: The MediaWiki API returned the error code invalidtitle: Bad title "File:"."

関連項目