Pruning Users

Does anyone have a script that will go through and remove users that don’t
have any affiliation with any tickets (ie removed dead tickets)? We
currently have about 50000 users (Mostly non-priviledged users) and was
wondering if anyone had a quick way of cleaning those up.

Robert Westendorp
Systems Administrator

“RW” == Robert Westendorp rjwsys@uniserve.com writes:

RW> Does anyone have a script that will go through and remove users that don’t
RW> have any affiliation with any tickets (ie removed dead tickets)? We
RW> currently have about 50000 users (Mostly non-priviledged users) and was
RW> wondering if anyone had a quick way of cleaning those up.

Sounds like a job for a LEFT JOIN in sql. Are there any tables that
reference user IDs other than the tickets table? If so, then you’ll
have to chase after those tables and delete as well. Otherwise you
can just delete based on the join.

Vivek Khera a écrit :

“RW” == Robert Westendorp rjwsys@uniserve.com writes:

RW> Does anyone have a script that will go through and remove users that don’t
RW> have any affiliation with any tickets (ie removed dead tickets)? We
RW> currently have about 50000 users (Mostly non-priviledged users) and was
RW> wondering if anyone had a quick way of cleaning those up.

Sounds like a job for a LEFT JOIN in sql. Are there any tables that
reference user IDs other than the tickets table? If so, then you’ll
have to chase after those tables and delete as well.

Many tables have “CreatorId” and “LastUpdatedBy” fields. You can take a
look in the constraints.mysql file (in RT etc/ directory), searching for
“REFERENCES Users(id)” and I think it worths take look at Principals too.

Guillaume Perréal.

Responsable informatique,
Cemagref, groupement de Lyon,
France.

Tél: (+33) 4.72.20.87.87.
Fax: (+33) 4.78.47.78.75.
Site: http://www.lyon.cemagref.fr/