You are here

function acquia_spi_file_hashes in Acquia Connector 7.2

Same name and namespace in other branches
  1. 6.2 acquia_spi/acquia_spi.module \acquia_spi_file_hashes()
  2. 6 acquia_spi/acquia_spi.module \acquia_spi_file_hashes()
  3. 7 acquia_spi/acquia_spi.module \acquia_spi_file_hashes()

Gather hashes of all important files, ignoring line ending and CVS Ids

Parameters

$excuded_dirs: Optional array of directory paths to be excluded.

Return value

An associative array keyed by filename of hashes.

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

File

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

Code

function acquia_spi_file_hashes($exclude_dirs = array()) {

  // The list of directories for the third parameter are the only ones that
  // will be recursed into.  Thus, we avoid sending hashes for any others.
  list($hashes, $fileinfo) = _acquia_spi_generate_hashes('.', $exclude_dirs, array(
    'modules',
    'profiles',
    'themes',
    'includes',
    'misc',
    'scripts',
  ));
  ksort($hashes);

  // Add .htaccess file.
  $htaccess = DRUPAL_ROOT . DIRECTORY_SEPARATOR . '.htaccess';
  if (is_file($htaccess)) {
    $owner = fileowner($htaccess);
    if (function_exists('posix_getpwuid')) {
      $userinfo = posix_getpwuid($owner);
      $owner = $userinfo['name'];
    }
    $fileinfo['.htaccess'] = 'mt:' . filemtime($htaccess) . '$p:' . substr(sprintf('%o', fileperms($htaccess)), -4) . '$o:' . $owner . '$s:' . filesize($htaccess);
  }
  return array(
    $hashes,
    $fileinfo,
  );
}