diff --git a/src/generate_bind_conf.php b/src/generate_bind_conf.php index c5f6f49c..4907007d 100755 --- a/src/generate_bind_conf.php +++ b/src/generate_bind_conf.php @@ -5,7 +5,7 @@ * * Generate Bind configuration for AlternC * - * To force generation, /launch/generate_bind_conf.php force + * To force generation, /launch/generate_bind_conf.php --force * * **/ @@ -15,6 +15,10 @@ ini_set("display_errors", 1); $bind = new system_bind(); -//$bind->regenerate_conf(true); // use it to force regeneration -$bind->regenerate_conf(); +$force = false; +if (in_array('--force', $argv)) { // Want to force + $force=true; +} + +$bind->regenerate_conf($force); diff --git a/src/rebuild_all_webconf.sh b/src/rebuild_all_webconf.sh index 1a7090c4..1d7cbaa3 100755 --- a/src/rebuild_all_webconf.sh +++ b/src/rebuild_all_webconf.sh @@ -1,15 +1,9 @@ #!/bin/bash # Get some vars -. /usr/lib/alternc/functions_hosting.sh +. /usr/lib/alternc/functions.sh -if [ -z "$VHOST_DIR" ] ; then - echo "Problem: No VHOST_DIR var" - exit 2 -fi - -echo "This script empty the $VHOST_DIR directory" -echo "and rebuild all web configuration." +echo "This script will rebuild all web configuration and regenerate DNS." echo "" echo "Only files in $VHOST_MANUALCONF will be preserved." echo "Use --force to skip confirmation" @@ -23,20 +17,13 @@ fi echo "" echo "++ Start rebuilding ++" -echo "Delete old configuration" -# [a-z_] for old storage schema (1.0) -for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z _ ; do - test -d "$VHOST_DIR/$i" && rm -rf "$VHOST_DIR/$i/" -done -test -f "$VHOST_FILE" && rm -f "$VHOST_FILE" -echo "Deleting complete" - echo "Set flag to rebuild" -mysql_query "update sub_domaines set web_action = 'UPDATE';" -mysql_query "update domaines set dns_action = 'UPDATE';" +mysql_query "update sub_domaines set web_action = 'UPDATE' and web_action != 'DELETE';" +mysql_query "update domaines set dns_action = 'UPDATE' and dns_action != 'DELETE';" echo "Launch update_domains to rebuild." /usr/lib/alternc/update_domains.sh +/usr/lib/alternc/generate_bind_conf.php --force echo "Finish."