From: Mikael Nordfeldth Date: Wed, 18 Feb 2015 13:01:35 +0000 (+0100) Subject: Profile table cleaning script. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0acf3e0e30dbe9b127f5e307619e7ee72eb4e9cc;p=quix0rs-gnu-social.git Profile table cleaning script. --- diff --git a/scripts/clean_profiles.php b/scripts/clean_profiles.php new file mode 100755 index 0000000000..470d6c1b91 --- /dev/null +++ b/scripts/clean_profiles.php @@ -0,0 +1,59 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'y'; +$longoptions = array('yes'); + +$helptext = <<query('SELECT * FROM profile WHERE ' . + 'NOT (SELECT COUNT(*) FROM notice WHERE profile_id=profile.id) ' . + 'AND NOT (SELECT COUNT(*) FROM user WHERE user.id=profile.id) ' . + 'AND NOT (SELECT COUNT(*) FROM user_group WHERE user_group.profile_id=profile.id) ' . + 'AND NOT (SELECT COUNT(*) FROM subscription WHERE subscriber=profile.id OR subscribed=profile.id) '); +while ($profile->fetch()) { + echo ' '.$profile->getID().':'.$profile->getNickname(); + $profile->delete(); +} +print "\nDONE.\n";