function user_import_update_6002 in User Import 6.4
Same name and namespace in other branches
- 8 user_import.install \user_import_update_6002()
- 6.2 user_import.install \user_import_update_6002()
- 7 user_import.install \user_import_update_6002()
- 7.2 user_import.install \user_import_update_6002()
Move settings into the 'options' column.
File
- ./
user_import.install, line 198 - Import and update users from a comma separated file (csv).
Code
function user_import_update_6002() {
$ret = array();
$result = db_query("SELECT * FROM {user_import}");
// Update each import.
while ($import = db_fetch_array($result)) {
$options = unserialize($import['options']);
$options['first_line_skip'] = $import['first_line_skip'];
$options['contact'] = $import['contact'];
$options['username_space'] = $import['username_space'];
$options['send_email'] = $import['send_email'];
//Avoid using update_sql() as it has issues with serialized data.
db_query("UPDATE {user_import} SET options = '%s' WHERE import_id = %d", serialize($options), $import['import_id']);
}
$ret[] = update_sql('ALTER TABLE {user_import} DROP COLUMN first_line_skip');
$ret[] = update_sql('ALTER TABLE {user_import} DROP COLUMN contact');
$ret[] = update_sql('ALTER TABLE {user_import} DROP COLUMN username_space');
$ret[] = update_sql('ALTER TABLE {user_import} DROP COLUMN send_email');
return $ret;
}