From 149a0b444d02f4e9af814b104aba2f3bb2889435 Mon Sep 17 00:00:00 2001 From: ingoj Date: Tue, 29 Dec 2020 12:03:02 +0100 Subject: [PATCH] v0.4 "dry-run" release Implemented "dry-run" option --- .DS_Store | Bin 0 -> 6148 bytes cleanup_friendica | 104 ---------------------------------------------- 2 files changed, 104 deletions(-) create mode 100644 .DS_Store delete mode 100644 cleanup_friendica diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..82e8cab391f9eabeb7e0220b89e02d3bf14bce23 GIT binary patch literal 6148 zcmeHKF;2r!47DLhkq}Zx#(x5&-r!S(6Z8V8R1~CE=>U7S&bJ7-{L;27M3XZwQ^ zMP+1wXUYHN+kW}U8{$|*boRKMicCbLh8xPxma$phd}K!@QUTTOv0hE*H|=ISsyrMp zZY3A8l6!d=@;~ro;|(2UJmoiAM@M0-m{&&fJ&nRRDcRl0V?n> z6+q86t4{;DQUNMJ1-=!q??Zwc=7L?Ie>$-E2mrL-csE@8ECEaw0Oo>SAR;ggDln*8 zMhp!);;Gc-f?Z(HMg3&lr<|;1LQy{*@#N*AIgl$ApaMe$j$=Eq{(l8OF#iup+))84 z@TU~es+l)4yi)0{qnEQ@o8Z^*FGH=DWARoD^j3_Gwc_($U9xNBbHOgq>4-ZW$R7dI Kg+>K_LxE3gEGpjs literal 0 HcmV?d00001 diff --git a/cleanup_friendica b/cleanup_friendica deleted file mode 100644 index c9396cd..0000000 --- a/cleanup_friendica +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# v0.3.1 - "try to force Github to accept this change"-release - -set -f -# set the following variables accordingly to your site -# the admin will get a notification mail in BCC - -# the following lines should be moved to a config file, eg. /usr/local/etc/cleanup_friendica.conf -#friendicapath="/var/www/net/nerdica.net/friendica" -#site="SITE" -#siteurl="https://domain.tld/" -#siteadmin="admin@domain.tld" -#sitefrom="no-reply@domain.tld" -#protectedusers="admin1 admin2 admin3" - -. /usr/local/etc/cleanup_friendica.conf - - -cd ${friendicapath} || exit 0 - -# delete users that never logged in and never posted content -# filtering for "weeks" will result in accounts with 2 weeks old accounts, -# filter for just "week" will do the same after 1 week. -# same should apply to "month" and "months", but untested. -for username in $( ${friendicapath}/bin/console user list active -c 10000 | grep 'never.*never' | grep weeks | awk '{print $2}') ; do - # if username is a protected user do nothing, else delete user - if [ -n "${protectedusers}" ]; then - pcheck=0 - for s in $(echo ${protectedusers}) ; do - if [ "${s}" = "${username}" ]; then - pcheck=1 - fi - done - if [ ${pcheck} -eq 0 ]; then - #echo "Delete user ${username}" - ${friendicapath}/bin/console user delete "${username}" -q - fi - fi -done - -# find & notify users that didn't logged in >6 months and send mail to log in again -for u in $( ${friendicapath}/bin/console user list active -c 10000 | grep -v '.*---.*' | sed 's/|/;/g' | tr -s "\ " | sed 's/^;\ //g' | sed 's/\ ;\ /;/g' | sed 's/\ /_/g' | tail -n +2 ); do - username=$(echo "${u}" | awk -F ";" '{print $1}') - dispname=$(echo "${u}" | awk -F ";" '{print $2}') - profileurl=$(echo "${u}"| awk -F ";" '{print $3}') - usermail=$(echo "${u}" | awk -F ";" '{print $4}') - registered=$(echo "${u}" | awk -F ";" '{print $5}') - lastlogin=$(echo "${u}" | awk -F ";" '{print $6}') - lastpost=$(echo "${u}" | awk -F ";" '{print $7}') - #echo "Userinfo: ${username},${dispname},${profileurl},${usermail},${registered},${lastlogin},${lastpost}" - res=$(echo "${lastlogin}" | grep '[6-9]_months.*') - if [ -n "${res}" ]; then - num_months=$(echo "${res}" | awk -F "_" '{ print $1}') - #echo "months: ${num_months}" - if [ ${num_months} -ge 7 ]; then - # delete account when last login is older than 7 months and send mail about deletion - # you should copy & paste the text from 6 months for the first runs of this script - # and later change the text to a notification that the account has been deleted. - ( cat <