Item12438: Trunk statistics script only processes the Main web by default

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: FoswikiUIStatistics
Branches: trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
It used to process all top level webs unless it is passed a web object.

On trunk it appears to get the Main web object by default.

-- GeorgeClark - 15 Mar 2013

git bisect reports:

b75d10c8e46adb05c30942798de53754e7da325d is the first bad commit
commit b75d10c8e46adb05c30942798de53754e7da325d
Author: SvenDowideit <SvenDowideit@0b4bb1d4-4e5a-0410-9cc4-b2b747904278>
Date:   Sat Oct 20 04:07:08 2012 +0000

    Item9225: re-write code to determine requested web&topic by writing it in the defaulting order - i hope its less convoluted now.
    
    git-svn-id: http://svn.foswiki.org/trunk@15641 0b4bb1d4-4e5a-0410-9cc4-b2b747904278

:040000 040000 001718d380d87ab03d888ac936564ab05a5ed73e 7734c2bff63d268c04f3b1531fa5e5d835c2bb46 M      UnitTestContrib
:040000 040000 de3469d8be1e71b751aa196f616ceefb6e4a9bfd ac8252a9171ee5f3bf99ab5442c42a3b60280bfb M      core

-- GeorgeClark - 15 Mar 2013

Specifically:

#set the defaults for web&topic
+#Development.AddWebParamToAllCgiScripts: enables bin/script?topic=WebPreferences;defaultweb=Sandbox
+    my $web = $query->param('defaultweb') || $Foswiki::cfg{UsersWebName};

CLI scripts used to run without any default web set.

-- GeorgeClark - 15 Mar 2013

Good analysis. Moved the application of the defaults to where they should be; statistics should be happy again.

-- CrawfordCurrie - 14 May 2013

I'm reopening this to check in a different fix. Your fix applies the URL defaultweb parameter too late, and the unit tests fail.

I think the fix is to move the assignment of defaultweb parameter up to the top, but leave the fallback where you moved it at the bottom. If defaultweb has been explicitly assigned then it needs to survive.

:
ViewScriptTests::test_urlparsing

Expected:'Sandbox'
 But got:'TemporaryViewScriptUsersWeb'
 at /var/www/foswiki/trunk/core/lib/Unit/TestCase.pm line 239
        Unit::TestCase::assert_equals('ViewScriptTests=HASH(0x87e5458)', 'Sandbox', 'TemporaryViewScriptUsersWeb') called at /var/www/foswiki/trunk/core/test/unit/ViewScriptTests.pm line 335
        ViewScriptTests::urltest('ViewScriptTests=HASH(0x87e5458)', '/?topic=WebChanges;defaultweb=Sandbox', 'Sandbox', 'WebChanges') called at /var/www/foswiki/trunk/core/test/unit/ViewScriptTests.pm line 359

-- GeorgeClark - 07 Oct 2013

I read the code and I concur.

-- CrawfordCurrie - 13 Oct 2013
 

ItemTemplate edit

Summary Trunk statistics script only processes the Main web by default
ReportedBy GeorgeClark
Codebase trunk
SVN Range
AppliesTo Engine
Component FoswikiUIStatistics
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:5f83a9070f0d distro:832a11c07c27
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches trunk
trunkCheckins distro:5f83a9070f0d distro:832a11c07c27
Release01x01Checkins
Topic revision: r11 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy