if (isset($errormsg)) {
     console_write_error($errormsg, '', false);
 }
 // Print Environment Status
 if ($verbose > CLI_NO) {
     print_environment_status($environment_results);
 }
 //==============================================================================//
 //download the language pack if it doesn't exist
 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("\n", '', false);
         console_write("\n", '', false);
         console_write('downloadlanguagepack', 'install');
         $download_lang_pack = read_yes_no();
         if ($download_lang_pack == 'yes') {
             $downloadsuccess = false;
             /// Create necessary lang dir
             if (!make_upload_directory('lang', false)) {
                 console_write_error(get_string('cannotcreatelangdir', 'error'), false);
             }
             /// Download and install component
             if (($cd = new component_installer('http://download.moodle.org', 'lang16', $INSTALL['lang'] . '.zip', 'languages.md5', 'lang')) && empty($errormsg)) {
                 $status = $cd->install();
                 //returns ERROR | UPTODATE | INSTALLED
                 switch ($status) {
                     case ERROR:
                         if ($cd->get_error() == 'remotedownloadnotallowed') {
                             $a = new stdClass();
                             $a->url = 'http://download.moodle.org/lang16/' . $pack . '.zip';
Beispiel #2
0
/**
 * Read a boolean parameter from the input
 *
 * @return boolean
 */
function read_boolean()
{
    $input = read_yes_no();
    return clean_param($input, PARAM_BOOL);
}