mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-8605 Preventing new user folder from being created when original folder is empty
This commit is contained in:
parent
67e56c0a3c
commit
fc278e842e
@ -2555,6 +2555,11 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
|
||||
foreach ($folders as $userid) {
|
||||
$olddir = $oldusersdir . '/' . $userid;
|
||||
$files = get_directory_list($olddir);
|
||||
|
||||
if (empty($files)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create new user directory
|
||||
if (!$newdir = make_user_directory($userid)) {
|
||||
@ -2564,7 +2569,6 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
|
||||
// Move contents of old directory to new one
|
||||
if (file_exists($olddir) && file_exists($newdir)) {
|
||||
$files = get_directory_list($olddir);
|
||||
foreach ($files as $file) {
|
||||
copy($olddir . '/' . $file, $newdir . '/' . $file);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user