本文整理汇总了PHP中VirtualHost::get方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtualHost::get方法的具体用法?PHP VirtualHost::get怎么用?PHP VirtualHost::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualHost
的用法示例。
在下文中一共展示了VirtualHost::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
* @license GNU GPL v3.0
* @package aetolos
* @subpackage emailmanager
*/
// No direct access - loadable only
if (!defined('AET_IN')) {
die("No Access");
}
// Check for parameter
if (!isset($cmdParameters['modify-virtualhost'])) {
Log::error('Missing parameter');
exit(9);
}
$vhost = new VirtualHost($db);
$vhost->domainName = $cmdParameters['modify-virtualhost'];
$rc = $vhost->get();
if ($rc === false) {
Log::error('Unknown virtual host');
exit(9);
}
$emailManager = new EmailManager($vhost);
if (isset($cmdParameters['add-email'])) {
if (!isset($cmdParameters['password'])) {
if (isset($cmdParameters['password-file'])) {
if (!is_file($cmdParameters['password-file'])) {
Log::error('Error while opening the password file');
exit(9);
}
$cmdParameters['password'] = file_get_contents($cmdParameters['password-file']);
if ($cmdParameters['password'] === false) {
Log::error('Error while reading the password file');
示例2: removeParkedDomain
/**
* Remove a parked domain from the current virtual host
* @param string $domainName Parked domain name to remove
* @return boolean
*/
public function removeParkedDomain($domainName)
{
// Load parked domain object
$vhost = new VirtualHost($this->db);
$vhost->domainName = $domainName;
$rc = $vhost->get();
if ($rc === false) {
Log::error('Unknown parked domain');
return false;
}
// Make sure this is a parked domain and not a virtual host
if ($vhost->parkedUnder == '') {
Log::error('The domain \'' . $vhost->domainName . '\' is not a parked domain, but a virtual host');
return false;
}
Log::debug('Delete parked domain: ' . $domainName);
// Full home directory path
$home = $this->home . '/' . $this->unixName;
// Delete etc
$etcDir = $home . '/etc/' . $domainName;
if (is_dir($etcDir)) {
exec('/usr/bin/rm -rf ' . escapeshellarg($etcDir) . ' 2>/dev/null');
}
// Delete mail
$mailDir = $home . '/mail/' . $domainName;
if (is_dir($mailDir)) {
exec('/usr/bin/rm -rf ' . escapeshellarg($mailDir) . ' 2>/dev/null');
}
// Delete NSD configuration and zone files
if (is_file(Config::read('nsd|directoryConfD') . '/' . $domainName . '.conf')) {
unlink(Config::read('nsd|directoryConfD') . '/' . $domainName . '.conf');
}
if (is_file(Config::read('nsd|directoryConfD') . '/' . $domainName . '.zone')) {
unlink(Config::read('nsd|directoryConfD') . '/' . $domainName . '.zone');
}
// Delete vhost directory
if (is_link('/etc/dovecot/vhost/' . $domainName)) {
unlink('/etc/dovecot/vhost/' . $domainName);
}
// Delete Apache virtual host file
if (is_file(Config::read('apache|directoryConfD') . '/' . $domainName . '.conf')) {
unlink(Config::read('apache|directoryConfD') . '/' . $domainName . '.conf');
}
// Delete Apache log files
if (is_file('/var/log/httpd/' . $domainName)) {
unlink('/var/log/httpd/' . $domainName);
}
if (is_file('/var/log/httpd/' . $domainName . '-bytes_log')) {
unlink('/var/log/httpd/' . $domainName . '-bytes_log');
}
if (is_file('/var/log/httpd/' . $domainName . '-ssl_log')) {
unlink('/var/log/httpd/' . $domainName . '-ssl_log');
}
// Remove from database
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHostMx` WHERE VirtualHost_ID=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting mail exchange server from the database table: virtualHostMx');
return false;
}
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHostNs` WHERE VirtualHost_ID=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting name server from the database table: virtualHostNs');
return false;
}
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHost` WHERE Id=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting parked domain from the database table: virtualHost');
return false;
}
return true;
}