Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
b84b5c52
Commit
b84b5c52
authored
Feb 16, 2007
by
Nigel McNie
Committed by
Nigel McNie
Feb 16, 2007
Browse files
Put the CSV file loading in a transaction for safety
parent
547d4209
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/admin/users/uploadcsv.php
View file @
b84b5c52
...
...
@@ -158,6 +158,7 @@ function uploadcsv_validate(Pieform $form, $values) {
function
uploadcsv_submit
(
Pieform
$form
,
$values
)
{
global
$SESSION
,
$CSVDATA
;
log_info
(
'Inserting users from the CSV file'
);
db_begin
();
foreach
(
$CSVDATA
as
$record
)
{
log_debug
(
'adding user '
.
$record
[
0
]);
$user
=
new
StdClass
;
...
...
@@ -175,6 +176,7 @@ function uploadcsv_submit(Pieform $form, $values) {
handle_event
(
'createuser'
,
$user
);
}
db_commit
();
log_info
(
'Inserted '
.
count
(
$CSVDATA
)
.
' records'
);
$SESSION
->
add_ok_msg
(
get_string
(
'uploadcsvusersaddedsuccessfully'
,
'admin'
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment