当前位置: 首页>>代码示例>>PHP>>正文


PHP Scheduler::isAllowedToRequest方法代码示例

本文整理汇总了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
//.........这里部分代码省略.........
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:101,代码来源:postSynchCtrl.php


注:本文中的Scheduler::isAllowedToRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。