Ignore:
Timestamp:
11/19/08 13:40:25 (4 years ago)
Author:
CrawfordCurrie
Message:

Item175: First bulk rename pass. Note: not quite ready yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/bin/configure

    r784 r809  
    33# Foswiki - The Free Open Source Wiki, http://foswiki.org/ 
    44# 
    5 # Copyright (C) 2000-2007 TWiki Contributors. 
     5# Copyright (C) 2000-2007 Foswiki Contributors. 
    66# 
    77# This program is free software; you can redistribute it and/or 
     
    1717# As per the GPL, removal of this notice is prohibited. 
    1818# 
    19 # Configuration script for TWiki. Once you have a basic webserver 
     19# Configuration script for Foswiki. Once you have a basic webserver 
    2020# configuration that lets you access this script, the rest of the 
    2121# configuration process is done from here. 
     
    4343# The Model consists of a simple node tree, where each node represents a 
    4444# structural element in the *presentation* of the configuration (this may 
    45 # not be consistent with the structure of $TWiki:cfg, so beware). Each 
     45# not be consistent with the structure of $Foswiki:cfg, so beware). Each 
    4646# leaf node has an associated Type (in the Types subdirectory) that has 
    4747# collected model and view behaviours for the basic types. 
    4848# The Model is independent of the language used to represent the 
    49 # configuration. There is one parser/generator provided, TWikiCfg, but it 
     49# configuration. There is one parser/generator provided, FoswikiCfg, but it 
    5050# would be trivial to add others. 
    5151# 
    5252# The View is a DOM document, generated as HTML by a set of UI classes. 
    5353# Because of some convoluted history, there are actually three sets of classes 
    54 # that generate views. They are all subclasses of TWiki::Configure::UI 
     54# that generate views. They are all subclasses of Foswiki::Configure::UI 
    5555#    UIs - are top-level and pluggable UI components. All the main screens are 
    5656#          implemented here. 
     
    9595die $@ if $@; 
    9696 
    97 # We warn against running TWiki on an older Perl version then 5.8.4 
     97# We warn against running Foswiki on an older Perl version then 5.8.4 
    9898# but we will not let configure die in this situation. The user 
    99 # may have updated many libraries and tweaked TWiki so let us give 
     99# may have updated many libraries and tweaked Foswiki so let us give 
    100100# him a chance. 
    101101my $perlversion = $]; 
     
    103103    print STDERR <<HERE; 
    104104Your perl version is older than 5.6.0. 
    105 TWiki has only been successfully tested on Perl 5.6.X and 5.8.X, 
     105Foswiki has only been successfully tested on Perl 5.6.X and 5.8.X, 
    106106and there have been reports that it does not run on 5.5. 
    107 Running TWiki with an older Perl version requires upgrading of modules and 
    108 tweaking of the TWiki code. 
     107Running Foswiki with an older Perl version requires upgrading of modules and 
     108tweaking of the Foswiki code. 
    109109HERE 
    110110} 
     
    194194 
    195195########################################################### 
    196 # Establish the path to the TWiki library 
     196# Establish the path to the Foswiki library 
    197197 
    198198# Set the working dir to the bin dir 
     
    218218    $localLibFailure = $@; 
    219219    # Stick the root/lib on the path; there's a high probability we'll be 
    220     # able to find the bits of TWiki::Configure that way. We will report 
     220    # able to find the bits of Foswiki::Configure that way. We will report 
    221221    # the setlib error later. 
    222222    unshift(@INC, File::Spec->catfile(@root, 'lib')); 
     
    230230    'File::Copy', 
    231231    'File::Temp', 
    232     'TWiki::Configure::Checker', 
    233     'TWiki::Configure::CSS', 
    234     'TWiki::Configure::Item', 
    235     'TWiki::Configure::JS', 
    236     'TWiki::Configure::Load', 
    237     'TWiki::Configure::Pluggable', 
    238     'TWiki::Configure::Root', 
    239     'TWiki::Configure::Section', 
    240     'TWiki::Configure::Type', 
    241     'TWiki::Configure::Types::BOOLEAN', 
    242     'TWiki::Configure::Types::NUMBER', 
    243     'TWiki::Configure::Types::SELECT', 
    244     'TWiki::Configure::Types::STRING', 
    245     'TWiki::Configure::TWikiCfg', 
    246     'TWiki::Configure::UI', 
    247     'TWiki::Configure::UIs::Section', 
    248     'TWiki::Configure::Value', 
    249     'TWiki::Configure::Valuer', 
     232    'Foswiki::Configure::Checker', 
     233    'Foswiki::Configure::CSS', 
     234    'Foswiki::Configure::Item', 
     235    'Foswiki::Configure::JS', 
     236    'Foswiki::Configure::Load', 
     237    'Foswiki::Configure::Pluggable', 
     238    'Foswiki::Configure::Root', 
     239    'Foswiki::Configure::Section', 
     240    'Foswiki::Configure::Type', 
     241    'Foswiki::Configure::Types::BOOLEAN', 
     242    'Foswiki::Configure::Types::NUMBER', 
     243    'Foswiki::Configure::Types::SELECT', 
     244    'Foswiki::Configure::Types::STRING', 
     245    'Foswiki::Configure::FoswikiCfg', 
     246    'Foswiki::Configure::UI', 
     247    'Foswiki::Configure::UIs::Section', 
     248    'Foswiki::Configure::Value', 
     249    'Foswiki::Configure::Valuer', 
    250250   ) { 
    251251    _loadBasicModule($module); 
     
    258258# errors, so we can report errors in the browser (i.e. without using die) 
    259259 
    260 # We are configuring $TWiki::cfg, so we need to be in package TWiki from 
     260# We are configuring $Foswiki::cfg, so we need to be in package Foswiki from 
    261261# now on. 
    262 package TWiki; 
    263  
    264 # We keep the actual config, and the default from TWiki.cfg, separate 
     262package Foswiki; 
     263 
     264# We keep the actual config, and the default from Foswiki.spec, separate 
    265265use vars qw( %cfg $defaultCfg ); 
    266266 
    267 # Declared in TWiki to support checkers 
     267# Declared in Foswiki to support checkers 
    268268use vars qw( $query ); 
    269269 
    270 # 'constants' used in TWiki.cfg 
     270# 'constants' used in Foswiki.spec 
    271271use vars qw( $TRUE $FALSE ); 
    272272$TRUE = 1; 
     
    275275# Remember what we detected previously, for use by Checkers 
    276276if( $scriptName =~ /(\.\w+)$/ ) { 
    277     $TWiki::cfg{DETECTED}{ScriptExtension} = $1; 
     277    $Foswiki::cfg{DETECTED}{ScriptExtension} = $1; 
    278278} 
    279279 
     
    293293 
    294294########################################################### 
    295 # Grope the OS. This duplicates a bit of code in TWiki.pm, 
     295# Grope the OS. This duplicates a bit of code in Foswiki.pm, 
    296296# but it has to be duplicated because we don't want to deal 
    297 # with loading TWiki just yet. 
    298  
    299 unless( $TWiki::cfg{DetailedOS} ) { 
    300     $TWiki::cfg{DetailedOS} = $^O; 
    301     unless( $TWiki::cfg{DetailedOS} ) { 
     297# with loading Foswiki just yet. 
     298 
     299unless( $Foswiki::cfg{DetailedOS} ) { 
     300    $Foswiki::cfg{DetailedOS} = $^O; 
     301    unless( $Foswiki::cfg{DetailedOS} ) { 
    302302        require Config; 
    303         $TWiki::cfg{DetailedOS} = $Config::Config{osname}; 
    304     } 
    305 } 
    306 unless( $TWiki::cfg{OS} ) { 
    307     if ($TWiki::cfg{DetailedOS} =~ /darwin/i) { # MacOS X 
    308         $TWiki::cfg{OS} = 'UNIX'; 
    309     } elsif ($TWiki::cfg{DetailedOS} =~ /Win/i) { 
    310         $TWiki::cfg{OS} = 'WINDOWS'; 
    311     } elsif ($TWiki::cfg{DetailedOS} =~ /vms/i) { 
    312         $TWiki::cfg{OS} = 'VMS'; 
    313     } elsif ($TWiki::cfg{DetailedOS} =~ /bsdos/i) { 
    314         $TWiki::cfg{OS} = 'UNIX'; 
    315     } elsif ($TWiki::cfg{DetailedOS} =~ /dos/i) { 
    316         $TWiki::cfg{OS} = 'DOS'; 
    317     } elsif ($TWiki::cfg{DetailedOS} =~ /^MacOS$/i) { # MacOS 9 or earlier 
    318         $TWiki::cfg{OS} = 'MACINTOSH'; 
    319     } elsif ($TWiki::cfg{DetailedOS} =~ /os2/i) { 
    320         $TWiki::cfg{OS} = 'OS2'; 
     303        $Foswiki::cfg{DetailedOS} = $Config::Config{osname}; 
     304    } 
     305} 
     306unless( $Foswiki::cfg{OS} ) { 
     307    if ($Foswiki::cfg{DetailedOS} =~ /darwin/i) { # MacOS X 
     308        $Foswiki::cfg{OS} = 'UNIX'; 
     309    } elsif ($Foswiki::cfg{DetailedOS} =~ /Win/i) { 
     310        $Foswiki::cfg{OS} = 'WINDOWS'; 
     311    } elsif ($Foswiki::cfg{DetailedOS} =~ /vms/i) { 
     312        $Foswiki::cfg{OS} = 'VMS'; 
     313    } elsif ($Foswiki::cfg{DetailedOS} =~ /bsdos/i) { 
     314        $Foswiki::cfg{OS} = 'UNIX'; 
     315    } elsif ($Foswiki::cfg{DetailedOS} =~ /dos/i) { 
     316        $Foswiki::cfg{OS} = 'DOS'; 
     317    } elsif ($Foswiki::cfg{DetailedOS} =~ /^MacOS$/i) { # MacOS 9 or earlier 
     318        $Foswiki::cfg{OS} = 'MACINTOSH'; 
     319    } elsif ($Foswiki::cfg{DetailedOS} =~ /os2/i) { 
     320        $Foswiki::cfg{OS} = 'OS2'; 
    321321    } else { 
    322         $TWiki::cfg{OS} = 'UNIX'; 
     322        $Foswiki::cfg{OS} = 'UNIX'; 
    323323    } 
    324324} 
     
    338338    if( (defined($image)) &&  
    339339        (($image eq 'favicon.ico') || 
    340         ($image eq 'T-logo34x26-t.gif') || 
    341         ($image eq 'T-logo-140x40-t.gif') || 
     340        ($image eq 'logo22x26.gif') || 
     341        ($image eq 'logo140x40.gif') || 
    342342        ($image eq 'warning.gif') || 
    343343        ($image eq 'info.gif')) ) { 
     
    375375          -type=>'image/x-icon' } ), 
    376376    CGI::script( { language => 'JavaScript', 
    377                    type => 'text/javascript' }, TWiki::Configure::JS::js1() ), 
    378     CGI::style( { -type=>'text/css' }, TWiki::Configure::CSS::css()), 
     377                   type => 'text/javascript' }, Foswiki::Configure::JS::js1() ), 
     378    CGI::style( { -type=>'text/css' }, Foswiki::Configure::CSS::css()), 
    379379    CGI::script( { language => 'JavaScript', 
    380380                   type => 'text/javascript' }, 
    381                  TWiki::Configure::JS::js2() ), 
     381                 Foswiki::Configure::JS::js2() ), 
    382382   ); 
    383383 
    384384# Generate standard page header 
    385385my $hdr = CGI::start_html( 
    386     -title => 'TWiki Configuration', 
     386    -title => 'Foswiki Configuration', 
    387387    -head => \@meta, 
    388388    -class => 'patternNoViewPage'); 
     
    406406 
    407407# use this script recursively to serve the icon image 
    408 print CGI::img({src=>$scriptName.'?action=image;image=T-logo-140x40-t.gif;type=image/gif', class=>'logo', alt=>'TWiki', width=>'140', height=>'40'}); 
    409  
    410 my $stub = new TWiki::Configure::Item(); 
    411 # This call will define $TWiki::defaultCfg by loading .spec files 
    412 my $sanityUI = TWiki::Configure::UI::loadChecker('BasicSanity', $stub); 
     408print CGI::img({src=>$scriptName.'?action=image;image=logo140x40.gif;type=image/gif', class=>'logo', alt=>'Foswiki', width=>'140', height=>'40'}); 
     409 
     410my $stub = new Foswiki::Configure::Item(); 
     411# This call will define $Foswiki::defaultCfg by loading .spec files 
     412my $sanityUI = Foswiki::Configure::UI::loadChecker('BasicSanity', $stub); 
    413413my ($sanityStatement, $badLSC) = $sanityUI->ui(); 
    414414 
     
    458458sub _checkLoadUI { 
    459459    my ($uiname, $root) = @_; 
    460     my $ui = TWiki::Configure::UI::loadUI($uiname, $root); 
     460    my $ui = Foswiki::Configure::UI::loadUI($uiname, $root); 
    461461    unless ($ui) { 
    462462        print "Could not load $uiname UI. Error was: <pre>$@</pre>"; 
     
    472472# Action invoked by 'Next' button on the main screen 
    473473sub _actionNext { 
    474     my $valuer = new TWiki::Configure::Valuer( 
    475         $TWiki::defaultCfg, \%TWiki::cfg); 
     474    my $valuer = new Foswiki::Configure::Valuer( 
     475        $Foswiki::defaultCfg, \%Foswiki::cfg); 
    476476    my %updated; 
    477     my $modified = $valuer->loadCGIParams($TWiki::query, \%updated); 
     477    my $modified = $valuer->loadCGIParams($Foswiki::query, \%updated); 
    478478 
    479479    # create the root of the UI 
    480     my $root = new TWiki::Configure::Root(); 
     480    my $root = new Foswiki::Configure::Root(); 
    481481    my $ui; 
    482     if (!TWiki::Configure::UI::authorised()) { 
     482    if (!Foswiki::Configure::UI::authorised()) { 
    483483        print CGI::h2('Authorisation is required to save.'); 
    484484        print CGI::div($modified.' configuration item'. 
     
    492492    } else { 
    493493        # Load the specs from the .spec files and generate the UI template 
    494         TWiki::Configure::TWikiCfg::load($root, 1); 
     494        Foswiki::Configure::FoswikiCfg::load($root, 1); 
    495495 
    496496        $ui = _checkLoadUI('UPDATE', $root); 
     
    503503# Invoked by "find more extensions" button in the Extensions section 
    504504sub _actionFindMoreExtensions { 
    505     my $root = new TWiki::Configure::Root(); 
    506     print CGI::h1( 'Find TWiki Extensions'); 
     505    my $root = new Foswiki::Configure::Root(); 
     506    print CGI::h1( 'Find Foswiki Extensions'); 
    507507    print '<div class="patternContent"><div class="patternTopic">'; 
    508508 
     
    516516# Invoked when an extension is to be installed 
    517517sub _actionInstallExtension { 
    518     my $root = new TWiki::Configure::Root(); 
     518    my $root = new Foswiki::Configure::Root(); 
    519519    my $ui; 
    520     if (!TWiki::Configure::UI::authorised()) { 
     520    if (!Foswiki::Configure::UI::authorised()) { 
    521521        $ui = _checkLoadUI('AUTH', $root); 
    522522        return 1 unless $ui; 
     
    533533sub _actionConfigure { 
    534534 
    535     $TWiki::Configure::UI::toterrors = 0; 
    536     $TWiki::Configure::UI::totwarnings = 0; 
     535    $Foswiki::Configure::UI::toterrors = 0; 
     536    $Foswiki::Configure::UI::totwarnings = 0; 
    537537 
    538538    print CGI::h1( 'Configuration'); 
     
    540540 
    541541    # The first three sections go without a root 
    542     my $stub = new TWiki::Configure::Item(); 
    543     my $eui = TWiki::Configure::UI::loadChecker('Environment', $stub); 
     542    my $stub = new Foswiki::Configure::Item(); 
     543    my $eui = Foswiki::Configure::UI::loadChecker('Environment', $stub); 
    544544 
    545545    # See if this platform has special detection or checking requirements 
    546546    # (most don't) 
    547     $stub = new TWiki::Configure::Item(); 
    548     my $osui = TWiki::Configure::UI::loadChecker( 
     547    $stub = new Foswiki::Configure::Item(); 
     548    my $osui = Foswiki::Configure::UI::loadChecker( 
    549549        $Config::Config{osname}, $stub); 
    550550 
    551     $stub = new TWiki::Configure::Item(); 
    552     my $cgiui = TWiki::Configure::UI::loadChecker('CGISetup', $stub); 
     551    $stub = new Foswiki::Configure::Item(); 
     552    my $cgiui = Foswiki::Configure::UI::loadChecker('CGISetup', $stub); 
    553553 
    554554    # Use a separate root for the _saveable_ sections 
    555     my $root = new TWiki::Configure::Root(); 
    556     my $valuer = new TWiki::Configure::Valuer( 
    557         $TWiki::defaultCfg, \%TWiki::cfg); 
     555    my $root = new Foswiki::Configure::Root(); 
     556    my $valuer = new Foswiki::Configure::Valuer( 
     557        $Foswiki::defaultCfg, \%Foswiki::cfg); 
    558558    # Load the config structures. 
    559     TWiki::Configure::TWikiCfg::load($root, !$badLSC); 
     559    Foswiki::Configure::FoswikiCfg::load($root, !$badLSC); 
    560560 
    561561    if (!$badLSC) { 
     
    563563<div class="patternContent"> 
    564564 <div class="patternTopic"> 
    565   <p><strong>Use this page to set the configuration options for TWiki. 
     565  <p><strong>Use this page to set the configuration options for Foswiki. 
    566566  Fill in the settings, and then press 'Next'.</strong></p> 
    567567  <div class="explanation"> 
    568568   <ul> 
    569     <li><b>If your TWiki site is already working</b>, continue to 
    570      <a rel="nofollow" href="$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{SystemWebName}/WebHome"> 
    571 browse to the TWiki WebHome</a>. 
     569    <li><b>If your Foswiki site is already working</b>, continue to 
     570     <a rel="nofollow" href="$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/WebHome"> 
     571browse to the Foswiki WebHome</a>. 
    572572     <ul> 
    573573      <li>You will now need to consider how you are going to manage 
    574574       authentication and access control. See the reference manual 
    575        sections on <a rel="nofollow" href="$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{SystemWebName}/TWikiUserAuthentication"> 
     575       sections on <a rel="nofollow" href="$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/UserAuthentication"> 
    576576 authentication</a> 
    577577       and 
    578        <a rel="nofollow" href="$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{SystemWebName}/AccessControl"> 
     578       <a rel="nofollow" href="$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/AccessControl"> 
    579579        access control</a>, and the 
    580580       <a rel="nofollow" href="#" onclick="foldBlock('SecuritySetup'); return false;">Security Setup</a> 
     
    583583     </ul> 
    584584    </li> 
    585     <li><b>To become an administrator</b> you need to first <a rel="nofollow" href="$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{SystemWebName}/UserRegistration"> 
    586 register</a> as a normal user first and then add your wikiname to the <a rel="nofollow" href="$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{UsersWebName}/$TWiki::cfg{SuperAdminGroup}"> 
    587  $TWiki::cfg{SuperAdminGroup}</a> (follow the text in yellow). 
     585    <li><b>To become an administrator</b> you need to first <a rel="nofollow" href="$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/UserRegistration"> 
     586register</a> as a normal user first and then add your wikiname to the <a rel="nofollow" href="$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{UsersWebName}/$Foswiki::cfg{SuperAdminGroup}"> 
     587 $Foswiki::cfg{SuperAdminGroup}</a> (follow the text in yellow). 
    588588    </li> 
    589589    <li> 
    590590     <b>If you are on a non-standard platform or environment</b> there are a lot of 
    591      <a href="http://twiki.org/cgi-bin/view/TWiki/SupplementalDocument">supplemental documents</a> 
    592      on TWiki.org describing how to 
    593      <a href="http://twiki.org/cgi-bin/view/TWiki/InstallingTWiki">install</a>, 
    594      <a href="http://twiki.org/cgi-bin/view/TWiki/UpgradingTWiki">upgrade</a>,  
    595      <a href="http://twiki.org/cgi-bin/view/TWiki/InternationalizationSupplement">internationalize</a> and  
    596      <a href="http://twiki.org/cgi-bin/view/TWiki/SecuringTWikiSite">secure</a> 
    597      your installation. 
     591     <a href="http://foswiki.org/Support/SupplementalDocuments">supplemental documents</a> on Foswiki.org 
    598592    </li> 
    599593    <li> 
    600594      <b>If you get stuck</b> there is a lot of support available at the 
    601       <a href="http://twiki.org/cgi-bin/view/Support/WebHome">TWiki:Support</a> 
    602       forum and on 
    603       <a href="http://twiki.org/cgi-bin/view/Codev/TWikiIRC">TWikiIRC</a> 
    604       (irc.freenode.net, channel #twiki). 
     595      <a href="http://foswiki.org/Support/WebHome">Support forum</a>. 
    605596     </li> 
    606597    </ul> 
     
    671662    print "</div><!-- options -->\n"; 
    672663 
    673     if ($TWiki::Configure::UI::toterrors || 
    674           $TWiki::Configure::UI::totwarnings) { 
    675         my $mess = 'Total: '.$TWiki::Configure::UI::toterrors.' error'. 
    676           ($TWiki::Configure::UI::toterrors==1?'':'s').', '. 
    677             $TWiki::Configure::UI::totwarnings.' warning'. 
    678               ($TWiki::Configure::UI::totwarnings==1?'':'s'); 
     664    if ($Foswiki::Configure::UI::toterrors || 
     665          $Foswiki::Configure::UI::totwarnings) { 
     666        my $mess = 'Total: '.$Foswiki::Configure::UI::toterrors.' error'. 
     667          ($Foswiki::Configure::UI::toterrors==1?'':'s').', '. 
     668            $Foswiki::Configure::UI::totwarnings.' warning'. 
     669              ($Foswiki::Configure::UI::totwarnings==1?'':'s'); 
    679670        print CGI::div($mess); 
    680671    } 
     
    685676                             -accesskey=>'N')); 
    686677 
    687     print "<a href=\"$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/$TWiki::cfg{SystemWebName}/WebHome\">Cancel and return to TWiki WebHome</a>"; 
     678    print "<a href=\"$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/WebHome\">Cancel and return to Foswiki WebHome</a>"; 
    688679 
    689680    print CGI::end_form(); 
Note: See TracChangeset for help on using the changeset viewer.