fixed new line in php

This commit is contained in:
Robbt 2020-01-03 20:14:02 -05:00
parent 9a027373e1
commit edaa2ead85
2 changed files with 5 additions and 2 deletions

View File

@ -184,7 +184,10 @@ class DatabaseSetup extends Setup {
if (!file_exists(LIBRETIME_CONF_DIR . '/icecast_pass')) {
throw new AirtimeDatabaseException("The Icecast Password file was not accessible", array());
};
$icecast_pass = file_get_contents(LIBRETIME_CONF_DIR . '/icecast_pass', true);
$icecast_pass_txt = file(LIBRETIME_CONF_DIR . '/icecast_pass');
$icecast_pass = $icecast_pass_txt[0];
$icecast_pass = str_replace(PHP_EOL, '', $icecast_pass);
error_log($icecast_pass);
$statement = self::$dbh->prepare("UPDATE cc_stream_setting SET value = :icecastpass WHERE keyname = 's1_pass'");
$statement->bindValue(':icecastpass', $icecast_pass, PDO::PARAM_STR);
try {

View File

@ -894,7 +894,7 @@ if [ "$icecast" = "t" ]; then
else
icecast_unit_name="icecast"
fi
icecast_pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};echo;)
icecast_pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};)
echo $icecast_pass > /tmp/icecast_pass
xmlstarlet ed --inplace -u /icecast/authentication/source-password -v $icecast_pass /etc/icecast2/icecast.xml
xmlstarlet ed --inplace -u /icecast/authentication/relay-password -v $icecast_pass /etc/icecast2/icecast.xml