diff options
author | stfwi <cerberos@atwillys.de> | 2011-07-05 19:50:41 +0100 |
---|---|---|
committer | stfwi <cerberos@atwillys.de> | 2011-07-05 19:50:41 +0100 |
commit | b0b08818dddb16360417cc8527424892b7ee24f2 (patch) | |
tree | 0b38824c3e4242a626e2bd393c32251eaf842769 /HTPasswdSync.install | |
parent | 2c44ee697d05d864f3b8b4e81fb80883f6532c17 (diff) | |
download | drupal_htpasswdsync-b0b08818dddb16360417cc8527424892b7ee24f2.tar.gz drupal_htpasswdsync-b0b08818dddb16360417cc8527424892b7ee24f2.tar.bz2 drupal_htpasswdsync-b0b08818dddb16360417cc8527424892b7ee24f2.zip |
ht files now updated when enabling/disabling module. Uninstall now deletes all htpasswdsync_* variables instead of explicit variable_del(). Removed _htpasswdsync_validate() as the functionality is now included in the name sanatizing process.
Diffstat (limited to 'HTPasswdSync.install')
-rw-r--r-- | HTPasswdSync.install | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/HTPasswdSync.install b/HTPasswdSync.install index 8288989..e83c828 100644 --- a/HTPasswdSync.install +++ b/HTPasswdSync.install @@ -1,5 +1,6 @@ <?php + /** * Install plugin * @return void @@ -8,22 +9,17 @@ function htpasswdsync_install() { drupal_install_schema('htpasswdsync_db'); } + /** * Uninstall plugin * @return void */ function htpasswdsync_uninstall() { - drupal_uninstall_schema('htpasswdsync_db'); - variable_del('htpasswdsync_htpasswd'); - variable_del('htpasswdsync_htgroup'); - variable_del('htpasswdsync_roles'); - variable_del('htpasswdsync_hash'); - variable_del('htpasswdsync_cron_time'); - variable_del('htpasswdsync_overwrite'); - variable_del('htpasswdsync_names_lowercase'); - variable_del('htpasswdsync_names_without_whitespace'); + db_query("DELETE FROM {variable} WHERE LOCATE('htpasswdsync_', name) = 1"); + drupal_uninstall_schema('htpasswdsync_db'); } + /** * Returns module database schema specification * @return array @@ -50,4 +46,25 @@ function htpasswdsync_db_schema() { ); return $schema; } + + +/** + * Enable plugin: Refresh database + * @return void + */ +function htpasswdsync_enable() { + if(variable_get('htpasswdsync_htpasswd', '---NOT--CONFIGURED---') != '---NOT--CONFIGURED---') { + _htpasswdsync_updatepasswd(false); + } +} + +/** + * Disable plugin: remove users from htuser/htgroup file + * @return void + */ +function htpasswdsync_disable() { + if(variable_get('htpasswdsync_htpasswd', '---NOT--CONFIGURED---') != '---NOT--CONFIGURED---') { + _htpasswdsync_updatepasswd(true); + } +} ?>
\ No newline at end of file |