]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12894 Fixing language string mess (language packs containing \n) & moved them...
authormjollnir_ <mjollnir_>
Wed, 9 Jan 2008 23:15:44 +0000 (23:15 +0000)
committermjollnir_ <mjollnir_>
Wed, 9 Jan 2008 23:15:44 +0000 (23:15 +0000)
also fixed a few typos and a || instead of && bug.  This all relates to the CLI installer.

admin/cliupgrade.php
install/stringnames.txt
lang/en_utf8/install.php
lib/installlib.php
lib/weblib.php

index 08757be7492b8de6b1c925016f8d8491ff68382c..c8a7b710c4c385aac1ad6c38f05179a05b2990e7 100644 (file)
@@ -177,6 +177,7 @@ if ( realpath($_SERVER['argv'][0]) == __FILE__ && count($args)>1) {
 //detect erros in the options
 if (PEAR::isError($console_opt)) {
     console_write(STDOUT,'invalidargumenthelp');
+    console_write(STDOUT, "\n", '', false);
     die();
 }
 
@@ -187,6 +188,7 @@ $options=get_options($console_opt);
 if (is_array($options)) {
     if(array_key_exists('help',$options)){
         console_write(STDOUT,'usagehelp');
+        console_write(STDOUT, "\n", '', false);
         die ;
     }
 }
@@ -231,7 +233,11 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 
     //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
@@ -239,14 +245,19 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     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);
 
@@ -261,7 +272,9 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     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);
@@ -288,7 +301,11 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 
 
     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
@@ -338,7 +355,11 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 
     // 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
@@ -352,7 +373,9 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     }
     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');
@@ -458,7 +481,7 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
         $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.
@@ -507,7 +530,7 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     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
@@ -531,6 +554,8 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     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'){
@@ -574,7 +599,7 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
         }
     }
     
-    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();
@@ -603,6 +628,7 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 
     if ($verbose > CLI_NO) {
         console_write(STDOUT,'creatingconfigfile','install');
+        console_write(STDOUT, "\n", '', false);
     }
 
     $str  = '<?php  /// Moodle Configuration File '."\r\n";
@@ -644,12 +670,17 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
         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);
     }
 }
 
@@ -657,6 +688,7 @@ if (!file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 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;
 
 
@@ -1305,6 +1337,7 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     if ( $verbose > CLI_NO ) {
         print_newline();
         console_write(STDOUT,'upgradingcompleted');
+        console_write(STDOUT, "\n", '', false);
     }
 }
 
index 766dfa00ccfded53fe1ca399792139a66bd5b5b0..97e6864a626c05c73736e9c4f715fb4393698cb7 100644 (file)
@@ -208,7 +208,6 @@ thisdirection
 thislanguage
 unicoderecommended
 unicoderequired
-unsafedirname
 upgradingactivitymodule
 upgradingbackupdb
 upgradingblocksdb
index 31875b4b8f9008501f5d3a082dae42a3ccae6f19..97a348dcab35ea1aaa8d74c2297cfb90fd53c24c 100644 (file)
@@ -1,7 +1,7 @@
 <?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 
@@ -24,26 +24,26 @@ $string['adminlastname'] = 'Last Name :';
 $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
@@ -77,7 +77,7 @@ $string['databasesettings'] = 'Now you need to configure the database where most
        <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.';
@@ -186,13 +186,13 @@ $string['download'] = 'Download';
 $string['downloadlanguagebutton'] = 'Download the &quot;$a&quot; 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';
@@ -231,24 +231,24 @@ $string['inputdatadirectory']='Data Directory :';
 $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>
@@ -310,7 +310,7 @@ $string['safemodehelp'] = '<p>Moodle may have a variety of problems with safe mo
    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>
@@ -323,12 +323,11 @@ $string['siteshortname'] = 'Site short name :';
 $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';
@@ -340,7 +339,8 @@ $string['upgradingqtypeplugin'] = 'Upgrading Question/type 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
@@ -364,9 +364,10 @@ OPTIONS
 --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 
@@ -382,10 +383,10 @@ $string['welcomep60'] = 'The following pages will lead you through some easy to
     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 :';
 
 ?>
index d14cf1138c0d5d28be161fbc1be3037ceb227016..90ed04c53aea463da4c065aaf5dcfc52b75f9c67 100644 (file)
@@ -240,6 +240,7 @@ function validate_option_values($options){
     if (isset($values['lang'])) {
         if (!valid_language($INSTALL['lang'])) {
             console_write(STDERR,'invalidvalueforlanguage');
+        console_write(STDOUT, "\n", '', false);
         }
     }
     if (isset($values['webdir'])) {
@@ -370,7 +371,7 @@ function console_write($stream,$identifier,$module='install',$use_string_lib=tru
         fwrite($stream,$identifier);
     }
     if ($stream == STDERR) {
-        fwrite($stream,get_string('aborting',$module));
+        fwrite($stream, "\n\n" . get_string('aborting',$module) . "\n\n");
         die;
     }
 }
@@ -397,6 +398,7 @@ function read_int() {
         return $input;
     } else {
         console_write(STDERR,'invalidint');
+        console_write(STDOUT, "\n", '', false);
     }
 }
 //=========================================================================//
@@ -413,6 +415,7 @@ function read_int_range($start,$end) {
         return $input;
     } else {
         console_write(STDERR,'invalidintrange');
+        console_write(STDOUT, "\n", '', false);
     }
 
 }
@@ -432,6 +435,7 @@ function read_yes_no() {
         }
     } else {
         console_write(STDERR,'invalidyesno');
+        console_write(STDOUT, "\n", '', false);
     }
 }
 
@@ -459,6 +463,7 @@ function read_element($set=array()) {
         return $input;
     } else {
         console_write(STDERR,'invalidsetelement');
+        console_write(STDOUT, "\n", '', false);
     }
 }
 //=========================================================================//
@@ -576,18 +581,22 @@ function inst_check_php_version() {
  * @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);
     }
 }
@@ -627,6 +636,6 @@ function print_environment_status_detailed($env = array()) {
  */
 
 function print_newline() {
-    console_write(STDOUT,'newline','install');
+    console_write(STDOUT, "\n", '', false);
 }
 ?>
index f414c197ef726023df7540790506b56c04830fe3..344d9db2c7ea0c37880b01b60dc80cdbf063a6aa 100644 (file)
@@ -2354,7 +2354,7 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
         if ($return) {
             return $output;
         } else {
-            console_write(STDOUT,$output,'',false);
+            console_write(STDOUT,$output . "\n",'',false);
             return;
         }
     }
@@ -5762,7 +5762,7 @@ function error ($message, $link='') {
     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 ;
     }