Explorar o código

Added database tab triggers. Issue #50

Serghey Rodin %!s(int64=14) %!d(string=hai) anos
pai
achega
75f9977cbf
Modificáronse 4 ficheiros con 6 adicións e 26 borrados
  1. 1 0
      bin/v_suspend_db_base
  2. 2 13
      bin/v_suspend_db_bases
  3. 1 0
      bin/v_unsuspend_db_base
  4. 2 13
      bin/v_unsuspend_db_bases

+ 1 - 0
bin/v_suspend_db_base

@@ -65,6 +65,7 @@ esac
 
 # Updating db value
 update_db_base_value '$SUSPENDED' 'yes'
+increase_user_value "$user" '$SUSPENDED_DB'
 
 # Logging
 log_event 'system' "$V_EVENT"

+ 2 - 13
bin/v_suspend_db_bases

@@ -52,20 +52,9 @@ search_string="SUSPENDED='no'"
 # Parsing unsuspeneded domains
 databases=$(db_clear_search)
 
+# Starting suspend loop
 for database in $databases; do
-    # Define database variables
-    db_user=$(get_db_value '$USER')
-    host=$(get_db_value '$HOST')
-    type=$(get_db_value '$TYPE')
-
-    # Switching on db type
-    case $type in
-        mysql) suspend_db_mysql ;;
-        pgsql) suspend_db_pgsql ;;
-    esac
-
-    # Updating db value
-    update_db_base_value '$SUSPENDED' 'yes'
+    $V_BIN/v_suspend_db_base "$user" "$database"
 done
 
 

+ 1 - 0
bin/v_unsuspend_db_base

@@ -65,6 +65,7 @@ esac
 
 # Updating db value
 update_db_base_value '$SUSPENDED' 'no'
+decrease_user_value "$user" '$SUSPENDED_DB'
 
 # Logging
 log_event 'system' "$V_EVENT"

+ 2 - 13
bin/v_unsuspend_db_bases

@@ -52,20 +52,9 @@ search_string="SUSPENDED='yes'"
 # Parsing unsuspeneded domains
 databases=$(db_clear_search)
 
+# Starting suspend loop
 for database in $databases; do
-    # Define database variables
-    db_user=$(get_db_value '$USER')
-    host=$(get_db_value '$HOST')
-    type=$(get_db_value '$TYPE')
-
-    # Switching on db type
-    case $type in
-        mysql) unsuspend_db_mysql ;;
-        pgsql) unsuspend_db_pgsql ;;
-    esac
-
-    # Updating db value
-    update_db_base_value '$SUSPENDED' 'no'
+    $V_BIN/v_unsuspend_db_base "$user" "$database"
 done