Extension:MassEditRegex/zh
MassEditRegex 发行状态: 稳定版 |
|
---|---|
实现 | 页面操作 , 特殊页面 |
描述 | 允许使用正则表达式一次编辑多个页面 |
作者 | Adam Nielsen (Malvineous留言) |
最新版本 | 8.4.1 |
MediaWiki | 1.35+ |
数据库更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | |
|
|
|
|
季度下載量 | 37 (Ranked 96th) |
前往translatewiki.net翻譯MassEditRegex扩展 | |
問題 | 开启的任务 · 报告错误 |
The MassEditRegex extension allows administrators perform a single edit across multiple pages in one step, by running a regular expression over the content of each page. This is well suited to performing simple edits such as renaming a template, adding pages to a category, or correcting typos (all of which can be done in the same edit operation by supplying multiple regular expressions.)
使用
Once the extension has been installed and permission masseditregex
to use MassEditRegex has been given, go to "Special:MassEditRegex" and fill out the edit form.
Familiarity with regular expressions is required to use this extension.
功能
- Page iteration can be done on the client side, so PHP maximum execution time is no longer an issue when editing large numbers of pages.
- Transform each page using one or more regular expressions in a single step.
- Edits appear as "bot" so they don't show up in the normal edit list (unless the user chooses to show bot edits).
- Only users with the
masseditregex
permission can perform changes. - A new "edit all" tab appears on category pages and on Special:WhatLinksHere, for editing all listed pages at once.
- Pages to edit can be specified as:
- A list of page names
- A list of page name prefixes (e.g. "Test" will match pages called "Testing" and "Tested")
- A list of categories (all pages within the categories will be edited)
- A list of backlinks (pages edited are those linking to the ones in the list)
安装
- 下载文件,并将解压后的
MassEditRegex
文件夹移动到extensions/
目录中。
开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MassEditRegex - 将下列代码放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'MassEditRegex' );
- Configure user group and user right at your convenience.
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
配置
This extension comes with an extra user right called "masseditregex
" to allow fine grained control of which user groups may use this extension.
By default it is assigned to no user group.
In case you would like to assign it to a user group e.g. "masseditregexeditor
", add the following code to your "LocalSettings.php
" file right after the lines added in step (3) of the installation process:
$wgGroupPermissions['masseditregexeditor']['masseditregex'] = true;
Alternatively you may grant the permission to an existing user group, e.g., "sysop
" by adding the following line:
$wgGroupPermissions['sysop']['masseditregex'] = true;
提示
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 a 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:"."
参见
- Extension:替换文本 — A similar extension which however will not work if you set
$wgCompressRevisions = true;
for your wiki.
此扩展在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此扩展。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |
- Stable extensions/zh
- Page action extensions/zh
- Special page extensions/zh
- GPL licensed extensions/zh
- Extensions in Wikimedia version control/zh
- SkinTemplateNavigation::Universal extensions/zh
- All extensions/zh
- Extensions included in Miraheze/zh
- Extensions included in MyWikis/zh
- Extensions included in ProWiki/zh
- Extensions included in WikiForge/zh
- Edit extensions/zh