aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-08 13:58:32 +0200
committerDaniel Lange <DLange@git.local>2016-04-08 13:58:32 +0200
commit99dffc20ec579fc7b24989fe2f793fb3f875f6df (patch)
treed73c8d929ac659d1f7c024f44e6021a689b8332f
parente82ab61ed1de64292bd6b1a6684c61288eec0aaa (diff)
downloaddrupal_htpasswdsync-master.tar.gz
drupal_htpasswdsync-master.tar.bz2
drupal_htpasswdsync-master.zip
Fix and improve drupal status report from moduleHEADmaster
-rw-r--r--CHANGELOG.txt2
-rw-r--r--HTPasswdSync.module26
2 files changed, 23 insertions, 5 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 849c772..b7167a8 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,5 @@
+v1.3 Update status report functionality (drupal/admin/reports/status)
+
v1.2 Enable or disable curly braces password prefix like {SHA512-crypt}
Dovecot introduced the prefix, htpasswd from nginx doesn't understand it
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