Changeset 1054


Ignore:
Timestamp:
11/28/08 21:18:36 (3 years ago)
Author:
CrawfordCurrie
Message:

Item295: another detox step, plus eliminate a warning in ACTIVATED_PLUGINS

Location:
trunk/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/bin/setlib.cfg

    r1050 r1054  
    1212# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
    1313# 
    14 # setlib.cfg: determines the defaults for TWiki and Perl library paths 
     14# setlib.cfg: determines the defaults for Foswiki and Perl library paths 
    1515# 
    1616 
     
    2222 
    2323# for development, you can enable ASSERTS by adding 
    24 # $ENV{TWIKI_ASSERTS} = 1; 
     24# $ENV{FOSWIKI_ASSERTS} = 1; 
    2525# to your bin/LocalLib.cfg 
    2626 
    27 use vars qw( $twikiLibPath @localPerlLibPath ); 
     27use vars qw( $foswikiLibPath @localPerlLibPath ); 
    2828 
    2929eval 'require "LocalLib.cfg"'; 
     30# if foswikiLibPath isn't defined, then see if $twikiLibPath is 
     31# for compatibility 
     32$foswikiLibPath = $twikiLibPath unless defined( $foswikiLibPath ); 
    3033 
    31 unless (( defined ($twikiLibPath) ) and (-e $twikiLibPath)) { 
     34unless (( defined ($foswikiLibPath) ) and (-e $foswikiLibPath)) { 
    3235        use Cwd qw( abs_path ); 
    33         ( $twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/; 
     36        ( $foswikiLibPath ) = ($foswikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/; 
    3437} 
    35 if ($twikiLibPath eq "") { 
    36     $twikiLibPath = "../lib"; 
     38if ($foswikiLibPath eq "") { 
     39    $foswikiLibPath = "../lib"; 
    3740    warn "using relative path for libs - some plugins may break"; 
    3841} 
     
    4043#    Path to local Perl modules 
    4144my $defaultingCPANBASE = !defined($CPANBASE); 
    42 $CPANBASE = "$twikiLibPath/CPAN/lib/" unless $CPANBASE; 
     45$CPANBASE = "$foswikiLibPath/CPAN/lib/" unless $CPANBASE; 
    4346if ( -e $CPANBASE ) { 
    4447        require Config; 
     
    4952 
    5053# Prepend to @INC, the Perl search path for modules 
    51 unshift @INC, $twikiLibPath; 
     54unshift @INC, $foswikiLibPath; 
    5255if ($defaultingCPANBASE) { 
    5356        push @INC, @localPerlLibPath if @localPerlLibPath; 
  • trunk/core/lib/Foswiki.pm

    r1051 r1054  
    6666 
    6767# Other computed constants 
    68 our $twikiLibDir; 
     68our $foswikiLibDir; 
    6969our %regex; 
    7070our %functionTags; 
     
    9191our $TranslationToken = "\0"; 
    9292 
    93 =begin TML 
    94  
    95 ---++ StaticMethod getLibDir() -> $path 
    96  
    97 Returns the full path of the directory containing Foswiki.pm 
    98  
    99 =cut 
    100  
    101 sub getLibDir { 
    102     if ($twikiLibDir) { 
    103         return $twikiLibDir; 
    104     } 
    105  
    106     # FIXME: Should just use $INC{"Foswiki.pm"} to get path used to load this 
    107     # module. 
    108     my $dir = ''; 
    109     foreach $dir (@INC) { 
    110         if ( $dir && -e "$dir/Foswiki.pm" ) { 
    111             $twikiLibDir = $dir; 
    112             last; 
    113         } 
    114     } 
     93# Returns the full path of the directory containing Foswiki.pm 
     94sub _getLibDir { 
     95    return $foswikiLibDir if $foswikiLibDir; 
     96 
     97    $foswikiLibDir = $INC{'Foswiki.pm'}; 
    11598 
    11699    # fix path relative to location of called script 
    117     if ( $twikiLibDir =~ /^\./ ) { 
     100    if ( $foswikiLibDir =~ /^\./ ) { 
    118101        print STDERR 
    119 "WARNING: Foswiki lib path $twikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line."; 
     102"WARNING: Foswiki lib path $foswikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line."; 
    120103        my $bin; 
    121104 
     
    140123            $bin = cwd(); 
    141124        } 
    142         $twikiLibDir = "$bin/$twikiLibDir/"; 
     125        $foswikiLibDir = "$bin/$foswikiLibDir/"; 
    143126 
    144127        # normalize "/../" and "/./" 
    145         while ( $twikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1| ) { 
    146         } 
    147         $twikiLibDir =~ s|([\\/])\.[\\/]|$1|g; 
    148     } 
    149     $twikiLibDir =~ s|([\\/])[\\/]*|$1|g;    # reduce "//" to "/" 
    150     $twikiLibDir =~ s|[\\/]$||;              # cut trailing "/" 
    151  
    152     return $twikiLibDir; 
     128        while ( $foswikiLibDir =~ s|([\\/])[^\\/]+[\\/]\.\.[\\/]|$1| ) { 
     129        } 
     130        $foswikiLibDir =~ s|([\\/])\.[\\/]|$1|g; 
     131    } 
     132    $foswikiLibDir =~ s|([\\/])[\\/]*|$1|g;    # reduce "//" to "/" 
     133    $foswikiLibDir =~ s|[\\/]$||;              # cut trailing "/" 
     134 
     135    return $foswikiLibDir; 
    153136} 
    154137 
     
    497480 
    498481    # initialize lib directory early because of later 'cd's 
    499     getLibDir(); 
     482    _getLibDir(); 
    500483 
    501484    # initialize the runtime engine 
     
    812795---++ ObjectMethod redirect( $url, $passthrough, $action_redirectto ) 
    813796 
    814    * $url - url or twikitopic to redirect to 
     797   * $url - url or topic to redirect to 
    815798   * $passthrough - (optional) parameter to **FILLMEIN** 
    816799   * $action_redirectto - (optional) redirect to where ?redirectto= 
     
    939922 
    940923    # Don't double-cache 
    941     return '' if ( $query->param('twiki_redirect_cache') ); 
     924    return '' if ( $query->param('foswiki_redirect_cache') ); 
    942925 
    943926    require Digest::MD5; 
     
    955938    $query->save( \*F ); 
    956939    close(F); 
    957     return 'twiki_redirect_cache=' . $uid; 
     940    return 'foswiki_redirect_cache=' . $uid; 
    958941} 
    959942 
     
    10951078Returns the URL to a Foswiki script, providing the web and topic as 
    10961079"path info" parameters.  The result looks something like this: 
    1097 "http://host/twiki/bin/$script/$web/$topic". 
     1080"http://host/foswiki/bin/$script/$web/$topic". 
    10981081   * =...= - an arbitrary number of name,value parameter pairs that will be url-encoded and added to the url. The special parameter name '#' is reserved for specifying an anchor. e.g. <tt>getScriptUrl('x','y','view','#'=>'XXX',a=>1,b=>2)</tt> will give <tt>.../view/x/y?a=1&b=2#XXX</tt> 
    10991082 
     
    31693152'Sorry, this version of Foswiki does not support the url parameter to Foswiki::initialize being different to the url in the query'; 
    31703153    } 
    3171     my $twiki = new Foswiki( $theRemoteUser, $query ); 
     3154    my $session = new Foswiki( $theRemoteUser, $query ); 
    31723155 
    31733156    # Force the new session into the plugins context. 
    3174     $Foswiki::Plugins::SESSION = $twiki; 
     3157    $Foswiki::Plugins::SESSION = $session; 
    31753158 
    31763159    return ( 
    3177         $twiki->{topicName}, $twiki->{webName}, $twiki->{scriptUrlPath}, 
    3178         $twiki->{userName},  $Foswiki::cfg{DataDir} 
     3160        $session->{topicName}, $session->{webName}, $session->{scriptUrlPath}, 
     3161        $session->{userName},  $Foswiki::cfg{DataDir} 
    31793162    ); 
    31803163} 
     
    36313614#| $web | web and  | 
    36323615#| $topic | topic to display the name for | 
    3633 #| $formatString | twiki format string (like in search) | 
     3616#| $formatString | format string (like in search) | 
    36343617sub REVINFO { 
    36353618    my ( $this, $params, $theTopic, $theWeb ) = @_; 
  • trunk/core/lib/Foswiki/Plugins.pm

    r1050 r1054  
    453453    foreach my $plugin ( @{ $this->{plugins} } ) { 
    454454        unless ( $plugin->{disabled} ) { 
    455             $text .= "$plugin->{installWeb}.$plugin->{name}, "; 
     455            my $web = $plugin->topicWeb(); 
     456            $text .= ($web ? "$web." : '!')."$plugin->{name}, "; 
    456457        } 
    457458    } 
  • trunk/core/lib/Foswiki/UI.pm

    r1050 r1054  
    134134    my ( $req, $sub, %initialContext ) = @_; 
    135135 
    136     my $cache = $req->param('twiki_redirect_cache'); 
     136    my $cache = $req->param('foswiki_redirect_cache'); 
    137137 
    138138# Never trust input data from a query. We will only accept an MD5 32 character string 
     
    155155            close(F); 
    156156            unlink($passthruFilename); 
    157             $req->delete('twiki_redirect_cache'); 
     157            $req->delete('foswiki_redirect_cache'); 
    158158            print STDERR "Passthru: Loaded and unlinked $passthruFilename\n" 
    159159              if TRACE_PASSTHRU; 
Note: See TracChangeset for help on using the changeset viewer.