<commit_before>#!/usr/bin/env bash
#
# Author: <NAME>
# Contact: mailto:<EMAIL>
# Version: $id$
# 
# update your app
# 

set +e
scriptPath=$(readlink -f "${0%/*}")


APP="app/console"
APACHE_RUN_USER="${APACHE_RUN_USER-www-data}"
APACHE_RUN_GROUP="${APACHE_RUN_GROUP-www-data}"
dirs="${dirs-app/cache app/logs}"
COMPOSER="$(which composer.phar)"
UPDATEPROD=1
WITHDB=0
WITHCOMPOSERUPDATE=1

if [ -e "$scriptPath/envvars" ]; then
    . $scriptPath/envvars
fi

function usage() {
    cat << EOF
Usage: $(basename $0) <options> -t

This script updates a sf2 environment

OPTIONS:
   -p Update prod env after dev env
   -d With db reset
   -c Skip composer
   -h Show this help
EOF
}

while getopts "hpcd:" OPTION ; do
    case $OPTION in
        h)
            usage
            exit 0
            ;;
        p)
            UPDATEPROD=1
            ;;
        c)
            WITHCOMPOSERUPDATE=0
            ;;
        d)
            WITHDB=1
            ;;
        ?)
            usage
            exit 1
            ;;
    esac
done

dirs="${dirs-app/cache app/logs web/media/ web/images/barcode_playground}"

MDBOTHBEFORE="$(md5sum composer.json composer.lock)"

#pre setup
rm -rf web/media/cache/_*
mkdir -p web/media

# update source
git pull

MDBOTHAFTER="$(md5sum composer.json composer.lock)"
if [ $WITHCOMPOSERUPDATE == 1 ]; then
    if [ "$MDBOTHBEFORE" != "$MDBOTHAFTER" ]; then
        $COMPOSER install
    fi 
    $COMPOSER update
fi

if [ $WITHDB = 1 ]; then
    # create db
    $APP doctrine:database:drop --force
    $APP doctrine:database:create
    $APP doctrine:schema:drop --force
    $APP doctrine:schema:create<commit_msg>Overriding default via envvars<commit_after>#!/usr/bin/env bash
#
# Author: <NAME>
# Contact: mailto:<EMAIL>
# Version: $id$
# 
# update your app
# 

set +e
scriptPath=$(readlink -f "${0%/*}")


APP="app/console"
APACHE_RUN_USER="${APACHE_RUN_USER-www-data}"
APACHE_RUN_GROUP="${APACHE_RUN_GROUP-www-data}"
dirs="${dirs-app/cache app/logs web/media/ web/images/barcode_playground}"
COMPOSER="$(which composer.phar)"
UPDATEPROD=1
WITHDB=0
WITHCOMPOSERUPDATE=1

function usage() {
    cat << EOF
Usage: $(basename $0) <options> -t

This script updates a sf2 environment

OPTIONS:
   -p Update prod env after dev env
   -d With db reset
   -c Skip composer
   -h Show this help
EOF
}

while getopts "hpcd:" OPTION ; do
    case $OPTION in
        h)
            usage
            exit 0
            ;;
        p)
            UPDATEPROD=1
            ;;
        c)
            WITHCOMPOSERUPDATE=0
            ;;
        d)
            WITHDB=1
            ;;
        ?)
            usage
            exit 1
            ;;
    esac
done

if [ -e "$scriptPath/envvars" ]; then
    . $scriptPath/envvars
fi


MDBOTHBEFORE="$(md5sum composer.json composer.lock)"

#pre setup
rm -rf web/media/cache/_*
mkdir -p web/media

# update source
git pull

MDBOTHAFTER="$(md5sum composer.json composer.lock)"
if [ $WITHCOMPOSERUPDATE == 1 ]; then
    if [ "$MDBOTHBEFORE" != "$MDBOTHAFTER" ]; then
        $COMPOSER install
    fi 
    $COMPOSER update
fi

if [ $WITHDB = 1 ]; then
    # create db
    $APP doctrine:database:drop --force
    $APP doctrine:database:create
    $APP doctrine:schema:drop --force
    $APP doctrine:schema:create
{'fraction_non_alphanumeric': 0.12649310872894334, 'fraction_numerical': 0.009188361408882083, 'mean_word_length': 2.370485036119711, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6089351', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1123, 'n_words': 284}