On 08/02/2018 13:23, Carsten Haitzler wrote:
On Thu, 08 Feb 2018 12:41:06 +0000 Bertrand Jacquin <bertr...@jacquin.bzh> said:



> you don't need to manually go close every ticket. just find one ticket
> and the
> problem user and tell me. it's possible to wipe the mess easily enough
> on the
> cmdline. i put together a small script that can qeury the sql db and
> nuke the
> user AND tasks they authored:
>
>   sudo ./phab-nuke-spam-user.sh jdnjka

Hug no, that will create inconsistency in the database, instead the
"remove destoy" tool should be used as explained on
https://secure.phabricator.com/book/phabricator/article/users/.

   $ sudo -u apache /srv/web/phab.enlightenment.org/bin/remove destroy
@username

that;'s actually what the script does... but it identifies all the tasks created by the user and nukes those separately then nukes the user.. it uses
the pha remove tool to do it, but mysql to query to find out what to
remove... :)

Oh alright, we're all good then, thanks!

specifically this is it:

#!/bin/sh

M="mysql -sN -D"
USER="$1"
USERPHID=`$M phabricator_user -e \
"select phid from user where userName=\"$USER\";"`

for ID in \
`$M phabricator_maniphest -e \
"select id from maniphest_task where authorPHID='"$USERPHID"';"`;
do
  echo Nuke T$ID
  /srv/web/phab.enlightenment.org/bin/remove destroy --force "T$ID"
done

echo Nuke @$USER
/srv/web/phab.enlightenment.org/bin/remove destroy --force "@$USER"

--
Bertrand

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to