Commit 87e94883 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Let bulk import continue processing after bad leap2a file (bug #823013)



A couple of 'continue' statements look to be leftovers from a previous
version of this script that added users in a loop.  Now that they each
user is added with a redirect back to the page, we should do this
correctly after a failure to unzip or process a leap2a file.

Change-Id: I4d412bcfe56483b0205485157be7f7cec91c6bac
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 0b4b644a
......@@ -113,6 +113,12 @@ $form = array(
* Work-around the redirection limit of Firefox (http://kb.mozillazine.org/Network.http.redirection-limit)
*/
function meta_redirect() {
global $SESSION, $LEAP2AFILES, $ADDEDUSERS, $FAILEDUSERS;
$SESSION->set('bulkimport_leap2afiles', $LEAP2AFILES);
$SESSION->set('bulkimport_addedusers', $ADDEDUSERS);
$SESSION->set('bulkimport_failedusers', $FAILEDUSERS);
$url = get_config('wwwroot') . '/admin/users/bulkimport.php';
print_meta_redirect($url);
exit;
......@@ -250,14 +256,14 @@ function import_next_user() {
if ($returnvar != 0) {
$FAILEDUSERS[$username] = get_string('unzipfailed', 'admin', hsc($filename));
log_debug("unzip command failed with return value $returnvar");
continue;
meta_redirect();
}
$leap2afilename = $uploaddir . 'leap2a.xml';
if (!is_file($leap2afilename)) {
$FAILEDUSERS[$username] = get_string('noleap2axmlfiledetected', 'admin');
log_debug($FAILEDUSERS[$username]);
continue;
meta_redirect();
}
// If the username is already taken, append something to the end
......@@ -322,10 +328,6 @@ function import_next_user() {
$ADDEDUSERS[] = get_record('usr', 'id', $user->id);
}
$SESSION->set('bulkimport_leap2afiles', $LEAP2AFILES);
$SESSION->set('bulkimport_addedusers', $ADDEDUSERS);
$SESSION->set('bulkimport_failedusers', $FAILEDUSERS);
meta_redirect();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment