/** * Fetches all inbound messages for given accounts (normally triggered via cron) * @param TxttoolsAccount[] $txttoolsAccounts The accounts to check * @return MoodletxtInboundMessage[] Inbound messages found * @version 2015062901 * @since 2010090301 */ public function getInboundMessages($txttoolsAccounts = array()) { $responses = array(); $lastUpdate = get_config('moodletxt', 'Inbound_Last_Update'); foreach ($txttoolsAccounts as $account) { try { $requests = $this->XMLBuilder->buildInboundMessageRequest($account, 0, 'ALL', $lastUpdate); $response = $this->outboundConnector->sendData($requests, $account); $this->XMLParser->setTxttoolsAccountObject($account); // Needed to set destination account $responses = array_merge($responses, $this->XMLParser->parse($response)); } catch (Exception $ex) { file_put_contents('C:\\moodle.log', time() . ': cron inbound poll failed for account (' . $account->getUsername() . '@' . $account->getUrl() . ') -> ' . $ex->getMessage(), FILE_APPEND); } } set_config('Inbound_Last_Update', time(), 'moodletxt'); return $responses; }