Script to clear down old microblog entries
Avoids the database growing indefinitely
This commit is contained in:
parent
46c07ff82f
commit
677df7c5ee
|
@ -8572,6 +8572,15 @@ function install_gnu_social {
|
|||
fi
|
||||
echo "GNU Social onion domain:${MICROBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
|
||||
|
||||
# clear down the database periodically
|
||||
echo '$n = new Notice();' > /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/clear-database.php
|
||||
echo "\$n->whereAdd('created < NOW() - INTERVAL 1 YEAR');" >> /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/clear-database.php
|
||||
echo 'if ($n->find()) { while ($n->fetch()) { $n->deleteAs($n->getProfile()); } }' >> /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/clear-database.php
|
||||
echo 'exit' >> /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/clear-database.php
|
||||
echo '#!/bin/bash' > /etc/cron.weekly/clear-microblog-database
|
||||
echo "cat /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/clear-database.php | php /var/www/$MICROBLOG_DOMAIN_NAME/htdocs/scripts/console.php" >> /etc/cron.weekly/clear-microblog-database
|
||||
chmod +x /etc/cron.weekly/clear-microblog-database
|
||||
|
||||
# some post-install instructions for the user
|
||||
if ! grep -q $"Microblog administrator" /home/$MY_USERNAME/README; then
|
||||
echo '' >> /home/$MY_USERNAME/README
|
||||
|
|
Loading…
Reference in New Issue