MDL-18066 - import_backup_file_silently - better handling of missing $USER. Credit goes to Gabriel Mazetto.

This commit is contained in:
stronk7
2009-01-30 09:56:16 +00:00
parent 613d0f81c4
commit 5648e66cb2
+1 -1
View File
@@ -649,7 +649,7 @@
function import_backup_file_silently($pathtofile,$destinationcourse,$emptyfirst=false,$userdata=false, $preferences=array()) {
global $CFG,$SESSION,$USER; // is there such a thing on cron? I guess so..
global $restore; // ick
if (empty($USER)) {
if (empty($USER) || empty($USER->id)) {
$USER = get_admin();
$USER->admin = 1; // not sure why, but this doesn't get set
}