MDL-8605 Preventing new user folder from being created when original folder is empty

This commit is contained in:
nicolasconnault 2007-10-11 14:19:05 +00:00
parent 67e56c0a3c
commit fc278e842e

View File

@ -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);
}