Extension talk:Replace Text/Archive 2018

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)

Search apparently not working after doing first set of replacements
I just did a search to replace " " with "  " 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: " " to "  ". 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 or if aparameter are used, e.g.  . 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)

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( " \n $search_label$tables\n " ); to $wgOut->addHTML( " \n $search_label \n$tables\n " ); Same for the second fieldset and $optional_filters_label. --Subfader 17:31, 14 March 2010 (UTC)

Useless query
IMO the info  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 ), " {$this->replacement} " ); }				} 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 ); }				} with 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 ), " {$this->replacement} " ); }				} 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)

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)