gwynne Sat Jul 28 13:22:52 2007 UTC
Modified files:
/phd/setup CLI.class.php Option_Metadata.inc.php
Template_File.class.php setup.messages.php setup.php
Log:
- Revert to {$} form instead of ${} form; I managed to get TextMate to
recognize it properly.
- Change to a more consistent method of assigning option values.
- Change to a more consistent method of making the CLI interface look halfway
readable.
- Added the chunking_memory_limit setting.
http://cvs.php.net/viewvc.cgi/phd/setup/CLI.class.php?r1=1.5&r2=1.6&diff_format=u
Index: phd/setup/CLI.class.php
diff -u phd/setup/CLI.class.php:1.5 phd/setup/CLI.class.php:1.6
--- phd/setup/CLI.class.php:1.5 Fri Jul 27 23:32:11 2007
+++ phd/setup/CLI.class.php Sat Jul 28 13:22:51 2007
@@ -1,6 +1,6 @@
<?php
-/* $Id: CLI.class.php,v 1.5 2007/07/27 23:32:11 gwynne Exp $
+/* $Id: CLI.class.php,v 1.6 2007/07/28 13:22:51 gwynne Exp $
+-------------------------------------------------------------------------+
| Copyright(c) 2007 |
| Authors: |
@@ -50,14 +50,14 @@
public function errorMessage( $message ) {
- print "ERROR: ${message}\n";
+ print "ERROR: {$message}\n";
exit( 1 );
}
public function warningMessage( $message ) {
- print "WARNING: ${message}\n";
+ print "WARNING: {$message}\n";
}
@@ -76,25 +76,27 @@
foreach ( $OPTIONS_DATA as $optionName => $optionData ) {
- if ( !strncmp( $optionName, '__', 2 ) )
- continue;
-
if ( $this->quietMode < 2 ) {
- print "${optionData[ 'description' ]}\n";
+ print "\n{$optionData[ 'description' ]}";
}
if ( $this->quietMode < 1 ) {
- print "${optionData[ 'details' ]}\n";
+ print "\n{$optionData[ 'details' ]}";
}
- if ( ( $valueList = $optionData[ 'value_list_function' ]() )
!== NULL ) {
- if ( $valueList !== FALSE ) {
- print PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_AVAILABLE_VALUES,
- wordwrap( "\t" . implode( ' ', $valueList ) , 71,
"\n\t", FALSE ) );
- }
- } else if ( $this->quietMode < 2 ) {
- print "\n";
+ $valueList = $optionData[ 'value_list_function' ]();
+ if ( is_null( $valueList ) ) {
+ print "\n" . PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_NO_VALUES );
+ } else if ( is_bool( $valueList ) ) {
+ print "\n" . PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_BOOLEAN_VALUES );
+ } else if ( is_int( $valueList ) ) {
+ print "\n" . PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_NUMBYTES_VALUES );
+ } else {
+ print "\n" . PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_AVAILABLE_VALUES,
+ wordwrap( "\t" . implode( ' ', $valueList ) , 71,
"\n\t", FALSE ) );
}
+ print "\n";
+
do {
$response = $this->getLine( PhD_Prompts::paramPrompt(
PhD_Prompts::CLI_OPTION_PROMPT, $optionData[ 'prompt'
], $configurator->$optionName ) );
@@ -104,10 +106,10 @@
if ( $optionData[ 'validity_check_function' ]( $response )
=== TRUE ) {
break;
}
- print $optionData[ 'invalid_message' ]."\n";
+ print "{$optionData[ 'invalid_message' ]}\n";
} while( TRUE );
- $configurator->$optionName = $valueList === FALSE ? ( substr(
strtolower( $response ), 0, 1 ) == 'y' ) : $response;
+ $configurator->$optionName = $optionData[
'final_value_function' ]( $response );
print "\n";
}
http://cvs.php.net/viewvc.cgi/phd/setup/Option_Metadata.inc.php?r1=1.4&r2=1.5&diff_format=u
Index: phd/setup/Option_Metadata.inc.php
diff -u phd/setup/Option_Metadata.inc.php:1.4
phd/setup/Option_Metadata.inc.php:1.5
--- phd/setup/Option_Metadata.inc.php:1.4 Fri Jul 27 23:09:28 2007
+++ phd/setup/Option_Metadata.inc.php Sat Jul 28 13:22:51 2007
@@ -1,6 +1,6 @@
<?php
-/* $Id: Option_Metadata.inc.php,v 1.4 2007/07/27 23:09:28 gwynne Exp $
+/* $Id: Option_Metadata.inc.php,v 1.5 2007/07/28 13:22:51 gwynne Exp $
+-------------------------------------------------------------------------+
| Copyright(c) 2007 |
| Authors: |
@@ -14,97 +14,126 @@
+-------------------------------------------------------------------------+
*/
-$OPTIONS_DATA = array(
- '__common_functions' => array(
- 'get_languages_func' => create_function( '', <<<~EOBLOB
+$OPTIONS_DATA_COMMON_FUNCS = array(
+
+ 'get_languages_func' => create_function( '', <<<~FUNCTION
+global $OPTIONS_DATA, $OPTIONS;
static $languages = NULL;
-$xvcf = $GLOBALS[ 'OPTIONS_DATA' ][ 'xml_root' ][ 'validity_check_function' ];
-if ( $xvcf( $GLOBALS[ 'OPTIONS' ][ 'xml_root' ] ) ) {
+if ( $OPTIONS_DATA[ 'xml_root' ][ 'validity_check_function' ]( $OPTIONS[
'xml_root' ] ) ) {
if ( is_null( $languages ) ) {
- $d = $GLOBALS[ 'OPTIONS' ][ 'xml_root' ];
+ $d = $OPTIONS[ 'xml_root' ];
if ( ( $languageList = @scandir( $d ) ) === FALSE ) {
PhD_Error( "Unable to scan XML root." );
}
- $c = 'return is_dir( "'.$d.'/${v}" ) && !in_array( $v, array( ".",
"..", "CVS", ".svn" ) );';
+ $c = 'return is_dir( "'.$d.'/{$v}" ) && !in_array( $v, array( ".",
"..", "CVS", ".svn" ) );';
$languages = array_filter( $languageList, create_function( '$v', $c )
);
}
return $languages;
}
return NULL;
-EOBLOB
- ),
- 'boolean_value_list_func' => create_function( '', <<<~EOBLOB
+FUNCTION
+ ),
+
+ 'numbytes_value_list_func' => create_function( '', <<<~FUNCTION
+return 0;
+FUNCTION
+ ),
+
+ 'numbytes_validity_func' => create_function( '$v', <<<~FUNCTION
+return preg_match( '/^(\d+)(?:([KMGTP])B?)?$/iu', $v, $matches ) ? TRUE :
FALSE;
+FUNCTION
+ ),
+
+ 'numbytes_final_value_func' => create_function( '$v', <<<~FUNCTION
+preg_match( '/^(\d+)(?:([KMGTP])B?)?$/iu', $v, $matches );
+$multipliers = array( '' => 1, 'K' => 1024, 'M' => 1048576, 'G' => 1073741824,
'T' => 1099511627776, 'P' => 1125899906842620 );
+return ( intval( $matches[ 1 ] ) * $multipliers[ strval( $matches[ 2 ] ) ] );
+FUNCTION
+ ),
+
+ 'boolean_value_list_func' => create_function( '', <<<~FUNCTION
return FALSE;
-EOBLOB
- ),
- 'boolean_validity_func' => create_function( '$v', <<<~EOBLOB
+FUNCTION
+ ),
+
+ 'boolean_validity_func' => create_function( '$v', <<<~FUNCTION
return in_array( substr( strtolower( $v ), 0, 1 ), array( 1, 0, 'y', 'n' ) )
|| $v === TRUE || $v === FALSE;
-EOBLOB
- ),
- 'unknown_value_list_func' => create_function( '', <<<~EOBLOB
+FUNCTION
+ ),
+
+ 'boolean_final_value_func' => create_function( '$v', <<<~FUNCTION
+return ( substr( strtolower( $v ), 0, 1 ) == 'y' ) ? TRUE : FALSE;
+FUNCTION
+ ),
+
+ 'verbatim_final_value_func' => create_function( '$v', <<<~FUNCTION
+return $v;
+FUNCTION
+ ),
+
+ 'unknown_value_list_func' => create_function( '', <<<~FUNCTION
return NULL;
-EOBLOB
- ),
+FUNCTION
),
+
);
-$OPTIONS_DATA = array_merge( $OPTIONS_DATA,
- array(
+$OPTIONS_DATA = array(
'output_format' => array(
'default_value' => 'xhtml',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The output format for PhD determines the final form of any output it produces.
Generally, this will be directly related to the medium in which it is used.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
Some possible options are HTML4, XHTML, XML (the identity transformation), CHM,
WML, PDF, and plaintext. For a full list, see the formats/ folder. The default
is the builtin XHTML. The selected theme will determine the version and
conformance of any XML-based format.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => create_function( '', <<<~EOBLOB
+ 'value_list_function' => create_function( '', <<<~FUNCTION
static $formatList = NULL;
if ( is_null( $formatList ) ) {
$path = dirname( __FILE__ ) . "/../formats";
if ( ( $formats = @scandir( $path ) ) === FALSE ) {
- PhD_Error( "The formats directory is missing or unreadable at
\"${path}\"." );
+ PhD_Error( "The formats directory is missing or unreadable at
\"{$path}\"." );
}
$formatList = array_map( create_function( '$v', 'return substr( $v, 0, -4
);' ),
- array_filter( $formats, create_function( '$v', 'return substr( $v, -4
) == ".php" && is_file( "'.$path.'/${v}" );' ) ) );
+ array_filter( $formats, create_function( '$v', 'return substr( $v, -4
) == ".php" && is_file( "'.$path.'/{$v}" );' ) ) );
if ( count( $formatList ) == 0 ) {
PhD_Error( "No output formats are available." );
}
}
return $formatList;
-EOBLOB
+FUNCTION
),
- 'validity_check_function' => create_function( '$format', <<<~EOBLOB
-$vlf = $GLOBALS[ 'OPTIONS_DATA' ][ 'output_format' ][ 'value_list_function' ];
-return in_array( $format, $vlf() );
-EOBLOB
+ 'validity_check_function' => create_function( '$format', <<<~FUNCTION
+return in_array( $format, $GLOBALS[ 'OPTIONS_DATA' ][ 'output_format' ][
'value_list_function' ]() );
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Choose a format',
'invalid_message' => 'That is not an available format. Please try
again.'
),
'output_theme' => array(
'default_value' => 'default',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The output theme for PhD determines site-specific alterations to the selected
output format.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
The default theme is, simply enough, the builtin "default", which will display
an error message for all cases. A valid theme must be selected by the
administrator for the site to function.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => create_function( '', <<<~EOBLOB
+ 'value_list_function' => create_function( '', <<<~FUNCTION
static $themeList = NULL;
if ( is_null( $themeList ) ) {
@@ -113,32 +142,32 @@
PhD_Error( "The themes directory is missing or unreadable." );
}
$themeList = array_filter( $themes,
- create_function( '$v', 'return is_dir( "'.$path.'/${v}" ) &&
!in_array( $v, array( ".", "..", "CVS" ) );' ) );
+ create_function( '$v', 'return is_dir( "'.$path.'/{$v}" ) &&
!in_array( $v, array( ".", "..", "CVS" ) );' ) );
if ( count( $themeList ) == 0 ) {
PhD_Error( "No themes are available." );
}
}
return $themeList;
-EOBLOB
+FUNCTION
),
- 'validity_check_function' => create_function( '$theme', <<<~EOBLOB
-$vlf = $GLOBALS[ 'OPTIONS_DATA' ][ 'output_theme' ][ 'value_list_function' ];
-return in_array( $theme, $vlf() );
-EOBLOB
+ 'validity_check_function' => create_function( '$theme', <<<~FUNCTION
+return in_array( $theme, $GLOBALS[ 'OPTIONS_DATA' ][ 'output_theme' ][
'value_list_function' ]() );
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Choose a theme',
'invalid_message' => 'That is not an available theme. Please try
again.'
),
'output_encoding' => array(
'default_value' => 'utf-8',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The output encoding for PDP-E determines the encoding that will be used for all
output. Input encodings are determined by the XML parser. The output encoding
can be any encoding supported by libiconv on this system.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
The default is UTF-8. For HTTP-based outputs, an appropriate header() call will
be made. For all SGML-based outputs, it is up to the output method to output a
proper encoding declaration. For reasons of safety and consistency, themes and
@@ -146,181 +175,211 @@
encoding or set of encodings, it must document that requirement and allow the
system administrator to choose the proper one, and raise an error at runtime
for an unsupported encoding.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'unknown_value_list_func' ],
- 'validity_check_function' => create_function( '$encoding',
- 'return iconv( $encoding, $encoding, "Test string" ) === "Test
string";' ),
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'unknown_value_list_func' ],
+ 'validity_check_function' => create_function( '$encoding', <<<~FUNCTION
+return iconv( $encoding, $encoding, "Test string" ) === "Test string";
+FUNCTION
+ ),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Choose an encoding',
'invalid_message' => 'That encoding does not appear to be supported by
your libiconv. Please try another.'
),
'xml_root' => array(
'default_value' => '/INVALID/PATH',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The location of the language trees.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
The XML root tells PhD where to find the XML files it wil be displaying in
this installation. The expected structure is the same as that used by
phpdoc-all, e.g. a set of directories named by language code containing the XML
files and translations laid out by section structure. Tilde expansion is NOT
done. Symbolic links are resolved at run time.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'unknown_value_list_func' ],
- 'validity_check_function' => create_function( '$root', <<<~EOBLOB
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'unknown_value_list_func' ],
+ 'validity_check_function' => create_function( '$root', <<<~FUNCTION
$rv = realpath( $root );
-return ( $rv !== FALSE && is_dir( $rv ) && is_readable( $rv ) &&
is_executable( $rv ) && is_dir( "${rv}/en" ) );
-EOBLOB
+return ( $rv !== FALSE && is_dir( $rv ) && is_readable( $rv ) &&
is_executable( $rv ) && is_dir( "{$rv}/en" ) );
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Enter the full path to the XML root',
- 'invalid_message' => <<<~EOBLOB
+ 'invalid_message' => <<<~MESSAGE
The path you entered does not exist, is not a directory, is not readable, is
not searchable, or does not contain an English directory. Please try again.
-EOBLOB
+MESSAGE
),
'language' => array(
'default_value' => 'en',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The language tells PhD which set of translations to use for display. The
language is a two or four letter language code. It is assumed that
subdirectories of the XML root are named according to the language code of the
translations they contain. The language specified here must exist in the XML
root.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
The default is English. English files are always the final fallback if a
translated version of a page is not found.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'get_languages_func' ],
- 'validity_check_function' => create_function( '$v', <<<~EOBLOB
-$vlf = $GLOBALS[ 'OPTIONS_DATA' ][ 'language' ][ 'value_list_function' ];
-return in_array( $v, $vlf() );
-EOBLOB
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'get_languages_func' ],
+ 'validity_check_function' => create_function( '$v', <<<~FUNCTION
+return in_array( $v, $GLOBALS[ 'OPTIONS_DATA' ][ 'language' ][
'value_list_function' ]() );
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Choose a primary language code',
- 'invalid_message' => <<<~EOBLOB
+ 'invalid_message' => <<<~MESSAGE
The language code you entered does not appear to exist, or is not a directory
in the XML root. Please try again.
-EOBLOB
+MESSAGE
),
'fallback_language' => array(
'default_value' => 'en',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The fallback language is used before English when PhD can not find a translated
file in the primary language. If it is set to English, PhD immediately falls
back to English files without any extra overhead. The language specified here
must exist in the XML root.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
This provides an optional fallback before English if another fallback would
make more sense for a site. The default is English, causing immediate fallback.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'get_languages_func' ],
- 'validity_check_function' => create_function( '$v', <<<~EOBLOB
-$vlf = $GLOBALS[ 'OPTIONS_DATA' ][ 'language' ][ 'value_list_function' ];
-return in_array( $v, $vlf() );
-EOBLOB
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'get_languages_func' ],
+ 'validity_check_function' => create_function( '$v', <<<~FUNCTION
+return in_array( $v, $GLOBALS[ 'OPTIONS_DATA' ][ 'language' ][
'value_list_function' ]() );
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Choose a fallback language code',
- 'invalid_message' => <<<~EOBLOB
+ 'invalid_message' => <<<~MESSAGE
The language code you entered does not appear to exist, or is not a directory
in the XML root. Please try again.
-EOBLOB
+MESSAGE
),
'enforce_revisions' => array(
'default_value' => FALSE,
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
PhD is capable of using either traditional <!-- Revision: --> and
<!-- EN-Revision: --> tags or the <phd:revision/> tag to specify version
control information for files and their translated counterparts. If the
revision control flag is set, PhD will enforce revision matching between
translated files and English files.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
The processor relies on whatever version control system is in use to provide
the revision information in its proper place for the tag style in use. Use of
the <phd:revision/> tag is strongly preferred to the use of XML comments. If a
reivison mismatch is found, the active theme is given an opportunity to present
an error or warning to users.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'boolean_value_list_func' ],
- 'validity_check_function' => $OPTIONS_DATA[ '__common_functions' ][
'boolean_validity_func' ],
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_value_list_func' ],
+ 'validity_check_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_validity_func' ],
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_final_value_func' ],
'prompt' => 'Type "(Y)es" to enable revision control, or "(N)o" to
disable it',
'invalid_message' => 'Please enter "(Y)es" or "(N)o".'
),
'database_path' => array(
'default_value' => '/INVALID/PATH/phd-data.sqlite',
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The database path tells PhD where to store the SQLite 3 database file, used for
indexing and cache data. Most installations will want to place the database
file in the same directory as PhD itself.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
This setup will attempt to create a database file in the given location and
remove it again. The user running PhD must have write and execute permissions
to the enclosing directory. The file name can be whatever best suits the needs
of the host system.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'unknown_value_list_func' ],
- 'validity_check_function' => create_function( '$path', <<<~EOBLOB
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'unknown_value_list_func' ],
+ 'validity_check_function' => create_function( '$path', <<<~FUNCTION
try {
$d = dirname( realpath( $path ) );
if ( !is_dir( $d ) || !is_writable( $d ) || !is_executable( $d ) ) {
return FALSE;
}
- $p = new PDO( "sqlite:${path}", NULL, NULL, array( PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION ) );
+ $p = new PDO( "sqlite:{$path}", NULL, NULL, array( PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION ) );
$p = NULL;
unset( $p );
return @unlink( $path );
} catch ( PDOException $e ) {
return FALSE;
}
-EOBLOB
+FUNCTION
),
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'verbatim_final_value_func' ],
'prompt' => 'Enter the full path to the database file',
- 'invalid_message' => <<<~EOBLOB
+ 'invalid_message' => <<<~MESSAGE
The path is invalid, you don't have write permission to it, an existing
database file is in the way, or loading SQLite failed. Please try again.
-EOBLOB
+MESSAGE
+ ),
+
+ 'chunking_memory_limit' => array(
+ 'default_value' => ( 100 * 1048576 ), // 100MB
+ 'description' => <<<~MESSAGE
+The chunking memory limit controls how big a single chunk of output data must
+grow for PhD to begin spooling it to disk to avoid memory exhaustion.
+MESSAGE
+ ,
+ 'details' => <<<~MESSAGE
+While performing transformations, PhD stores a growing chunk in memory for
+efficiency. However, efficiency will quickly degrade if the chunk is too large.
+This is particularly problematic for output formats and themes which don't do
+any chunking at all. Setting this limit to zero will force PhD to spool for all
+chunks, no matter how small. This is the recommended setting for non-chunking
+outputs; the default is fine for most other installations.
+MESSAGE
+ ,
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'numbytes_value_list_func' ],
+ 'validity_check_function' => $OPTIONS_DATA_COMMON_FUNCS[
'numbytes_validity_func' ],
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'numbytes_final_value_func' ],
+ 'prompt' => 'Enter the chunking limit',
+ 'invalid_message' => 'You must enter a valid numeric value.'
),
'debug' => array(
'default_value' => FALSE,
- 'description' => <<<~EOBLOB
+ 'description' => <<<~MESSAGE
The debug flag controls whether PhD runs in debug mode. This should NEVER be
set in a production environment; its intended use is for PhD developers and
experienced site administrators.
-EOBLOB
+MESSAGE
,
- 'details' => <<<~EOBLOB
+ 'details' => <<<~MESSAGE
If set, many extra assertions are enabled and verbose error messages and
progress information are provided. Please note that debug output is under the
control of both the output format and the output theme, as a matter of
consistency. This flag is only provided in the setup interface for ease of
administration.
-EOBLOB
+MESSAGE
,
- 'value_list_function' => $OPTIONS_DATA[ '__common_functions' ][
'boolean_value_list_func' ],
- 'validity_check_function' => $OPTIONS_DATA[ '__common_functions' ][
'boolean_validity_func' ],
+ 'value_list_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_value_list_func' ],
+ 'validity_check_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_validity_func' ],
+ 'final_value_function' => $OPTIONS_DATA_COMMON_FUNCS[
'boolean_final_value_func' ],
'prompt' => 'Type "(Y)es" to enable debug output, or "(N)o" to disable
it',
'invalid_message' => 'Please enter "(Y)es" or "(N)o".'
),
- )
+
);
function getOptionNames() {
http://cvs.php.net/viewvc.cgi/phd/setup/Template_File.class.php?r1=1.4&r2=1.5&diff_format=u
Index: phd/setup/Template_File.class.php
diff -u phd/setup/Template_File.class.php:1.4
phd/setup/Template_File.class.php:1.5
--- phd/setup/Template_File.class.php:1.4 Fri Jul 27 23:09:28 2007
+++ phd/setup/Template_File.class.php Sat Jul 28 13:22:51 2007
@@ -1,6 +1,6 @@
<?php
-/* $Id: Template_File.class.php,v 1.4 2007/07/27 23:09:28 gwynne Exp $
+/* $Id: Template_File.class.php,v 1.5 2007/07/28 13:22:51 gwynne Exp $
+-------------------------------------------------------------------------+
| Copyright(c) 2007 |
| Authors: |
@@ -125,7 +125,7 @@
protected function doSubstitutions( $substitutions, $template ) {
return str_replace(
- array_map( create_function( '$v', 'return "@${v}@";' ),
array_keys( $substitutions ) ),
+ array_map( create_function( '$v', 'return "@{$v}@";' ),
array_keys( $substitutions ) ),
array_values( $substitutions ),
$template );
http://cvs.php.net/viewvc.cgi/phd/setup/setup.messages.php?r1=1.4&r2=1.5&diff_format=u
Index: phd/setup/setup.messages.php
diff -u phd/setup/setup.messages.php:1.4 phd/setup/setup.messages.php:1.5
--- phd/setup/setup.messages.php:1.4 Fri Jul 27 23:32:11 2007
+++ phd/setup/setup.messages.php Sat Jul 28 13:22:51 2007
@@ -1,6 +1,6 @@
<?php
-/* $Id: setup.messages.php,v 1.4 2007/07/27 23:32:11 gwynne Exp $
+/* $Id: setup.messages.php,v 1.5 2007/07/28 13:22:51 gwynne Exp $
+-------------------------------------------------------------------------+
| Copyright(c) 2007 |
| Authors: |
@@ -121,18 +121,28 @@
PROMPTMSG;
- const CLI_BOOLEAN_VALUE = "\n";/*<<<~PROMPTMSG
-This is a flag setting. Type "y" or "yes" to turn it on, or "n" or "no" to turn
-it off.
+ const CLI_NO_VALUES = <<<~PROMPTMSG
+There is no list of possible values available.
+PROMPTMSG;
+
+ const CLI_BOOLEAN_VALUES = <<<~PROMPTMSG
+This is a yes/no setting.
-PROMPTMSG;*/
+PROMPTMSG;
+ const CLI_NUMBYTES_VALUES = <<<~PROMPTMSG
+This is a value given in number of bytes. For convenience you may use any of
+the following suffixes to multiply the number by the shown factor. By the way,
+if you actually use the P suffix, I pity you.
+ K = 1024, M = K*1024, G = M*1024, T = G*1024, P = T*1024
+
+PROMPTMSG;
+
const CLI_AVAILABLE_VALUES = <<<~PROMPTMSG
The available values in this installation are:
%%%
-
PROMPTMSG;
const CLI_OPTION_PROMPT = <<<~PROMPTMSG
http://cvs.php.net/viewvc.cgi/phd/setup/setup.php?r1=1.3&r2=1.4&diff_format=u
Index: phd/setup/setup.php
diff -u phd/setup/setup.php:1.3 phd/setup/setup.php:1.4
--- phd/setup/setup.php:1.3 Fri Jul 27 23:09:28 2007
+++ phd/setup/setup.php Sat Jul 28 13:22:51 2007
@@ -1,6 +1,6 @@
<?php
-/* $Id: setup.php,v 1.3 2007/07/27 23:09:28 gwynne Exp $
+/* $Id: setup.php,v 1.4 2007/07/28 13:22:51 gwynne Exp $
+-------------------------------------------------------------------------+
| Copyright(c) 2007 |
| Authors: |
@@ -21,7 +21,7 @@
*/
// Used for versioning.
-$REVISION = '$Id: setup.php,v 1.3 2007/07/27 23:09:28 gwynne Exp $';
+$REVISION = '$Id: setup.php,v 1.4 2007/07/28 13:22:51 gwynne Exp $';
// Chosen interface for the setup. Determined from SAPI name at main()-time.
$chosenInterface = NULL;
@@ -75,9 +75,6 @@
// Fill in defaults.
$OPTIONS = array();
foreach ( $OPTIONS_DATA as $name => $data ) {
- if ( strncmp( $name, '__', 2 ) == 0 ) {
- continue;
- }
$OPTIONS[ $name ] = $data[ 'default_value' ];
}