function _acquia_spi_generate_hashes in Acquia Connector 7
Same name and namespace in other branches
- 6.2 acquia_spi/acquia_spi.module \_acquia_spi_generate_hashes()
- 6 acquia_spi/acquia_spi.module \_acquia_spi_generate_hashes()
- 7.2 acquia_spi/acquia_spi.module \_acquia_spi_generate_hashes()
Recursive helper function for acquia_spi_file_hashes().
1 call to _acquia_spi_generate_hashes()
- acquia_spi_file_hashes in acquia_spi/
acquia_spi.module - Gather hashes of all important files, ignoring line ending and CVS Ids
File
- acquia_spi/
acquia_spi.module, line 191 - Send site profile information (SPI) and system data to Acquia Network.
Code
function _acquia_spi_generate_hashes($dir, $exclude_dirs, $limit_dirs = array()) {
$hashes = array();
$fileinfo = array();
if (is_dir($dir) && ($handle = opendir($dir))) {
while ($file = readdir($handle)) {
if (!in_array($file, array(
'.',
'..',
'CVS',
'.svn',
'.git',
'.bzr',
))) {
$path = $dir == '.' ? $file : "{$dir}/{$file}";
if (is_dir($path) && !in_array($path, $exclude_dirs) && (empty($limit_dirs) || in_array($path, $limit_dirs)) && $file != 'translations') {
list($sub_hashes, $sub_fileinfo) = _acquia_spi_generate_hashes($path, $exclude_dirs);
$hashes = array_merge($sub_hashes, $hashes);
$fileinfo = array_merge($sub_fileinfo, $fileinfo);
$hashes[$path] = acquia_spi_hash_path($path);
}
elseif (acquia_spi_is_manifest_type($file)) {
$hashes[$path] = acquia_spi_hash_path($path);
$owner = fileowner($path);
if (function_exists('posix_getpwuid')) {
$userinfo = posix_getpwuid($owner);
$owner = $userinfo['name'];
}
$fileinfo[$path] = 'mt:' . filemtime($path) . '$p:' . substr(sprintf('%o', fileperms($path)), -4) . '$o:' . $owner . '$s:' . filesize($path);
}
}
}
closedir($handle);
}
return array(
$hashes,
$fileinfo,
);
}