Changeset 809 for trunk/core/bin/configure
- Timestamp:
- 11/19/08 13:40:25 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/bin/configure (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/bin/configure
r784 r809 3 3 # Foswiki - The Free Open Source Wiki, http://foswiki.org/ 4 4 # 5 # Copyright (C) 2000-2007 TWiki Contributors.5 # Copyright (C) 2000-2007 Foswiki Contributors. 6 6 # 7 7 # This program is free software; you can redistribute it and/or … … 17 17 # As per the GPL, removal of this notice is prohibited. 18 18 # 19 # Configuration script for TWiki. Once you have a basic webserver19 # Configuration script for Foswiki. Once you have a basic webserver 20 20 # configuration that lets you access this script, the rest of the 21 21 # configuration process is done from here. … … 43 43 # The Model consists of a simple node tree, where each node represents a 44 44 # structural element in the *presentation* of the configuration (this may 45 # not be consistent with the structure of $ TWiki:cfg, so beware). Each45 # not be consistent with the structure of $Foswiki:cfg, so beware). Each 46 46 # leaf node has an associated Type (in the Types subdirectory) that has 47 47 # collected model and view behaviours for the basic types. 48 48 # The Model is independent of the language used to represent the 49 # configuration. There is one parser/generator provided, TWikiCfg, but it49 # configuration. There is one parser/generator provided, FoswikiCfg, but it 50 50 # would be trivial to add others. 51 51 # 52 52 # The View is a DOM document, generated as HTML by a set of UI classes. 53 53 # Because of some convoluted history, there are actually three sets of classes 54 # that generate views. They are all subclasses of TWiki::Configure::UI54 # that generate views. They are all subclasses of Foswiki::Configure::UI 55 55 # UIs - are top-level and pluggable UI components. All the main screens are 56 56 # implemented here. … … 95 95 die $@ if $@; 96 96 97 # We warn against running TWiki on an older Perl version then 5.8.497 # We warn against running Foswiki on an older Perl version then 5.8.4 98 98 # but we will not let configure die in this situation. The user 99 # may have updated many libraries and tweaked TWiki so let us give99 # may have updated many libraries and tweaked Foswiki so let us give 100 100 # him a chance. 101 101 my $perlversion = $]; … … 103 103 print STDERR <<HERE; 104 104 Your perl version is older than 5.6.0. 105 TWiki has only been successfully tested on Perl 5.6.X and 5.8.X,105 Foswiki has only been successfully tested on Perl 5.6.X and 5.8.X, 106 106 and there have been reports that it does not run on 5.5. 107 Running TWiki with an older Perl version requires upgrading of modules and108 tweaking of the TWiki code.107 Running Foswiki with an older Perl version requires upgrading of modules and 108 tweaking of the Foswiki code. 109 109 HERE 110 110 } … … 194 194 195 195 ########################################################### 196 # Establish the path to the TWiki library196 # Establish the path to the Foswiki library 197 197 198 198 # Set the working dir to the bin dir … … 218 218 $localLibFailure = $@; 219 219 # 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 report220 # able to find the bits of Foswiki::Configure that way. We will report 221 221 # the setlib error later. 222 222 unshift(@INC, File::Spec->catfile(@root, 'lib')); … … 230 230 'File::Copy', 231 231 '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', 250 250 ) { 251 251 _loadBasicModule($module); … … 258 258 # errors, so we can report errors in the browser (i.e. without using die) 259 259 260 # We are configuring $ TWiki::cfg, so we need to be in package TWiki from260 # We are configuring $Foswiki::cfg, so we need to be in package Foswiki from 261 261 # now on. 262 package TWiki;263 264 # We keep the actual config, and the default from TWiki.cfg, separate262 package Foswiki; 263 264 # We keep the actual config, and the default from Foswiki.spec, separate 265 265 use vars qw( %cfg $defaultCfg ); 266 266 267 # Declared in TWiki to support checkers267 # Declared in Foswiki to support checkers 268 268 use vars qw( $query ); 269 269 270 # 'constants' used in TWiki.cfg270 # 'constants' used in Foswiki.spec 271 271 use vars qw( $TRUE $FALSE ); 272 272 $TRUE = 1; … … 275 275 # Remember what we detected previously, for use by Checkers 276 276 if( $scriptName =~ /(\.\w+)$/ ) { 277 $ TWiki::cfg{DETECTED}{ScriptExtension} = $1;277 $Foswiki::cfg{DETECTED}{ScriptExtension} = $1; 278 278 } 279 279 … … 293 293 294 294 ########################################################### 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, 296 296 # 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 299 unless( $Foswiki::cfg{DetailedOS} ) { 300 $Foswiki::cfg{DetailedOS} = $^O; 301 unless( $Foswiki::cfg{DetailedOS} ) { 302 302 require Config; 303 $ TWiki::cfg{DetailedOS} = $Config::Config{osname};304 } 305 } 306 unless( $ TWiki::cfg{OS} ) {307 if ($ TWiki::cfg{DetailedOS} =~ /darwin/i) { # MacOS X308 $ 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 earlier318 $ 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 } 306 unless( $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'; 321 321 } else { 322 $ TWiki::cfg{OS} = 'UNIX';322 $Foswiki::cfg{OS} = 'UNIX'; 323 323 } 324 324 } … … 338 338 if( (defined($image)) && 339 339 (($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') || 342 342 ($image eq 'warning.gif') || 343 343 ($image eq 'info.gif')) ) { … … 375 375 -type=>'image/x-icon' } ), 376 376 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()), 379 379 CGI::script( { language => 'JavaScript', 380 380 type => 'text/javascript' }, 381 TWiki::Configure::JS::js2() ),381 Foswiki::Configure::JS::js2() ), 382 382 ); 383 383 384 384 # Generate standard page header 385 385 my $hdr = CGI::start_html( 386 -title => ' TWiki Configuration',386 -title => 'Foswiki Configuration', 387 387 -head => \@meta, 388 388 -class => 'patternNoViewPage'); … … 406 406 407 407 # 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 files412 my $sanityUI = TWiki::Configure::UI::loadChecker('BasicSanity', $stub);408 print CGI::img({src=>$scriptName.'?action=image;image=logo140x40.gif;type=image/gif', class=>'logo', alt=>'Foswiki', width=>'140', height=>'40'}); 409 410 my $stub = new Foswiki::Configure::Item(); 411 # This call will define $Foswiki::defaultCfg by loading .spec files 412 my $sanityUI = Foswiki::Configure::UI::loadChecker('BasicSanity', $stub); 413 413 my ($sanityStatement, $badLSC) = $sanityUI->ui(); 414 414 … … 458 458 sub _checkLoadUI { 459 459 my ($uiname, $root) = @_; 460 my $ui = TWiki::Configure::UI::loadUI($uiname, $root);460 my $ui = Foswiki::Configure::UI::loadUI($uiname, $root); 461 461 unless ($ui) { 462 462 print "Could not load $uiname UI. Error was: <pre>$@</pre>"; … … 472 472 # Action invoked by 'Next' button on the main screen 473 473 sub _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); 476 476 my %updated; 477 my $modified = $valuer->loadCGIParams($ TWiki::query, \%updated);477 my $modified = $valuer->loadCGIParams($Foswiki::query, \%updated); 478 478 479 479 # create the root of the UI 480 my $root = new TWiki::Configure::Root();480 my $root = new Foswiki::Configure::Root(); 481 481 my $ui; 482 if (! TWiki::Configure::UI::authorised()) {482 if (!Foswiki::Configure::UI::authorised()) { 483 483 print CGI::h2('Authorisation is required to save.'); 484 484 print CGI::div($modified.' configuration item'. … … 492 492 } else { 493 493 # 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); 495 495 496 496 $ui = _checkLoadUI('UPDATE', $root); … … 503 503 # Invoked by "find more extensions" button in the Extensions section 504 504 sub _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'); 507 507 print '<div class="patternContent"><div class="patternTopic">'; 508 508 … … 516 516 # Invoked when an extension is to be installed 517 517 sub _actionInstallExtension { 518 my $root = new TWiki::Configure::Root();518 my $root = new Foswiki::Configure::Root(); 519 519 my $ui; 520 if (! TWiki::Configure::UI::authorised()) {520 if (!Foswiki::Configure::UI::authorised()) { 521 521 $ui = _checkLoadUI('AUTH', $root); 522 522 return 1 unless $ui; … … 533 533 sub _actionConfigure { 534 534 535 $ TWiki::Configure::UI::toterrors = 0;536 $ TWiki::Configure::UI::totwarnings = 0;535 $Foswiki::Configure::UI::toterrors = 0; 536 $Foswiki::Configure::UI::totwarnings = 0; 537 537 538 538 print CGI::h1( 'Configuration'); … … 540 540 541 541 # 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); 544 544 545 545 # See if this platform has special detection or checking requirements 546 546 # (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( 549 549 $Config::Config{osname}, $stub); 550 550 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); 553 553 554 554 # 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); 558 558 # Load the config structures. 559 TWiki::Configure::TWikiCfg::load($root, !$badLSC);559 Foswiki::Configure::FoswikiCfg::load($root, !$badLSC); 560 560 561 561 if (!$badLSC) { … … 563 563 <div class="patternContent"> 564 564 <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. 566 566 Fill in the settings, and then press 'Next'.</strong></p> 567 567 <div class="explanation"> 568 568 <ul> 569 <li><b>If your TWiki site is already working</b>, continue to570 <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"> 571 browse to the Foswiki WebHome</a>. 572 572 <ul> 573 573 <li>You will now need to consider how you are going to manage 574 574 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"> 576 576 authentication</a> 577 577 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"> 579 579 access control</a>, and the 580 580 <a rel="nofollow" href="#" onclick="foldBlock('SecuritySetup'); return false;">Security Setup</a> … … 583 583 </ul> 584 584 </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"> 586 register</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). 588 588 </li> 589 589 <li> 590 590 <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 598 592 </li> 599 593 <li> 600 594 <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>. 605 596 </li> 606 597 </ul> … … 671 662 print "</div><!-- options -->\n"; 672 663 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'); 679 670 print CGI::div($mess); 680 671 } … … 685 676 -accesskey=>'N')); 686 677 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>"; 688 679 689 680 print CGI::end_form();
Note: See TracChangeset
for help on using the changeset viewer.
