openaustralia / righttoknow

Theme for, and issues specific to, Right To Know.
https://www.righttoknow.org.au/
MIT License
21 stars 14 forks source link

Fix script/clear-caches script in alternative fashion #750

Open mlandauer opened 3 years ago

mlandauer commented 3 years ago

In our fork of alaveteli we have an update to the script/clear-caches script which handles the fact that we're symbolic linking from our shared cache directory to a directory on a different filesystem. Our version of the script is:

#!/bin/bash
TOP_DIR="$(dirname "$BASH_SOURCE")/.."
pushd "$TOP_DIR"
# Clear the cache of attachment and body text.

bundle exec rails runner "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded
 = null, cached_main_body_text_folded = null, sent_at = null, subject = null, mail_from = null, mail_from_domain = null, valid_to_reply_to = null, last_parsed = nul
l\")"

cd -P cache
cd ..
TOP_DIR="$(pwd)"
# Remove page cache (do it in two stages so live site gets cache cleared faster)
rm -fr $TOP_DIR/old-cache
mv $TOP_DIR/cache $TOP_DIR/old-cache
mkdir $TOP_DIR/cache
rm -fr $TOP_DIR/old-cache
popd

We want to use the main-line version of alaveteli from the mysociety repo so we will not have this change. We will need to find an alternative way of handling this.

Either: