Changeset 974


Ignore:
Timestamp:
11/26/08 12:42:53 (3 years ago)
Author:
CrawfordCurrie
Message:

Item175: detox various environment variables, constants, and the cookie name

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/ActionTrackerPlugin/lib/TWiki/Plugins/ActionTrackerPlugin.pm

    r464 r974  
    6565    return unless _lazyInit($web, $topic); 
    6666 
    67     my $debug = $ENV{TWIKI_ASSERTS} ? '_src' : ''; 
     67    my $debug = ''; 
     68    $debug = '_src' if DEBUG; 
    6869 
    6970    TWiki::Func::addToHEAD('ACTIONTRACKERPLUGIN_CSS', <<HERE); 
  • trunk/PublishContrib/lib/TWiki/Contrib/Publish.pm

    r671 r974  
    478478    $header = TWiki::Func::renderText( $header, $this->{web} ); 
    479479    $header =~ s/<nop>//go; 
    480     TWiki::Func::writeHeader($query); 
     480    TWiki::Func::writeHeader(); 
    481481    _display $header; 
    482482 
     
    600600    $query->param('topic', "$this->{web}.$topic"); 
    601601 
    602     # Create a new TWiki so that the contexts are correct. This is really, 
    603     # really inefficient, but is essential at the moment to maintain correct 
    604     # prefs 
    605     my $twiki = new TWiki($this->{publisher}, $query); 
    606     $TWiki::Plugins::SESSION = $twiki; 
     602    if (defined &TWiki::Func::pushTopicContext) { 
     603        TWiki::Func::pushTopicContext($this->{web}, $topic); 
     604    } else { 
     605        # Create a new TWiki so that the contexts are correct. This is really, 
     606        # really inefficient, but is essential to maintain correct prefs if 
     607        # we don't have a modern Func 
     608        my $twiki = new TWiki($this->{publisher}, $query); 
     609        $TWiki::Plugins::SESSION = $twiki; 
     610    } 
    607611 
    608612    # Because of Item5388, we have to re-read the topic to get the 
  • trunk/TestFixturePlugin/lib/TWiki/Plugins/TestFixturePlugin.pm

    r803 r974  
    3333# 
    3434# DO NOT USE THIS PLUGIN IN A USER INSTALLATION. IT IS DESIGNED FOR 
    35 # TWIKI CORE TESTING ONLY!!! 
     35# FOSWIKI CORE TESTING ONLY!!! 
    3636# 
    3737# The idea is that topics contain blocks marked by <!-- expected --> 
  • trunk/UnitTestContrib/test/unit/FoswikiSuite.pm

    r816 r974  
    3030    my $home = "../.."; 
    3131    unless (-e "$home/lib/MANIFEST") { 
    32         $home = $ENV{TWIKI_HOME}; 
     32        $home = $ENV{FOSWIKI_HOME}; 
    3333    } 
    3434    require Cwd; 
  • trunk/UnitTestContrib/test/unit/FoswikiTestCase.pm

    r816 r974  
    2020 
    2121BEGIN { 
    22     push( @INC, "$ENV{TWIKI_HOME}/lib" ) if defined($ENV{TWIKI_HOME}); 
     22    push( @INC, "$ENV{FOSWIKI_HOME}/lib" ) if defined($ENV{FOSWIKI_HOME}); 
    2323    unshift @INC, '../../bin'; # SMELL: dodgy 
    2424    require 'setlib.cfg'; 
     
    3030# Temporary directory to store work files in (sessions, logs etc). 
    3131# Will be cleaned up after running the tests unless the environment 
    32 # variable TWIKI_DEBUG_KEEP is true 
     32# variable FOSWIKI_DEBUG_KEEP is true 
    3333use File::Temp; 
    34 my $cleanup  =  $ENV{TWIKI_DEBUG_KEEP} ? 0 : 1; 
     34my $cleanup  =  $ENV{FOSWIKI_DEBUG_KEEP} ? 0 : 1; 
    3535 
    3636sub new { 
     
    130130    } 
    131131    # then reenable only those listed in MANIFEST 
    132     if ($ENV{TWIKI_HOME} && -e "$ENV{TWIKI_HOME}/lib/MANIFEST") { 
    133         open(F, "$ENV{TWIKI_HOME}/lib/MANIFEST") || die $!; 
     132    if ($ENV{FOSWIKI_HOME} && -e "$ENV{FOSWIKI_HOME}/lib/MANIFEST") { 
     133        open(F, "$ENV{FOSWIKI_HOME}/lib/MANIFEST") || die $!; 
    134134    } else { 
    135135        open(F, "../../lib/MANIFEST") || die $!; 
  • trunk/UnitTestContrib/test/unit/RequestTests.pm

    r816 r974  
    9999        $req->action($_); 
    100100        $this->assert_str_equals($_, $req->action, 'Wrong action value'); 
    101         $this->assert_str_equals($_, $ENV{TWIKI_ACTION}, 'Wrong TWIKI_ACTION environment'); 
     101        $this->assert_str_equals($_, $ENV{FOSWIKI_ACTION}, 'Wrong FOSWIKI_ACTION environment'); 
    102102    } 
    103103} 
  • trunk/UnitTestContrib/test/unit/ResponseTests.pm

    r816 r974  
    5656        'f-o-o-bar'    => 'baz', 
    5757        'Set-COOKIe'   => [ 
    58             'TWIKISID=4ed0fb8647881e17852dff882f0cfaa7; path=/', 
     58            'FOSWIKISID=4ed0fb8647881e17852dff882f0cfaa7; path=/', 
    5959            'SID=8f3d9cb028e4f7dabe435bcfc4905cda; path=/' 
    6060        ], 
     
    8989    $this->assert_deep_equals( 
    9090        [ 
    91             'TWIKISID=4ed0fb8647881e17852dff882f0cfaa7; path=/', 
     91            'FOSWIKISID=4ed0fb8647881e17852dff882f0cfaa7; path=/', 
    9292            'SID=8f3d9cb028e4f7dabe435bcfc4905cda; path=/' 
    9393        ], 
     
    130130    require CGI::Cookie; 
    131131    my $c1 = new CGI::Cookie( 
    132         -name   => 'TWIKISID', 
     132        -name   => 'FOSWIKISID', 
    133133        -value  => '80eaee753351a6d4d050320ce4d60822', 
    134134        -domain => 'localhost' 
  • trunk/WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm

    r811 r974  
    2121# Readers are invited to add more testcases. 
    2222# 
    23 # The tests require TWIKI_LIBS to include a pointer to the lib 
     23# The tests require FOSWIKI_LIBS to include a pointer to the lib 
    2424# directory of a TWiki installation, so it can pick up the bits 
    2525# of TWiki it needs to include. 
  • trunk/core/lib/Assert.pm

    r411 r974  
    1414# 
    1515# Usage is as for Carp::Assert except that you have to explicitly 
    16 # enable asserts using the environment variable "TWIKI_ASSERTS" 
    17 # add ENV{TWIKI_ASSERTS} = 1; to you bin/setlib.cfg or bin/LocalLib.cfg 
     16# enable asserts using the environment variable ENV{FOSWIKI_ASSERTS} 
     17# (or ENV{TWIKI_ASSERTS}) 
     18# add ENV{FOSWIKI_ASSERTS} = 1; to you bin/setlib.cfg or bin/LocalLib.cfg 
    1819 
    1920use strict; 
     
    3334sub ASSERTS_OFF() { 0 }    # CONSTANT 
    3435 
    35 # Export the proper DEBUG flag if TWIKI_ASSERTS is set, 
     36# Export the proper DEBUG flag if FOSWIKI_ASSERTS is set, 
    3637# otherwise export noop versions of our routines 
    3738sub noop { } 
     
    4041    no warnings 'redefine'; 
    4142    no strict 'refs'; 
    42     if ( $ENV{TWIKI_ASSERTS} ) { 
     43    if ( $ENV{FOSWIKI_ASSERTS} || $ENV{TWIKI_ASSERTS} ) { 
    4344        *DEBUG = *ASSERTS_ON; 
    4445        Assert->export_to_level( 1, @_ ); 
  • trunk/core/lib/Foswiki.pm

    r966 r974  
    171171        # ASSERTs 
    172172        # ASSERTS are turned on by defining the environment variable 
    173         # TWIKI_ASSERTS. If ASSERTs are off, this is assumed to be a 
     173        # FOSWIKI_ASSERTS. If ASSERTs are off, this is assumed to be a 
    174174        # production environment, and no stack traces or paths are 
    175175        # output to the browser. 
     
    331331    $functionTags{WIKIWEBMASTERNAME} = sub { $Foswiki::cfg{WebMasterName} }; 
    332332 
    333     # Compatibility synonyms, deprecated in 4.2 but still used throughout 
    334     # the documentation. 
    335     $functionTags{MAINWEB}  = $functionTags{USERSWEB}; 
    336     $functionTags{TWIKIWEB} = $functionTags{SYSTEMWEB}; 
    337  
    338333    # locale setup 
    339334    # 
  • trunk/core/lib/Foswiki/Configure/UI.pm

    r830 r974  
    4040        $replist .= $Foswiki::cfg{ExtensionsRepositories} 
    4141          if defined $Foswiki::cfg{ExtensionsRepositories}; 
    42         $replist .= "$ENV{TWIKI_REPOSITORIES};"    # DEPRECATED 
    43           if defined $ENV{TWIKI_REPOSITORIES};     # DEPRECATED 
    4442        $replist = ";$replist;"; 
    4543        while ( 
  • trunk/core/lib/Foswiki/Engine/CGI.pm

    r876 r974  
    9595 
    9696    my $action; 
    97     if ( exists $ENV{TWIKI_ACTION} ) { 
    98  
    99         # This handles scripts that have set $TWIKI_ACTION 
    100         $action = $ENV{TWIKI_ACTION}; 
     97    if ( exists $ENV{FOSWIKI_ACTION} ) { 
     98 
     99        # This handles scripts that have set $FOSWIKI_ACTION 
     100        $action = $ENV{FOSWIKI_ACTION}; 
    101101    } 
    102102    elsif ( exists $Foswiki::cfg{SwitchBoard}{$cgiScriptName} ) { 
    103103 
    104104        # This handles other named CGI scripts that have a switchboard entry 
    105         # but haven't set $TWIKI_ACTION (old-style run scripts) 
     105        # but haven't set $FOSWIKI_ACTION (old-style run scripts) 
    106106        $action = $cgiScriptName; 
    107107    } 
  • trunk/core/lib/Foswiki/Engine/CLI.pm

    r830 r974  
    7676sub preparePath { 
    7777    my ( $this, $req ) = @_; 
    78     $req->action( $ENV{TWIKI_ACTION} ); 
    79     delete $ENV{TWIKI_ACTION}; 
     78    $req->action( $ENV{FOSWIKI_ACTION} ); 
     79    delete $ENV{FOSWIKI_ACTION}; 
    8080    if ( exists $this->{path_info} ) { 
    8181        $req->pathInfo( $this->{path_info} ); 
  • trunk/core/lib/Foswiki/LoginManager.pm

    r830 r974  
    3232      * Foswiki::LoginManager::ApacheLogin looks at REMOTE_USER (only for authenticated scripts) 
    3333      * Foswiki::LoginManager::TemplateLogin just returns undef 
    34    1 reads the TWIKISID cookie to get the SID (or the TWIKISID parameters in the CGI query if cookies aren't available, or IP2SID mapping if that's enabled). 
     34   1 reads the FOSWIKISID cookie to get the SID (or the FOSWIKISID parameters in the CGI query if cookies aren't available, or IP2SID mapping if that's enabled). 
    3535   1 Creates the CGI::Session object, and the session is thereby read. 
    3636   1 If the username still isn't known, reads it from the cookie. Thus Foswiki::LoginManager::ApacheLogin overrides the cookie using REMOTE_USER, and Foswiki::LoginManager::TemplateLogin *always* uses the session. 
     
    9595 
    9696            # 4.10 is broken; see Item1989 
    97             $Foswiki::LoginManager::Session::NAME = 'TWIKISID'; 
     97            $Foswiki::LoginManager::Session::NAME = 'FOSWIKISID'; 
    9898        } 
    9999        else { 
    100             Foswiki::LoginManager::Session->name('TWIKISID'); 
     100            Foswiki::LoginManager::Session->name('FOSWIKISID'); 
    101101        } 
    102102    } 
  • trunk/core/lib/Foswiki/Request.pm

    r815 r974  
    124124    return @_ == 1 
    125125      ? $_[0]->{action} 
    126       : ( $ENV{TWIKI_ACTION} = $_[0]->{action} = $_[1] ); 
     126      : ( $ENV{FOSWIKI_ACTION} = $_[0]->{action} = $_[1] ); 
    127127} 
    128128 
  • trunk/core/lib/Monitor.pm

    r809 r974  
    1818Monitor::MonitorMethod('Foswiki::Users', 'getCanonicalUserID'); 
    1919 
    20 Then set the environment variable TWIKI_MONITOR to a perl true value, and 
     20Then set the environment variable FOSWIKI_MONITOR to a perl true value, and 
    2121run the script from the command line e.g: 
    2222$ cd bin 
     
    7171BEGIN { 
    7272    my $caller = caller; 
    73     if ( $ENV{TWIKI_MONITOR} ) { 
     73    if ( $ENV{FOSWIKI_MONITOR} ) { 
    7474        require Benchmark; 
    7575        import Benchmark ':hireswallclock'; 
     
    9494 
    9595sub END { 
    96     return unless ( $ENV{TWIKI_MONITOR} ); 
     96    return unless ( $ENV{FOSWIKI_MONITOR} ); 
    9797    MARK('END'); 
    9898    my $lastbm; 
Note: See TracChangeset for help on using the changeset viewer.