md5check !== null ) { if ( $md5 !== $module->md5check ) { watchdog('security', t('Security issue. Module @moduleName has changed.', array('@moduleName' => $moduleName )), array(),WATCHDOG_CRITICAL) ; db_query($updateSQL,array($md5,$module->filename)); } } elseif ( $module->md5check === null ) { db_query($updateSQL,array($md5,$module->filename)); } } } function md5check_get_values_for_module( $moduleName ) { $sql = 'SELECT * FROM {system} WHERE name = "%s"'; $result = db_query($sql,array($moduleName)); $item = db_fetch_object($result) ; return $item ; } function md5check_calculate_md5_value_for_module( $module ) { $modulePath = drupal_get_path('module',$module->name); $files = md5check_rglob($modulePath .'/*'); $md5 = '' ; foreach ( $files as $file ) { if ( is_file($file) ) $md5 .= md5_file($file); } $md5 = md5($md5); return $md5 ; } function md5check_rglob($pattern, $flags = 0, $path = '') { if (!$path && ($dir = dirname($pattern)) != '.') { if ($dir == '\\' || $dir == '/') $dir = ''; return md5check_rglob(basename($pattern), $flags, $dir . '/'); } $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); foreach ($paths as $p) $files = array_merge($files, md5check_rglob($pattern, $flags, $p . '/')); return $files; }