private function _setProductData(array $aAPIResponseProductData, $sASIN, $sLocale, $iCacheDuration) { // Check if a customer review exists. $_bCustomerReviewExists = $this->_hasCustomerReview($aAPIResponseProductData); if ($_bCustomerReviewExists) { AmazonAutoLinks_Event_Scheduler::getCustomerReviews($this->getElement($aAPIResponseProductData, array('CustomerReviews', 'IFrameURL'), ''), $sASIN, $sLocale, $iCacheDuration); } $_aRow = $this->_formatRow($aAPIResponseProductData, $sASIN, $sLocale, $iCacheDuration, $_bCustomerReviewExists); $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']); $_iObjectID = $_oProductTable->setRowByASINLocale($sASIN . '_' . strtoupper($sLocale), $_aRow); }
/** * * @callback action aal_action_api_get_customer_review */ public function doAction() { $_aParams = func_get_args() + array(null); $_aArguments = $_aParams[0] + array(null, null, null, null); $_sURL = $_aArguments[0]; $_sASIN = $_aArguments[1]; $_sLocale = $_aArguments[2]; $_iCacheDuration = $_aArguments[3]; $_oHTTP = new AmazonAutoLinks_HTTPClient($_sURL, $_iCacheDuration); $_sHTMLBody = $_oHTTP->get(); if (!$_sHTMLBody) { return; } $_aRow = $this->_formatRow($_sURL, $_sHTMLBody, $_iCacheDuration, $_oHTTP->getCharacterSet()); if (empty($_aRow)) { return; } $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']); $_iSetObjectID = $_oProductTable->setRowByASINLocale($_sASIN . '_' . strtoupper($_sLocale), $_aRow); }
/** * Clears expired caches. * @since 3 * @return void */ private function _clearExpiredCaches($oFactory) { $_oCacheTable = new AmazonAutoLinks_DatabaseTable_request_cache(AmazonAutoLinks_Registry::$aDatabaseTables['request_cache']); $_oCacheTable->deleteExpired(); $_oProductTable = new AmazonAutoLinks_DatabaseTable_product(AmazonAutoLinks_Registry::$aDatabaseTables['product']); $_oProductTable->deleteExpired(); // DELETE FROM table WHERE (col1,col2) IN ((1,2),(3,4),(5,6)) $oFactory->setSettingNotice(__('Caches have been cleared.', 'amazon-auto-links')); }