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";