You are here

function devel_generate_add_statistics in Devel 7

Same name and namespace in other branches
  1. 8.3 devel_generate/devel_generate.module \devel_generate_add_statistics()
  2. 8 devel_generate/devel_generate.module \devel_generate_add_statistics()
  3. 8.2 devel_generate/devel_generate.module \devel_generate_add_statistics()
  4. 6 devel_generate.inc \devel_generate_add_statistics()
  5. 4.x devel_generate/devel_generate.module \devel_generate_add_statistics()

Generate statistics information for a node.

Parameters

$node: A node object.

1 call to devel_generate_add_statistics()
devel_generate_node_insert in devel_generate/devel_generate.module
Inserts nodes properly based on generation options.

File

devel_generate/devel_generate.inc, line 595

Code

function devel_generate_add_statistics($node) {
  $statistic = array(
    'nid' => $node->nid,
    'totalcount' => mt_rand(0, 500),
    'timestamp' => REQUEST_TIME - mt_rand(0, $node->created),
  );
  $statistic['daycount'] = mt_rand(0, $statistic['totalcount']);
  db_insert('node_counter')
    ->fields($statistic)
    ->execute();
}