本文整理匯總了PHP中sockets::SaveClusterConfigFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP sockets::SaveClusterConfigFile方法的具體用法?PHP sockets::SaveClusterConfigFile怎麽用?PHP sockets::SaveClusterConfigFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sockets
的用法示例。
在下文中一共展示了sockets::SaveClusterConfigFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: server_receive_status
function server_receive_status()
{
writelogs("Receive infos from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__);
$gl = new gluster();
if ($gl->clients[$_POST["NTFY_STATUS"]] == null) {
writelogs("Depreciated server, send order to delete", __FUNCTION__, __FILE__, __LINE__);
echo "DELETE_YOU";
exit;
}
$ini = new Bs_IniHandler();
while (list($num, $ligne) = each($_POST)) {
writelogs("Receive infos {$num} = {$ligne} from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__);
$ini->_params["CLUSTER"][$num] = $ligne;
}
$sock = new sockets();
$sock->SaveClusterConfigFile($ini->toString(), "clusters-" . $_POST["NTFY_STATUS"]);
$cyrus_id = $sock->getFrameWork("cmd.php?idofUser=cyrus");
echo "CYRUS-ID={$cyrus_id};\n";
$gl = new gluster();
if (is_array($gl->clients)) {
while (list($num, $name) = each($gl->clients)) {
$cl[] = $name;
}
}
$datas = implode(";", $cl);
writelogs("Sending servers list " . strlen($datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
echo $datas;
}
示例2: import_webfilter
function import_webfilter($filename)
{
if (!is_file($filename)) {
echo "{$filename} no such file\n";
return;
}
$unix = new unix();
$ext = Get_extension($filename);
if ($ext != "gz") {
echo "{$filename} not a compressed file\n";
return;
}
$destinationfile = $unix->FILE_TEMP();
$sqlsourcefile = $unix->FILE_TEMP() . ".sql";
if (!$unix->uncompress($filename, $destinationfile)) {
echo "{$filename} corrupted GZ file...\n";
return;
}
$contentArray = unserialize(base64_decode(@file_get_contents($destinationfile)));
if (!is_array($contentArray)) {
echo "{$filename} corrupted file not an array...\n";
return;
}
@file_put_contents($sqlsourcefile, $contentArray["SQL"]);
$sock = new sockets();
echo "Saving default rule...\n";
$sock->SaveClusterConfigFile($contentArray["DansGuardianDefaultMainRule"], "DansGuardianDefaultMainRule");
$mysqlbin = $unix->find_program("mysql");
$q = new mysql_squid_builder();
$password = null;
$localdatabase = "squidlogs";
$q = new mysql_squid_builder();
$cmdline = "{$mysqlbin} --batch --force {$q->MYSQL_CMDLINES}";
$cmd = "{$cmdline} --database={$localdatabase} <{$sqlsourcefile} 2>&1";
if ($GLOBALS["VERBOSE"]) {
echo $cmd . "\n";
}
exec($cmd, $results);
while (list($key, $value) = each($results)) {
echo "{$value}\n";
}
}