I packaged and released this Plugin for
PaulineCheung. We created this Plugin at work because we had to do some large scale refactoring of content.
Please enjoy this Plugin
This Plugin is an example of how to manipulate topics without a standalone script. All is done by the commonTagsHandler of the Plugin, called from the
viewauth
script. The
CommentPlugin and others that depend on standalone scripts could/should be changed the same way.
--
PeterThoeny - 08 Feb 2004
I observed that in
GlobalSearchAndReplace, the WebForm is messed up. I assume that this is as a result of something that is entered in that page. You might want to check whether it has to do with some HTML generated by the plugin.
This looks like a great feature. There appears to be some overlap with the search and replace after topic moves, maybe we can factor this commonality out (might require making this plugin part of core functionality)?
--
ThomasWeigert - 08 Feb 2004
Web form: This is because the Plugin is not installed and that topic contains a
%TABLE{}%
without a table, thus formatting the form below. I added an extra table.
Search overlap: Yes, it makes sense to move the existing topic rename funtionality out of lib/TWiki/Search.pm into a separate module, or even into a Plugin that gets shipped with TWiki.
--
PeterThoeny - 08 Feb 2004
I like the concept of moving the entire search/topic rename/topic text replace into a separate Plugin module. Oftentimes I have wished the the topic rename could be changed to act a little differently - packaging this as a Plugin, maybe even one that overrides a very simple implementation in a core module (is this called "overloading"?) would allow a TWiki admin to turn on/off advanced features per web, yet still keep some rudementary ones, modify the Plugin without endangering the core code, etc.
Just my thoughts.
--
SteveRJones - 09 Feb 2004
Nice functionality but I'd want to change it to operate across multiple webs. Anyone see any reason why not?
--
MartinCleaver - 18 May 2004
Reason? Time to implement, rather lack of
--
PeterThoeny - 20 May 2004
New version posted on Plugin topic with monir enhancement:
- In replace string, added support for
$topic
token, useful to replace text with the name of the current topic.
--
PeterThoeny - 03 Nov 2004
.zip
checked into
CVSplugins:GlobalReplacePlugin
--
WillNorris - 23 Nov 2004
Thanks
MikkoLaakso for adding the examples, should be taken into the next Plugin release.
--
PeterThoeny - 01 Nov 2005
The plugin doesn't work with usernames of this form: domain\username
--
CarterSmithhart - 28 Nov 2005
Please consider adding the
use strict;
pragma to this plugin. Its use is important to ensuring the quality of TWiki plugins and avoiding unpleasant surprises. See
UseStrict for more.
--
MeredithLesly - 02 Jul 2006
In TWiki 4.0.2 I can use
GlobalReplacePlugin to find fixed strings, but I can't get it to work with any regular expressions. I'm looking for text like "%CITE{text}%", much like the example in
GlobalSearchAndReplaceHelp. I can find "CITE{.." but not "%CITE" or "CITE{.*". (I've used REs before, though I don't claim to be an expert.) In debug.txt, I noticed that handleGlobalReplace is receiving % as
%
and * as
*
- could this be part of the problem?
Any suggestions for how I might fix this?
--
ClifKussmaul - 24 Jul 2006
The regular expression problem seems to be in handleDecode(). It's looking for things like #037 but is receiving #37 (no leading 0). If I copy the set of patterns and remove the leading 0s, everything seems to work fine.
--
ClifKussmaul - 30 Jul 2006
Thanks Clif for the report. Note to myself: Check this Plugin with regex patterns on TWiki 4.
--
PeterThoeny - 03 Aug 2006
I'm using this on 4.0.5 and I'm getting the same behaviour as Clif cites above. Guess I'll be doing some scripting...
--
MarcusLeonard - 27 Dec 2006
The following patch fixes the issue of TWiki 4.x behaving differently for encodings:
--- GlobalReplacePlugin.pm.save1 2004-11-03 00:23:57.000000000 -0800
+++ GlobalReplacePlugin.pm 2008-10-03 15:29:54.000000000 -0700
@@ -389,15 +389,15 @@
my( $theStr ) = @_;
# entity decode
- $theStr =~ s/\&\#034;/\"/g;
- $theStr =~ s/\&\#037;/\%/g;
- $theStr =~ s/\&\#042;/\*/g;
- $theStr =~ s/\&\#095;/\_/g;
- $theStr =~ s/\&\#061;/\=/g;
- $theStr =~ s/\&\#091;/\[/g;
- $theStr =~ s/\&\#093;/\]/g;
- $theStr =~ s/\&\#060;/\</g;
- $theStr =~ s/\&\#062;/\>/g;
+ $theStr =~ s/\&\#0?34;/\"/g;
+ $theStr =~ s/\&\#0?37;/\%/g;
+ $theStr =~ s/\&\#0?42;/\*/g;
+ $theStr =~ s/\&\#0?95;/\_/g;
+ $theStr =~ s/\&\#0?61;/\=/g;
+ $theStr =~ s/\&\#0?91;/\[/g;
+ $theStr =~ s/\&\#0?93;/\]/g;
+ $theStr =~ s/\&\#0?60;/\</g;
+ $theStr =~ s/\&\#0?62;/\>/g;
$theStr =~ s/\&\#124;/\|/g;
return $theStr;
--
PeterThoeny - 05 Oct 2008
Hello, I am very excited about this plugin because my site was heavily impacted by the new method=post requirements in 4.3.1.
I do the search and I get a wonderful results list of the topics and appropriate changes, but when I go to submit an item (trying with just 1 check item at first, I get the following error mesasge:
Result of Global Search And Replace
Back to
GlobalSearchAndReplace.
You are currently logged in as
AJAlfieriCrispin. Only Members of the Main. may save the changes of a Global Search And Replace.
The thing is I AM a member of TWiki admin group in the forms of "aj" (my AD login ID) and "Main.AJAlfieriCrispin" and "AJAlfieriCrispin".
The odd thing about the error message is that it says I must be a member of "Main." so it looks like it is looking for a group that doesn't exist or some other bug. Any help would be appreciated. This is fairly critical for me to get a bunch of pages fixed.
Thanks, AJ
--
AJAlfieriCrispin - 2009-06-05
I'm quickly working around the problem by modifying
my $access = 1 ;
in
GlobalReplacePlugin.pm
--
AJAlfieriCrispin - 2009-06-05
That is a viable workaround. Disable the plugin after use, someone who does not know regular expressions could do damage to a TWiki site. Plugin code needs to be reviewed/fixed to support check for admin group membership by login name
and wikiname.
--
PeterThoeny - 2009-06-06
Thanks Peter, I definitely disabled things when done. The Search and Replace went flawlessly, so many thanks to
PaulineCheung!
Since I put both my login name AND my wikiname in the proper group I think the problem is more basic in the .pm module, or possibly with the way the following call is made
GlobalReplacePlugin.pm line 135-137:
my $access = &TWiki::Func::checkAccessPermission("change",
&TWiki::Func::userToWikiName($_user),
"", $prefsTopic, $prefsWeb );
I'm just not Perl savvy enough to go tracing this. But my noob guess is since my workaround worked, that the problem is in this call or its results.
--
AJAlfieriCrispin - 2009-06-06
Is there a way to rename multiple Topics at the same time ?
--
AlinGramescu - 2011-11-03
Not with this plugin and not with TWiki at the moment.
--
PeterThoeny - 2011-11-03
See related new plugin:
ReplaceTextPlugin
--
Peter Thoeny - 2019-05-05