2023-10-24 19:04:40 +00:00
#apply env vars
. /e
#generate seed-emojis-$SITE_NAME.sql
EXPORT_EMOJIS = $( psql --csv --tuples-only -P "null=NULL" -c \
2023-10-26 18:15:17 +00:00
"SELECT ''''||name||'''', ' '''||kind||'''', ' '||2, ' '''||tags||'''', ' '||nsfw||'', ' '||created_utc||'' FROM emojis WHERE submitter_id IS NULL and author_id != 2 ORDER BY name" \
2023-10-24 19:04:40 +00:00
" $DATABASE_URL " )
EXPORT_EMOJIS = $( sed 's/.*/\(&\),/' <<< " $EXPORT_EMOJIS " )
echo "INSERT INTO public.emojis (name, kind, author_id, tags, nsfw, created_utc) VALUES" > " /d/seed-emojis- $SITE_NAME .sql "
echo " ${ EXPORT_EMOJIS %? } " >> " /d/seed-emojis- $SITE_NAME .sql "
echo "ON CONFLICT (name) DO UPDATE SET tags = EXCLUDED.tags;" >> " /d/seed-emojis- $SITE_NAME .sql "
#pull and push
/d/scripts/g
#execute seed-emojis.sql of other site
if [ $SITE_NAME = = "rDrama" ] ; then
psql " $DATABASE_URL " -f /d/seed-emojis-WPD.sql
else
psql " $DATABASE_URL " -f /d/seed-emojis-rDrama.sql
fi
#clear cache for ppl who have NSFW warnings enabled
redis-cli del " ${ SITE } _flask_cache_emojis_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Platy_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Wolf_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Donkey Kong_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Tay_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Capy_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Carp_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey Flags_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey Alphabet_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Classic_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Rage_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Wojak_False "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Misc_False "
#clear cache for ppl who have NSFW warnings disabled
redis-cli del " ${ SITE } _flask_cache_emojis_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Platy_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Wolf_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Donkey Kong_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Tay_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Capy_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Carp_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey Flags_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Marsey Alphabet_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Classic_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Rage_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Wojak_True "
redis-cli del " ${ SITE } _flask_cache_emoji_list_Misc_True "
#sync original files
2023-10-25 08:45:28 +00:00
rclone copy /asset_submissions/emojis/original yes:emojis-original
rclone copy yes:emojis-original /asset_submissions/emojis/original