本文整理匯總了PHP中Scheduler::isAllowedToRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Scheduler::isAllowedToRequest方法的具體用法?PHP Scheduler::isAllowedToRequest怎麽用?PHP Scheduler::isAllowedToRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Scheduler
的用法示例。
在下文中一共展示了Scheduler::isAllowedToRequest方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doPostSynch
function doPostSynch($wsName, $dateFrom, $dateTo)
{
global $dao, $postOSIReq, $CONF_LastrequestLbl, $isOkResponses, $nbChildrenProducts, $nbResponse200, $nbResponseError, $nbResponse409, $nbNoReference;
/* Check if allow to get this request */
$isAllow = Scheduler::isAllowedToRequest($wsName);
if (!ForceRequest::isForcedRequest() && !$isAllow) {
return;
}
switch ($wsName) {
/*
* WSO-P005
* POST /article
*/
case "WSO-P005":
Log::write("###### Do request " . $wsName . " - action=create_article ######", "info");
$offset = 0;
$limit = 1000;
do {
$newProducts = $dao->getLastCreateProducts($dateFrom, $dateTo, GlobalConfig::getDefaultLangId(), GlobalConfig::getDefaultCountryId(), $offset, $limit);
$isOkResponses = true;
$nbMainProducts = 0;
$nbChildrenProducts = 0;
$nbResponse200 = 0;
$nbResponseError = 0;
$nbResponse409 = 0;
$nbNoReference = 0;
if ($newProducts) {
$nbMainProducts = count($newProducts);
foreach ($newProducts as $product) {
/*
* Create main product
* @param $product => array
* @param create child products
* @param send publication
*/
createMainProduct($product, true, true);
}
Log::write("Nb total main products = " . $nbMainProducts, "info");
Log::write("Nb total children products = " . $nbChildrenProducts, "info");
Log::write("Nb without reference = " . $nbNoReference, "info");
Log::write("Nb sent products = " . ($nbMainProducts + $nbChildrenProducts - $nbNoReference), "info");
Log::write("Nb response 200 (ok) = " . $nbResponse200, "info");
Log::write("Nb response 409 (duplicate) = " . $nbResponse409, "info");
Log::write("Nb response error = " . $nbResponseError, "info");
} else {
Log::write("No request to send", "info");
}
$offset += $limit;
} while (count($newProducts) == $limit);
if ($isOkResponses && !ForceRequest::isForcedRequest()) {
Configuration::updateValue($CONF_LastrequestLbl . $wsName, Scheduler::getTimeOnInit());
}
Log::write("End request " . $wsName . " ------<br /><br />", "info");
break;
/*
* WSO-P006
* POST /article/$reference$
*/
/*
* WSO-P006
* POST /article/$reference$
*/
case "WSO-P006":
Log::write("###### Do request " . $wsName . " - action=update_article ######", "info");
$offset = 0;
$limit = 1000;
do {
$updateProducts = $dao->getLastUpdateProducts($dateFrom, $dateTo, GlobalConfig::getDefaultLangId(), GlobalConfig::getDefaultCountryId(), $offset, $limit);
$isOkResponses = true;
$nbMainProducts = 0;
$nbChildrenProducts = 0;
$nbResponse200 = 0;
$nbResponseError = 0;
$nbResponse409 = 0;
$nbNoReference = 0;
if ($updateProducts) {
$nbMainProducts = count($updateProducts);
foreach ($updateProducts as $product) {
updateMainProduct($product);
}
Log::write("Nb total main products = " . $nbMainProducts, "info");
Log::write("Nb total children products = " . $nbChildrenProducts, "info");
Log::write("Nb without reference = " . $nbNoReference, "info");
Log::write("Nb sent products = " . ($nbMainProducts + $nbChildrenProducts - $nbNoReference), "info");
Log::write("Nb response 200 (ok) = " . $nbResponse200, "info");
Log::write("Nb response 409 (duplicate) = " . $nbResponse409, "info");
Log::write("Nb response error = " . $nbResponseError, "info");
} else {
Log::write("No request to send", "info");
}
$offset += $limit;
} while (count($updateProducts) == $limit);
if ($isOkResponses && !ForceRequest::isForcedRequest()) {
Configuration::updateValue($CONF_LastrequestLbl . $wsName, Scheduler::getTimeOnInit());
}
Log::write("End request " . $wsName . " ------<br /><br />", "info");
break;
/*
* WSO-P010
* POST /client/web
//.........這裏部分代碼省略.........