Tags:
create new tag
view all tags

SID-02451: rename script from CLI

Status: Answered 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title rename script from CLI
SupportCategory CategoryAPI
TWiki version 6.1.0
Server OS RH 7
Web server apache
Perl version 5.8
Browser & version Command line
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2020-08-07 - PeterJones
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.