Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@dj
A function to actually clean Akkoma /Pleroma well
```
DATABASES=(akkoma detroitriotcity)
echo "Stopping Akkoma"
systemctl stop akkoma
for i in "${DATABASES[@]}"; do
echo "Scanning Fderated Posts to Delete: $i"
su postgres -s /bin/bash -lc "echo \"SELECT COUNT(*) FROM \"objects\" AS o0 WHERE (o0.\"data\"->'to' ? 'https://www.w3.org/ns/activitystreams#Public' OR o0.\"data\"->'cc' ? 'https://www.w3.org/ns/activitystreams#Public') AND (o0.\"inserted_at\" < now() - interval '15 days' ) AND (split_part(o0.\"data\"->>'actor', '/', 3) != '$i')\" | psql $i"
echo "Deleting Objects for: $i"
su postgres -s /bin/bash -lc "echo \"DELETE FROM \"objects\" AS o0 WHERE (o0.\"data\"->'to' ? 'https://www.w3.org/ns/activitystreams#Public' OR o0.\"data\"->'cc' ? 'https://www.w3.org/ns/activitystreams#Public') AND (o0.\"inserted_at\" < now() - interval '15 days' ) AND (split_part(o0.\"data\"->>'actor', '/', 3) != '$i')\" | psql $i"
echo "Deleting Activities for: $i"
su postgres -s /bin/bash -lc "echo \"DELETE FROM \"activities\" where data->>'type' = 'Create' and local = 'f' and inserted_at < now() - interval '10 days'"\" | psql $i
echo "Starting Akkoma: $i"
systemctl start akkoma
done
}
```