• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5458: Rename web drop all link refer to the web

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   patch 4.2.1, 5.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

In TWiki-4.2.0, Tue, 22 Jan 2008, build 16278

Rename a web "OldWeb" to "NewWeb".

Expected result:

All the links like "OldWeb.SomeTopic" will be changed to "NewWeb.SomeTopic".

Actual result:

All links are changed to "NewWeb". So the links are lost.

-- TWiki:Main/LijiYu - 20 Mar 2008

I changed the Render.pm, and it works for this bug. But have the concern that such modification will cause severe side effect. Can any EXPERT look into this bug?

Here is my modification of Render.pm

1930c1930,1931
<     $text =~ s/$re/$newWeb/g;
---
>     $text =~ s/$oldWeb/$newWeb/g;
>

-- TWiki:Main.LijiYu - 24 Mar 2008

I can see that the code made at SVN 13367 for sure broke web renaming.

But the suggested fix is not correct either. It will replace any word which is the web name.

I think I have a fix ready but it is too late for me to test now. Will return

-- TWiki:Main.KennethLavrsen - 25 Mar 2008

I am testing this code.

Unit tests run fine. A rename of a web runs fine. Still need to do a little more code inspection to ensure that I did not break any other features. I think it is OK. You can also give it a go with testing Liji.

old patch deleted

-- TWiki:Main.KennethLavrsen - 26 Mar 2008

The final fix as patch

[root@www TWikiRelease04x02]# svn diff -r 16562:16563
Index: lib/TWiki/Render.pm
===================================================================
--- lib/TWiki/Render.pm (revision 16562)
+++ lib/TWiki/Render.pm (revision 16563)
@@ -1827,10 +1827,13 @@
             # Searching for a web
             if( $options{interweb} ) {
                 # web name used to refer to a topic
-                $re = $bow.'\.'.$matchWeb.'\.[A-Za-z0-9]+'.$eow;
+                $re = $bow . '\.' . $matchWeb . '(\.[$TWiki::regex{mixedAlphaNum}]+)' . $eow;
             } else {
                 # most general search for a reference to a topic or subweb
-                $re = $bow.$matchWeb.'\.[A-Za-z0-9]+'.$eow;
+                # note that replaceWebReferences() uses $1 from this regex
+                $re = $bow . $matchWeb .
+                      "(([\/\.][$TWiki::regex{upperAlpha}][$TWiki::regex{mixedAlphaNum}_]*)*" .
+                      "\.[$TWiki::regex{mixedAlphaNum}]+)" . $eow;
             }
         }
     }
@@ -1927,7 +1930,7 @@

     my $re = getReferenceRE( $oldWeb, undef);

-    $text =~ s/$re/$newWeb/g;
+    $text =~ s/$re/$newWeb$1/g;

     $re = getReferenceRE( $oldWeb, undef, url => 1);

has been checked in to both trunk and the 4.2.1 code

-- TWiki:Main.KennethLavrsen - 26 Mar 2008

Kenneth, it seems that all the pages containing the Old Web name will be listed during renaming. Would you please attach a clean Reander.pm file so that I can easily get it?

-- TWiki:Main.LijiYu - 26 Mar 2008

I have attached the version of Render.pm that I believe should work with 4.2.0. I have not checked that the Render.pm attached will work in 4.2.0. It may contain other fixes but I doubt there is any issue with replacing it but just in case, keep a copy of your original handy wink

-- TWiki:Main.KennethLavrsen - 26 Mar 2008

I used this file with TWiki-4.2.0, Tue, 22 Jan 2008, build 16278. All the pages containing the OldWebName pattern are listed in the Rename Web page. So I dared not to click the "Rename/Move" button.

-- TWiki:Main.LijiYu - 27 Mar 2008

The above patch (dd. 26 Mar 2008) doesn't work properly on a fresh 4.2, i just tried. For example, it changed 'TWiki.TWikiRegistration' to 'Wastwiki.WastwikiRegistration' when i renamed the TWiki web to Wastwiki.

-- TWiki:Main.KoenMartens - 24 Apr 2008

It is only by chance that I now see Koen's remark that my fix was not as complete as one could wish. Those that read this - when you comment a closed or Waiting for Release report please flip it back to either New, Confirmed or even better Waiting for Feedback and add the name of the guy that thought he had fixed the problem. Otherwise the risk is high that this important info is lost

-- KennethLavrsen - 18 Jun 2008

After applying the patch on a 4.2 (see also Item5712) I tried to rename a parent web of a hierarchy. From now on let's assume: xxx old name of parent web, yyy name of chilld web, zzz name of topic inside child web, nnn new name of the parent web. The rename worked for only some occurences of the xxx.yyy.zzz link type, changing it into nnn.yyy.zzz and just replacing it with nnn in other cases (I really couldn't identify reasonable differences between the first and the latter). The rename didn't work for the simple "xxx" occurences, left untouched instead of changing them into "nnn"

-- TWiki:Main.FabrizioBerdondini - 18 Jun 2008

Can you try and analyse it a little more so I get a faster way to reproducing it?

I do not understand what you mean with "simple xxx occurances". For the renaming to work the web name has to be used in a context where it is clearly used as a web name. If the name of a web is just used as a free standing word in the text the renaming should for sure not change such words. I need real examples.

-- TWiki:Main.KennethLavrsen - 18 Jun 2008

We have a first level web named NewProject with some children, i.e. named Organization and FlowAnalisys. In the WebHome of NewProject there is a link to the page NewProject.Organization.ProjectCalendar.

Inside the web NewProject you can also find:

  • Some pages of the child web Organization that contain occurencies of NewProject string inside a "CALC" for some variable/application settings.

  • Some other pages of children web FlowAnalisys that contain "full path" links to other pages, example: NewProject.FlowAnalisys.MilestonesManagement

We tried to rename the NewProject web into Officine with the following results:

  • Before applying the patch:
    • the link to the calendar was lost, changed into Officine.ProjectCalendar instead of the expected Officine.Organization.ProjectCalendar
    • the "full path" link NewProject.flowAnalisys.MilestonesManagement was also lost, it became Officine.MilestoneManagement
    • the string NewProject inside "CALC{}" was everywhere changed into Officine

  • After applying the patch:
    • the link to the calendar was correctly changed into Officine.Organization.ProjectCalendar as expected
    • The "full path" link NewProject.flowAnalisys.MilestonesManagement was somewhere correctly changed into the expected Officine.flowAnalisys.MilestonesManagement, somewhere else "destroyed" thus being changed into Officine.MilestonesManagement. I wasn't able to find noticeable differences between structure/text/link inside pages correctly updated and messed-up ones
    • the string NewProject inside "CALC{}" was never changed

Hope this could help...

-- TWiki:Main.FabrizioBerdondini - 19 Jun 2008

worrying. we had this sort of in again, out again issue with renaming webs in bejing-cairo times too.

if someone makes a list of all the possible cases, and the correct result, I'll start on unit tests for them, and that should help someone else finish them.

-- TWiki:Main.SvenDowideit - 19 Jun 2008

Even if you cannot see the difference is there a chance we can see the actual examples before and after?

If the topic is confidencial then strip off everything except the one line before and after and maybe rename some words.

If we have Web.Subweb.TopicName type of links inside the string of a CALC then I actually think we are beyond what we can - or even WANT - the renamer to rename. It is a balance. No script can ever 100% know if information that depends on other information is plain text or supposed to become a link to a topic in a web. There will always be cases where the renaming will not work - OR - we will have to accept that things get renamed that we did not want renamed.

-- TWiki:Main.KennethLavrsen - 19 Jun 2008

We are "rearranging" the structure of a "trial" TWiki in order to give public access to it and allow you to test the behaviour of the "rename" inside it.

I said, in my previous post that in some cases the "rename" worked correctly while in other not, thus I wasn't able to determine a significant difference between the two cases.

From further analisys there's chance the second test was run on already "corrupted" datas (from a first rename), so the rename didn't work because some links had not been corrected after the first tests.

-- TWiki:Main.FabrizioBerdondini - 24 Jun 2008

Reclosing this. Reopen if you have an actual example that fails. I have tried tonight and as I see it it works in current SVN.

-- KennethLavrsen - 25 Jun 2008

ItemTemplate
Summary Rename web drop all link refer to the web
ReportedBy TWiki:Main.LijiYu
Codebase 4.2.0, 4.2.1, ~twiki4
SVN Range TWiki-5.0.0, Sun, 09 Mar 2008, build 16496
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:16563 TWikirev:16564
TargetRelease patch
ReleasedIn 4.2.1, 5.0.0
Topic attachments
I Attachment History Action Size Date Who Comment
Perl source code filepm Render.pm r1 manage 71.5 K 2008-03-26 - 17:45 UnknownUser Render.pm for TWiki 4.2 as per SVN version 16563
Edit | Attach | Watch | Print version | History: r22 < r21 < r20 < r19 < r18 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r22 - 2008-08-04 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback