name] = unserialize($variable->value); } } function boost_stats_update_node_counter() { Global $nid; // A node has been viewed, so update the node's counters. db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), $nid); // If we affected 0 rows, this is the first time viewing the node. if (!db_affected_rows()) { // We must create a new row to store counters for the new node. db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', $nid, time()); } } function boost_stats_add_access_log() { Global $title, $q, $referer, $session_id, $uid; db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", $title, $q, $referer, ip_address(), $uid, $session_id, timer_read('page'), time()); } function boost_stats_output_stats_block() { if (boost_stats_variable_get('boost_block_show_stats')) { if (!boost_stats_variable_get('boost_block_cache_stats_block') && !boost_stats_variable_get('throttle_level')) { boost_stats_full_boot(); $block = module_invoke('statistics', 'block', 'view', 0); $block = $block['content']; } else { $block = boost_stats_variable_get('boost_statistics_html'); } } else { $block = 'NULL'; } return array('#boost-stats' => $block); } function boost_stats_full_boot() { Global $full_boot; if (!isset($full_boot)) { $full_boot = FALSE; } if (!$full_boot) { include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } $full_boot = TRUE; } function boost_stats_variable_get($name) { Global $variables; return isset($variables[$name]) ? $variables[$name] : FALSE; }