Недавно заметил что после удаления юзера мусор остается и база растет, хотя кол-во реальных юзеров в БД остается такой же, так же после удаления юзера остаются его комменты и многое др. Вот исправление:
Открываем include/class_user.php по дефолту строки от 1990 по 2057 отвечают за удаление всего мусора из бд со всеми его побрякушками.
заменяем это:
PHP:
// THIS METHOD DELETES THE USER CURRENTLY ASSOCIATED WITH THIS OBJECT
// INPUT:
// OUTPUT:
function user_delete()
{
global $database, $url, $global_plugins;
// CALL USER DELETE HOOK
($hook = SE_Hook::exists('se_user_delete')) ? SE_Hook::call($hook, $this->user_info['user_id']) : NULL;
// DELETE USER, USERSETTING, PROFILE, STYLES TABLE ROWS
$database->database_query("DELETE FROM se_users WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_usersettings WHERE usersetting_user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_profilevalues WHERE profilevalue_user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_profilestyles WHERE profilestyle_user_id='{$this->user_info['user_id']}' LIMIT 1");
// DELETE USER-OWNED AND PROFILE COMMENTS
$database->database_query("DELETE FROM se_profilecomments WHERE profilecomment_user_id='{$this->user_info['user_id']}'");
// DELETE NOTIFICATIONS SENT TO OTHER USERS FOR A PM THEY SENT
$database->database_query("DELETE se_notifys.* FROM se_pmconvoops LEFT JOIN se_notifys ON se_notifys.notify_object_id=se_pmconvoops.pmconvoop_pmconvo_id WHERE se_notifys.notify_notifytype_id=2 && se_pmconvoops.pmconvoop_user_id='{$this->user_info['user_id']}'");
// DELETE PMCONVOS AND PMS WHERE THE DELETED USER AND THE OTHER USER ARE THE ONLY TWO INSIDE, OR WHERE THE DELETED USER WAS THE INITIAL SENDER
$database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=pmconvo_recipients-1 WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
$database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=0 WHERE pmconvoop_user_id='{$this->user_info['user_id']}' && pmconvoop_user_id=(SELECT pm_authoruser_id FROM se_pms WHERE pm_pmconvo_id=pmconvo_id ORDER BY pm_id ASC)");
$database->database_query("DELETE FROM se_pmconvoops WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
// THIS MAY ALSO DELETE OTHER CONVOS THAT WERE PARTIALLY REMOVED
$database->database_query("DELETE se_pms.*, se_pmconvos.*, se_pmconvoops.* FROM se_pmconvos LEFT JOIN se_pms ON pm_pmconvo_id=pmconvo_id LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id WHERE pmconvo_recipients<2");
// DELETE CONNECTIONS TO AND FROM USER
$database->database_query("DELETE FROM se_friends, se_friendexplains USING se_friends LEFT JOIN se_friendexplains ON se_friends.friend_id=se_friendexplains.friendexplain_friend_id WHERE se_friends.friend_user_id1='{$this->user_info['user_id']}' OR se_friends.friend_user_id2='{$this->user_info['user_id']}'");
// DELETE ALL OF THIS USER'S REPORTS
$database->database_query("DELETE FROM se_reports WHERE report_user_id='{$this->user_info['user_id']}'");
// DELETE USER ACTIONS
$database->database_query("DELETE FROM se_actions, se_actionmedia USING se_actions LEFT JOIN se_actionmedia ON se_actions.action_id=se_actionmedia.actionmedia_action_id WHERE action_user_id='{$this->user_info['user_id']}'");
// DELETE USER NOTIFICATIONS
$database->database_query("DELETE FROM se_notifys WHERE notify_user_id='{$this->user_info['user_id']}'");
// DELETE NOTIFICATIONS BY USER
$database->database_query("DELETE FROM se_notifys WHERE notify_notifytype_id=1 AND notify_object_id='{$this->user_info['user_id']}'");
// DELETE USER'S FILES
if( is_dir($url->url_userdir($this->user_info['user_id'])) )
$dir = $url->url_userdir($this->user_info['user_id']);
else
$dir = ".".$url->url_userdir($this->user_info['user_id']);
if( $dh = @opendir($dir) )
{
while( ($file = @readdir($dh)) !== false )
{
if( $file != "." && $file != ".." )
{
@unlink($dir.$file);
}
}
@closedir($dh);
}
@rmdir($dir);
$this->user_clear();
}
// END user_delete() METHOD
на это
PHP:
// THIS METHOD DELETES THE USER CURRENTLY ASSOCIATED WITH THIS OBJECT
// INPUT:
// OUTPUT:
function user_delete()
{
global $database, $url, $global_plugins;
// CALL USER DELETE HOOK
($hook = SE_Hook::exists('se_user_delete')) ? SE_Hook::call($hook, $this->user_info['user_id']) : NULL;
// DELETE USER, USERSETTING, PROFILE, STYLES TABLE ROWS
$database->database_query("DELETE FROM se_users WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_usersettings WHERE usersetting_user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_profilevalues WHERE profilevalue_user_id='{$this->user_info['user_id']}' LIMIT 1");
$database->database_query("DELETE FROM se_profilestyles WHERE profilestyle_user_id='{$this->user_info['user_id']}' LIMIT 1");
######################
# MORFEI EDIT BEGIN #
######################
// DELETE USER-VIEWS
$database->database_query("DELETE FROM se_profileviews WHERE profileview_user_id='{$this->user_info['user_id']}' LIMIT 1");
// DELETE SESSION AUTH USER ID
$database->database_query("DELETE FROM se_session_auth WHERE session_auth_user_id='{$this->user_info['user_id']}'");
// PLUGIN DELETE BEGIN
// PLUGIN DELETE - DELETE GIFT
$database->database_query("DELETE FROM mf_gifts WHERE to_id='{$this->user_info['user_id']}'");
// PLUGIN DELETE - DELETE USERPOINT
$database->database_query("DELETE FROM se_semods_userpointstats WHERE userpointstat_user_id='{$this->user_info['user_id']}'");
// PLUGIN DELETE END
// DELETE USER-OWNED AND PROFILE COMMENTS
$database->database_query("DELETE FROM se_profilecomments WHERE profilecomment_authoruser_id='{$this->user_info['user_id']}'");
$database->database_query("DELETE FROM se_profilecomments WHERE profilecomment_user_id='{$this->user_info['user_id']}'");
######################
# MORFEI EDIT END #
######################
// DELETE NOTIFICATIONS SENT TO OTHER USERS FOR A PM THEY SENT
$database->database_query("DELETE se_notifys.* FROM se_pmconvoops LEFT JOIN se_notifys ON se_notifys.notify_object_id=se_pmconvoops.pmconvoop_pmconvo_id WHERE se_notifys.notify_notifytype_id=2 && se_pmconvoops.pmconvoop_user_id='{$this->user_info['user_id']}'");
// DELETE PMCONVOS AND PMS WHERE THE DELETED USER AND THE OTHER USER ARE THE ONLY TWO INSIDE, OR WHERE THE DELETED USER WAS THE INITIAL SENDER
$database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=pmconvo_recipients-1 WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
$database->database_query("UPDATE se_pmconvos LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id SET pmconvo_recipients=0 WHERE pmconvoop_user_id='{$this->user_info['user_id']}' && pmconvoop_user_id=(SELECT pm_authoruser_id FROM se_pms WHERE pm_pmconvo_id=pmconvo_id ORDER BY pm_id ASC)");
$database->database_query("DELETE FROM se_pmconvoops WHERE pmconvoop_user_id='{$this->user_info['user_id']}'");
// THIS MAY ALSO DELETE OTHER CONVOS THAT WERE PARTIALLY REMOVED
$database->database_query("DELETE se_pms.*, se_pmconvos.*, se_pmconvoops.* FROM se_pmconvos LEFT JOIN se_pms ON pm_pmconvo_id=pmconvo_id LEFT JOIN se_pmconvoops ON pmconvoop_pmconvo_id=pmconvo_id WHERE pmconvo_recipients<2");
// DELETE CONNECTIONS TO AND FROM USER
$database->database_query("DELETE FROM se_friends, se_friendexplains USING se_friends LEFT JOIN se_friendexplains ON se_friends.friend_id=se_friendexplains.friendexplain_friend_id WHERE se_friends.friend_user_id1='{$this->user_info['user_id']}' OR se_friends.friend_user_id2='{$this->user_info['user_id']}'");
// DELETE ALL OF THIS USER'S REPORTS
$database->database_query("DELETE FROM se_reports WHERE report_user_id='{$this->user_info['user_id']}'");
// DELETE USER ACTIONS
$database->database_query("DELETE FROM se_actions, se_actionmedia USING se_actions LEFT JOIN se_actionmedia ON se_actions.action_id=se_actionmedia.actionmedia_action_id WHERE action_user_id='{$this->user_info['user_id']}'");
// DELETE USER NOTIFICATIONS
$database->database_query("DELETE FROM se_notifys WHERE notify_user_id='{$this->user_info['user_id']}'");
// DELETE NOTIFICATIONS BY USER
$database->database_query("DELETE FROM se_notifys WHERE notify_notifytype_id=1 AND notify_object_id='{$this->user_info['user_id']}'");
// DELETE USER'S FILES
if( is_dir($url->url_userdir($this->user_info['user_id'])) )
$dir = $url->url_userdir($this->user_info['user_id']);
else
$dir = ".".$url->url_userdir($this->user_info['user_id']);
if( $dh = @opendir($dir) )
{
while( ($file = @readdir($dh)) !== false )
{
if( $file != "." && $file != ".." )
{
@unlink($dir.$file);
}
}
@closedir($dh);
}
@rmdir($dir);
$this->user_clear();
}
// END user_delete() METHOD
у меня стоит всего лишь 2 плагина GIFT и USERPOINT, у кого их нету удалите из моего кода это:
PHP:
// PLUGIN DELETE BEGIN
// PLUGIN DELETE - DELETE GIFT
$database->database_query("DELETE FROM mf_gifts WHERE to_id='{$this->user_info['user_id']}'");
// PLUGIN DELETE - DELETE USERPOINT
$database->database_query("DELETE FROM se_semods_userpointstats WHERE userpointstat_user_id='{$this->user_info['user_id']}'");
// PLUGIN DELETE END
ПРОШУ ПРИСОЕДИНИТСЯ ЛЮДЕЙ ХОРОШО ЗНАЮЩИХ PHP И SocialEngine 3 ДЛЯ ИДЕАЛИЗИРОВАНИЯ ИСПРАВЛЕНИЯ.