Zeile 12 | Zeile 12 |
---|
function task_userpruning($task) { global $db, $lang, $mybb, $cache;
|
function task_userpruning($task) { global $db, $lang, $mybb, $cache;
|
|
|
if($mybb->settings['enablepruning'] != 1)
|
if($mybb->settings['enablepruning'] != 1)
|
{
| {
|
return; }
|
return; }
|
|
|
// Are we pruning by posts? if($mybb->settings['enableprunebyposts'] == 1) { $in_usergroups = array(); $users = array();
|
// Are we pruning by posts? if($mybb->settings['enableprunebyposts'] == 1) { $in_usergroups = array(); $users = array();
|
|
|
$usergroups = $cache->read("usergroups"); foreach($usergroups as $gid => $usergroup) {
| $usergroups = $cache->read("usergroups"); foreach($usergroups as $gid => $usergroup) {
|
Zeile 34 | Zeile 34 |
---|
} $in_usergroups[] = $gid; }
|
} $in_usergroups[] = $gid; }
|
|
|
// If we're not pruning unactivated users, then remove them from the criteria if($mybb->settings['pruneunactived'] == 0) { $key = array_search('5', $in_usergroups); unset($in_usergroups[$key]); }
|
// If we're not pruning unactivated users, then remove them from the criteria if($mybb->settings['pruneunactived'] == 0) { $key = array_search('5', $in_usergroups); unset($in_usergroups[$key]); }
|
| // Exclude super admins $exclude_super_admins = not_super_admins(true);
|
$regdate = TIME_NOW-(intval($mybb->settings['dayspruneregistered'])*24*60*60);
|
$regdate = TIME_NOW-(intval($mybb->settings['dayspruneregistered'])*24*60*60);
|
$query = $db->simple_select("users", "uid", "regdate <= ".intval($regdate)." AND postnum <= ".intval($mybb->settings['prunepostcount'])." AND usergroup IN(".$db->escape_string(implode(',', $in_usergroups)).")");
| $query = $db->simple_select("users", "uid", "regdate <= ".intval($regdate)." AND postnum <= ".intval($mybb->settings['prunepostcount'])." AND usergroup IN(".$db->escape_string(implode(',', $in_usergroups)).")".$exclude_super_admins);
|
while($user = $db->fetch_array($query)) { $users[$user['uid']] = $user['uid']; } }
|
while($user = $db->fetch_array($query)) { $users[$user['uid']] = $user['uid']; } }
|
|
|
// Are we pruning unactivated users? if($mybb->settings['pruneunactived'] == 1) {
| // Are we pruning unactivated users? if($mybb->settings['pruneunactived'] == 1) {
|
Zeile 60 | Zeile 62 |
---|
$users[$user['uid']] = $user['uid']; } }
|
$users[$user['uid']] = $user['uid']; } }
|
|
|
if(!empty($users)) { $uid_list = $db->escape_string(implode(',', $users));
|
if(!empty($users)) { $uid_list = $db->escape_string(implode(',', $users));
|
|
|
// Delete the user $db->delete_query("userfields", "ufid IN({$uid_list})"); $db->delete_query("privatemessages", "uid IN({$uid_list})");
| // Delete the user $db->delete_query("userfields", "ufid IN({$uid_list})"); $db->delete_query("privatemessages", "uid IN({$uid_list})");
|
Zeile 110 | Zeile 112 |
---|
{ $moderation->delete_post($post['pid']); }
|
{ $moderation->delete_post($post['pid']); }
|
}
| }
|
else { // We're just updating the UID
| else { // We're just updating the UID
|
Zeile 120 | Zeile 122 |
---|
// Update forum stats update_stats(array('numusers' => '-'.intval($num_deleted)));
|
// Update forum stats update_stats(array('numusers' => '-'.intval($num_deleted)));
|
|
|
$cache->update_moderators(); $cache->update_banned(); }
|
$cache->update_moderators(); $cache->update_banned(); }
|
|
|
add_task_log($task, $lang->task_userpruning_ran); } ?>
| add_task_log($task, $lang->task_userpruning_ran); } ?>
|