SID-02451: rename script from CLI
| Status: |
Answered |
TWiki version: |
6.1.0 |
Perl version: |
5.8 |
| Category: |
CategoryAPI |
Server OS: |
RH 7 |
Last update: |
5 years ago |
Hello
Is it possible to run the rename script from the command line?
I want to archive old topics into a subweb of the current web. I find a list of topics to archive and put them into a bash script as follows
cd /twiki/bin; ./rename -topic MyWeb.MyTopic -user admin -newweb MyWeb.Archive -currentwebonly
The above command runs without problems and does not return any messages, however the topic is not moved
Thanks for any feedback
--
Peter Jones - 2020-08-01
Discussion and Answer
It turns out to be a bug, tracked at
TWikibug:Item7906
. Please apply this fix:
Index: TWiki/UI/Manage.pm
===================================================================
--- TWiki/UI/Manage.pm (revision 30785)
+++ TWiki/UI/Manage.pm (working copy)
@@ -521,7 +521,8 @@
return;
}
- return undef unless (!$query || $query->request_method() =~ /^POST$/i );
+ return undef unless ( $session->inContext( 'command_line' ) ||
+ !$query || $query->request_method() =~ /^POST$/i );
my $new_url;
my $trashWebName = $session->trashWebName(web => $oldWeb);
--
Peter Thoeny - 2020-08-02
Hi Peter
Thanks for the reply
I made the suggested change, The rename script now returns the html of the form but does not actually execute the move.
Is it possible to force the 'Submit' of the form?
Pete
--
Peter Jones - 2020-08-03
Hmm, not sure why it does not work for you. I successfully tested the fix with this command:
$ ./rename -topic Sandbox.TestTopic5798 -user admin -newweb Sandbox -newtopic TestRename
If you have a non-WikiWord topic you need to add the
nonwikiword flag, see
TWikiScripts
--
Peter Thoeny - 2020-08-05
Hi Peter
Yes I confirm that it works as you have written it.
The
-newtopic is necessary otherwise the form is returned without being submitted.
Thanks for your hep.
--
Peter Jones - 2020-08-07
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.