예제 #1
0
 /**
  * Iterates through the given resultset, dispatching every single mail with the given priority.
  * @param \System\Db\Database The database to use for the emailsystem queue
  * @param SMTP The smtp to use
  * @param \System\Db\DatabaseResult The results to iterate
  * @param int The priority level
  */
 private static final function iterateMailResults(\System\Db\Database $db, \System\Email\SMTP $smtp, \System\Db\DatabaseResult $results, $priority)
 {
     foreach ($results as $result) {
         $attachQuery = new \System\Db\Query($db, \System\Email\SQL_EMAILSYSTEM_GET_ATTACH);
         $attachQuery->bind($result->id, \System\Db\QueryType::TYPE_INTEGER);
         $attachQuery->bind($priority, \System\Db\QueryType::TYPE_INTEGER);
         $attachments = $db->query($attachQuery);
         self::addToLog('Processing ' . $results->count() . ' ' . self::$priorityNames[$priority][0] . ' priority mails');
         self::dispatchSingleMail($smtp, $result->from, self::convertAddressStringToArray($result->to), self::convertAddressStringToArray($result->cc), self::convertAddressStringToArray($result->bcc), $result->subject, $result->message, $attachments);
         $query = new \System\Db\Query($db, \System\Email\SQL_EMAILSSYTEM_DELETEMAIL);
         $query->bind(self::$priorityNames[$priority][1], \System\Db\QueryType::TYPE_QUERY);
         $query->bind($result->id, \System\Db\QueryType::TYPE_INTEGER);
         $db->query($query);
         $query = new \System\Db\Query($db, \System\Email\SQL_EMAILSYSTEM_DELETEATTACH);
         $query->bind($result->id, \System\Db\QueryType::TYPE_INTEGER);
         $query->bind($priority, \System\Db\QueryType::TYPE_INTEGER);
         $db->query($query);
     }
 }
예제 #2
0
 /**
  * Returns the global total amount of DB query execution time. This number is the total time over all queries executed on all
  * connected database objects.
  * @return string The total amount of execution time for all DB queries.
  */
 public static final function getTotalQueryTime()
 {
     return \System\Db\DatabaseResult::getTotalQueryTime();
 }