本文整理匯總了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