Chris@0: delete('statistics.node_counter_scale'); Chris@0: \Drupal::state()->delete('statistics.day_timestamp'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_schema(). Chris@0: */ Chris@0: function statistics_schema() { Chris@0: $schema['node_counter'] = [ Chris@0: 'description' => 'Access statistics for {node}s.', Chris@0: 'fields' => [ Chris@0: 'nid' => [ Chris@0: 'description' => 'The {node}.nid for these statistics.', Chris@0: 'type' => 'int', Chris@0: 'unsigned' => TRUE, Chris@0: 'not null' => TRUE, Chris@0: 'default' => 0, Chris@0: ], Chris@0: 'totalcount' => [ Chris@0: 'description' => 'The total number of times the {node} has been viewed.', Chris@0: 'type' => 'int', Chris@0: 'unsigned' => TRUE, Chris@0: 'not null' => TRUE, Chris@0: 'default' => 0, Chris@0: 'size' => 'big', Chris@0: ], Chris@0: 'daycount' => [ Chris@0: 'description' => 'The total number of times the {node} has been viewed today.', Chris@0: 'type' => 'int', Chris@0: 'unsigned' => TRUE, Chris@0: 'not null' => TRUE, Chris@0: 'default' => 0, Chris@0: 'size' => 'medium', Chris@0: ], Chris@0: 'timestamp' => [ Chris@0: 'description' => 'The most recent time the {node} has been viewed.', Chris@0: 'type' => 'int', Chris@0: 'unsigned' => TRUE, Chris@0: 'not null' => TRUE, Chris@0: 'default' => 0, Chris@0: ], Chris@0: ], Chris@0: 'primary key' => ['nid'], Chris@0: ]; Chris@0: Chris@0: return $schema; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Disable the Statistics module if the node module is not enabled. Chris@0: */ Chris@0: function statistics_update_8001() { Chris@0: if (!\Drupal::moduleHandler()->moduleExists('node')) { Chris@0: if (\Drupal::service('module_installer')->uninstall(['statistics'], TRUE)) { Chris@0: return 'The statistics module depends on the node module and has therefore been uninstalled.'; Chris@0: } Chris@0: else { Chris@0: return 'There was an error uninstalling the statistcs module.'; Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Disable the Statistics module if the node module is not enabled. Chris@0: */ Chris@0: function statistics_update_8002() { Chris@0: // Set the new configuration setting for max age to the initial value. Chris@0: \Drupal::configFactory()->getEditable('statistics.settings')->set('display_max_age', 3600)->save(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Remove access_log settings. Chris@0: */ Chris@0: function statistics_update_8300() { Chris@0: \Drupal::configFactory()->getEditable('statistics.settings')->clear('access_log')->save(); Chris@0: }