Manual:Grep.php/ja

MediaWiki バージョン:
1.38
Category:MediaWiki code/ja#Grep.php

詳細

grep.php file is a maintenance script that searches the source text of pages for lines matching a given regex, and prints the matching lines to stdout.

This script first fetches all page titles from the database, optionally filtering them by namespace or prefix, and then fetches their text contents to check for the given PCRE regular expression, printing the matching lines.

オプション/引数

オプション/引数 説明 必須かどうか
regexThe regex to search for.必須
--prefix Title prefix. Can be specified more than once. Use e.g. --prefix=Talk: to search an entire namespace. 省略可能
--show-wiki
-l
Add the wiki ID to the output省略可能
--pages-with-matchesSuppress normal output; instead print the title of each page from which output would normally have been printed.省略可能

使用法

php maintenance/run.php grep <regexp> [ --prefix | --show-wiki | pages-with-matches ]

The regular expression will be fed directly to preg_replace(), delimited by curly braces, except if the first character is /, in which case you are expected to add the end delimiter. This allows providing a regular expression modifier after the end delimiter.

MediaWiki バージョン 1.39.13 以前では、メンテナンス スクリプトを php maintenance/run.php スクリプト名 ではなく php maintenance/スクリプト名.php を使用して実行する必要があります。

便利なリンク

Category:Maintenance scripts/ja Category:Content maintenance scripts/ja
Category:Content maintenance scripts/ja Category:Maintenance scripts/ja Category:MediaWiki code/ja