Open main menu

Extension talk:Replace Text/Archive 2010 to 2011


Regex (big wish)

Please add regular expressions. That would help to maintain templates.--Jannis 11:27, 11 January 2010 (UTC)

I also think that would be the next logical step :) Maybe a good preview (before / after) of the unparsed text would be needed here. --Subfader 18:31, 16 January 2010 (UTC)
Yes, that would be lovely. --SomaticJourney 19:30, 13 March 2010 (UTC)
Probably unlikely to happen, as SQL (the database language used) doesn't support RegExs. But even having simple wildcards (which SQL does support) would be a big plus! 13:45, 6 August 2010 (UTC)
At least simple wildcards would be so usefull. whith this you can also use this extension as a powerfull anti-spam tool besides its other usefullness -- 15:33, 3 December 2010 (UTC)

Search apparently not working after doing first set of replacements

I just did a search to replace "{{Template1}}" with "{{Template1-build}}" within a specific namespace. It replaced that text just fine on about 90 pages within that namespace.

I then wanted to do a similar replace in the same namespace, like this: "{{Template2}}" to "{{Template2-build}}". However, the search isn't finding the pages in that same namespace saying that no pages were found. My job to replace Template1 seems to have finished about a half hour ago, so I don't think there is any conflicting going on. Also, we have a development instance of our site, and when I try the same search on that site it does pick up all the Template2 instances. Any idea what might be happening? Thanks! --Gkullberg 18:38, 26 January 2010 (UTC)

Hard to tell from here, if not impossible ;) --Subfader 20:38, 26 January 2010 (UTC)
Agreed. Yet is there anything you can point me to on the server that I could look at, like processes, error / task logs, or anything where I could troubleshoot myself? --Gkullberg 21:13, 26 January 2010 (UTC)
Did you try the whole thing again for Template2? If still nothing happened the Template1 case doesn't matter much here and we have the case that you searched term wasn't found at all. I can tell you what I would to. I would check if Template2 is called anywhere at all directly and in which namespace; therefor I would
  • go to [[Template:Template2]] and see "what links here", if nothing was found
  • i'd search it using this extension: replace "Template2" (without quotes and {{}}" with nothing or a temp string, just to see what it finds.If nothing was found I dunno lol.
If it was found I would check if it really is only used as {{Template2}} or if aparameter are used, e.g. {{Template2|1=foo}}. You may have tested all this, but I can't think of more.
If something was found but nothing happens it's useful to run maintenance/runJobs.php --Subfader 01:41, 27 January 2010 (UTC)
What does runJobs.php do in respect to Replace Text? I'm still seeing funny behavior in that namespace from before. Ever since I did that original find/replace on that namespace it no longer finds anything I search for It works for other namespaces just fine, but not the one problem namespace. If I do a standard Wiki search in that namespace it finds the text I'm looking for, but not when I do a find from the Replace Text extension. Any ideas what might be causing this? --Gkullberg 17:02, 16 March 2010 (UTC)
I can confirm this behavior. Strings are found after the first replacement and are said to be replaced, but aren't in fact. --Nakohdo 07:43, 15 April 2010 (UTC)
I got the impression that the replacements indeed take place, but aren't immediately reflected in the (special) pages. I renamed a category and one hour ago there were only 4 pages in the new category on the categories special page now there are 27 ... Might be connected with cron runs and/or caching. Reloading that page shifts those numbers even as I write this. --Nakohdo 08:52, 15 April 2010 (UTC)

Redirects still getting created

I did a find & replace for a bunch of page names which got moved to new names. I unchecked "Save the old titles as redirects to the new titles", yet redirects still got created. I was hoping that redirects didn't get created. Is that the intended outcome? --Gkullberg 21:12, 26 January 2010 (UTC)

No it's not. I have problems with my job queue atm so I can't confirm but it looks like this is indeed a bug. --Subfader 03:45, 27 January 2010 (UTC)
Ah, what do you know, it's really a bug. Well, not exactly a bug, but an issue involving the somewhat-new MediaWiki 'suppressredirect' permission. I added a note about this to the "Known issues" section. Yaron Koren 04:49, 27 January 2010 (UTC)

Fieldset legends

I suggest to use legends for the fieldsets in SpecialReplaceText.php: Change

$wgOut->addHTML( "<fieldset>\n<p>$search_label</p\n>$tables\n</fieldset>" );


$wgOut->addHTML( "<fieldset>\n<legend>$search_label</legend>\n$tables\n</fieldset>" );

Same for the second fieldset and $optional_filters_label. --Subfader 17:31, 14 March 2010 (UTC)

Useless query

IMO the info "There are XX pages that already contain the replacement string..." is quite useless. On wikis with more than 10,000 articles this query (which is a deep query, not just a mysql search) takes a lot of time and wastes the user's time and the server's ressources.

I decided to make that optional. If $wgReplaceTextSkipInfo is set to true in LocalSettings.php the info is skipped and the form jumps directly to the preview. All other checks and warnings still fully work. Add $wgReplaceTextSkipInfo to the globals of function doSpecialReplaceText() and replace

				if ( $this->replacement === '' ) {
					$message = 'replacetext_blankwarning';
				} elseif ( $this->edit_pages ) {
					$res = $this->doSearchQuery( $this->replacement, $this->selected_namespaces, $this->category, $this->prefix );
					$count = $res->numRows();
					if ( $count > 0 ) {
						$message = array( 'replacetext_warning', $wgLang->formatNum( $count ), "<tt>{$this->replacement}</tt>" );
				} elseif ( $this->move_pages ) {
					$res = $this->getMatchingTitles( $this->replacement, $this->selected_namespaces, $this->category, $this->prefix );
					$count = $res->numRows();
					if ( $count > 0 ) {
						$message = array( 'replacetext_warning', $wgLang->formatNum( $count ), $this->replacement );


if ( $this->replacement === '' ) { $message = 'replacetext_blankwarning'; } elseif ($wgReplaceTextSkipInfo != 'true') { if ( $this->edit_pages ) { $res = $this->doSearchQuery( $this->replacement, $this->selected_namespaces, $this->category, $this->prefix ); $count = $res->numRows(); if ( $count > 0 ) { $message = array( 'replacetext_warning', $wgLang->formatNum( $count ), "<tt>{$this->replacement}</tt>" ); } } elseif ( $this->move_pages ) { $res = $this->getMatchingTitles( $this->replacement, $this->selected_namespaces, $this->category, $this->prefix ); $count = $res->numRows(); if ( $count > 0 ) { $message = array( 'replacetext_warning', $wgLang->formatNum( $count ), $this->replacement ); } }


The code may look ugly though. IMO the default behaviour should be changed so after installation the info can be enabled if really needed. --Subfader 17:56, 14 March 2010 (UTC)

Hi, out of curiosity: how many string replacements do you run, that eliminating this step makes a difference? I guess a similar question could be asked for the issue below as well. Yaron Koren 16:55, 15 March 2010 (UTC)
1 to 5 per day, sometimes a real session with up to 50 strings from my standard list (see archive for my automation request). I really think it's useless. You'd also find it useless if google would first show a page reading "Found 8 million results. Click here to see the search results." :D As mentioned it's not only useless but wastes time and ressources. If you have to run a replacement on a complete namespace or more without category or prefix filter on a big wiki it takes 5-10 seconds to build the info and the same AGAIN to build the preview.
I even think of removing all error messages (like empty replacements string warning) to the top of the preview (properly highlighted) so you never see the info page and always land directly on the preview page. --Subfader 02:17, 16 March 2010 (UTC)
Yeah, what you're saying makes a lot of sense... I guess that page has been extraneous ever since users could specify exactly which pages they wanted to do replacement on (i.e., since version 0.2 :) ). I still think it's nice to tell people how many pages contain the replacement string already (or, even more importantly, warn about replacing with a blank string); but, as you note, those could be put at the top of the actual replacement page. Yaron Koren 04:36, 16 March 2010 (UTC)
Well, I kept the query, but in the new version, 0.8, the warning now shows up at the top of the second screen, instead of in a separate "confirmation" screen. Thanks for the idea. Yaron Koren 22:04, 18 March 2010 (UTC)
errorbox is fine for that. If you want a little more usability, replace tt with code tags ;) --Subfader 00:10, 19 March 2010 (UTC)

Quick links to (un)tick namespace

This adds quick links to easily (un)tick defined groups of namespaces:


Here's the code. The javascript code is ugly but I couldn't care less since Special:ReplaceText is private and it works for me. --Subfader 19:18, 14 March 2010 (UTC)

Interesting; thanks for the idea, and the code. Are you aware of the new 'Vector' skin, in MediaWiki 1.16? It has its own interface for searching by specific sets of namespaces - it's a similar concept to yours, but with different group names. I would think it makes sense to use their set of namespaces, for consistency - any thoughts? Yaron Koren 20:56, 14 March 2010 (UTC)
You mean on Special:Search? Yes I switched to 1.16alpha right after it was released in August just to use that feature for the search :) Thoughts: The grouping is ok on the Search. The ones I used here are my own preference. I realized I always needed the same namespaced ticked again and again.
Somebody should create a useful master namespace selector which then should be used on all pages like special pages and it could be easily used by extensions like this. My 2 cents about namespace usabilty. The only improvemnt recently was grouping the talk namesapces after all these years, that's very poor imo. --Subfader 00:35, 15 March 2010 (UTC)
Okay - well, my instinct is to always try to fit in with how MediaWiki does it. What do you mean by "the only improvement recently" - what about the other namespace groupings? Yaron Koren 02:15, 15 March 2010 (UTC)
I mean the only improvement about a more useful way to select namespaces (except the new grouping for the search). There only is the fieldset or the drop down variation. Btw, I don't expect you to include this to the extension, I just wanted to post it, cos I can imagine other people who often replace text may find this useful. Better check my 2 posts above :) --Subfader 02:39, 15 March 2010 (UTC)
Okay, I think I get it. Thanks also for the advice :) - I missed those other two posts entirely. Yaron Koren 02:43, 15 March 2010 (UTC)
I modified the interface in version 0.8 to look more like the "Special:Search" page in MW 1.16, and to include its "check all" and "check none" buttons if MW is at version 1.16 or greater - hopefully this is a step in the right direction. Yaron Koren 22:17, 18 March 2010 (UTC)
Yeah let's go for more usability. Everything that doesn't annoy me on a daily basis is cool :) --Subfader 00:06, 19 March 2010 (UTC)

Apostrophe bug again?

Currently text like this is not found at all or only randomly: <div class='comment'>. Can you confirm? --Subfader 13:55, 1 May 2010 (UTC)

Could be a problem with a recent $wgCompressRevisions problem tho. --Subfader 23:48, 1 May 2010 (UTC)

Losing discussion after moving

If you replace text in titles (page moves) and do not tick the corresponding talk NS, you will lose all discussions since the page has a different title then. What can be done about it? E.g. if NS_MAIN and replace titles then also in NS_TALK titles. Trying some javascript for the form now. --Subfader 23:00, 2 May 2010 (UTC)

That's true; but can't you just run the replace again, this time on those talk namespaces? Yaron Koren 02:09, 4 May 2010 (UTC)
Yep, but to do so you have to realize the accident happened :) --Subfader 02:54, 4 May 2010 (UTC)
Hm, that's true... a little Javascript "OK / Cancel" alert could be a good idea. Yaron Koren 19:19, 4 May 2010 (UTC)
Yep. I'm not able to write a proper solution that would do that per php for all namespaces including custom ones. --Subfader 18:51, 5 May 2010 (UTC)

Input Boxes - Number of lines

The input boxes on the specialpage are offering 3 lines for the target and the replacment text. This isn't that much. My quick solution on I changed 2 lines in the function showForm (file SpecialReplaceText.php):

$wgOut->addHTML( Xml::textarea( 'target', $this->target, 50, 2, array( 'style' => 'width: auto;' ) ) );
$wgOut->addHTML( Xml::textarea( 'target', $this->target, 50, 10, array( 'style' => 'width: auto;' ) ) );
$wgOut->addHTML( Xml::textarea( 'replacement', $this->replacement, 50, 2, array( 'style' => 'width: auto;' ) ) );
$wgOut->addHTML( Xml::textarea( 'replacement', $this->replacement, 50, 10, array( 'style' => 'width: auto;' ) ) );

It would help, if one can set up both height and width in LocalSettings.php after the 'require_once' line. Without a special configuration in LocalSettings.php the width of 50 and the height of 2 may work as default values.

…and please don't worry about my possibly funny english - I'm out of practice… :-) --Wgkderdicke 16:49, 21 May 2010 (UTC)

Regular Expressions

One the goals I had installing Replace Text was to replace parameters of templates or to remove templates in their entirety that appear on a lot of pages. This could be easily accommodated with regular expressions (see xkcd) where I could specific a beginning string "{{Dummy Template" and an ending string "}}". I spoke with Yaron and he pointed out the complications arising from a lack of regular expression support in SQL (shame on you, whoever you are, who didn't make regular expressions a part of SQL!). But since template manipulation is a common requirement of this extension, and since templates are the building blocks of any sophisticate wiki, I hope someone can come by and incorporate this functionality.

MySQL actually has a REGEXP operator, so this is entirely possible (with the condition that only specific MySQL versions will be supported). And, agreed, regexp search and replace would be awesome. --The CyberShadow 22:12, 3 October 2010 (UTC)

Missing Checkbox

Hi Folks, just install the new version (0.8) of this great plugin on my MediaWiki Installation 1.15.4 in german. It works just fine, the only thing that is different from the screenshot on the description page is that I don't have a "Check all" or "Uncheck all" button. Is that normal or did screw up something ? THY a lot,--Brocchinia 14:34, 23 July 2010 (UTC)

Hi - yes, that's normal; those checkboxes only show up when using the Vector skin, which is only available in MediaWiki 1.16+. I just added a note to the page to explain that. Yaron Koren 15:05, 23 July 2010 (UTC)

How to access Replace Text?

Once it is installed, how do I get to the page? I.e. As a normal user, how do I tell if it is already installed on a wiki I am using? Daviddoria 12:04, 13 August 2010 (UTC)

It's the page "Special:ReplaceText". Yaron Koren 16:55, 13 August 2010 (UTC)

No way to finish replacement process : Summary window doesn't have a confimation button

Hi, when i do a continue on the page list replacement page, i see another page with the page count that will be impacted by the replacement, a link "Return to form" and that's all... no link seems to be available to finish the replacement process.

That's strange - what versions of RT and MediaWiki are you using? Yaron Koren 18:21, 26 October 2010 (UTC)
I'm having the same issue: RT 0.9.1 and Mediawiki 1.16+
I've been having this problem, too—RT 0.9.1 (also happens with 0.8.1, I tried this first then updated to 0.9.1), MediaWiki 1.17. I also have an old Referata wiki, and noticed that the same issue occurs there as well. Is there some other way to trigger the replace function we can use as a workaround in the meantime?
On my wiki it also sometimes doesn't want replace. I then run maintenance/runJobs.php --type replacetext. --Subfader 09:42, 24 July 2011 (UTC)

Tip: running two (or more) jobs together

If you run one replace text job with this extension and then quickly after run another, it looks like the second will not be run. The first is shown in Recent changes but the second is not. Before trying it again, check out the job queue (under Statistics). It will probably include the second job. There appears to be a delay of several (15 - 30 or so) minutes before the second is started, even if the first is finished. --Robinson weijman 10:24, 20 January 2011 (UTC)

I needed this but it does not work

I have a database of about 3.6 million article or so. I needed to replace one reoccurring name in the articles but it runs for a while then it is just stuck on loading. I checked on WHM and I notice at first it uses a healthy amount of resources then it uses less and less and finally it just disappears all together. I have adjusted the jobs and everything with no such luck. Is this a fluke when dealing with large databases? Currently my entire database is pushing about 20 gigs.

I'm sure this is due to the very large size of your wiki. Did you try using the "Replace only in pages with the prefix" option? It could help to break the process down into manageable chunks, if you, for instance, did a separate call for each letter of the alphabet. Yaron Koren 16:12, 25 January 2011 (UTC)

Thanks gonna give it a try going through each letter of the alphabet beats going through the whole thing by hand :)

Call to undefined method Xml::textarea()

Fatal error: Call to undefined method Xml::textarea() in /var/www/wiki/extensions/ReplaceText/SpecialReplaceText.php on line 220

I just installed the latest extension. How do I resolve this error?

Hi - what version of MediaWiki are you using? My guess is that you have an old version, but I don't know exactly when Xml::textarea() was added. Yaron Koren 16:27, 26 January 2011 (UTC)

I have version 1.12.0. Here is the link:

Ah, okay. That version's not supported by Replace Text - you need 1.13 or higher. Yaron Koren 16:34, 26 January 2011 (UTC)

Many thanks

Case insensitive

Now that we got regex, would a case insensitive checkbox be possible (affecting also non-regex replacements)? --Subfader 17:04, 19 February 2011 (UTC)

I'm glad you saw the new regex feature, and that it's (apparently) working for you. As for case-insensitive searches: my understanding is that it's not possible, because the database field where MediaWiki stores the actual text, i.e. the "old_text" field in the "text" table, is of type "mediumblob", and any kind of blob field is always case-sensitive - see here. The MediaWiki search features lets you do case-insensitive searches, but that uses a different DB table, "searchindex", which does some processing on the text to make searches easier, like removing punctuation - which also makes it unusable for Replace Text. So unfortunately, I think the only solution would be to modify or add to the MediaWiki database in some way. Yaron Koren 22:36, 20 February 2011 (UTC)
Sounds like the effort would not be worth it. I only tested regex quickly on localhost and it worked, but didn't highlight the found sections in the preview. Also no replacement was done, but that could be cos of the localhost installation. --Subfader 16:19, 21 February 2011 (UTC)
Ah - so it didn't really work, then... I know the highlighting needs fixing - it only works some of the time. Yaron Koren 19:08, 21 February 2011 (UTC)
Tried 0.9.1 on localhost and server: it finds the regex matches but nothing is replaced. Jobque is empty when I run maintenance/runJobs.php afterwards. MW 1.16a (August 2009), MySQL 5.0.51a. I'd also like to see text matched in teh preview of each item. --Subfader 10:39, 3 April 2011 (UTC)

Bug in 0.9 / replacing text in page titles

Hi, I just tested the new version for another reason an realised that the extension proceeds to a blank page as soon as you would like to replace some text in page titles. This behaviour does not appear with 0.8.1. Cheers --[[kgh]] 12:26, 22 February 2011 (UTC)

Can you give any more information - the search string, the replacement string, use of regex, the number of pages? Yaron Koren 17:35, 22 February 2011 (UTC)
I apologize for my delayed answer. Somehow I did not get a notification. :( Sure I can provide additional information as I should have done in the first place anyway: I did not use regex. The search string was “[G131]” and the replacement string was G131. v0.8.1 tells me that there is no such title containing “[G131]” whilst v0.9.0 just proceeds to a blank page. Thus the problem seems to be related to the special character since replacing G131 to G132 would work with both versions. Cheers --[[kgh]] 17:09, 24 February 2011 (UTC)
I can't reproduce this problem either. What MySQL version (assuming you're using MySQL) and PHP version are you using? Yaron Koren 20:17, 28 February 2011 (UTC)

Problem with identifying text to be replaced

Hi, I have a problem which is puzzling me. I wanted to replace the term [portfolio_slideshow] which occurred on about 150 pages. However it only replaced 50 of these occurrences - the ones the extension was able to identify. The other 100 appearances seem to be some sort of invisible. I cannot find any difference between both cases. Some kind of tip how to solve this would be cool. Cheers --[[kgh]] 13:17, 22 February 2011 (UTC)

I have no idea. Different namespace? Yaron Koren 17:37, 22 February 2011 (UTC)
Sadly this is not the case. I even selected all namespaces without helping the cause. However it would not have been necessary since the text is only included in the main namespace. Perhaps this extension uses another search mechanism than MW itself which might have caused the problem. One of my ideas was that this extension might need a leading and trailing blanc character. However this would not explain why it worked in 50 cases. Perhaps this is something for Robert Stack ;-) Cheers --[[kgh]] 17:18, 24 February 2011 (UTC)
I just made the observation that ReplaceText stopped working at all. It just does not pick up the text to be replaced. I am working on MW 1.16.2, SWM 1.5.5 and RT 0.8.1. I hope that this is not a big problem. Cheers --[[kgh]] 09:23, 28 February 2011 (UTC)
Could it be that your job queue has a backlog? All of RT's replacements are done via the job queue. Yaron Koren 14:13, 28 February 2011 (UTC)
No, that is not the case. I just ran runJobs.php to make sure and tried unsuccessfully to do a replacement. It still does not find the text to be replaced though the standard MW search does. I think a job queue just prevents the replacements to be done right away until it is their turn. Whilst I was at it I thought of one more thing that might result in this behaviour and tested it. That is what I found out: It does do replacements in all namespaces except for pages generated with semantic templates, e. g. page "Hello World" containing {{Template1|Property1=Hello|Property2=World}}. This extension seems to ignore the source code of such pages. Thus "Hello" and "World" may not be replaced. However this would explain the partial replacement I reported about on Feb. 22, 2011 too. This problem looks now more like a feature request than an problem. Cheers --[[kgh]] 14:57, 28 February 2011 (UTC)
What's the feature request? Yaron Koren 15:28, 28 February 2011 (UTC)
The feature request would be that Replace Text will be able to pick up the source code of pages containing semantic templates instead of ignoring it unless this behaviour is a bug. --[[kgh]] 16:36, 28 February 2011 (UTC)

That seems like a bug report, not a feature request... still, I find that very strange. Do you have a case where a simple string like "Hello" doesn't get replaced, and you can duplicate the problem consistently? Yaron Koren 18:24, 28 February 2011 (UTC)

A long time has passed since I reported this issue first. The reason is that I am unable to detect why. In the meantime this extension stopped working entirely for the wikis I reported in February. Finally I start to have problems on a public wiki may be observed. Today I replaced “Glossar” by “Eintrag” in namespace “Glossar” This worked for 89 pages while it did not for 51 other pages. Now I tried to change back from “Eintrag” to “Glossar”. This however fails entirely. I am pretty much helpless and sadly unable to find a scheme. There are no jobs queued, so this cannot be the reason. The wiki is on MW 1.16.5 and uses RT 0.9.1. The wiki in question is here Cheers --[[kgh]] 20:36, 12 October 2011 (UTC)
Hi - I basically have no idea. How do you know there are no jobs queued - did you check the "jobs" database table? That's the only reliable way to know. Yaron Koren 22:41, 14 October 2011 (UTC)
It is really strange. Yes I checked the jobs in the database itself for the very first time to make sure. However, this problem does not seem to be related to jobs. It is "just" a matter of not recognising the strings to be replaced. I also thought of some caching related cause, still this again would not explain this behaviour in its entirety. I am sure time will reveal the reason and I was just not patient enough so far. Cheers --[[kgh]] 08:10, 15 October 2011 (UTC)

RegExp: How to match whether a substring is there or not?

I want to replace 'customdate' to 'datepicker' and 'customdatetime' to 'datetimepicker'. In the regexp language I'm used to (the one 'sed' uses), I'd do it like that: s/customdate\([time]*\)/date\1picker/g - how to do it with Replace Text?

I tried a couple of things, but can't get it to work. When I use customdate([time]*) as original text and date$1picker as replacement text, I get datepicker (ok) and datepickertime (huh?). Is this a bug, or am I doing it wrong? --Patrick Nagel 10:19, 7 March 2011 (UTC)

I don't think it's a bug - I think it's just using "greedy matching", matching the bare string "customdate" in all cases and ignoring the rest. By the way, I believe the string "[time]" means "any individual character of t, i, m and e" - something like ((time)*) instead might be preferable. But I'm not sure about that, and I'm also not sure if it's related to the problem. Yaron Koren 15:36, 7 March 2011 (UTC)

Replace text in Categories

I tries to replace a category name at a number of image files that were misnamed. This extension normally works fine for me for texts, but any text between [[ does not change. How can I change that ? 10:14, 10 March 2011 (UTC)

Are you using regexps? If so, try not using them. Yaron Koren 15:31, 10 March 2011 (UTC)

replace text in a template

I try to replace the text {{Version10.3}} to {{Version11.0}}. But whatever I try, no text is found and I have this text in a lot of pages. Anyone who can help? Erwin van der Ploeg 13:17, 15 March 2011 (UTC)

I just tested with those exact strings, and it worked for me. As with the last question - are you using regexps? If so, try not using them. Yaron Koren 13:29, 15 March 2011 (UTC)

Strage, I do not use regexp. But I can't get it to work. Any idea? Erwin van der Ploeg 13:53, 15 March 2011 (UTC)

What happens if you try to replace the text without the curly brackets - does that work? Yaron Koren 14:12, 15 March 2011 (UTC)

No. nothing. Erwin van der Ploeg 14:28, 15 March 2011 (UTC)

I guess the issue, then, is that Replace Text doesn't work for you at all. What versions of MediaWiki, Replace Text and PHP are you using? And what DB system (MySQL, etc.) are you using? Yaron Koren 14:41, 15 March 2011 (UTC)

It does work for most texts, bit not for the {[version. I don't have any idea why. Our Wiki specs are: MediaWiki 1.16.0 PHP 5.2.13 (isapi) MySQL 5.0.24-community-nt Erwin van der Ploeg 11:45, 16 March 2011 (UTC)

Okay. Just to clarify: trying to replace the bare string "Version10.3" doesn't work? If so, could it be because the relevant pages are in another namespace, or something? Yaron Koren 13:25, 16 March 2011 (UTC)

The bare string also isn't found. I select all namespaces, so this can't be it. I've update to version .91 and I get an error: Fatal error: Call to undefined method OutputPage::addModuleStyles() in C:\ReflexWiki\Public\\extensions\ReplaceText\SpecialReplaceText.php on line 26 What now? Erwin van der Ploeg 12:45, 17 March 2011 (UTC)

Hi - thanks for letting me know about that. I just updated version 0.9.1 to fix that problem. As for the original issue, I have no idea. Yaron Koren 13:31, 17 March 2011 (UTC)

Same for me; it all works, except texts in brackets... 15:19, 17 March 2011 (UTC)

That's not the same, then; what didn't work above was the bare string "Version10.3". Yaron Koren 16:46, 17 March 2011 (UTC)
But how to change texts between [ or { ? 13:42, 20 March 2011 (UTC)
I don't know - that should work. Are you using regexp? Yaron Koren 14:49, 20 March 2011 (UTC)

Result not shown immediately?

I tried replaced a tag in my wiki, at the first 10 minutes, nothing seemed to happen, so I disabled the require_once for replace text extension in localsetting.php.

Error immediately happens, which says something about "JobQueue.php" in /includes. And a few minutes later, I noticed some pages have been modified.

What I'm not sure is whether the script can only change parts of pages (maybe the first N results, as mentioned here ).

I'm wondering in most of cases, how long does it take to complete the replacement process? --Wmama 17:40, 21 March 2011 (UTC)

The whole replacement is done using MediaWiki jobs (each page replacement is a separate job), so the amount of time it takes is totally dependent on the current size of the job queue, the speed at which jobs are executed, etc. Yaron Koren 17:44, 21 March 2011 (UTC)
Thanks Yaron! Sorry that I didn't realize that you've already written it clearly on the Known issues section.
Another issue is about Extension:CommunityVoice, which provides a content page with a rating bar. The extension needs a separate table in the DB and ajax to run. After installing ReplaceText, my extension doesn't work anymore. I'm wondering if it's possible that the job queue interrupts this? --Wmama 18:10, 21 March 2011 (UTC)
I don't know - that sounds strange. Yaron Koren 18:45, 21 March 2011 (UTC)

Regex not working

I tried several times but I can replace regex. Nothing gets replaced, not even after running maintenance/runJobs.php. Anone got it working at all? ReplaceText 0.9.1 on MW 1.16alpha and MySQL 5.0.51a here. --Subfader 17:47, 12 June 2011 (UTC)

Works like a charm here: ReplaceText 0.9.1 (MW 1.16WMF4, MySQL 5.1.49, PHP 5.3.3, running on Ubuntu 10.10). No insult intended, but did you remember to check the "use regular expressions" checkbox? Dror Snir 18:05, 12 June 2011 (UTC)
Yes I did check, otherwise the preview page wouldn't work ;) Btw, normal replace text works, just not regex. --Subfader 18:38, 12 June 2011 (UTC)
Update: I used an easy example now without special characters. It worked, but still only after forcing it via maintenance/runJobs.php.
But still buggy: The bug is that if you don't declare special characters in the find-string it may find the correct pages but will not replace text on them. Try yourself: Create a page with this text:
Replace with
[$1 SomeDomain]
No error message appears and the preview page builts up but with empty highlighted text (only the page name is listed). After running maintenance/runJobs.php:
2011-06-12 23:06:16 replaceText Tests/1 user_id=1 target_str=*)$ 
replacement_str=[$1 SomeDomain] use_regex=1 
edit_summary=Text replace - "*)$" to "[$1 SomeDomain]" 
create_redirect= watch_page= t=75 good
Nothing was replaced! Now try escaping backslashes: Find:
This time it will built the preview properly and will be replaced. The problem is that it finds the correct page with the wrong find-string! Also the preview is not 100% proper (see here) Please fix. --Subfader 23:14, 12 June 2011 (UTC)
Nice QA! I guess I never tried it without escaping every special character. Maybe Yaron will see this discussion... Dror Snir 23:23, 12 June 2011 (UTC)
I think I found it. I wondererd why only some are found here: Media:Replace text - 1307921746054.png. The solution is that only those were found where the page content ended with the URL (all others have category tags in rows below the URL). Reason: $ in the find string matches not the end of the row but is a placeholder for the rest of the page content!? --Subfader 23:49, 12 June 2011 (UTC)

Hi - thanks for doing all this testing. This makes sense to some extent - the regexp handling in Replace Text is only certified to work with a certain set of characters, and '$' (in the search term) is not one of them - see the extension page. It would be nice to handle '^' and '$', though - I'll try to look into it. Yaron Koren 18:09, 13 June 2011 (UTC)

PHP Fatal error: Class 'Html' not found in ...../ReplaceText/SpecialReplaceText.php on line 228

I'm receiving this error in MediaWiki 1.15. I downloaded 1.17, and includes/Html.php exists in that version whereas I do not have it in 1.15. I wonder if the minimum requirement of 1.13 is incorrect then? Does the dependency on the Html class require a more recent version of 1.15? A fresh download of 1.15.5 does not contain Html.php, but 1.16.5 does. It looks like the minimum requirement is MediaWiki 1.16, not 1.13. I'm going to edit the main extension page with this dependency once I verify that the error disappears with an upgrade... --Balleyne 19:10, 12 July 2011 (UTC)

Yes, it's true that some changes to the Replace Text code on SVN a few months ago (not made by me) removed backward compatibility for MW < 1.16. I'm planning to restore that backward compatibility, but I haven't gotten around to it yet. Thanks for the reminder. Yaron Koren 19:25, 12 July 2011 (UTC)

input type="text"

The category and prefix inputs miss type="text"

			"<p>$category_search_label\n" .
			Xml::input( 'category', 20, $this->category, array('type'=>'text') ) . '</p>' .
			"<p>$prefix_search_label\n" .
			Xml::input( 'prefix', 20, $this->prefix, array('type'=>'text') ) . '</p>' .
			"</fieldset>\n" .

--Subfader 19:28, 23 July 2011 (UTC)

Oh, wow - I just realized that I never looked at this. I finally checked these changes in - (very belated) thanks for this patch! Yaron Koren 02:53, 7 December 2011 (UTC)

Change notification from Replace Extension using localhost in URL

The subject almost says it all. Links in change notification emails work correctly when users edit or create a page on our intranet mediawiki. But if I use the Replace extension to make a change, the notification email uses http://localhost/main/index.php/whatever. Am I missing some setting somewhere?

MediaWiki - 1.16.0 (r150)
PHP - 5.3.2-1ubuntu4.9 (apache2handler)
MySQL - 5.1.41-3ubuntu12.7

Thanks. --Skew 07:22, 10 August 2011 (UTC)

Custom links better than Extension Distributor

I would assume that the version from SVN would be more up-to-date than the zip/tar links that are provided, especially when it relates to translations. What makes the direct links better? -- Prod 01:56, 20 November 2011 (UTC)

They're better because they've been "curated". The latest/SVN version from the ExtensionDistributor could contain code that hasn't been tested and has bugs, while snapshots for previous MediaWiki versions are just random snapshots in time, that I know for sure contain bugs. It always cause problems for various extensions of mine when someone who uses, say, MediaWiki 1.15 (understandably) downloads the 1.15 version of the code from ExtensionDistributor - and it has known bugs, missing features, etc. Yaron Koren 03:05, 20 November 2011 (UTC)

Errors in 1.18

All instances of Xml::hidden in the file extensions/ReplaceText/SpecialReplaceText.php need to be replaced with Html::hidden in order for this extension to function properly in version 1.18.

That was just fixed in the version released a few days ago - 0.9.2. Yaron Koren 18:31, 6 December 2011 (UTC)

Replace Text is not working with more than 1000 replacements

The jobs are not send if more than one thousand replacements are expected... Is there an issue to overpass this limit ?
--LeSurHumain 17:30, 14 December 2011 (UTC)

Ok ! I found an issue to my problem and it's now working. :-))
It was suhosin who limit the amount of data of the post...
I disabled it by supressing suhosin.ini in my "/etc/php5/conf.d" and reload apache...
I made my replacements...
I reactived suhosin in putting again suhosin.ini in "/etc/php5/conf.d" and reload apache again.
--LeSurHumain 17:54, 14 December 2011 (UTC)
Cool, that's good to know - I just added that to the "Known issues" section. Yaron Koren 13:09, 16 December 2011 (UTC)
I would have liked to know which one of suhosin settings caused this. I will post in case I run into this. However, this will take a while. Cheers --[[kgh]] 21:51, 15 February 2012 (UTC)

Links to Text

This tool is useful replacing text, but I can't replace URLS to text like:

I want to "Unlink" a url: [[myurl]] to -> Myurl

-- 10:39, 17 December 2011 (UTC)

That should work, actually - what's the full text for the search and replacement strings you tried? And did you click "Use regular expressions"? Yaron Koren 21:47, 18 December 2011 (UTC)
it's destroyed all my templates, and articles lol!!!!,
For example
Original text: [[Panamá]]
Replace text: Panamá
Result was --> ORIGINAL SENTENCE: I like the [[Music]] of [[Panamá]] --> RESULT SENTENCE: I like the [[MusiPanamá] of [[Panam�Panamá]
I Want ----> ORIGINAL SENTENCE: I like the [[Music]] of [[Panamá]] --> RESULT SENTENCE: I like the [[Music]] of Panamá

-- 08:38, 21 December 2011 (UTC)

That's very unfortunate (and strange). Did you click "Use regular expressions" when you did the replacement? Yaron Koren 13:17, 21 December 2011 (UTC)
Yes both options!! don't worry man, I forgot the "reversion" options to get back revisions!!, I will check some of the replacetext code to find what's going on!!! -- 06:27, 22 December 2011 (UTC)
Return to "Replace Text/Archive 2010 to 2011" page.