Changeset 8022
- Timestamp:
- 07/04/10 11:45:19 (3 years ago)
- Location:
- trunk/core
- Files:
-
- 5 edited
-
bin/configure (modified) (4 diffs)
-
lib/Foswiki/Configure/Checker.pm (modified) (10 diffs)
-
lib/Foswiki/Configure/Checkers/Store/Implementation.pm (modified) (1 diff)
-
lib/Foswiki/Configure/Types/URL.pm (modified) (1 diff)
-
lib/Foswiki/Configure/Types/URLPATH.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/bin/configure
r8021 r8022 32 32 not be consistent with the structure of $Foswiki:cfg, so beware). Each 33 33 leaf node has an associated Type (in the Types subdirectory) that has 34 collected model and view behaviours for the basic types. The node tree 35 is made up of the classes: 34 collected model and view behaviours for the basic types. 35 36 Class hierarchy 36 37 * Foswiki::Configure::Item 37 38 * Foswiki::Configure::Value - a leaf value … … 60 61 model for these sections. 61 62 62 These are top-level pluggable UI components. All the main screens are 63 implemented as UIs, under Foswiki::Configure::UIs. 63 Class hierarchy 64 * Foswiki::Configure::UI 65 * Foswiki::Configure::Checker 66 * Foswiki::Configure::Checkers::* - see below 67 * Foswiki::Configure::UIs::* - components used in building screens 68 * Foswiki::Configure::UIs::Item 69 * Foswiki::Configure::UIs::Section 70 * Foswiki::Configure::UIs::Root 71 * Foswiki::Configure::UIs::Value 64 72 65 73 ---+++ Checkers … … 72 80 ---+++ Types 73 81 Types provide some UI support in the form of type-specific prompters. 74 this is really an abuse of the Model, but it saves creating82 This is really an abuse of the Model, but it saves creating 75 83 decorator classes for all the Model types. 76 84 … … 78 86 is visited in depth-first order. 79 87 88 Class hierarchy 89 * Foswiki::Configure::Type - base 90 * Foswiki::Configure::Types::NUMBER - numerical type (perl float values) 91 * Foswiki::Configure::Types::OCTAL - octal (permissions) 92 * Foswiki::Configure::Types::BOOLEAN - boolean type 93 * Foswiki::Configure::Types::LANGUAGE 94 * Foswiki::Configure::Types::PERL - perl structure 95 * Foswiki::Configure::Types::SELECT - select from a list of values 96 * Foswiki::Configure::Types::SELECTCLASS - select a class from a path 97 * Foswiki::Configure::Types::STRING - string type 98 * Foswiki::Configure::Types::REGEX - regular expression 99 * Foswiki::Configure::Types::COMMAND - shell command 100 * Foswiki::Configure::Types::PASSWORD - hidden password 101 * Foswiki::Configure::Types::PATH - file path (/) 102 * Foswiki::Configure::Types::URL - absolute url path (/) 103 * Foswiki::Configure::Types::URLPATH - relative url path (/) 104 * Foswiki::Configure::Types::UNKNOWN - unknown type 105 106 TODO: 107 The type classes are the obvious place to attach client-side javascript 108 validators, thus releasing the server-side checkers to consider the "deeper" 109 issues. 80 110 81 111 =cut -
trunk/core/lib/Foswiki/Configure/Checker.pm
r8021 r8022 1 1 # See bottom of file for license and copyright information 2 3 =begin TML 4 5 ---+ package Foswiki::Configure::Checker; 6 7 Base class of all checkers. Checkers give checking and guessing support 8 for configuration values. Most of the methods of this class are intended 9 to be protected i.e. only available to subclasses. 10 11 =cut 2 12 3 13 package Foswiki::Configure::Checker; … … 14 24 =begin TML 15 25 16 ---++ +ObjectMethod check($value) -> $html26 ---++ ObjectMethod check($value) -> $html 17 27 * $value - Value object for the thing being checked 18 28 19 29 Entry point for the value check. Overridden by subclasses. 20 30 21 Returns html formatted by $this->ERROR(), WARN(), NOTE(), guessed() or 22 hand made _OR_ and empty string to be inserted in the configure UI 23 24 The checker can either check the sanity of the previously saved value, 25 or guess a one if none exists: 31 Returns html formatted by $this->ERROR(), WARN(), NOTE(), or 32 hand made _OR_ an empty string. The output of a checker will normally 33 be included in an HTML table, so don't get too carried away. 26 34 27 35 =cut … … 33 41 return ''; 34 42 } 43 44 =begin TML 45 46 ---++ PROTECTED ObjectMethod guessed($status) -> $html 47 48 A checker can either check the sanity of the previously saved value, 49 or guess a one if none exists. If the checker guesses, it should call 50 =$this->guessed(0)= (passing 1 if the guess was an error). 51 52 =cut 35 53 36 54 sub guessed { … … 50 68 } 51 69 } 70 71 =begin TML 72 73 ---++ PROTECTED ObjectMethod warnAboutWindowsBackSlashes($path) -> $html 74 75 Generate a warning if the supplied pathname includes windows-style 76 path separators. 77 78 =cut 52 79 53 80 sub warnAboutWindowsBackSlashes { … … 60 87 } 61 88 } 89 90 =begin TML 91 92 ---++ PROTECTED ObjectMethod guessMajorDir($cfg, $dir, $silent) -> $html 93 94 Try and guess the path of one of the major directories, by looking relative 95 to the absolute pathname of the dir where configure is being run. 96 97 =cut 62 98 63 99 sub guessMajorDir { … … 80 116 81 117 =begin TML 82 ---+++ ObjectMethod checkTreePerms($path, $perms, $filter) -> 'html' 83 84 Called by a Checker to perform 85 a recursive check of the specified path. The recursive check118 119 ---++ PROTECTED ObjectMethod checkTreePerms($path, $perms, $filter) -> $html 120 121 Perform a recursive check of the specified path. The recursive check 86 122 is limited to the configured "PathCheckLimit". This prevents excessive 87 123 delay on installations with large data or pub directories. The … … 203 239 } 204 240 241 =begin TML 242 243 ---++ PROTECTED ObjectMethod checkCanCreateFile($path) -> $html 244 245 Check that the given path can be created (or, if it already exists, 246 can be written). If the existing path is a directory, recursively 247 check for rw permissions using =checkTreePerms=. 248 249 Returns a message or the empty string if the check passed. 250 251 =cut 252 205 253 sub checkCanCreateFile { 206 254 my ( $this, $name ) = @_; … … 235 283 } 236 284 237 # Since Windows (without Cygwin) makes it hard to capture stderr 238 # ('2>&1' works only on Win2000 or higher), and Windows will usually have 239 # GNU tools in any case (installed for Foswiki since there's no built-in 240 # diff, grep, patch, etc), we only check for these tools on Unix/Linux 241 # and Cygwin. 285 =begin TML 286 287 ---++ PROTECTED ObjectMethod checkGnuProgram($prog) -> $html 288 289 Check for the availability of a GNU program. 290 291 Since Windows (without Cygwin) makes it hard to capture stderr 292 ('2>&1' works only on Win2000 or higher), and Windows will usually have 293 GNU tools in any case (installed for Foswiki since there's no built-in 294 diff, grep, patch, etc), we only check for these tools on Unix/Linux 295 and Cygwin. 296 297 =cut 298 242 299 sub checkGnuProgram { 243 300 my ( $this, $prog ) = @_; … … 279 336 } 280 337 281 # Check for a compilable RE 338 =begin TML 339 340 ---++ PROTECTED ObjectMethod checkRE($keys) -> $html 341 Check that the configuration item identified by the given keys represents 342 a compilable perl regular expression. 343 344 =cut 345 282 346 sub checkRE { 283 347 my ( $this, $keys ) = @_; … … 295 359 } 296 360 297 sub copytree {298 my ( $this, $from, $to ) = @_;299 my $e = '';300 301 if ( -d $from ) {302 if ( !-e $to ) {303 mkdir($to) || return "Failed to mkdir $to: $!<br />";304 }305 elsif ( !-d $to ) {306 return "Existing $to is in the way<br />";307 }308 309 my $d;310 return "Failed to copy $from: $!<br />" unless opendir( $d, $from );311 foreach my $f ( grep { !/^\./ } readdir $d ) {312 $f =~ /(.*)/;313 $f = $1; # untaint314 $e .= $this->copytree( "$from/$f", "$to/$f" );315 }316 closedir($d);317 }318 319 if ( !$e && !-e $to ) {320 require File::Copy;321 if ( !File::Copy::copy( $from, $to ) ) {322 $e = "Failed to copy $from to $to: $!<br />";323 }324 }325 return $e;326 }327 328 361 my $rcsverRequired = 5.7; 362 363 =begin TML 364 365 ---++ PROTECTED ObjectMethod checkRCSProgram($prog) -> $html 366 Specific to RCS, this method checks that the given program is available. 367 Check is only activated when the selected store implementation is RcsWrap. 368 369 =cut 329 370 330 371 sub checkRCSProgram { -
trunk/core/lib/Foswiki/Configure/Checkers/Store/Implementation.pm
r7681 r8022 18 18 RcsWrap does not work well on Windows, please use RcsLite. 19 19 EOF 20 }21 22 if ( $Foswiki::cfg{Store}{Implementation} =~ /RcsWrap/ ) {23 24 # Check that GNU diff is found in PATH; used by rcsdiff25 $mess .= $this->checkGnuProgram('diff');26 27 # Check all the RCS programs28 $mess .= $this->checkRCSProgram('initBinaryCmd');29 $mess .= $this->checkRCSProgram('initTextCmd');30 $mess .= $this->checkRCSProgram('tmpBinaryCmd');31 $mess .= $this->checkRCSProgram('ciCmd');32 $mess .= $this->checkRCSProgram('ciDateCmd');33 $mess .= $this->checkRCSProgram('coCmd');34 $mess .= $this->checkRCSProgram('histCmd');35 $mess .= $this->checkRCSProgram('infoCmd');36 $mess .= $this->checkRCSProgram('histCmd');37 $mess .= $this->checkRCSProgram('diffCmd');38 $mess .= $this->checkRCSProgram('lockCmd');39 $mess .= $this->checkRCSProgram('unlockCmd');40 $mess .= $this->checkRCSProgram('delRevCmd');41 20 } 42 21 -
trunk/core/lib/Foswiki/Configure/Types/URL.pm
r7452 r8022 6 6 use warnings; 7 7 8 use Foswiki::Configure::Type ();9 our @ISA = ('Foswiki::Configure::Type ');8 use Foswiki::Configure::Types::STRING (); 9 our @ISA = ('Foswiki::Configure::Types::STRING'); 10 10 11 11 sub new { -
trunk/core/lib/Foswiki/Configure/Types/URLPATH.pm
r7452 r8022 8 8 use Foswiki::Configure::Types::STRING (); 9 9 our @ISA = ('Foswiki::Configure::Types::STRING'); 10 11 sub new { 12 my $class = shift; 13 14 return bless( { name => 'URLPATH' }, $class ); 15 } 10 16 11 17 1;
Note: See TracChangeset
for help on using the changeset viewer.
