You are here

function acquai_spi_get_last_nodes in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.2 acquia_spi/acquia_spi.module \acquai_spi_get_last_nodes()

Get last 15 nodes created--this can be useful to determine if you have some sort of spamme on your site

Parameters

n/a:

Return value

array of the details of last 15 nodes created

1 call to acquai_spi_get_last_nodes()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 1032
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquai_spi_get_last_nodes() {
  $last_five_nodes = array();
  $query = db_query_range('SELECT title, type, nid, created FROM {node} WHERE created > UNIX_TIMESTAMP()-3600 ORDER BY created DESC', 0, 15);
  $count = 0;
  while ($data = db_fetch_array($query)) {
    $last_five_nodes[$count]['url'] = drupal_get_path_alias('node/' . $data['nid']);
    $last_five_nodes[$count]['title'] = $data['title'];
    $last_five_nodes[$count]['type'] = $data['type'];
    $last_five_nodes[$count]['created'] = $data['created'];
    $count++;
  }
  return $last_five_nodes;
}