From f78f1e5d4e837b658b535d90c28c3a55df8e8a91 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Thu, 09 Oct 2014 12:22:36 -0400 Subject: [PATCH] - certificate bundle is deprecated since apache 2.4.8 --- server/plugins-available/apache2_plugin.inc.php | 27 ++++++++++----------------- 1 files changed, 10 insertions(+), 17 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 8af0500..6e6ac11 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -335,8 +335,15 @@ //* Write new ssl files if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]); - if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); - if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]); + if(version_compare($app->system->getapacheversion(true), '2.4.8', '>=')) { + $tmp_data = ''; + if(trim($data["new"]["ssl_cert"]) != '') $tmp_data .= $data["new"]["ssl_cert"] . "\n"; + if(trim($data["new"]["ssl_bundle"]) != '') $tmp_data .= $data["new"]["ssl_bundle"]; + if(trim($tmp_data) != '') $app->system->file_put_contents($crt_file, $tmp_data); + } else { + if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file, $data["new"]["ssl_cert"]); + if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file, $data["new"]["ssl_bundle"]); + } //* Write the key file, if field is empty then import the key into the db if(trim($data["new"]["ssl_key"]) != '') { @@ -2738,23 +2745,9 @@ } else { $content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master'); } - $start_content = ''; - $stop_content = ''; if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm') { - $start_content .= 'if [ ! -d /var/run/hhvm ]; then - mkdir -p -m0777 /var/run/hhvm - else - chmod 777 /var/run/hhvm - fi - umask 017 - sudo -u ' . $data['new']['system_user'] . ' touch /var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid - /usr/bin/hhvm --mode daemon -vServer.Type=fastcgi --user ' . $data['new']['system_user'] . ' -vServer.FileSocket=/tmp/hhvm.' . $data['new']['system_user'] . '.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/tmp/hhvm.' . $data['new']['system_user'] . '.hhbc -vPidFile=/var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid & echo $! > /var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid'; - - $stop_content .= 'if [[ -e "/var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid" ]] ; then kill -SIGTERM `cat /var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid` >/dev/null 2>&1 ; fi - rm -f /tmp/hhvm.' . $data['new']['system_user'] . '.sock /tmp/hhvm.' . $data['new']['system_user'] . '.hhbc /var/run/hhvm/hhvm_' . $data['new']['system_user'] . '.pid'; - - $content = str_replace(array('{START}', '{STOP}', '{SYSTEM_USER}'), array($start_content, $stop_content, $data['new']['system_user']), $content); + $content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $content); file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); -- Gitblit v1.9.1