/** * Schedules an action of getting product information in the background. * * @since 3 * @action schedule aal_action_api_get_product_info */ public static function getProductInfo($sAssociateID, $sASIN, $sLocale, $iCacheDuration) { $_oOption = AmazonAutoLinks_Option::getInstance(); if (!$_oOption->isAPIConnected()) { return false; } $_bScheduled = self::_scheduleTask('aal_action_api_get_product_info', array($sAssociateID, $sASIN, $sLocale, $iCacheDuration)); if (!$_bScheduled) { return $_bScheduled; } // Loads the site in the background. The method takes care of doing it only once in the entire page load. AmazonAutoLinks_Shadow::see(); return true; }
/** * * @callback action shutdown */ public function _replyToScheduleUpdatingCaches() { if (empty($GLOBALS['aAmazonAutoLinks_APIRequestURIs'])) { return; } $_iScheduled = 0; foreach ($GLOBALS['aAmazonAutoLinks_APIRequestURIs'] as $aExpiredCacheRequest) { // Schedules the action to run in the background with WP Cron. $_iScheduled += $this->_scheduleCacheRenewal($aExpiredCacheRequest); } if ($_iScheduled) { AmazonAutoLinks_Shadow::see(); } }