View Issue Details

IDProjectCategoryView StatusLast Update
0017031phpList 3 applicationStatisticspublic01-02-14 02:05
Reporterduncanc Assigned To 
Status resolvedResolutionfixed 
Product Version3.0.5 
Target Version3.0.6Fixed in Version3.0.6 
Summary0017031: Reset click statistics deletes links used by other messages
DescriptionThe final tab when composing a message has a checkbox to 'reset click statistics'.

The processing when that is checked is incorrect and will incorrectly delete rows from the linktrack_forward table causing 404/page not found errors when a link of the same url in a different message is clicked.

See function resetMessageStatistics() in file lib.php.
This processing will delete rows from linktrack_forward whose url has been clicked, even when that url is used by another message.
Rows in this table do not relate to messages, so the check of $count[0] < 2 is wrong.
I don't see why rows in linktrack_forward need to be deleted, even if the row is used only by one message, as new rows for the same urls will be created when the message is built.
The code should probably be removing rows from linktrack_ml instead.

The processing may well be as simple as deleting rows from linktrack_ml and from linktrack_uml_click for the given message id.

As this problem causes confusion for subscribers, I have had reports of "page not found" when clicking a link, can it be fixed in the upcoming release?

  $delete = array();
  $req = Sql_Query(sprintf('select forwardid from %s where messageid = %d',$GLOBALS['tables']['linktrack_uml_click'],$messageid));
  while ($fwdid = Sql_Fetch_Row($req)) {
    $count = Sql_Fetch_Row_Query(sprintf('select count(*) from %s where id = %d',$GLOBALS['tables']['linktrack_forward'],$fwdid[0]));
    if ($count[0] < 2) {
      $delete[] = $fwdid[0];
  if (sizeof($delete)) {
    Sql_Query(sprintf('delete from %s where id in (%s)',$GLOBALS['tables']['linktrack_forward'],join(',',$delete)));
TagsNo tags attached.



23-01-14 12:54

administrator   ~0052629

yes, that is serious.


25-01-14 13:59

updater   ~0052661

See GitHub pull request


01-02-14 02:05

administrator   ~0052791