• 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.

Item4902: Must revert SYSTEMWEB/USERSWEB change in Plugins frown

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine ALL PLUGINS Urgent Closed   minor 4.2.0

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


I want to make BugsContrib compatible back to 4.0

to do so, I'd like to optionally define SYSTEMWEB and USERSWEB only if they are undefined - so I tried..

    • Set %IF{"$USERSWEB = ''" then="#"}%USERSWEB = Main

but that does not see to ever be false (4.0.5 and MAIN)

so I tried

    • Set %IF{"defined USERSWEB" then="#"}%USERSWEB = Main

which seems to return false in both 4.0.5 and MAIN

I've als added 's and stuff to no change in the result

I'd like some help - then we can write even more docco?

-- TWiki:Main/SvenDowideit - 29 Oct 2007

Untested, perhaps:

   * Set USERSWEB = %IF{"defined USERSWEB" then="%USERSWEB%" else="%MAINWEB%" }%

-- TWiki:Main.SteffenPoulsen - 29 Oct 2007

While I appreciate the intent, this sort of recursive definition doesn't work. When you define a user var, it totally replaces the system definition, so defining USERSWEB = USERSWEB that way would lead to an infinite loop (which is blocked, I hope).

Sorry, but I can't think of a way to do what you want.....


well, unless there is a way, BugsContrib will revert back to using TWIKIWEB and MAINWEB.

I'm somewhat surprised that defined USERSWEB returns false in 4.2 - I thought that was what Micha & you guys fixed, as it was one of the bugs I highlighted in the IF bug last week.

-- TWiki:Main.SvenDowideit - 30 Oct 2007

It doesn't return false, as demonstrated by this sentence.

Conditional sets have always been an issue. The problem is that TWiki hides the evaluation order of TWiki variables, and doesn't always do it consistently. For example, when evaluating %VAR, it only looks at the target web/topic and does not replay the whole preference setting procedure for that target. As a result, a conditional set could end up returning different values depending on how it is evaluated, if the conditional looks at the values of TWiki variables in the scope where it is set. This is not a low-hanging nut, ripe for chopping - it's a reason to completely rewrite preference handling from the ground up. frown

Without such a rewrite, your only hope is to write:

  • Set USERSWEB = TWiki

in the Bugs contrib, which will override the system-defined value of USERSWEB, but will at least override it with the correct value.

BTW I don't see this as Urgent, dropping to Normal.

-- TWiki:Main.CrawfordCurrie - 30 Oct 2007

It is a general problem that plugins stop working because of the MAINWEB -> USERSWEB and TWIKIWEB -> SYSTEMWEB bulk conversion that was brute forced on all plugins.

People upgrading or installing plugins on old TWikis now need to add the definitions of USERSWEB and SYSTEMWEB to TWikiPreferences. A real pain and will create many support questions and bug reports in future. Was that change really necessary?

-- TWiki:Main.KennethLavrsen - 30 Oct 2007

ok, If you don't think its urgent, and needs to be fixed before we release 4.2, I guess I should just change BugsContrib back to using TWIKIWEB and MAINWEB - as there's not much point in trying to use the new settings.

I do think this is urgent.

-- TWiki:Main.SvenDowideit - 01 Nov 2007

The problem here is not that USERSWEB and SYSTEMWEB are undefined in 4.2. The problem is that they are undefined in earlier TWiki versions. Since we cannot affect the code in earlier TWiki versions, it's impossible to come up with a code solution in the core.

The alternative is a solution that detects if the settings are present when the plugin is run, and refuses to allow the plugin to be enabled unless the settings are present. This has to be done in the code of the plugin. For example,

unless (TWiki::Func::getPreferencesValue('SYSTEMWEB')) {
    TWiki::Func::writeWarning("SYSTEMWEB is not set - please set it in Main.TWikiPreferences");
    return 1;
in initPlugin. Of course this only works for plugins. For contribs, we have a more difficult problem. However it is still solveable, by embedding the same check into one or more of the contrib topics. For example,
%IF{"defined 'SYSTEMWEB'" else="<span class=twikiAlert>SYSTEMWEB is not set - please set it in Main.TWikiPreferences</span>"}%

Both of these solutions depend on the good behaviour of the extension author, but I'm afraid i can't think of another way to do it. However they are both valid workarounds, so dropping this to Normal again.


We are having a discussion in IRC regarding this. Some test cases.

  • Set %IF{"defined 'BLAH'" then="#"}%GLAH = Z
evaluates to:
  • Set GLAH = Z
and %GLAH% is %GLAH%

Now the same expression with the tested var set

  • Set BLEH = 1
  • Set %IF{"defined 'BLEH'" then="#"}%GLEH = Z
evaluates to:
  • Set #GLEH = Z
and %GLEH% is %GLEH%

OK, the conclusion of the discussion is that there's no way to do this, and we need to revert the changes to all the plugins to use TWIKIWEB and MAINWEB again frown There is no way to work around it technically, and there has been insufficient warning of USERSWEB and SYSTEMWEB.


Ähm, what were the reasons to introduce USERSWEB and SYSTEMWEB in the first place?

-- TWiki:Main.FranzJosefGigler - 07 Nov 2007

It was a change requested by a number of different people over the years. Generally people find 'TWIKIWEB' and 'MAINWEB' obscure and meaningless. Imagine yourself as a new user; given what they are used for, do these names make sense to you?

-- TWiki:Main.CrawfordCurrie - 08 Nov 2007

No, of course not, but one line of doku would have told me their meaning. Thought that it was some functional necessity to allow renaming of the Main and the TWiki web, but I guess that the existing 'variables' could be reused for that too, right?

-- FranzJosefGigler - 08 Nov 2007

I will revert the variables for plugins, so that older installations of TWiki can use the plugins again. For newer TWiki releases the change will be transparent anyway.

-- TWiki:Main.AndreUlrich - 12 Nov 2007

Andre says he has reverted in MAIN. Need to check the default plugins in the release branch as well.

-- TWiki:Main.CrawfordCurrie - 20 Nov 2007

I merged the changes, so we can close this now.


Missed a few - fixing


Edit | Attach | Watch | Print version | History: r38 < r37 < r36 < r35 < r34 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r38 - 2008-01-16 - KennethLavrsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback