示例#1
0
            } else {
                // We don't need the zip file any longer, so delete it to make
                // it easier to process the rest of the files inside the directory.
                @unlink($dstfile);
                $results = array('errors' => 0, 'updated' => 0);
                process_directory($zipdir, $userfields[$userfield], $overwritepicture, $results);
                // Finally remove the temporary directory with all the user images and print some stats.
                remove_dir($zipdir);
                notify(get_string('usersupdated', 'admin') . ": " . $results['updated']);
                notify(get_string('errors', 'admin') . ": " . $results['errors']);
                echo '<hr />';
            }
        }
    }
}
$mform->display();
admin_externalpage_print_footer();
exit;
// ----------- Internal functions ----------------
/**
 * Create a unique temporary directory with a given prefix name,
 * inside a given directory, with given permissions. Return the
 * full path to the newly created temp directory.
 *
 * @param string $dir where to create the temp directory.
 * @param string $prefix prefix for the temp directory name (default '')
 * @param string $mode permissions for the temp directory (default 700)
 *
 * @return string The full path to the temp directory.
 */
function my_mktempdir($dir, $prefix = '', $mode = 0700)