[SCRIPTS] Fix postgres incompatible query in clean_profiles.php

This commit is contained in:
susdiv 2020-06-05 17:57:22 +00:00 committed by Diogo Peralta Cordeiro
parent 4153a93390
commit 2a82f2774d

View File

@ -47,10 +47,11 @@ if (!have_option('y', 'yes')) {
}
print "Deleting";
$user_table = common_database_tablename('user');
$profile = new Profile();
$profile->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_table} 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()) {