Error trying delete user [message #38287] |
Mon, 30 July 2007 21:39 |
Shaltay
Messages: 6 Registered: July 2007
Karma: 0
|
Junior Member |
|
|
I run v. 2.7.7 RC2 with russian-utf8 translation. So error below appears while trying delete any user:
(/var/FUDforum2/Data/include/theme/default/db.inc:72
/var/FUDforum2/Data/include/users_adm.inc:25
/var/FUDforum2/adm/admuser.php:156
) 1100: Table 'fud_mod' was not locked with LOCK TABLES
Query: DELETE FROM fud_mod WHERE user_id IN(4)
_POST: array ( 'S' => '2544c9c266d86a5f30c128ddefc1bcc8', 'SQ' => 'a4b2e70679d86d77ffa1983edc3b20dc', 'act' => 'del', 'f' => '1', 'usr_id' => '4', 'del_confirm' => '1', 'btn_yes' => 'Yes', )
Server Version: 5.0.32-Debian_7etch1-log
[Referring Page] http://forum.mysite.com/adm/admuser.php?usr_id=4&S=2544c9c266d86a5f30c128ddefc1bcc8&act=del&f=1&SQ=a4b2e70679d86d77ffa1983edc3b20dc
Common server parameters:
System Configuration
PHP built On: Linux server 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686
Database Version: 5.0.32-Debian_7etch1-log
PHP Version: 5.2.0-8+etch3
Web Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch3
WebServer to PHP interface: apache2handler
WebServer User/Group: 33 / 33
Forum Version: 2.7.7RC2
Relavent PHP Settings:
Safe Mode: OFF
Open basedir: none
Display Errors: OFF
File Uploads: ON
Maximum File Upload Size: 2M
Magic Quotes: OFF
Register Globals: OFF
Output Buffering: Yes
Disabled Functions: none
PSpell Support: No
Zlib Support: Yes
[Updated on: Mon, 30 July 2007 21:42] Report message to a moderator
|
|
|
|
Re: Error trying delete user [message #38390 is a reply to message #38379] |
Wed, 01 August 2007 16:36 |
Shaltay
Messages: 6 Registered: July 2007
Karma: 0
|
Junior Member |
|
|
Hello.
I have last version from CVS. The error still persisrs.
# cat /var/www/forum/data/include/users_adm.inc
<?php
/**
* copyright : (C) 2001-2007 Advanced Internet Designs Inc.
* email : forum(at)prohost(dot)org
* $Id: users_adm.inc,v 1.23 2007/04/25 18:34:01 hackie Exp $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
**/
function usr_delete($id)
{
$tbl = $GLOBALS['DBHOST_TBL_PREFIX'];
if (!db_locked()) {
$ll = 1;
db_lock($tbl.'mod WRITE', $tbl.'msg_store WRITE', $tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '.$tbl.'poll_opt_track WRITE, '.$tbl.'users WRITE, '.$tbl.'pmsg WRITE, '.$tbl.'attach WRITE, '.$tbl.'mod WRITE, '.$tbl.'custom_tags WRITE, '.$tbl.'thread_notify WRITE, '.$tbl.'forum_notify WRITE, '.$tbl.'read WRITE, '.$tbl.'forum_read WRITE, '.$tbl.'thread_rate_track WRITE, '.$tbl.'user_ignore WRITE, '.$tbl.'buddy WRITE, '.$tbl.'mod mm WRITE, '.$tbl.'users u WRITE, '.$tbl.'forum f WRITE');
}
if (!is_array($id)) {
$id = array($id);
}
q('DELETE FROM '.$tbl.'mod WHERE user_id IN('.implode(',', $id).')');
if (db_affected()) {
rebuildmodlist();
}
q('DELETE FROM '.$tbl.'custom_tags WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'thread_notify WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'forum_notify WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'read WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'forum_read WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'thread_rate_track WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'user_ignore WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'user_ignore WHERE ignore_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'buddy WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'buddy WHERE bud_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'poll_opt_track WHERE user_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'group_members WHERE user_id IN('.implode(',', $id).')');
q('UPDATE '.$tbl.'msg SET poster_id=0 WHERE poster_id IN('.implode(',', $id).')');
/* Delete the private messages of this user */
$c = q('SELECT id FROM '.$tbl.'pmsg WHERE duser_id IN('.implode(',', $id).')');
while ($r = db_rowarr($c)) {
pmsg_del($r[0], 5);
}
q('UPDATE '.$tbl.'pmsg SET ouser_id=0, read_stamp=post_stamp WHERE ouser_id IN('.implode(',', $id).')');
q('DELETE FROM '.$tbl.'users WHERE id IN('.implode(',', $id).')');
if (isset($ll)) {
db_unlock();
}
}
function usr_adm_avatar($id, $del=0)
{
if (!($ud = db_sab('SELECT u.login, u.email, t.name FROM '.$GLOBALS['DBHOST_TBL_PREFIX'].'users u INNER JOIN '.$GLOBALS['DBHOST_TBL_PREFIX'].'themes t ON t.id=u.theme WHERE u.id='.$id))) {
return;
}
$ud->name = preg_replace('![^A-Za-z0-9]!', '_', $ud->name);
include_once($GLOBALS['INCLUDE'] . 'theme/' . $ud->name . '/avatar_msg.inc');
if (!$del) {
q('UPDATE '.$GLOBALS['DBHOST_TBL_PREFIX'].'users SET users_opt=(users_opt|4194304|16777216) & ~ (4194304|16777216) | 8388608 WHERE id='.$id);
if (db_affected()) {
send_status_update($id, $ud->login, $ud->email, $GLOBALS['approved_avatar_title'], $GLOBALS['approved_avatar_msg']);
}
} else {
q('UPDATE '.$GLOBALS['DBHOST_TBL_PREFIX'].'users SET users_opt=(users_opt|8388608|16777216) & ~ (8388608|16777216) | 4194304, avatar_loc=NULL WHERE id='.$id);
if (db_affected()) {
send_status_update($id, $ud->login, $ud->email, $GLOBALS['unapproved_avatar_title'], $GLOBALS['unapproved_avatar_msg']);
}
}
}
|
|
|
Re: Error trying delete user [message #38393 is a reply to message #38390] |
Wed, 01 August 2007 22:49 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The new code contains the supposedly missing lock on the fud_mod table
$tbl.'mod WRITE' <-- block does this.
I've just tried to reproduce the bug on our test forum and there was no issue deleting a user.
FUDforum Core Developer
|
|
|
|
Re: Error trying delete user [message #38456 is a reply to message #38436] |
Wed, 08 August 2007 02:29 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The table is definitely being locked, it is one of the last tables for which the lock is being set.
FUDforum Core Developer
|
|
|
Re: Error trying delete user [message #38469 is a reply to message #38287] |
Wed, 08 August 2007 11:39 |
JanRei
Messages: 361 Registered: October 2005 Location: Germany
Karma: 0
|
Senior Member Contributing Core Developer Translator |
|
|
I think the query is actually not executed completely. Maybe it should like the following?
db_lock($tbl.'mod WRITE, '.$tbl.'msg_store WRITE, '.$tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '.$tbl.'poll_opt_track WRITE, '.$tbl.'users WRITE, '.$tbl.'pmsg WRITE, '.$tbl.'attach WRITE, '.$tbl.'custom_tags WRITE, '.$tbl.'thread_notify WRITE, '.$tbl.'forum_notify WRITE, '.$tbl.'read WRITE, '.$tbl.'forum_read WRITE, '.$tbl.'thread_rate_track WRITE, '.$tbl.'user_ignore WRITE, '.$tbl.'buddy WRITE, '.$tbl.'mod mm WRITE, '.$tbl.'users u WRITE, '.$tbl.'forum f WRITE');
|
|
|
Re: Error trying delete user [message #38485 is a reply to message #38469] |
Fri, 10 August 2007 00:00 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The code in the cvs has:
$tbl.'attach WRITE, '.$tbl.'mod WRITE, '.
so the lock on the mod table is being put in place.
FUDforum Core Developer
|
|
|
|
|
|
Re: Error trying delete user [message #38519 is a reply to message #38492] |
Sun, 12 August 2007 17:14 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
In the code found in the CVS all commas are within quotes, there is only 1 parameter to the db_lock() function.
FUDforum Core Developer
|
|
|
Re: Error trying delete user [message #38525 is a reply to message #38287] |
Sun, 12 August 2007 18:20 |
JanRei
Messages: 361 Registered: October 2005 Location: Germany
Karma: 0
|
Senior Member Contributing Core Developer Translator |
|
|
Well, if I use latest CVS I get the query error Serga and Shaltay posted above saying the table fud26_custom_tags hasn't been locked.
I think that this has something to do with the commas or do you have another explanation why the first two commas are highlighted in green although they should be red like the other ones?
<?php
db_lock($tbl.'mod WRITE', $tbl.'msg_store WRITE', $tbl.'forum WRITE, '.$tbl.'msg WRITE, '.$tbl.'group_members WRITE, '
?>
[Updated on: Sun, 12 August 2007 19:57] Report message to a moderator
|
|
|
|
|