本文整理汇总了PHP中maincf_multi::ConfigureMilters方法的典型用法代码示例。如果您正苦于以下问题:PHP maincf_multi::ConfigureMilters方法的具体用法?PHP maincf_multi::ConfigureMilters怎么用?PHP maincf_multi::ConfigureMilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maincf_multi
的用法示例。
在下文中一共展示了maincf_multi::ConfigureMilters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MultiplesInstances_start
function MultiplesInstances_start($hostname, $ou)
{
$hostname = trim($hostname);
if ($hostname == null) {
if ($GLOBALS["VERBOSE"]) {
echo "{$GLOBALS["deflog_start"]} milter-greylist (" . __FUNCTION__ . ") return -> hostname is null\n";
}
return;
}
$unix = new unix();
echo "{$GLOBALS["deflog_start"]} milter-greylist hostname:{$hostname} OU:({$ou}) line: " . __LINE__ . "\n";
$main = new maincf_multi($hostname, $ou);
$array_filters = unserialize(base64_decode($main->GET_BIGDATA("PluginsEnabled")));
if ($array_filters["APP_MILTERGREYLIST"] == 0) {
$enabled = false;
}
$pid = MultiplesInstancesPID($hostname);
if ($unix->process_exists($pid)) {
echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} already running PID {$pid}\n";
return;
}
echo "{$GLOBALS["deflog_start"]} milter-greylist hostname \"{$hostname}\" line: " . __LINE__ . "\n";
$bin_path = $unix->find_program("milter-greylist");
@mkdir("/var/spool/postfix/var/run/milter-greylist/{$hostname}", 0755, true);
@mkdir("/var/milter-greylist/{$hostname}", 666, true);
if (!is_file("/var/milter-greylist/{$hostname}/greylist.db")) {
@file_put_contents("/var/milter-greylist/{$hostname}/greylist.db", " ");
}
shell_exec("/bin/chmod 644 /var/milter-greylist/{$hostname}/greylist.db");
if (!is_file("/etc/milter-greylist/{$hostname}/greylist.conf")) {
echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} /etc/milter-greylist/{$hostname}/greylist.conf does not exists\n";
MultiplesInstances($hostname, $ou);
return;
}
$cmdline = "{$bin_path} -P /var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.pid";
$cmdline = $cmdline . " -p /var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock";
$cmdline = $cmdline . " -d /var/milter-greylist/{$hostname}/greylist.db";
$cmdline = $cmdline . " -f /etc/milter-greylist/{$hostname}/greylist.conf";
if ($GLOBALS["VERBOSE"]) {
echo "{$GLOBALS["deflog_start"]} milter-greylist {$cmdline}\n";
}
system($cmdline);
for ($i = 0; $i < 20; $i++) {
$pid = MultiplesInstancesPID($hostname);
if ($unix->process_exists($pid)) {
echo "{$GLOBALS["deflog_start"]} milter-greylist {$hostname} started PID {$pid}\n";
break;
}
sleep(1);
}
$pid = MultiplesInstancesPID($hostname);
if ($unix->process_exists($pid)) {
$main->ConfigureMilters();
}
for ($i = 0; $i < 10; $i++) {
if (is_file("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock")) {
break;
}
echo "{$GLOBALS["deflog_start"]} milter-greylist waiting greylist.sock ({$i}/10)\n";
sleep(1);
}
@chown("/var/spool/postfix/var/run/milter-greylist", "postfix");
@chgrp("/var/spool/postfix/var/run/milter-greylist", "postfix");
@chown("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock", "postfix");
@chmod("/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock", 0777);
@chmod("/var/spool/postfix/var/run/milter-greylist", 0755);
$unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/*");
$unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/{$hostname}");
$unix->chown_func("postfix", "postfix", "/var/spool/postfix/var/run/milter-greylist/{$hostname}/greylist.sock");
}