You are here

function simplenews_statistics_update_6303 in Simplenews Statistics 6.3

Upgrade to beta1 or aplha5 (depending on Simplenews)

File

./simplenews_statistics.install, line 298
Simplenews statistics (un)install and updates file.

Code

function simplenews_statistics_update_6303() {

  // Remove all statistics for nodes that don't exist anymore
  $query = 'DELETE FROM {simplenews_statistics} WHERE nid NOT IN (SELECT nid FROM {node})';
  db_query($query);
  $query = 'DELETE FROM {simplenews_statistics_clicks} WHERE nid NOT IN (SELECT nid FROM {node})';
  db_query($query);
  $query = 'DELETE FROM {simplenews_statistics_opens} WHERE nid NOT IN (SELECT nid FROM {node})';
  db_query($query);
}