本文整理汇总了PHP中VirtualHost::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtualHost::insert方法的具体用法?PHP VirtualHost::insert怎么用?PHP VirtualHost::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualHost
的用法示例。
在下文中一共展示了VirtualHost::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
if ($sslCert != '') {
$rc = 'yes';
} else {
$rc = 'no';
}
Log::debug('SSL/TLS certificate: ' . $rc);
// Load SSL/TLS CA bundle
$sslBundle = trim(tarReadFile($cmdParameters['import'], 'sslcerts/' . $vhost->domainName . '.cabundle'));
if ($sslBundle != '') {
$rc = 'yes';
} else {
$rc = 'no';
}
Log::debug('SSL/TLS CA bundle: ' . $rc);
// Create virtual host and insert to database
$rc = $vhost->insert();
if ($rc === false) {
Log::error('Error while adding virtual host');
exit(9);
}
Log::debug('Extracting homedir.tar...');
// Extract homedir.tar under the user home directory
exec('/usr/bin/tar --extract --strip-components=1 --one-file-system -f ' . escapeshellarg($cmdParameters['import']) . ' -C ' . escapeshellarg($vhost->home . '/' . $vhost->unixName) . ' ' . escapeshellarg('*/homedir.tar') . ' 2>/dev/null');
// Set permissions
$homeDirTar = $vhost->home . '/' . $vhost->unixName . '/homedir.tar';
chown($homeDirTar, $vhost->unixName);
chgrp($homeDirTar, $vhost->unixName);
Log::debug('Untaring homedir.tar...');
// Untar homedir.tar
exec('/usr/bin/sudo -u ' . escapeshellarg($vhost->unixName) . ' /usr/bin/tar --extract --one-file-system --exclude="*/.autorespond" --exclude="*/.cpaddons" --exclude="*/.cpanel" --exclude="*/perl5" --exclude="*/.autorespond-loopprotect" --exclude="*/.contactemail" --exclude="*/cpbackup-exclude.conf" --exclude="*/.dns" --exclude="*/.filter" --exclude="*/.lastlogin" --exclude="*/.spamassassinenable" --exclude="*/access-logs" --exclude="*/www" -f ' . escapeshellarg($homeDirTar) . ' -C ' . escapeshellarg($vhost->home . '/' . $vhost->unixName));
// Delete homedir.tar file