<commit_before>#!/bin/bash

# This script attempts to download a new TAD ACL.  If successful, it then
# updates the TAD access rights of all users.

if [[ $# != 1 ]]; then
    echo "usage: $0 notification_email_address"
    exit 1
fi

DOWNLOAD_URL="http://biber3.ub.uni-tuebingen.de/tad/acl.yaml"
DOWNLOAD_DOCUMENT="/tmp/new_tad_email_acl.yaml"
TARGET_DOCUMENT="/var/lib/tuelib/tad_email_acl.yaml"

if ! wget "$DOWNLOAD_URL" --output-document="$DOWNLOAD_DOCUMENT" 2> /dev/null; then
    mutt -H - <<END_OF_EMAIL
To: $1
Subject: $0 Failed
X-Priority: 1

Failed to download a new TAD email ACL from $DOWNLOAD_URL.
END_OF_EMAIL
elif ! diff --brief "$DOWNLOAD_DOCUMENT" "$TARGET_DOCUMENT" > /dev/null; then
    mv "$DOWNLOAD_DOCUMENT" "$TARGET_DOCUMENT"
    /usr/local/bin/set_tad_access_flag --update-all-users
fi<commit_msg>Unconditionally update TAD access flags.<commit_after>#!/bin/bash

# This script attempts to download a new TAD ACL.  If successful, it then
# updates the TAD access rights of all users.

if [[ $# != 1 ]]; then
    echo "usage: $0 notification_email_address"
    exit 1
fi

DOWNLOAD_URL="http://biber3.ub.uni-tuebingen.de/tad/acl.yaml"
DOWNLOAD_DOCUMENT="/tmp/new_tad_email_acl.yaml"
TARGET_DOCUMENT="/var/lib/tuelib/tad_email_acl.yaml"

if ! wget "$DOWNLOAD_URL" --output-document="$DOWNLOAD_DOCUMENT" 2> /dev/null; then
    mutt -H - <<END_OF_EMAIL
To: $1
Subject: $0 Failed
X-Priority: 1

Failed to download a new TAD email ACL from $DOWNLOAD_URL.
END_OF_EMAIL
elif ! diff --brief "$DOWNLOAD_DOCUMENT" "$TARGET_DOCUMENT" > /dev/null; then
    mv "$DOWNLOAD_DOCUMENT" "$TARGET_DOCUMENT"
fi

/usr/local/bin/set_tad_access_flag --update-all-users
{'fraction_non_alphanumeric': 0.12769784172661872, 'fraction_numerical': 0.009592326139088728, 'mean_word_length': 4.401294498381877, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1188321', 'n_tokens_mistral': 650, 'n_tokens_neox': 615, 'n_words': 155}