[jorge] Cleaning up trash......."; $conn=mysql_connect("_MYSQL_HOST_", "_USER_", "_PASSWORD_") or die ("DB connect failed\n"); mysql_select_db ("_DB_NAME_") or die ("DB select failed\n"); $xmpp_host="_YOUR_XMPP_HOST_"; $query="select owner_id, peer_name_id,peer_server_id,idx,date as tslice,vhost from pending_del where timeframe < date_format((date_sub(curdate(),interval 1 month)), '%Y-%c-%e')"; $result=mysql_query($query); if (mysql_num_rows($result)>0) { $i=0; while($row=mysql_fetch_array($result)) { $i++; $ch_del="delete from `logdb_messages_$row[tslice]"."_$xmpp_host` where owner_id='$row[owner_id]' and peer_name_id='$row[peer_name_id]' and peer_server_id='$row[peer_server_id]' and ext = '$row[idx]' "; $li_del="delete from jorge_mylinks where owner_id='$row[owner_id]' and ext='$row[idx]' and peer_name_id = '$row[peer_name_id]' and peer_server_id='$row[peer_server_id]' and datat = '$row[tslice]' and vhost = '$row[vhost]' "; $fa_del="delete from jorge_favorites where owner_id='$row[owner_id]' and ext='$row[idx]' and peer_name_id = '$row[peer_name_id]' and peer_server_id='$row[peer_server_id]' and vhost = '$row[vhost]' "; $pe_del="delete from pending_del where owner_id='$row[owner_id]' and peer_name_id = '$row[peer_name_id]' and peer_server_id='$row[peer_server_id]' and date='$row[tslice]' and idx='$row[idx]' and vhost = '$row[vhost]' "; mysql_query("$ch_del") or die("Error #1\n"); mysql_query("$li_del") or die("Error #2\n"); mysql_query("$fa_del") or dir("Error #3\n"); mysql_query("$pe_del") or die("Error #4\n"); } print "Deleted $i chats.\n"; } else { print "Nothing to delete.\n"; } ?>