mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
d79d5ac276
List of changes: * New OOP API using PHP namespace \core\session\. * All handlers now update the sessions table consistently. * Experimental DB session support in Oracle. * Full support for session file handler (filesystem locking required). * New option for alternative session directory. * Official memcached session handler support. * Workaround for memcached version with non-functional gc. * Improved security - forced session id regeneration. * Improved compatibility with recent PHP releases. * Fixed borked CSS during install in debug mode. * Switched to file based sessions in new installs. * DB session setting disappears if DB does not support sessions. * DB session setting disappears if session handler specified in config.php. * Fast purging of sessions used in request only. * No legacy distinction - file, database and memcached support the same functionality. * Session handler name included in performance info. * Fixed user_loggedin and user_loggedout event triggering. * Other minor bugfixing and improvements. * Fixed database session segfault if MUC disposed before $DB. Limitations: * Session access time is now updated right after session start. * Support for $CFG->sessionlockloggedinonly was removed. * First request does not update userid in sessions table. * The timeouts may break badly if server hosting forces PHP.ini session settings. * The session GC is a lot slower, we do not rely on external session timeouts. * There cannot be any hooks triggered at the session write time. * File and memcached handlers do not support session lock acquire timeouts. * Some low level PHP session functions can not be used directly in Moodle code.
58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* script for bulk user delete operations
|
|
*/
|
|
|
|
require_once('../../config.php');
|
|
require_once($CFG->libdir.'/adminlib.php');
|
|
|
|
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
|
|
|
require_login();
|
|
admin_externalpage_setup('userbulk');
|
|
require_capability('moodle/user:delete', context_system::instance());
|
|
|
|
$return = $CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk.php';
|
|
|
|
if (empty($SESSION->bulk_users)) {
|
|
redirect($return);
|
|
}
|
|
|
|
echo $OUTPUT->header();
|
|
|
|
//TODO: add support for large number of users
|
|
|
|
if ($confirm and confirm_sesskey()) {
|
|
$notifications = '';
|
|
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
|
|
$rs = $DB->get_recordset_select('user', "id $in", $params);
|
|
foreach ($rs as $user) {
|
|
if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
|
|
unset($SESSION->bulk_users[$user->id]);
|
|
} else {
|
|
$notifications .= $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
|
|
}
|
|
}
|
|
$rs->close();
|
|
\core\session\manager::gc(); // Remove stale sessions.
|
|
echo $OUTPUT->box_start('generalbox', 'notice');
|
|
if (!empty($notifications)) {
|
|
echo $notifications;
|
|
} else {
|
|
echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
|
|
}
|
|
$continue = new single_button(new moodle_url($return), get_string('continue'), 'post');
|
|
echo $OUTPUT->render($continue);
|
|
echo $OUTPUT->box_end();
|
|
} else {
|
|
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
|
|
$userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
|
|
$usernames = implode(', ', $userlist);
|
|
echo $OUTPUT->heading(get_string('confirmation', 'admin'));
|
|
$formcontinue = new single_button(new moodle_url('user_bulk_delete.php', array('confirm' => 1)), get_string('yes'));
|
|
$formcancel = new single_button(new moodle_url('user_bulk.php'), get_string('no'), 'get');
|
|
echo $OUTPUT->confirm(get_string('deletecheckfull', '', $usernames), $formcontinue, $formcancel);
|
|
}
|
|
|
|
echo $OUTPUT->footer();
|