Loading entity_statistics.install +10 −1 Original line number Diff line number Diff line Loading @@ -57,8 +57,17 @@ function entity_statistics_schema() { 'default' => '', ), ), 'primary key' => array('entity_id'), 'primary key' => array('entity_id', 'entity_type'), ); return $schema; } /** * Recreate primary key to fix problems with same entity id on different types */ function entity_statistics_update_7001(&$sandbox) { db_drop_primary_key('entity_counter'); db_add_primary_key('entity_counter', array('entity_id', 'entity_type')); } entity_statistics.module +1 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,10 @@ function entity_statistics_exit() { $entity_type = arg(0); if (isset($entity_types[$entity_type]) && is_numeric(arg(1)) && arg(2) == NULL && entity_statistics_entity_type_enabled($entity_type)) { // A entity has been viewed, so update the entity's counters. db_merge('entity_counter')->key(array('entity_id' => arg(1)))->fields(array( db_merge('entity_counter')->key(array('entity_id' => arg(1), 'entity_type' => $entity_type))->fields(array( 'daycount' => 1, 'totalcount' => 1, 'timestamp' => REQUEST_TIME, 'entity_type' => $entity_type, ))->expression('daycount', 'daycount + 1')->expression('totalcount', 'totalcount + 1')->execute(); } } Loading entity_statistics.php +1 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,7 @@ if (variable_get('entity_statistics_count_entity_views_ajax', 0)) { $entity_id = $_POST['entity_id']; $entity_type = $_POST['entity_type']; if (is_numeric($entity_id)) { db_merge('entity_counter')->key(array('entity_id' => $entity_id))->fields(array( 'entity_type' => $entity_type, db_merge('entity_counter')->key(array('entity_id' => $entity_id, 'entity_type' => $entity_type))->fields(array( 'daycount' => 1, 'totalcount' => 1, 'timestamp' => REQUEST_TIME, Loading Loading
entity_statistics.install +10 −1 Original line number Diff line number Diff line Loading @@ -57,8 +57,17 @@ function entity_statistics_schema() { 'default' => '', ), ), 'primary key' => array('entity_id'), 'primary key' => array('entity_id', 'entity_type'), ); return $schema; } /** * Recreate primary key to fix problems with same entity id on different types */ function entity_statistics_update_7001(&$sandbox) { db_drop_primary_key('entity_counter'); db_add_primary_key('entity_counter', array('entity_id', 'entity_type')); }
entity_statistics.module +1 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,10 @@ function entity_statistics_exit() { $entity_type = arg(0); if (isset($entity_types[$entity_type]) && is_numeric(arg(1)) && arg(2) == NULL && entity_statistics_entity_type_enabled($entity_type)) { // A entity has been viewed, so update the entity's counters. db_merge('entity_counter')->key(array('entity_id' => arg(1)))->fields(array( db_merge('entity_counter')->key(array('entity_id' => arg(1), 'entity_type' => $entity_type))->fields(array( 'daycount' => 1, 'totalcount' => 1, 'timestamp' => REQUEST_TIME, 'entity_type' => $entity_type, ))->expression('daycount', 'daycount + 1')->expression('totalcount', 'totalcount + 1')->execute(); } } Loading
entity_statistics.php +1 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,7 @@ if (variable_get('entity_statistics_count_entity_views_ajax', 0)) { $entity_id = $_POST['entity_id']; $entity_type = $_POST['entity_type']; if (is_numeric($entity_id)) { db_merge('entity_counter')->key(array('entity_id' => $entity_id))->fields(array( 'entity_type' => $entity_type, db_merge('entity_counter')->key(array('entity_id' => $entity_id, 'entity_type' => $entity_type))->fields(array( 'daycount' => 1, 'totalcount' => 1, 'timestamp' => REQUEST_TIME, Loading