mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-18066 - import_backup_file_silently - better handling of missing $USER. Merged from 19_STABLE
This commit is contained in:
parent
b894086df5
commit
569c693719
1 changed files with 1 additions and 1 deletions
|
@ -497,7 +497,7 @@
|
||||||
function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false, $preferences=array()) {
|
function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false, $preferences=array()) {
|
||||||
global $CFG,$SESSION,$USER, $DB; // is there such a thing on cron? I guess so..
|
global $CFG,$SESSION,$USER, $DB; // is there such a thing on cron? I guess so..
|
||||||
global $restore; // ick
|
global $restore; // ick
|
||||||
if (empty($USER)) {
|
if (empty($USER) || empty($USER->id)) {
|
||||||
session_set_user(get_admin());
|
session_set_user(get_admin());
|
||||||
$USER->admin = 1; // not sure why, but this doesn't get set
|
$USER->admin = 1; // not sure why, but this doesn't get set
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue