From a7d43f0d159cc4e65ae7d765cbf07d35226227c0 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 30 Dec 2007 22:19:36 +0000 Subject: [PATCH] MDL-12698, MDL-12569 - componentlib & langimport improvements and fixes; merged from MOODLE_19_STABLE --- admin/environment.php | 2 +- admin/langimport.php | 325 +++++++++++++++++++------------------ install.php | 2 +- install/stringnames.txt | 1 + lang/en_utf8/admin.php | 6 +- lang/en_utf8/error.php | 1 + lib/componentlib.class.php | 63 ++++--- lib/languages.md5 | 2 +- 8 files changed, 204 insertions(+), 198 deletions(-) diff --git a/admin/environment.php b/admin/environment.php index 4ceaa2f3ff48f..0003a25d24932 100644 --- a/admin/environment.php +++ b/admin/environment.php @@ -68,7 +68,7 @@ $status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED switch ($status) { case ERROR: - if ($cd->get_error() == 'remotedownloadnotallowed') { + if ($cd->get_error() == 'remotedownloaderror') { $a = new stdClass(); $a->url = 'http://download.moodle.org/environment/environment.zip'; $a->dest= $CFG->dataroot.'/'; diff --git a/admin/langimport.php b/admin/langimport.php index 0ae768bd75fe3..317f4dbf70d8f 100755 --- a/admin/langimport.php +++ b/admin/langimport.php @@ -6,6 +6,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); + require_once($CFG->libdir.'/filelib.php'); + require_once($CFG->libdir.'/componentlib.class.php'); admin_externalpage_setup('langimport'); @@ -17,25 +19,24 @@ $sitelang = optional_param('sitelangconfig', '', PARAM_FILE); define('INSTALLATION_OF_SELECTED_LANG', 2); - define('CHANGE_SITE_LANG', 3); define('DELETION_OF_SELECTED_LANG', 4); define('UPDATE_ALL_LANG', 5); - $strlang = get_string('langimport','admin'); - - $strlanguage = get_string("language"); - $strthislanguage = get_string("thislanguage"); - $title = $strlang; - - admin_externalpage_print_header(); + $strlang = get_string('langimport','admin'); + $strlanguage = get_string('language'); + $strthislanguage = get_string('thislanguage'); + $title = $strlang; //reset and diagnose lang cache permissions @unlink($CFG->dataroot.'/cache/languages'); if (file_exists($CFG->dataroot.'/cache/languages')) { - notify('Language cache can not be deleted, please check permissions in dataroot.'); + error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!'); } get_list_of_languages(true); //refresh lang cache + $notice_ok = array(); + $notice_error = array(); + switch ($mode){ case INSTALLATION_OF_SELECTED_LANG: ///installation of selected language pack @@ -44,26 +45,24 @@ @mkdir ($CFG->dataroot.'/temp/'); //make it in case it's a fresh install, it might not be there @mkdir ($CFG->dataroot.'/lang/'); - require_once($CFG->libdir.'/componentlib.class.php'); if ($cd = new component_installer('http://download.moodle.org', 'lang16', $pack.'.zip', 'languages.md5', 'lang')) { $status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED switch ($status) { - case ERROR: - if ($cd->get_error() == 'remotedownloadnotallowed') { - $a = new stdClass(); + case ERROR: + if ($cd->get_error() == 'remotedownloaderror') { + $a = new object(); $a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip'; $a->dest= $CFG->dataroot.'/lang'; - error(get_string($cd->get_error(), 'error', $a)); + error(get_string($cd->get_error(), 'error', $a), 'langimport.php'); } else { - error(get_string($cd->get_error(), 'error')); + error(get_string($cd->get_error(), 'error'), 'langimport.php'); } break; case INSTALLED: - get_list_of_languages(true); //refresh lang cache - redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1); + $notice_ok[] = get_string('langpackinstalled','admin',$pack); break; case UPTODATE: @@ -76,29 +75,20 @@ } break; - case CHANGE_SITE_LANG: //change site language - - if (confirm_sesskey()) { - $langconfig = get_record('config','name','lang'); - $langconfig->value = $sitelang; - if (!empty($sitelang) && update_record('config',$langconfig)){ - redirect('langimport.php', get_string('sitelangchanged','admin')); - } else { - error('Could not update the default site language!'); - } - } - - break; case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely - if (!$confirm && confirm_sesskey()) { + if ($uninstalllang == 'en_utf8') { + $notice_error[] = 'en_utf8 can not be uninstalled!'; + + } else if (!$confirm && confirm_sesskey()) { + admin_externalpage_print_header(); notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang), - 'langimport.php?mode=4&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(), + 'langimport.php?mode='.DELETION_OF_SELECTED_LANG.'&uninstalllang='.$uninstalllang.'&confirm=1&sesskey='.sesskey(), 'langimport.php'); + print_footer(); + die; + } else if (confirm_sesskey()) { - if ($uninstalllang == 'en_utf8') { - error ('en_utf8 can not be uninstalled!'); - } $dest1 = $CFG->dataroot.'/lang/'.$uninstalllang; $dest2 = $CFG->dirroot.'/lang/'.$uninstalllang; $rm1 = false; @@ -112,9 +102,9 @@ get_list_of_languages(true); //refresh lang cache //delete the direcotries if ($rm1 or $rm2) { - redirect('langimport.php', get_string('langpackremoved','admin'), 3); + $notice_ok[] = get_string('langpackremoved','admin'); } else { //nothing deleted, possibly due to permission error - error('An error has occurred, language pack is not completely uninstalled, please check file permissions'); + $notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions'; } } break; @@ -123,7 +113,6 @@ //0th pull a list from download.moodle.org, //key = langname, value = md5 - $source = 'http://download.moodle.org/lang16/languages.md5'; $md5array = array(); $updated = 0; //any packs updated? $alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs @@ -131,7 +120,7 @@ $packs = array(); //all the packs that needs updating - if (!$availablelangs = proxy_url($source)) { + if (!$availablelangs = get_remote_list_of_languages()) { print_error('cannotdownloadlanguageupdatelist'); } @@ -140,8 +129,12 @@ $md5array[$alang[0]] = $alang[1]; } - //filtering out non-16 packs + //filtering out non-16 and unofficial packs foreach ($alllangs as $clang) { + if (!array_key_exists($clang, $md5array)) { + $notice_ok[] = get_string('langpackupdateskipped', 'admin', $clang); + continue; + } $dest1 = $CFG->dataroot.'/lang/'.$clang; $dest2 = $CFG->dirroot.'/lang/'.$clang; @@ -163,6 +156,7 @@ if ($pack == 'en_utf8') { // no update for en_utf8 continue; } + //1. delete old director(ies) $dest1 = $CFG->dataroot.'/lang/'.$pack; @@ -170,38 +164,40 @@ $rm1 = false; $rm2 = false; if (file_exists($dest1)) { - $rm1 = remove_dir($dest1); + if (!remove_dir($dest1)) { + $notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.'; + continue; + } } if (file_exists($dest2)) { - $rm2 = remove_dir($dest2); - } - if (!($rm1 || $rm2)) { - error ('could not delete old directory, update failed'); + if (!remove_dir($dest2)) { + $notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.'; + continue; + } } //2. copy & unzip into new - require_once($CFG->libdir.'/componentlib.class.php'); if ($cd = new component_installer('http://download.moodle.org', 'lang16', $pack.'.zip', 'languages.md5', 'lang')) { $status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED switch ($status) { case ERROR: - if ($cd->get_error() == 'remotedownloadnotallowed') { + if ($cd->get_error() == 'remotedownloaderror') { $a = new stdClass(); $a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip'; $a->dest= $CFG->dataroot.'/lang'; - error(get_string($cd->get_error(), 'error', $a)); + error(get_string($cd->get_error(), 'error', $a)); // not probable } else { - error(get_string($cd->get_error(), 'error')); + error(get_string($cd->get_error(), 'error')); // not probable } break; case UPTODATE: //Print error string or whatever you want to do break; case INSTALLED: - notify(get_string('langpackupdated','admin',$pack), 'notifysuccess'); + $notice_ok[] = get_string('langpackupdated', 'admin', $pack); $updated = true; //Print/do whatever you want break; @@ -213,130 +209,136 @@ } if ($updated) { - notice(get_string('langupdatecomplete','admin'), 'langimport.php'); + $notice_ok[] = get_string('langupdatecomplete','admin'); } else { - notice(get_string('nolangupdateneeded','admin'), 'langimport.php'); + $notice_ok[] = get_string('nolangupdateneeded','admin'); } break; + } //close of main switch - default: //display choice mode - $source = 'http://download.moodle.org/lang16/languages.md5'; - $remote = 0; //flag for reading from remote or local + admin_externalpage_print_header(); - if ($availablelangs = proxy_url($source)) { - $remote = 1; - } else { - $availablelangs = get_local_list_of_languages(); - } -/* - if ($fp = fopen($source, 'r')){ /// attempt to get the list from Moodle.org. - while(!feof ($fp)) { - $availablelangs[] = split(',', fgets($fp,1024)); - } - $remote = 1; //can read from download.moodle.org - } else { /// fopen failed, we find local copy of list. - $availablelangs = get_local_list_of_languages(); - } -*/ - if (!$remote) { - print_box_start(); - print_string('remotelangnotavailable','admin',$CFG->dataroot.'/lang/'); - print_box_end(); - } + $installedlangs = get_list_of_languages(true, true); - print_box_start(); - echo ''; - echo ''; - } - $empty = 0; - } - } - if ($remote) { - echo ''; - echo '
'; - } - echo ''; - echo ''; + if ($notice_error) { + $info = implode('
', $notice_error); + notify($info, 'notifyproblem'); + } + + print_box_start(); + echo '
'; - echo '
'; - echo '
'; - echo ''; - $installedlangs = get_list_of_languages(false, true); + if ($availablelangs = get_remote_list_of_languages()) { + $remote = 1; + } else { + $remote = 0; //flag for reading from remote or local + $availablelangs = get_local_list_of_languages(); + } - /// display installed langs here + if (!$remote) { + print_box_start(); + print_string('remotelangnotavailable', 'admin', $CFG->dataroot.'/lang/'); + print_box_end(); + } - echo '
\n"; - echo ''; - echo '
'; - echo '
'; - echo '
'; - echo '
'; - echo '
'; - echo '
'; - echo '
'; - echo '
'; - - /// Display option to change site language - - /// display to be installed langs here - - echo '
'; - //availabe langs table - $empty = 1; //something to pring - - /// if this language pack is not already installed, then we allow installation - - echo '
'; - echo '
'; - echo ''; - echo '
\n"; - if ($remote) { - echo '
'.$alang[2].''.get_string('download','admin').'
'; + echo ''; } + $empty = 0; + } + } + if ($remote) { + echo ''; + echo '
'; + } + echo ''; + echo ''; - //close available langs table - echo '
'; + echo '
'; + echo '
'; + echo ''; + + /// display installed langs here + + echo '
\n"; + echo ''; + echo '
'; + echo '
'; + echo '
'; + + if ($remote) { + echo '
'; + echo '
'; + echo '
'; + echo '
'; + echo '
'; + } + + /// Display option to change site language + + /// display to be installed langs here + + echo '
'; + //availabe langs table + $empty = 1; //something to pring + + /// if this language pack is not already installed, then we allow installation + + echo '
'; + echo '
'; + echo ''; + echo '
\n"; + if ($remote) { + echo '
'.$alang[2].''.get_string('download','admin').'
'; - print_box_end(); - break; + if ($empty) { + echo '
'; + print_string('nolanguagetodownload','admin'); + } - } //close of main switch + //close available langs table + echo ''; + print_box_end(); admin_externalpage_print_footer(); - /* returns a list of available language packs from a + /** + * Returns a list of available language packs from a * local copy shipped with standard moodle distro * this is for site that can't perform fopen * @return array */ function get_local_list_of_languages() { global $CFG; - $source = $CFG->wwwroot.'/lib/languages.md5'; + $source = $CFG->dirroot.'/lib/languages.md5'; $availablelangs = array(); - if ($fp = fopen($source, 'r')){ + if ($fp = fopen($source, 'r')) { while(!feof ($fp)) { $availablelangs[] = split(',', fgets($fp,1024)); } @@ -344,7 +346,8 @@ function get_local_list_of_languages() { return $availablelangs; } - /* checks the md5 of the zip file, grabbed from download.moodle.org, + /** + * checks the md5 of the zip file, grabbed from download.moodle.org, * against the md5 of the local language file from last update * @param string $lang * @param string $md5check @@ -359,23 +362,25 @@ function is_installed_lang($lang, $md5check) { return false; } - //returns an array of languages, or false if can not read from source - function proxy_url($url) { - global $CFG; - + /** + * Returns the latest list of available language packs from + * moodle.org + * @return array or false if can not download + */ + function get_remote_list_of_languages() { + $source = 'http://download.moodle.org/lang16/languages.md5'; $availablelangs = array(); - if( $content = download_file_content($url) ){ - + if ($content = download_file_content($source)) { $alllines = split("\n", $content); - foreach($alllines as $line){ - if(!empty($line)){ + foreach($alllines as $line) { + if (!empty($line)){ $availablelangs[] = split(',', $line); } } - return $availablelangs; - }else{ + + } else { return false; } } diff --git a/install.php b/install.php index 1cd2368f9bc9f..18e8156ee3c80 100644 --- a/install.php +++ b/install.php @@ -470,7 +470,7 @@ $status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED switch ($status) { case ERROR: - if ($cd->get_error() == 'remotedownloadnotallowed') { + if ($cd->get_error() == 'remotedownloaderror') { $a = new stdClass(); $a->url = 'http://download.moodle.org/lang16/'.$pack.'.zip'; $a->dest= $CFG->dataroot.'/lang'; diff --git a/install/stringnames.txt b/install/stringnames.txt index 243e1551d0d42..e565e5569f94a 100644 --- a/install/stringnames.txt +++ b/install/stringnames.txt @@ -124,6 +124,7 @@ postgres7 previous qtyperqpwillberemoved qtyperqpwillberemovedanyway +remotedownloaderror remotedownloadnotallowed report restricted diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 60627483c7218..65c806965bd3b 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -400,10 +400,12 @@ $string['langlist'] = 'Languages on language menu'; $string['langmenu'] = 'Display language menu'; $string['langnoeditenglish'] = 'Can\'t overwrite the base english language pack. Please switch lang directory to make local changes'; +$string['langpackinstalled'] = 'Language pack $a was successfully installed'; $string['langpackmaintaining'] = 'Language pack maintaining'; $string['langpackremoved'] = 'Language pack was uninstalled'; $string['langpacks'] = 'Language packs'; -$string['langpackupdated'] = 'Language pack $a was successfully installed'; +$string['langpackupdated'] = 'Language pack $a was successfully updated'; +$string['langpackupdateskipped'] = 'Update of $a language pack skipped'; $string['langpackwillbeupdated'] = 'Note for translators: During the upgrade, Moodle will try to update your language pack. Your modifications in non-local language folders will be overwritten.'; $string['langrmyourself'] = 'To prevent data loss, lang.php is not able to overwrite existing file with empty content. Please, remove the file manually in order to get rid of it.'; $string['languagesettings'] = 'Language settings'; @@ -651,7 +653,7 @@ $string['unsupported'] = 'Unsupported'; $string['updateaccounts'] = 'Update existing accounts'; $string['updatecomponent'] = 'Update Component'; -$string['updatelangs'] = 'Update all local language packs'; +$string['updatelangs'] = 'Update all installed language packs'; $string['updatetimezones'] = 'Update timezones'; $string['upgradeforumread'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts.
To use this functionality you need to update your tables.'; $string['upgradeforumreadinfo'] = 'A new feature has been added in Moodle 1.5 to track read/unread forum posts. To use this functionality you need to update your tables with all the tracking information for existing posts. Depending on the size of your site this can take a long time (hours) and can be quite taxing on the database, so it\'s best to do it during a quiet period. However, your site will continue functioning during this upgrade and users won\'t be affected. Once you start this process you should let it finish (keep your browser window open). However, if you stop the process by closing the window: don\'t worry, you can start over.

Do you want to start the upgrading process now?'; diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index 56ec11b7d0e0f..001ce459d2586 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -83,6 +83,7 @@ $string['pleasereport'] = 'If you have time, please let us know what you were trying to do when the error occurred:'; $string['pluginrequirementsnotmet'] = 'Plugin \"$a->pluginname\" ($a->pluginversion) could not be installed. It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).'; $string['processingstops'] = 'Processing stops here. Remaining records ignored.'; +$string['remotedownloaderror'] = 'Download of component to your server failed, please verify proxy settings, PHP cURL extension is highly recommended.

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).

You must download the url\">$a->url file manually, copy it to \"$a->dest\" in your server and unzip it there.'; $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.'; $string['scheduledbackupsdisabled'] = 'Scheduled backups have been disabled by the server admin'; diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index e4e1758903aa2..1130393d6e761 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -7,7 +7,7 @@ // Moodle - Modular Object-Oriented Dynamic Learning Environment // // http://moodle.com // // // -// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // +// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // // (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com // // // // This program is free software; you can redistribute it and/or modify // @@ -27,19 +27,19 @@ // This library includes all the necessary stuff to use the one-click // download and install feature of Moodle, used to keep updated some // items like languages, pear, enviroment... i.e, components. -// -// It has been developed harcoding some important limits that are +// +// It has been developed harcoding some important limits that are // explained below: // - It only can check, download and install items under moodledata. // - Every downloadeable item must be one zip file. // - The zip file root content must be 1 directory, i.e, everything // is stored under 1 directory. -// - Zip file name and root directory must have the same name (but +// - Zip file name and root directory must have the same name (but // the .zip extension, of course). // - Every .zip file must be defined in one .md5 file that will be // stored in the same remote directory than the .zip file. // - The name of such .md5 file is free, although it's recommended -// to use the same name than the .zip (that's the default +// to use the same name than the .zip (that's the default // assumption if no specified). // - Every remote .md5 file will be a comma separated (CVS) file where each // line will follow this format: @@ -52,7 +52,6 @@ // - Will contain the md5 od the latest installed component // With all these details present, the process will perform this tasks: // - Perform security checks. Only admins are allowed to use this for now. -// - Perform server checks. fopen must allow to open remote URLs. // - Read the .md5 file from source (1). // - Extract the correct line for the .zip being requested. // - Compare it with the local .md5 file (2). @@ -68,21 +67,20 @@ // - If different: // - ERROR. Old package won't be modified. We shouldn't // reach here ever. -// - If fopen is not available, a message text about how to do -// the process manually (remotedownloadnotallowed) must be -// built to explain it. +// - If component download is not possible, a message text about how to do +// the process manually (remotedownloaderror) must be displayed to explain it. // // General Usage: // // To install one component: // // require_once($CFG->libdir.'/componentlib.class.php'); -// if ($cd = new component_installer('http://download.moodle.org', 'lang16', +// if ($cd = new component_installer('http://download.moodle.org', 'lang16', // 'es_utf8.zip', 'languages.md5', 'lang')) { // $status = $cd->install(); //returns ERROR | UPTODATE | INSTALLED // switch ($status) { -// case ERROR: -// if ($cd->get_error() == 'remotedownloadnotallowed') { +// case ERROR: +// if ($cd->get_error() == 'remotedownloaderror') { // $a = new stdClass(); // $a->url = 'http://download.moodle.org/lang16/es_utf8.zip'; // $a->dest= $CFG->dataroot.'/lang'; @@ -144,7 +142,7 @@ class component_installer { var $sourcebase; /// Full http URL, base for downloadable items - var $zippath; /// Relative path (from sourcebase) where the + var $zippath; /// Relative path (from sourcebase) where the /// downloadeable item resides. var $zipfilename; /// Name of the .zip file to be downloaded var $md5filename; /// Name of the .md5 file to be read @@ -166,12 +164,12 @@ class component_installer { * without performing any check at all. * * @param string Full http URL, base for downloadeable items - * @param string Relative path (from sourcebase) where the + * @param string Relative path (from sourcebase) where the * downloadeable item resides * @param string Name of the .zip file to be downloaded - * @param string Name of the .md5 file to be read (default '' = same + * @param string Name of the .md5 file to be read (default '' = same * than zipfilename) - * @param string Relative path (from moodledata) where the .zip file will + * @param string Relative path (from moodledata) where the .zip file will * be expanded (default='' = moodledataitself) * @return object */ @@ -193,8 +191,7 @@ function component_installer ($sourcebase, $zippath, $zipfilename, $md5filename= /** * This function will check if everything is properly set to begin - * one installation. It'll check for fopen wrappers enabled and - * admin privileges. Also, it will check for required settings + * one installation. Also, it will check for required settings * and will fill everything as needed. * * @return boolean true/false (plus detailed error in errorstring) @@ -204,11 +201,6 @@ function check_requisites() { $this->requisitesok = false; - /// Check for fopen remote enabled - if (!ini_get('allow_url_fopen')) { - $this->errorstring='remotedownloadnotallowed'; - return false; - } /// Check that everything we need is present if (empty($this->sourcebase) || empty($this->zippath) || empty($this->zipfilename)) { $this->errorstring='missingrequiredfield'; @@ -231,7 +223,7 @@ function check_requisites() { return false; } } - /// Calculate the componentnamea + /// Calculate the componentname $pos = stripos($this->zipfilename, '.zip'); $this->componentname = substr($this->zipfilename, 0, $pos); /// Calculate md5filename if it's empty @@ -304,7 +296,7 @@ function install() { $destinationdir = $CFG->dataroot.'/'.$this->destpath; $destinationcomponent = $destinationdir.'/'.$this->componentname; @remove_dir($destinationcomponent.'_old'); //Deleting possible old components before - @rename ($destinationcomponent, $destinationcomponent.'_old'); //Moving to a safe place + @rename ($destinationcomponent, $destinationcomponent.'_old'); //Moving to a safe place /// Unzip new version if (!unzip_file($zipfile, $destinationdir, false)) { /// Error so, go back to the older @@ -359,7 +351,7 @@ function need_upgrade() { } } - /** + /** * This function will change the zip file to install on the fly * to allow the class to process different components of the * same md5 file without intantiating more objects. @@ -416,7 +408,9 @@ function get_component_md5() { } /// Get all components of md5 file if (!$comp_arr = $this->get_all_components_md5()) { - $this->errorstring='cannotdownloadcomponents'; + if (empty($this->errorstring)) { + $this->errorstring='cannotdownloadcomponents'; + } return false; } /// Search for the componentname component @@ -436,8 +430,8 @@ function get_component_md5() { return $component[1]; } - /** - * This function allows you to retrieve the complete array of components found in + /** + * This function allows you to retrieve the complete array of components found in * the md5filename * * @return array array of components in md5 file or false if error @@ -493,12 +487,15 @@ function get_all_components_md5() { $this->cachedmd5components[$source] = $comp_arr; } else { /// Return error - $this->errorstring='cannotdownloadcomponents'; + $this->errorstring='remotedownloaderror'; return false; } } - /// If there is no commponents, error - if (empty($comp_arr)) { + /// If there is no commponents or erros found, error + if (!empty($this->errorstring)) { + return false; + + } else if (empty($comp_arr)) { $this->errorstring='cannotdownloadcomponents'; return false; } @@ -515,7 +512,7 @@ function get_error() { } /** This function returns the extramd5 field (optional in md5 file) - * + * * @return string the extramd5 field */ function get_extra_md5_field() { diff --git a/lib/languages.md5 b/lib/languages.md5 index 5c9b16ba241dd..e18daf39b433d 100644 --- a/lib/languages.md5 +++ b/lib/languages.md5 @@ -4,7 +4,7 @@ be_utf8,f38e8e0b312376eec708fd9f95aa04fb,Беларуская bg_utf8,676f4a9b93800c1cacbf9ca4ee5010b2,Български bs_utf8,9ad1de9a6ab3f54f59eeab8d7ce867d1,Bosanski ca_utf8,dbe5f8d6a111839a5d89533a5ce37815,Català -cs_utf8,87ae11d3bac8effd71a06b43da80f401,Cestina +cs_utf8,87ae11d3bac8effd71a06b43da80f401,Čeština da_utf8,066302a39241bfd7db7b3dfa0e53d658,Dansk de_du_utf8,c5cc95e33762bb1b4faba54824b383f6,Deutsch - Du de_utf8,d04fcaf901ae31a65c273211650c7239,Deutsch