aboutsummaryrefslogtreecommitdiffstats
path: root/HTPasswdSync.module
diff options
context:
space:
mode:
Diffstat (limited to 'HTPasswdSync.module')
-rw-r--r--HTPasswdSync.module26
1 files changed, 21 insertions, 5 deletions
diff --git a/HTPasswdSync.module b/HTPasswdSync.module
index f6689bb..3ac1a77 100644
--- a/HTPasswdSync.module
+++ b/HTPasswdSync.module
@@ -19,6 +19,21 @@ function _htpasswdsync_grpfilename() {
/**
+ * Returns the age of the htpasswd/group file or "unknown"
+ * @param string $file
+ * @return string
+ */
+function _htpasswdsync_fileage($file) {
+ if(is_file($file)) {
+ return t('last update !time ago', array(
+ '!time' => format_interval(time()-filemtime($file))));
+ } else {
+ return t('unknown');
+ }
+}
+
+
+/**
* Returns an array containing the role ids of the roles to write into
* the htgroup file. (selected in the admin page)
* @return array
@@ -699,7 +714,8 @@ function htpasswdsync_requirements($phase) {
$htpasswd_status_msg = _htpasswdsync_check_file(_htpasswdsync_passfilename());
$htpasswd_status_val = REQUIREMENT_ERROR;
if (!$htpasswd_status_msg) {
- $htpasswd_status_msg = t('!file file is writable', array('!file' => 'htpasswd'));
+ $htpasswd_status_msg = t('!file file is writable', array('!file' => 'htpasswd')) .
+ " (" . _htpasswdsync_fileage(_htpasswdsync_passfilename()) . ")";
$htpasswd_status_val = REQUIREMENT_OK;
}
} else {
@@ -711,7 +727,8 @@ function htpasswdsync_requirements($phase) {
$htgroup_status_msg = _htpasswdsync_check_file(_htpasswdsync_grpfilename());
$htgroup_status_val = REQUIREMENT_ERROR;
if (!$htgroup_status_msg) {
- $htgroup_status_msg = t('!file file is writable', array('!file' => 'htgroup'));
+ $htgroup_status_msg = t('!file file is writable', array('!file' => 'htgroup')) .
+ " (" . _htpasswdsync_fileage(_htpasswdsync_grpfilename()) . ")";
$htgroup_status_val = REQUIREMENT_OK;
}
} else {
@@ -723,9 +740,8 @@ function htpasswdsync_requirements($phase) {
$requirements['htpasswdsync_status'] = array(
'title' => t('HTPasswd Sync Status'),
- 'value' => $htpasswd_status_msg . "<br>" . $htgroup_status_msg . "<br>" .
- t('last update !time ago.', array(
- '!time' => format_interval(time()-variable_get('htpasswdsync_cron_time', 0)))),
+ 'value' => "htpasswd: " . $htpasswd_status_msg . "<br>" .
+ "htgroup: " . $htgroup_status_msg . "<br>",
'severity' => $status,
);

© 2014-2024 Faster IT GmbH | imprint | privacy policy