Difference between revisions of "User:Stachoo/Bulk update form"

From FollowTheScore
Jump to: navigation, search
Line 4: Line 4:
  
 
{{#form: name=pageupdate | action={{SCRIPTPATH}}/index.php |
 
{{#form: name=pageupdate | action={{SCRIPTPATH}}/index.php |
{{#input: name=title | type=hidden | value=User:Stachoo/Bulk_update_form }}
+
{{#input: name=title | type=hidden | value=Special:Call/User:Stachoo/Bulk_update_form }}
 
<table class=wikitable>
 
<table class=wikitable>
 
<tr><th>update all articles matching these criteria</th>
 
<tr><th>update all articles matching these criteria</th>

Revision as of 11:20, 20 November 2009

Use this page with care. It will perform updates on the wiki text of many articles simultaneously.

DO NOT USE this page here in this wiki. Try in your own wiki!

{{#form: name=pageupdate | action=/dpldemo/index.php | {{#input: name=title | type=hidden | value=Special:Call/User:Stachoo/Bulk_update_form }}

update all articles matching these criteria Apply the following changes
namespace {{#input: name=namespace | value=}}
title contains (%) {{#input: name=titlematch | value= }}
wikitext contains /regexp/ {{#input: name=wikipattern | value= }}
category {{#input: name=category | value= }}
use of template {{#input: name=uses | value= }}
replace this /regexp/ {{#input: name=replace | value= }}
by {{#input: name=by | value= }}
  
before this text {{#input: name=before | value= }}
insert {{#input: name=insbefore | value= }}
  
after this text {{#input: name=after | value= }}
insert {{#input: name=insafter | value= }}

Type exec into the mode field to perform the update or leave empty to preview changes:

mode {{#input: name=mode | value= }}
edit summary {{#input: name=summary | value= }} {{#input: type=submit| name=submit }}    reset form

}} <javascript src="setFocus1.js" />

{{#vardefine:skip|dummy}}

  • The pattern for title matching is used in a SQL-LIKE expression; so %Foo% will match all articles with a name containing Foo. The pattern may or may not be case sensitive - depending on the database settings in your wiki. So %foo% might in some cases match an article named The Foos and in other cases not.
  • The pattern used to match wiki content follows php regexp syntax. It refers to the raw wiki text - including template parameters. Note that you MUST use delimiters like / around the pattern. Be careful when using symbols like the pipe character - they must be 'escaped' by backslashes.

  • If you leave all parameters on the right hand side empty you will get a list of all wiki articles that match your selection criteria.
  • As soon as you enter something into the right hand side form fields you will see the (modified) raw wiki text of all articles on which your replacement rules will work. Note that NO CHANGE is done to those wiki articles, however, until you enter exec in the third parameter section (see below).
  • If you want to see the raw unchanged wiki text before you decide what to do, enter something into the "after" or "before" field (it does not matter if that piece of text really exists in the wiki text of your articles). If you enter a pattern into the "replace" form field and leave the "by" field empty, the matching part of the raw wiki text will be replaced by nothing (empty string).

  • The replace parameter expects a regular expression; here you you can also add modifiers if you want. Use grouping for back references. Example: "/(ab?c+)def/i" would match "xyaCcccdeFx". If you replace the matching part of the wiki text by zz\1ghi you will get xyzzaCcccghix.
  • If you see an error message complaining about empty Delimiters you probably forgot to put slashes around the regular expressions.
  • The positions where text is inserted (before and after) are also regular expressions. But in this case slashes are put around automatically by the source code of this template - so you must not use delimiters here. Modify the source code of this page if you want to change this.
  • Because mediaWiki internally strips white space around template arguments special care is needed when leading or trailing spaces are significant for your position pattern. Leading or trailing spaces must be written as \s when specifying positions, line feeds must be written as \n.
  • The content to insert is normal text. Notet that you must use the special symbols " « ¦ » " instead of " < | > ". Leading and trailing spaces are stripped. As a work around you can make two successive replacements where you first insert an arbitrary unique pattern plus the spaces and then remove that special marker pattern in a second round of updates.

  • You must enter the literal exec into the mode field to really perform the update. Otherwise you will get a list of pages with the modified wiki text. Depending on the number and size of the articles you have selected this list can become quite large.
  • The execution may take some time. The updates will be made under your user and the summary text will contain the update rules. You can add additional text which will be prepended to the summary. After the update you will be forwarded to the last page which was changed. If you run into CPU limitations this will help you to find out how many pages were updated. To catch the remaining pages you will have to adapt the selction criteria, e.g. by the use of a name pattern for page titles.

  • clicking on reset form clears all fields and takes you back to this eplanation.