| | |
| | | <?php |
| | | |
| | | /* |
| | | Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh |
| | | Copyright (c) 2007 - 2012, Till Brehm, projektfarm Gmbh |
| | | All rights reserved. |
| | | |
| | | Redistribution and use in source and binary forms, with or without modification, |
| | |
| | | @$app->system->unlink($rand_file); |
| | | $ssl_request = $app->db->quote($app->system->file_get_contents($csr_file)); |
| | | $ssl_cert = $app->db->quote($app->system->file_get_contents($crt_file)); |
| | | $ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2)); |
| | | /* Update the DB of the (local) Server */ |
| | | $app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'"); |
| | | $app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'"); |
| | | $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'"); |
| | | /* Update also the master-DB of the Server-Farm */ |
| | | $app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data['new']['domain']."'"); |
| | | $app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert', ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'"); |
| | | $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'"); |
| | | } |
| | | |
| | |
| | | $ssl_dir = $data["new"]["document_root"]."/ssl"; |
| | | $domain = ($data["new"]["ssl_domain"] != '')?$data["new"]["ssl_domain"]:$data["new"]["domain"]; |
| | | $key_file = $ssl_dir.'/'.$domain.'.key.org'; |
| | | $key_file2 = $ssl_dir.'/'.$domain.'.key'; |
| | | $key_file2 = $ssl_dir.'/'.$domain.'.key'; |
| | | $csr_file = $ssl_dir.'/'.$domain.".csr"; |
| | | $crt_file = $ssl_dir.'/'.$domain.".crt"; |
| | | $bundle_file = $ssl_dir.'/'.$domain.".bundle"; |
| | |
| | | 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(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]); |
| | | |
| | | /* Update the DB of the (local) Server */ |
| | | $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'"); |
| | |
| | | if(is_link($data['old']['document_root'].'/log')) $app->system->unlink($data['old']['document_root'].'/log'); |
| | | } |
| | | |
| | | /* |
| | | // Create the symlink for the logfiles |
| | | if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) $app->system->mkdirpath('/var/log/ispconfig/httpd/'.$data['new']['domain']); |
| | | if(!is_link($data['new']['document_root'].'/log')) { |
| | | // exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log"); |
| | | if ($web_config["website_symlinks_rel"] == 'y') { |
| | | $this->create_relative_link("/var/log/ispconfig/httpd/".$data["new"]["domain"], $data["new"]["document_root"]."/log"); |
| | | } else { |
| | | exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log"); |
| | | } |
| | | |
| | | $app->log('Creating symlink: ln -s /var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/log',LOGLEVEL_DEBUG); |
| | | } |
| | | */ |
| | | |
| | | //* Create the log dir if nescessary and mount it |
| | | if(!is_dir($data['new']['document_root'].'/log') || is_link($data['new']['document_root'].'/log')) { |
| | | if(is_link($data['new']['document_root'].'/log')) unlink($data['new']['document_root'].'/log'); |
| | |
| | | // make tmp directory writable for Apache and the website users |
| | | $app->system->chmod($data['new']['document_root'].'/tmp',0777); |
| | | |
| | | // Set Log symlink to 755 to make the logs accessible by the FTP user |
| | | // Set Log directory to 755 to make the logs accessible by the FTP user |
| | | if(realpath($data['new']['document_root'].'/log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') { |
| | | $app->system->chmod($data['new']['document_root'].'/log',0755); |
| | | } |