<commit_before>#!/bin/bash
set -e

php -r '
$dbhost = @$_ENV["DB_HOST"] ?: "db";
$dbname = @$_ENV["DB_NAME"] ?: "mapas";
$dbuser = @$_ENV["DB_USER"] ?: "mapas";
$dbpass = @$_ENV["DB_PASS"] ?: "<PASSWORD>";

$pdo = null;
echo "\naguardando o banco de dados subir corretamente...";
while(true){
    try {
        $pdo = new PDO("pgsql:host={$dbhost};port=5432;dbname={$dbname};user={$dbuser};password={$dbpass}");
        echo "\nconectado com sucesso ao banco pgsql:host={$dbhost};port=5432;dbname={$dbname};user={$dbuser};\n";
        break;
    } catch (Exception $e) {
        echo "..";        
    }
    sleep(1);
}

echo "\ncorrigindo status da fila de criação de cache de permissão\n\n";

$pdo->query("UPDATE permission_cache_pending SET status = 0;");
'
if ! cmp /var/www/version.txt /var/www/private-files/deployment-version >/dev/null 2>&1
then
    cd /var/www/scripts
    ./deploy.sh
    cp /var/www/version.txt /var/www/private-files/deployment-version
fi

chown -R www-data:www-data /var/www/html/assets /var/www/html/files /var/www/private-files

nohup /recreate-pending-pcache-cron.sh &

touch /mapas-ready

exec "$@"<commit_msg>mudança no entrypoint.sh para executar o db-update sempre que inicia o container<commit_after>#!/bin/bash
set -e

php -r '
$dbhost = @$_ENV["DB_HOST"] ?: "db";
$dbname = @$_ENV["DB_NAME"] ?: "mapas";
$dbuser = @$_ENV["DB_USER"] ?: "mapas";
$dbpass = @$_ENV["DB_PASS"] ?: "mapas";

$pdo = null;
echo "\naguardando o banco de dados subir corretamente...";
while(true){
    try {
        $pdo = new PDO("pgsql:host={$dbhost};port=5432;dbname={$dbname};user={$dbuser};password={$dbpass}");
        echo "\nconectado com sucesso ao banco pgsql:host={$dbhost};port=5432;dbname={$dbname};user={$dbuser};\n";
        break;
    } catch (Exception $e) {
        echo "..";        
    }
    sleep(1);
}

echo "\ncorrigindo status da fila de criação de cache de permissão\n\n";

$pdo->query("UPDATE permission_cache_pending SET status = 0;");
'

if ! cmp /var/www/version.txt /var/www/private-files/deployment-version >/dev/null 2>&1
then
    /var/www/scripts/deploy.sh
    cp /var/www/version.txt /var/www/private-files/deployment-version
else
    /var/www/scripts/db-update.sh
fi

chown -R www-data:www-data /var/www/html/assets /var/www/html/files /var/www/private-files

nohup /recreate-pending-pcache-cron.sh &

touch /mapas-ready

exec "$@"
{'fraction_non_alphanumeric': 0.18957545187053385, 'fraction_numerical': 0.01008827238335435, 'mean_word_length': 3.5945945945945947, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 21, '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': '3354419', 'n_tokens_mistral': 962, 'n_tokens_neox': 936, 'n_words': 183}