mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
1. get_records_csv also needs a table name in addition to file name.
2. is_readable() check before trying to fopen() http://, if you happen to not have an internet connection this prevents ugly failures.
This commit is contained in:
parent
6571aa7cbd
commit
a03d61346e
1 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@
|
|||
|
||||
$source = 'http://download.moodle.org/timezones/';
|
||||
if (!$importdone and ini_get('allow_url_fopen')) {
|
||||
if ($contents = file_get_contents($source)) { // Grab whole page
|
||||
if (is_readable($source) && $contents = file_get_contents($source)) { // Grab whole page
|
||||
if ($file = fopen($CFG->dataroot.'/temp/timezones.txt', 'w')) { // Make local copy
|
||||
fwrite($file, $contents);
|
||||
fclose($file);
|
||||
|
@ -95,7 +95,7 @@
|
|||
|
||||
$source = $CFG->dirroot.'/lib/timezones.txt';
|
||||
if (!$importdone and is_readable($source)) { // Distribution file
|
||||
if ($timezones = get_records_csv($source)) {
|
||||
if ($timezones = get_records_csv($source, 'timezone')) {
|
||||
update_timezone_records($timezones);
|
||||
$importdone = $source;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue