mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2025-01-12 08:39:30 +00:00
Added archiving (7z) statuses
This commit is contained in:
parent
1fd4ccb782
commit
6accd4c39c
|
@ -12,7 +12,10 @@ for i in $ids; do
|
|||
if [ -f "$main_basedir"/all_statuses/$instance/$i/$i.json ]; then
|
||||
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
||||
continue
|
||||
elif [ -d "$main_basedir"/all_statuses/$instance/*/$i ]; then
|
||||
elif [ -n "$(7z e -so $main_basedir/archives/$instance.7z $i | cat)" ]; then
|
||||
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
||||
continue
|
||||
elif [ -d "$main_basedir"/all_statuses/$instance/$i ]; then
|
||||
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
||||
continue
|
||||
fi
|
||||
|
|
|
@ -4,10 +4,21 @@
|
|||
|
||||
json=$(cat)
|
||||
|
||||
mkdir -p "$main_basedir/archives/"
|
||||
unixtime_offset=$(expr $(date "+%s") - 86400)
|
||||
|
||||
for i in $ids; do
|
||||
status_id=$i
|
||||
acct=$(echo "$json" | jj "#[id=$i].account.acct")
|
||||
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
||||
old_check=$(date +'%s' -r "$main_basedir"/all_statuses/$instance/$i/$i.json)
|
||||
if [ $old_check -lt $unixtime_offset ]; then
|
||||
7z a -sdel "$main_basedir"/archives/$instance.7z "$main_basedir"/all_statuses/$instance/$i
|
||||
echo "Olded status $i $(date -d "@$old_check") moved to archive"
|
||||
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$status_id" ]; then
|
||||
ln -v -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
||||
|
||||
|
|
Loading…
Reference in a new issue