Florian Schaal
2014-10-17 a204303e5099dcb88e5e4760a09e7de9a96c4ea3
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');