#!/bin/sh #------------------------------------------------------------------------------ # eisfair-ng configuration generator script # Copyright (c) 2007 - 2017 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ retval=0 . /etc/default.d/php-apache2 . /etc/config.d/php-apache2 . /etc/config.d/apache2 APACHE_USER="apache" PHPv=php7 PHPo=php5 # ----------------------------------------------------------------------------- # load php module if not installed # ----------------------------------------------------------------------------- load_php_module() { local name="$1" apk info -q -e ${PHPv}-$name || apk add -q ${PHPv}-$name if [ $? -eq 0 ]; then return 0 else # create error message if packages not installed logger -p error -t cui-php-apache2 "Fail install: ${PHPv}-$name" echo "Fail install: ${PHPv}-$name" return 1 fi } # ----------------------------------------------------------------------------- # remove old php module if installed # ----------------------------------------------------------------------------- remove_php_module() { local name="$1" apk del -q ${PHPv}-$name >/dev/null 2>&1 if [ $? -eq 0 ]; then return 0 else # create error message if packages not remove logger -p error -t cui-php-apache2 "Fail remove: ${PHPv}-$name" return 1 fi } # ----------------------------------------------------------------------------- # update all old php modules # ----------------------------------------------------------------------------- mlist="" mkdir -p /etc/${PHPv}/conf.d if [ -e /etc/${PHPo}/conf.d/ ] then for modfile in /etc/${PHPo}/conf.d/*.ini do fname=$(basename "$modfile") fname=${fname%*.ini} case "$fname" in eisfair) continue ;; mysql) echo -n "" ;; *) mlist="$fname $mlist" ;; esac apk del -q ${PHPo}-$fname done apk del -f -q ${PHPo}-apache2 apk add -f -q ${PHPv} apk add -f -q ${PHPv}-apache2 for modfile in $mlist do load_php_module $modfile done rm -rf /etc/${PHPo} else apk info -q -e ${PHPv} || apk add -q ${PHPv} load_php_module apache2 fi # ----------------------------------------------------------------------------- # create php info files # ----------------------------------------------------------------------------- if [ "$PHP_INFO" = "yes" ] ; then mkdir -p /var/www/localhost/htdocs echo ''>/var/www/localhost/htdocs/info.php echo '"; echo "
  • GD support: "; if(function_exists("gd_info")){ echo "yes"; $info = gd_info(); $keys = array_keys($info); for($i=1;$i\n
  • ".$keys[$i] .": " . yesNo($info[$keys[$i]]); } } else { echo "no"; } echo "
  • "; } function yesNo($bool){ if($bool){ return " yes"; }else{ return " no"; } } describeGDdyn(); echo "

    "; echo "

    "; echo " "; echo "
    "; } ?>'>/var/www/localhost/htdocs/gd.php chown $APACHE_USER /var/www/localhost/htdocs/info.php /var/www/localhost/htdocs/gd.php else rm -f /var/www/localhost/htdocs/info.php /var/www/localhost/htdocs/gd.php fi # ============================================================================= # Auswerten der Config Parameter # ============================================================================= # ----------------------------------------------------------------------------- # start cat >/etc/${PHPv}/conf.d/eisfair.ini <> /etc/${PHPv}/conf.d/eisfair.ini else echo "log_errors = Off" >> /etc/${PHPv}/conf.d/eisfair.ini fi # ----------------------------------------------------------------------------- # Display Errors if [ "$PHP_DISPLAY_ERRORS" = "yes" ] ; then echo "display_errors = On" >> /etc/${PHPv}/conf.d/eisfair.ini else echo "display_errors = Off" >> /etc/${PHPv}/conf.d/eisfair.ini fi # ----------------------------------------------------------------------------- # SendMail Path if [ -n "$PHP_SENDMAIL_PATH" -a -f "$PHP_SENDMAIL_PATH" ] ; then echo "sendmail_path = ${PHP_SENDMAIL_PATH} ${PHP_SENDMAIL_APP}" >>/etc/${PHPv}/conf.d/eisfair.ini else echo "sendmail_path = sendmail -t -i" >>/etc/${PHPv}/conf.d/eisfair.ini fi # ----------------------------------------------------------------------------- # Date Timezone Settings cat >>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <> /etc/${PHPv}/conf.d/eisfair.ini else echo 'upload_tmp_dir = "/tmp"' >> /etc/${PHPv}/conf.d/eisfair.ini fi # ----------------------------------------------------------------------------- # file and memory limit cat >>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini < Returns data converted to SQL server settings ; Off => Returns values as YYYY-MM-DD hh:mm:ss ;mssql.datetimeconvert = On ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. -1 = library default ; msdlib defaults to 25 ; FreeTDS defaults to 4096 ;mssql.max_procs = -1 ; Specify client character set. ; If empty or not set the client charset from freetds.comf is used ; This is only used when compiled with FreeTDS ;mssql.charset = "ISO-8859-1" EOF fi else remove_php_module mssql fi # ----------------------------------------------------------------------------- # POSTGRESQL if [ "${PHP_EXT_PGSQL}" = "yes" ] ; then load_php_module pgsql if [ $? -eq 0 ]; then cat >>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <>/etc/${PHPv}/conf.d/eisfair.ini <