View Issue Details

IDProjectCategoryView StatusLast Update
0015248mantisbtemailpublic2014-09-23 18:05
ReporterChewits Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.11 
Target Version1.2.13Fixed in Version1.2.13 
Summary0015248: The order of sending emails is inverted when using cron
Description

When I use cron for sending email notification all the messages seems are sent in the wrong order. I investigated the issue and found that e-mails sent via the function email_send_all() [core/email_api.php], which in its turn uses the email_queue_get_ids() [core/email_queue_api.php]:

/**

  • Get array of email queue id's
  • @return array
    */
    function email_queue_get_ids() {
    $t_email_table = db_get_table( 'mantis_email_table' );

    $query = 'SELECT email_id FROM ' . $t_email_table . ' ORDER BY email_id DESC';
    $result = db_query_bound( $query );
    
    $t_ids = array();
    while(( $t_row = db_fetch_array( $result ) ) !== false ) {
            $t_ids[] = $t_row['email_id'];
    }
    
    return $t_ids;

    }

All the messages are put in the database in a forward order. Unclear why they are retrieved in reverse order?

Steps To Reproduce

cut 'DESC' from db-query

TagsNo tags attached.

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

dregad

dregad

2012-11-29 05:22

developer   ~0034423

Fixed. Thanks for the bug report.

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036112

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x 0737f330

2012-11-29 05:15

dregad


Details Diff
Make email_send_all() send older queued messages first

To achieve this, a new optional parameter was added to function
email_queue_get_ids() to specify the desired sort order (defaults to
'DESC' to ensure no change in behavior).

email_send_all() now retrieves the list of emails to send in ascending
order.

Fixes 0015248
Affected Issues
0015248
mod - core/email_api.php Diff File
mod - core/email_queue_api.php Diff File

MantisBT: master 17858aee

2012-11-29 05:15

dregad


Details Diff
Make email_send_all() send older queued messages first

To achieve this, a new optional parameter was added to function
email_queue_get_ids() to specify the desired sort order (defaults to
'DESC' to ensure no change in behavior).

email_send_all() now retrieves the list of emails to send in ascending
order.

Fixes 0015248
Affected Issues
0015248
mod - core/email_api.php Diff File
mod - core/email_queue_api.php Diff File