本文整理匯總了PHP中SquidUpdate::ScribePurge方法的典型用法代碼示例。如果您正苦於以下問題:PHP SquidUpdate::ScribePurge方法的具體用法?PHP SquidUpdate::ScribePurge怎麽用?PHP SquidUpdate::ScribePurge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SquidUpdate
的用法示例。
在下文中一共展示了SquidUpdate::ScribePurge方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: purge
/**
* Purges a list of Squids defined in $wgSquidServers.
* $urlArr should contain the full URLs to purge as values
* (example: $urlArr[] = 'http://my.host/something')
* XXX report broken Squids per mail or log
*
* @param $urlArr array
* @return void
*/
static function purge($urlArr)
{
global $wgSquidServers, $wgHTCPMulticastAddress, $wgHTCPPort;
/*if ( (@$wgSquidServers[0]) == 'echo' ) {
echo implode("<br />\n", $urlArr) . "<br />\n";
return;
}*/
if (!$urlArr) {
return;
}
// wikia change start
global $wgPurgeSquidViaScribe;
if ($wgPurgeSquidViaScribe == true) {
SquidUpdate::ScribePurge($urlArr);
return;
}
// wikia change end
if ($wgHTCPMulticastAddress && $wgHTCPPort) {
SquidUpdate::HTCPPurge($urlArr);
}
wfProfileIn(__METHOD__);
$maxSocketsPerSquid = 8;
// socket cap per Squid
$urlsPerSocket = 400;
// 400 seems to be a good tradeoff, opening a socket takes a while
$socketsPerSquid = ceil(count($urlArr) / $urlsPerSocket);
if ($socketsPerSquid > $maxSocketsPerSquid) {
$socketsPerSquid = $maxSocketsPerSquid;
}
$pool = new SquidPurgeClientPool();
$chunks = array_chunk($urlArr, ceil(count($urlArr) / $socketsPerSquid));
foreach ($wgSquidServers as $server) {
foreach ($chunks as $chunk) {
$client = new SquidPurgeClient($server);
foreach ($chunk as $url) {
$client->queuePurge($url);
}
$pool->addClient($client);
}
}
$pool->run();
wfProfileOut(__METHOD__);
}