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


if [ "$USER" = "root" ]; then

    # set localtime
    ln -sf /usr/share/zoneinfo/$LOCALTIME /etc/localtime

    # secure path
    chmod a-rwx -R $PHP_INI_DIR/conf.d/ /usr/local/etc/php-fpm.d/
fi

#
# functions
function set_conf {
    echo "$4">$2; IFSO=$IFS; IFS=$(echo -en "\n\b")
    for c in `printenv|grep $1`; do echo "`echo $c|cut -d "=" -f1|awk -F"$1" '{print $2}'` $3 `echo $c|cut -d "=" -f2`" >> $2; done;
    IFS=$IFSO
}

#
# PHP

echo "date.timezone = \"${LOCALTIME}\"" >> $PHP_INI_DIR/conf.d/00-default.ini
if [ "$PHP_php5enmod" != "" ]; then docker-php-ext-enable $PHP_php5enmod > /dev/null 2>&1; fi;

# Set php.ini
set_conf "PHP__" "$PHP_INI_DIR/conf.d/40-user.ini" "="

# Set phpfpm.conf
set_conf "PHPFPM_GLOBAL__" "/usr/local/etc/php-fpm.d/40-user-global.conf" "=" "[global]"
set_conf "PHPFPM__" "/usr/local/etc/php-fpm.d/41-user-pool.conf" "=" "[www]"

if [ -f /usr/local/etc/php-fpm.d/www.conf ]; then 
  mv /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/00-www.conf
fi

#
# docker links

# Deprecated - Set memcached server with link
if [ -n "$PHP_MEMCACHED_PORT_11211_TCP_ADDR" ]; then
    echo "[WARNING] Deprecated - Future versions of Docker will not support links - you should remove them for forwards-compatibility."
    echo "session.save_handler = memcached" > $PHP_INI_DIR/conf.d/20-memcached.ini
    echo "session.save_path = $PHP_MEMCACHED_PORT_11211_TCP_ADDR:$PHP_MEMCACHED_PORT_11211_TCP_PORT" >> $PHP_INI_DIR/conf.d/20-memcached.ini
elif [ -f $PHP_INI_DIR/conf.d/20-memcached.ini ]; then
    rm $PHP_INI_DIR/conf.d/20-memcached.ini
fi

# Deprecated - Set msmtp server with link
if [ -n "$SMTP_PORT_25_TCP_ADDR" ]; then
    echo "[WARNING] Deprecated - Future versions of Docker will not support links - you should remove them for forwards-compatibility."
    echo 'sendmail_path = /usr/bin/msmtp -t' >> $PHP_INI_DIR/conf.d/00-default.ini
    echo -e "defaults \nauth           off \ntls            off \nlogfile        ~/.msmtp.log \naccount        mailcatcher \nhost           ${$SMTP_PORT_25_TCP_ADDR} \nport           ${$SMTP_PORT_25_TCP_PORT} \nauto_from on \naccount default : mailcatcher" > /etc/msmtprc
fi

# Set memcached session save handle
if [ -n "$MEMCACHED" ]; then
    if [ ! -f $PHP_INI_DIR/conf.d/docker-php-ext-memcached.ini ]; then docker-php-ext-enable  memcached > /dev/null; fi

    IFSO=$IFS; IFS=' ' read -ra BACKENDS <<< "${MEMCACHED}"
    for BACKEND in "${BACKENDS[@]}"; do
        SAVE_PATH="${SAVE_PATH}${BACKEND}?${MEMCACHED_CONFIG:-persistent=1&timeout=5&retry_interval=30},"
    done; IFS=$IFSO;

cat << EOF >> $PHP_INI_DIR/conf.d/20-memcached.ini
    session.save_handler = memcached
    session.save_path = "${SAVE_PATH}"
EOF

fi

# Set msmtp server
if [ -n "$SMTP" ]; then
    echo 'sendmail_path = /usr/sbin/msmtp -t' >> $PHP_INI_DIR/conf.d/00-default.ini
    echo -e "defaults \nauth           off \ntls            off \nlogfile        ~/.msmtp.log \naccount        mailcatcher \nhost           ${SMTP} \nport           ${SMTP_PORT:-25} \nauto_from on \naccount default : mailcatcher" > /etc/msmtprc
fi


#
# Run
exec "$@"<commit_msg>7.4-fpm: fix typo msmtp path<commit_after>#!/bin/bash
set -e


if [ "$USER" = "root" ]; then

    # set localtime
    ln -sf /usr/share/zoneinfo/$LOCALTIME /etc/localtime

    # secure path
    chmod a-rwx -R $PHP_INI_DIR/conf.d/ /usr/local/etc/php-fpm.d/
fi

#
# functions
function set_conf {
    echo "$4">$2; IFSO=$IFS; IFS=$(echo -en "\n\b")
    for c in `printenv|grep $1`; do echo "`echo $c|cut -d "=" -f1|awk -F"$1" '{print $2}'` $3 `echo $c|cut -d "=" -f2`" >> $2; done;
    IFS=$IFSO
}

#
# PHP

echo "date.timezone = \"${LOCALTIME}\"" >> $PHP_INI_DIR/conf.d/00-default.ini
if [ "$PHP_php5enmod" != "" ]; then docker-php-ext-enable $PHP_php5enmod > /dev/null 2>&1; fi;

# Set php.ini
set_conf "PHP__" "$PHP_INI_DIR/conf.d/40-user.ini" "="

# Set phpfpm.conf
set_conf "PHPFPM_GLOBAL__" "/usr/local/etc/php-fpm.d/40-user-global.conf" "=" "[global]"
set_conf "PHPFPM__" "/usr/local/etc/php-fpm.d/41-user-pool.conf" "=" "[www]"

if [ -f /usr/local/etc/php-fpm.d/www.conf ]; then 
  mv /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/00-www.conf
fi

#
# docker links

# Deprecated - Set memcached server with link
if [ -n "$PHP_MEMCACHED_PORT_11211_TCP_ADDR" ]; then
    echo "[WARNING] Deprecated - Future versions of Docker will not support links - you should remove them for forwards-compatibility."
    echo "session.save_handler = memcached" > $PHP_INI_DIR/conf.d/20-memcached.ini
    echo "session.save_path = $PHP_MEMCACHED_PORT_11211_TCP_ADDR:$PHP_MEMCACHED_PORT_11211_TCP_PORT" >> $PHP_INI_DIR/conf.d/20-memcached.ini
elif [ -f $PHP_INI_DIR/conf.d/20-memcached.ini ]; then
    rm $PHP_INI_DIR/conf.d/20-memcached.ini
fi

# Deprecated - Set msmtp server with link
if [ -n "$SMTP_PORT_25_TCP_ADDR" ]; then
    echo "[WARNING] Deprecated - Future versions of Docker will not support links - you should remove them for forwards-compatibility."
    echo 'sendmail_path = /usr/bin/msmtp -t' >> $PHP_INI_DIR/conf.d/00-default.ini
    echo -e "defaults \nauth           off \ntls            off \nlogfile        ~/.msmtp.log \naccount        mailcatcher \nhost           ${$SMTP_PORT_25_TCP_ADDR} \nport           ${$SMTP_PORT_25_TCP_PORT} \nauto_from on \naccount default : mailcatcher" > /etc/msmtprc
fi

# Set memcached session save handle
if [ -n "$MEMCACHED" ]; then
    if [ ! -f $PHP_INI_DIR/conf.d/docker-php-ext-memcached.ini ]; then docker-php-ext-enable  memcached > /dev/null; fi

    IFSO=$IFS; IFS=' ' read -ra BACKENDS <<< "${MEMCACHED}"
    for BACKEND in "${BACKENDS[@]}"; do
        SAVE_PATH="${SAVE_PATH}${BACKEND}?${MEMCACHED_CONFIG:-persistent=1&timeout=5&retry_interval=30},"
    done; IFS=$IFSO;

cat << EOF >> $PHP_INI_DIR/conf.d/20-memcached.ini
    session.save_handler = memcached
    session.save_path = "${SAVE_PATH}"
EOF

fi

# Set msmtp server
if [ -n "$SMTP" ]; then
    echo 'sendmail_path = /usr/bin/msmtp -t' >> $PHP_INI_DIR/conf.d/00-default.ini
    echo -e "defaults \nauth           off \ntls            off \nlogfile        ~/.msmtp.log \naccount        mailcatcher \nhost           ${SMTP} \nport           ${SMTP_PORT:-25} \nauto_from on \naccount default : mailcatcher" > /etc/msmtprc
fi


#
# Run
exec "$@"
{'fraction_non_alphanumeric': 0.16096866096866097, 'fraction_numerical': 0.0205761316872428, 'mean_word_length': 3.0952689565780944, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, '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': '4483892', 'n_tokens_mistral': 2615, 'n_tokens_neox': 2512, 'n_words': 528}