Jump to content
MediaWiki

Extensão: MassEditRegex

From mediawiki.org
This page is a translated version of the page Extension:MassEditRegex and the translation is 35% complete.
Manual de extensões do MediaWiki
MassEditRegex
Estado de lançamento: estável
Implementação Ação de página , Página espacial
Descrição Permite utilizar expressões regulares para editar várias páginas ao mesmo tempo
Autor(es) Adam Nielsen (Malvineous discussão )
Última versão 8.4.1
MediaWiki >= 1.46.0
Alterações à base de dados Não
  • $wgAjaxExportList
  • masseditregex
Licence GNU - Licença Pública Geral 2.0 ou superior
Transferência
Traduza a extensão MassEditRegex se esta estiver disponível em translatewiki.net
Problemas Tarefas em aberto · Reportar um erro

A extensão MassEditRegex permite que os administradores realizem uma única edição em várias páginas num único passo, executando uma expressão regular sobre o conteúdo de cada página. 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.)


Utilização

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.

Aviso Aviso: 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.

Funcionalidades

  • 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:
    • Uma lista de nomes de página
    • 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)

Instalação

  • Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado MassEditRegex, na sua pasta extensions/.
    Developers and code contributors should install the extension from Git instead, using:
    cdextensions/
    gitclonehttps://gerrit.wikimedia.org/r/mediawiki/extensions/MassEditRegex
    
  • Acrescente o seguinte código ao fundo do ficheiro $LocalSettings:
    wfLoadExtension( 'MassEditRegex' );
    
  • Configure user group and user right at your convenience.
  • Yes Pronto – Na página especial Special:Version da sua wiki verifique se a extensão foi instalada.

Configuração

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 this permission to an existing user group, e.g., "sysop" by adding the following line:

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

Dicas

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\n1ドル

Problemas conhecidos

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.

Página não encontrada

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.

Substituição em certos espaços nominais

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:"."

Consultar também

This extension is included in the following wiki farms/hosts and/or packages:

AltStyle によって変換されたページ (->オリジナル) /