public function cleanUp() { $maxEndtime = Customweb_Core_Util_System::getScriptExecutionEndTime() - 4; $where = '(updatedOn < NOW() - INTERVAL 2 MONTH AND authorizationStatus = "' . Customweb_Payment_Authorization_ITransaction::AUTHORIZATION_STATUS_FAILED . '") OR (updatedOn < NOW() - INTERVAL 6 MONTH AND authorizationStatus = "' . Customweb_Payment_Authorization_ITransaction::AUTHORIZATION_STATUS_PENDING . '" ) OR (updatedOn < NOW() - INTERVAL 1 MONTH AND (authorizationStatus = "" OR authorizationStatus IS NULL )) LIMIT 0,40'; $removable = $this->manager->searchPrimaryKey($this->transactionClassName, $where); foreach ($removable as $remove) { if ($maxEndtime > time()) { $this->manager->removeByPrimaryKey($this->transactionClassName, $remove); } else { break; } } }
public function getScheduledTransactionIds() { $primaryKeys = $this->manager->searchPrimaryKey($this->transactionClassName, 'executeUpdateOn IS NOT NULL AND executeUpdateOn < NOW() LIMIT 0,' . (int) $this->getMaxNumberOfTransaction()); if (count($primaryKeys) < 1) { throw new Exception("No Scheduled Transactions found."); } return $primaryKeys; }