function acquai_spi_get_404s in Acquia Connector 7.2
Same name and namespace in other branches
- 6.2 acquia_spi/acquia_spi.module \acquai_spi_get_404s()
- 7.3 acquia_spi/acquia_spi.module \acquai_spi_get_404s()
Grabs the last 404 errors in logs, excluding the checks we run for drupal files like README
Parameters
n/a:
Return value
An array of the pages not found and some associated data
1 call to acquai_spi_get_404s()
- acquia_spi_get in acquia_spi/
acquia_spi.module - Gather site profile information about this site.
File
- acquia_spi/
acquia_spi.module, line 1171 - Send site profile information (NSPI) and system data to Acquia Insight.
Code
function acquai_spi_get_404s() {
$data = array();
$row = 0;
if (module_exists('dblog')) {
$result = db_select('watchdog', 'w')
->fields('w', array(
'message',
'hostname',
'referer',
'timestamp',
))
->condition('w.type', 'page not found', '=')
->condition('w.timestamp', REQUEST_TIME - 3600, '>')
->condition('w.message', array(
"UPGRADE.txt",
"MAINTAINERS.txt",
"README.txt",
"INSTALL.pgsql.txt",
"INSTALL.txt",
"LICENSE.txt",
"INSTALL.mysql.txt",
"COPYRIGHT.txt",
"CHANGELOG.txt",
), 'NOT IN')
->orderBy('w.timestamp', 'DESC')
->range(0, 10)
->execute();
foreach ($result as $record) {
$data[$row]['message'] = $record->message;
$data[$row]['hostname'] = $record->hostname;
$data[$row]['referer'] = $record->referer;
$data[$row]['timestamp'] = $record->timestamp;
$row++;
}
}
return $data;
}