also fixed a few typos and a || instead of && bug. This all relates to the CLI installer.
//detect erros in the options
if (PEAR::isError($console_opt)) {
console_write(STDOUT,'invalidargumenthelp');
+ console_write(STDOUT, "\n", '', false);
die();
}
if (is_array($options)) {
if(array_key_exists('help',$options)){
console_write(STDOUT,'usagehelp');
+ console_write(STDOUT, "\n", '', false);
die ;
}
}
//welcome message
if ($verbose > CLI_NO) {
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'welcometext','install');
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
}
//============================================================================//
//Language selection for the installation
if ( ( $interactive == CLI_FULL ) || ($interactive == CLI_SEMI && ( !isset($INSTALL['lang'])) ) ) {
$langs=get_installer_list_of_languages();
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'selectlanguage','install');
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'availablelangs','install');
+ console_write(STDOUT, "\n", '', false);
//output available languages
foreach ( $langs as $language ) {
console_write(STDOUT,"\t",'',false);
console_write(STDOUT,$language,'',false);
console_write(STDOUT,"\n",'',false);
}
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'yourchoice','install');
$short_code_langs = get_short_codes($langs);
if ($verbose == CLI_NO) {
$silent=true;
}else{
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'checkingphpsettings','install');
+ console_write(STDOUT, "\n", '', false);
}
/// Check that PHP is of a sufficient version
check_compatibility(inst_check_php_version(), get_string('phpversion', 'install'), get_string('phpversionerror', 'install'),false,$silent);
if ( ( $interactive == CLI_FULL ) || ($interactive == CLI_SEMI && ( !isset($INSTALL['dirroot']) || !isset($INSTALL['wwwroot']) || !isset($INSTALL['dataroot']) ) ) ) {
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'locationanddirectories','install');
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
}
//input the web directory
// Database section heading
if ( ( $interactive == CLI_FULL ) || ($interactive == CLI_SEMI && ( !isset($INSTALL['dbhost']) || !isset($INSTALL['dbname']) || !isset($INSTALL['dbtype']) || !isset($INSTALL['dbuser']) || !isset($INSTALL['dbpass']) || !isset($INSTALL['prefix']) ) ) ) {
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'databasesettingsformoodle','install');
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
}
//Input dialogs
}
if ( ( $interactive == CLI_FULL ) || ($interactive == CLI_SEMI && ( !isset($INSTALL['dbtype']) ))) {
$dbtypes=array('mysql','oci8po','postgres7','mssql','mssql_n','odbc_mssql');
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'availabledbtypes','install');
+ console_write(STDOUT, "\n", '', false);
foreach ($dbtypes as $dbtype) {
console_write(STDOUT,"\t",'',false);
console_write(STDOUT,$dbtype,'install');
$db->SetFetchMode(ADODB_FETCH_ASSOC);
if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
- $errormsg= get_string('cannotconnecttodb','install');
+ $errormsg= get_string('cannotconnecttodb','install') . "\n";
} else {
/// We have been able to connect properly, just test the database encoding now.
/// It must be Unicode for 1.8 installations.
if ($dbconnected) {
/// Execute environment check, printing results
if (!check_moodle_environment($INSTALL['release'], $environment_results, false)) {
- $errormsg = get_string('errorsinenvironment', 'install');
+ $errormsg = get_string('errorsinenvironment', 'install') . "\n";
}
} else {
/// We never should reach this because DB has been tested before arriving here
if ( ( $interactive == CLI_FULL ) || ($interactive == CLI_SEMI && ( !isset($INSTALL['downloadlangaugepack']) ))) {
$site_langs=get_list_of_languages();
if (!key_exists($INSTALL['lang'],$site_langs)) {
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
console_write(STDOUT,'downloadlanguagepack','install');
$download_lang_pack=read_yes_no();
if($download_lang_pack == 'yes'){
}
}
- if ( $verbose > CLI_NO && $downloadsuccess) {
+ if ( $verbose > CLI_NO && !empty($downloadsuccess)) {
//print success message if language pack download is successful
console_write(STDOUT,'downloadsuccess');
print_newline();
if ($verbose > CLI_NO) {
console_write(STDOUT,'creatingconfigfile','install');
+ console_write(STDOUT, "\n", '', false);
}
$str = '<?php /// Moodle Configuration File '."\r\n";
fclose($fh);
if ($verbose > CLI_NO) {
console_write(STDOUT,'configfilecreated','install');
+ console_write(STDOUT, "\n", '', false);
}
} else {
- console_write(STDERR,'writeconfigfilefailed','install');
+ console_write(STDOUT,'configfilenotwritten','install');
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDOUT, "\n", '', false);
+ console_write(STDERR, $str, '', false);
}
if ( $verbose ) {
console_write(STDOUT,'installationiscomplete','install');
+ console_write(STDOUT, "\n", '', false);
}
}
if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
// This is what happens if there is no upgrade....
//console_write(STDERR,'configurationfileexist','install');
+ //console_write(STDOUT, "\n", '', false);
//die;
if ( $verbose > CLI_NO ) {
print_newline();
console_write(STDOUT,'upgradingcompleted');
+ console_write(STDOUT, "\n", '', false);
}
}
thislanguage
unicoderecommended
unicoderequired
-unsafedirname
upgradingactivitymodule
upgradingbackupdb
upgradingblocksdb
<?PHP // $Id$
// install.php - created with Moodle 1.7 beta + (2006101003)
-
+$string['aborting'] = 'Aborting installation';
$string['admindirerror'] = 'The admin directory specified is incorrect';
$string['admindirname'] = 'Admin Directory';
$string['admindirsetting'] = 'A very few webhosts use /admin as a special URL for you to access a
$string['adminpassword'] = 'Password :';
$string['adminusername'] = 'Username :';
$string['askcontinue'] = 'Continue (yes/no) :';
-$string['availabledbtypes']='\nAvailable db types \n';
-$string['availablelangs']='List of available languages \n';
-$string['cannotconnecttodb'] = 'Cannot connect to db \n';
+$string['availabledbtypes']='Available db types';
+$string['availablelangs']='List of available languages';
+$string['cannotconnecttodb'] = 'Cannot connect to db';
$string['caution'] = 'Caution';
-$string['checkingphpsettings']='\n\nChecking PHP Settings\n\n';
+$string['checkingphpsettings']='Checking PHP Settings';
$string['chooselanguage'] = 'Choose a language';
$string['chooselanguagehead'] = 'Choose a language';
$string['chooselanguagesub'] = 'Please choose a language for the installation ONLY. You will be able to choose site and user languages on a later screen.';
$string['compatibilitysettings'] = 'Checking your PHP settings ...';
$string['compatibilitysettingshead'] = 'Checking your PHP settings ...';
$string['compatibilitysettingssub'] = 'Your server should pass all these tests to make Moodle run properly';
-$string['configfilecreated'] = 'Configuration file successfully created\n ';
+$string['configfilecreated'] = 'Configuration file successfully created';
$string['configfiledoesnotexist'] = 'Configuration file does not exist !!!';
$string['configfilenotwritten'] = 'The installer script was not able to automatically create a config.php file containing your chosen settings, probably because the Moodle directory is not writeable. You can manually copy the following code into a file named config.php within the root directory of Moodle.';
$string['configfilewritten'] = 'config.php has been successfully created';
$string['configurationcomplete'] = 'Configuration completed';
$string['configurationcompletehead'] = 'Configuration completed';
$string['configurationcompletesub'] = 'Moodle made an attempt to save your configuration in a file in the root of your Moodle installation.';
-$string['configurationfileexist']='Configuration file already exist!\n';
-$string['creatingconfigfile'] =' Creating configuration file ...\n';
+$string['configurationfileexist']='Configuration file already exist!';
+$string['creatingconfigfile'] =' Creating configuration file ...';
$string['database'] = 'Database';
$string['databasecreationsettings'] = 'Now you need to configure the database settings where most Moodle data
will be stored. This database will be created automatically by the installer
<b>User:</b> your database username<br />
<b>Password:</b> your database password<br />
<b>Tables Prefix:</b> optional prefix to use for all table names';
-$string['databasesettingsformoodle']='\n\nDatabase settings for Moodle\n\n';
+$string['databasesettingsformoodle']='Database settings for Moodle';
$string['databasesettingshead'] = 'Now you need to configure the database where most Moodle data
will be stored. This database must already have been created
and a username and password created to access it.';
$string['downloadlanguagebutton'] = 'Download the "$a" language pack';
$string['downloadlanguagehead'] = 'Download language pack';
$string['downloadlanguagenotneeded'] = 'You may continue the installation process using the default language pack, \"$a\".';
-$string['downloadlanguagepack']='\n\nDo you want to download language pack now(yes/no) :';
+$string['downloadlanguagepack']='Do you want to download language pack now(yes/no) :';
$string['downloadlanguagesub'] = 'You now have the option of downloading a language pack and continuing the installation process in this language.<br /><br />If you are unable to download the language pack, the installation process will continue in English. (Once the installation process is complete, you will have the opportunity to download and install additional language packs.)';
$string['downloadsuccess'] = 'Language Pack Downloaded Successfuly';
$string['doyouagree'] = 'Do you agree ? (yes/no):';
$string['environmenthead'] = 'Checking your environment ...';
$string['environmentsub'] = 'We are checking if the various components of your system meet the system requirements';
-$string['errorsinenvironment'] ='Errors in the environment !\n';
+$string['errorsinenvironment'] ='Errors in the environment!';
$string['fail'] = 'Fail';
$string['fileuploads'] = 'File Uploads';
$string['fileuploadserror'] = 'This should be on';
$string['inputwebadress']='Web address :';
$string['inputwebdirectory']='Moodle Directory :';
$string['installation'] = 'Installation';
-$string['installationiscomplete'] = 'Installtion is completed !\n';
+$string['installationiscomplete'] = 'Installation is completed!';
$string['invalidargumenthelp']='
Error: Invalid argument(s)
Usage: \$php cliupgrade.php OPTIONS
- Use --help option to get more help\n';
+ Use --help option to get more help';
$string['invalidemail'] = 'Invalid Email';
$string['invalidhost'] = 'Invalid Host ';
-$string['invalidint']='Error: value is not an integer \n';
-$string['invalidintrange'] = 'Error: Value is outside valid range\n';
+$string['invalidint']='Error: value is not an integer';
+$string['invalidintrange'] = 'Error: Value is outside valid range';
$string['invalidpath'] = 'Invalid Path ';
-$string['invalidsetelement']= 'Error: Value given is not in the given options \n';
+$string['invalidsetelement']= 'Error: Value given is not in the given options';
$string['invalidtextvalue'] = 'Invalid Text Value';
$string['invalidurl'] = 'Invalid URL ';
-$string['invalidvalueforlanguage']='Invalid value for --lang option. Type --help for more help\n';
-$string['invalidyesno'] = 'Error: value is not a valid yes/no argument \n';
+$string['invalidvalueforlanguage']='Invalid value for --lang option. Type --help for more help';
+$string['invalidyesno'] = 'Error: value is not a valid yes/no argument';
$string['langdownloaderror'] = 'Unfortunately the language \"$a\" was not installed. The installation process will continue in English.';
$string['langdownloadok'] = 'The language \"$a\" was installed successfully. The installation process will continue in this language.';
-$string['locationanddirectories']= '\n\nLocation and directories \n\n';
+$string['locationanddirectories']= 'Location and directories';
$string['magicquotesruntime'] = 'Magic Quotes Run Time';
$string['magicquotesruntimeerror'] = 'This should be off';
$string['magicquotesruntimehelp'] = '<p>Magic quotes runtime should be turned off for Moodle to function properly.</p>
to just find a new web hosting company for your Moodle site.</p>
<p>You can try continuing the install if you like, but expect a few problems later on.</p>';
-$string['selectlanguage']='\n\nSelecting a language for installation\n';
+$string['selectlanguage']='Selecting a language for installation';
$string['sessionautostart'] = 'Session Auto Start';
$string['sessionautostarterror'] = 'This should be off';
$string['sessionautostarthelp'] = '<p>Moodle requires session support and will not function without it.</p>
$string['sitesummary'] ='Site summary :';
$string['skipdbencodingtest'] = 'Skip DB Encoding Test';
$string['tableprefix']='Table prefix :';
-$string['unsafedirname'] = 'Error: Unsafe characters in directory name. valid characters are a-zA-Z0-9_-\n';
$string['upgradingactivitymodule']= 'Upgrading Activity Module';
$string['upgradingbackupdb'] = 'Upgrading Backup Database';
$string['upgradingblocksdb'] = 'Upgrading Blocks Database';
$string['upgradingblocksplugin'] = 'Upgrading Blocks Plugin';
-$string['upgradingcompleted'] = 'Upgrading completed...\n';
+$string['upgradingcompleted'] = 'Upgrading completed...';
$string['upgradingcourseformatplugin'] = 'Upgrading Course Format Pluggin';
$string['upgradingenrolplugin'] = 'Upgrading Enrol Plugin';
$string['upgradinggradeexportplugin'] = 'Upgrading Grade Export Plugin';
$string['upgradingrpcfunctions'] = 'Upgrading RPC Functions';
$string['usagehelp']='
Synopsis:
-\$php cliupgrade.php OPTIONS\n
+\$php cliupgrade.php OPTIONS
+
OPTIONS
--lang Valid installed language for installation. Default is English(en)
--webaddr Web address for the Moodle site
--adminusername Username for the admin. Default is admin
--adminpassword Password for the admin. Default is admin
--adminemail Email address of admin. Default is root@localhost
---help print out this help\n
+--help print out this help
+
Usage:
-\$php cliupgrade.php --lang=en --webaddr=http://www.example.com --moodledir=/var/www/html/moodle --datadir=/var/moodledata --dbtype=mysql --dbhost=localhost --dbname=moodle --dbuser=root --prefix=mdl --agreelicense=yes --confirmrelease=yes --sitefullname=\"Example Moodle Site\" --siteshortname=moodle --sitesummary=siteforme --adminfirstname=Admin --adminlastname=User --adminusername=admin --adminpassword=admin --adminemail=admin@example.com --verbose=1 --interactivelevel=2 \n';
+\$php cliupgrade.php --lang=en --webaddr=http://www.example.com --moodledir=/var/www/html/moodle --datadir=/var/moodledata --dbtype=mysql --dbhost=localhost --dbname=moodle --dbuser=root --prefix=mdl --agreelicense=yes --confirmrelease=yes --sitefullname=\"Example Moodle Site\" --siteshortname=moodle --sitesummary=siteforme --adminfirstname=Admin --adminlastname=User --adminusername=admin --adminpassword=admin --adminemail=admin@example.com --verbose=1 --interactivelevel=2';
$string['versionerror'] = 'User aborted due to version Error ';
$string['welcomep10'] = '$a->installername ($a->installerversion)';
$string['welcomep20'] = 'You are seeing this page because you have successfully installed and
configure and set up <strong>Moodle</strong> on your computer. You may accept the default
settings or, optionally, amend them to suit your own needs.';
$string['welcomep70'] = 'Click the \"Next\" button below to continue with the set up of <strong>Moodle</strong>.';
-$string['welcometext']='\n\n---Welcome to moodle commandline installer---\n\n';
+$string['welcometext']='---Welcome to moodle commandline installer---';
$string['writetoconfigfilefaild'] = 'Error: Write to config file failed ';
$string['wwwroot'] = 'Web address';
$string['wwwrooterror'] = 'The \'Web Address\' does not appear to be valid - this Moodle installation doesn\'t appear to be there. The value below has been reset.';
-$string['yourchoice']='\nYour choice :';
+$string['yourchoice']='Your choice :';
?>
if (isset($values['lang'])) {
if (!valid_language($INSTALL['lang'])) {
console_write(STDERR,'invalidvalueforlanguage');
+ console_write(STDOUT, "\n", '', false);
}
}
if (isset($values['webdir'])) {
fwrite($stream,$identifier);
}
if ($stream == STDERR) {
- fwrite($stream,get_string('aborting',$module));
+ fwrite($stream, "\n\n" . get_string('aborting',$module) . "\n\n");
die;
}
}
return $input;
} else {
console_write(STDERR,'invalidint');
+ console_write(STDOUT, "\n", '', false);
}
}
//=========================================================================//
return $input;
} else {
console_write(STDERR,'invalidintrange');
+ console_write(STDOUT, "\n", '', false);
}
}
}
} else {
console_write(STDERR,'invalidyesno');
+ console_write(STDOUT, "\n", '', false);
}
}
return $input;
} else {
console_write(STDERR,'invalidsetelement');
+ console_write(STDOUT, "\n", '', false);
}
}
//=========================================================================//
* @param array $env, of type object
*/
function print_environment_status($env = array()) {
- console_write(STDOUT,"Status\t\tInfo\t\tPart\n\r",'',false);
+ console_write(STDOUT, get_string('name') . "\t\t\t" . get_string('info') . "\t" . get_string('status') . "\n\r", '', false);
+ //console_write(STDOUT,"Status\t\tInfo\t\tPart\n\r",'',false);
foreach ( $env as $object) {
-
+ console_write(STDOUT,$object->part,'',false);
+ console_write(STDOUT,"\t\t",'',false);
+ if (!empty($object->info)) {
+ console_write(STDOUT, $object->info, '', false);
+ } else {
+ console_write(STDOUT, "\t", '', false);
+ }
+ console_write(STDOUT, "\t\t", '', false);
if ($object->status == 1 ) {
console_write(STDOUT,'ok','',false);
} else {
console_write(STDOUT,'fail','',false);
}
- console_write(STDOUT,"\t\t",'',false);
- console_write(STDOUT,$object->info,'',false);
- console_write(STDOUT,"\t\t",'',false);
- console_write(STDOUT,$object->part,'',false);
console_write(STDOUT,"\n\r",'',false);
}
}
*/
function print_newline() {
- console_write(STDOUT,'newline','install');
+ console_write(STDOUT, "\n", '', false);
}
?>
if ($return) {
return $output;
} else {
- console_write(STDOUT,$output,'',false);
+ console_write(STDOUT,$output . "\n",'',false);
return;
}
}
global $CFG, $SESSION, $THEME;
$message = clean_text($message); // In case nasties are in here
- if (defined('CLI_UPGRADE') || CLI_UPGRADE) {
+ if (defined('CLI_UPGRADE') && CLI_UPGRADE) {
console_write(STDERR,$message,'',false);
die ;
}