diff --git a/.gitattributes b/.gitattributes
index a30af3ba..a18e8327 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -88,6 +88,7 @@ bureau/admin/adm_tldadd.php -text
bureau/admin/adm_tlddoadd.php -text
bureau/admin/adm_tlddoedit.php -text
bureau/admin/adm_tldedit.php -text
+bureau/admin/adm_update_domains.php -text
bureau/admin/adm_variables.php -text
bureau/admin/aide/files/browser_set.png -text
bureau/admin/aide/files/ftp_add.png -text
@@ -488,6 +489,7 @@ etc/alternc/templates/default/saslauthd -text
etc/alternc/templates/dovecot/dovecot-dict-quota.conf -text
etc/alternc/templates/dovecot/dovecot-sql.conf -text
etc/alternc/templates/dovecot/dovecot.conf -text
+etc/alternc/templates/incron.d/alternc -text
etc/alternc/templates/postfix/ca.der -text
etc/alternc/templates/postfix/master.cf -text
etc/alternc/templates/postfix/myalias.cf -text
@@ -532,6 +534,7 @@ install/upgrades/1.0.sql -text
install/upgrades/1.1.php -text
install/upgrades/1.1.sh -text
install/upgrades/1.1.sql -text
+install/upgrades/3.0.sh -text
install/upgrades/README -text
lang/.svnignore -text
lang/README -text
@@ -596,6 +599,7 @@ src/fixperms.sh -text
src/functions.sh -text
src/functions_dns.sh -text
src/functions_hosting.sh -text
+src/inotify_update_domains.sh -text
src/mem_add -text
src/mem_del -text
src/popimap-log-login.sh -text
diff --git a/bureau/admin/adm_update_domains.php b/bureau/admin/adm_update_domains.php
new file mode 100644
index 00000000..acd4410b
--- /dev/null
+++ b/bureau/admin/adm_update_domains.php
@@ -0,0 +1,41 @@
+enabled) {
+ __("This page is restricted to authorized staff");
+ exit();
+}
+
+touch($L_INOTIFY_UPDATE_DOMAIN);
+
+Header('Location: /main.php');
+
+?>
diff --git a/bureau/admin/dom_edit.php b/bureau/admin/dom_edit.php
index d9b5caf9..a1289288 100644
--- a/bureau/admin/dom_edit.php
+++ b/bureau/admin/dom_edit.php
@@ -136,15 +136,17 @@ for($i=0;$i<$r["nsub"];$i++) {
-
" target="_blank"> |
-
+ | |
+ |
+?>
checkRight()) { ?>
- ">status) __("Switch debug Off"); else __("Switch debug On"); ?>
+ ">status) __("Switch debug Off"); else __("Switch debug On"); ?>
+
diff --git a/bureau/admin/styles/style.css b/bureau/admin/styles/style.css
index fdf76d40..5f12a29b 100644
--- a/bureau/admin/styles/style.css
+++ b/bureau/admin/styles/style.css
@@ -502,3 +502,8 @@ input#dir, input#sub_local {
.grey, .grey td {
color: #999;
}
+
+.retour-auto {
+ max-width:220px;
+ word-wrap:break-word;
+}
diff --git a/bureau/class/functions.php b/bureau/class/functions.php
index 87468301..8b0f27a7 100644
--- a/bureau/class/functions.php
+++ b/bureau/class/functions.php
@@ -246,11 +246,16 @@ function selected($bool) {
}
}
-function ecif($test,$tr,$fa="") {
+function ecif($test,$tr,$fa="",$affiche=1) {
if ($test)
- echo $tr;
+ $retour = $tr;
else
- echo $fa;
+ $retour = $fa;
+
+ if ($affiche)
+ echo $retour;
+ else
+ return $retour;
}
function __($str) {
@@ -653,5 +658,18 @@ function display_browser($dir="", $caller="main.dir", $width=350, $height=450) {
}
+// Insere un $wrap_string tous les $max caracteres dans $message
+function auto_wrap($message="",$max=10,$wrap_string="") {
+ $cpt = 0;
+ $mot = split(" ",$message);
+ while (isset($mot[$cpt]) && ($mot[$cpt] != "")){
+ if(@strlen($mot[$cpt]) > $max){
+ $nvmot = chunk_split ($mot[$cpt], $max, $wrap_string );
+ $message = str_replace($mot[$cpt], $nvmot, $message);
+ }
+ $cpt++;
+ }
+ return $message;
+}
?>
diff --git a/debian/alternc.postinst b/debian/alternc.postinst
index 6d61e614..47738ca0 100644
--- a/debian/alternc.postinst
+++ b/debian/alternc.postinst
@@ -115,6 +115,9 @@ SQLBACKUP_OVERWRITE=""
# known slave servers, empty for none, localhost is special (no ssh)
ALTERNC_SLAVES=""
+
+# File to look at for forced launch of update_domain (use incron)
+INOTIFY_UPDATE_DOMAIN="/var/run/alternc/inotify_update_domain.lock"
EOF
chown root:alterncpanel $CONFIGFILE
diff --git a/debian/control b/debian/control
index 09be5890..e0480f95 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Standards-Version: 3.9.1
Package: alternc
Architecture: all
Pre-depends: debconf (>= 0.5.00) | debconf-2.0, bash (>= 4)
-Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, ca-certificates, locales, perl-suid | perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, acl, dovecot-imapd (>= 1:1.2.15), dovecot-pop3d (>= 1:1.2.15), vlogger, mailx
+Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, bind9, wget, rsync, ca-certificates, locales, perl-suid | perl, postfix-mysql, wwwconfig-common, sasl2-bin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, acl, dovecot-imapd (>= 1:1.2.15), dovecot-pop3d (>= 1:1.2.15), vlogger, mailx, incron
Recommends: mysql-server(>= 5.0), ntp, quota
Conflicts: alternc-admintools, alternc-awstats (< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (< 2.0)
Provides: alternc-admintools
diff --git a/debian/rules b/debian/rules
index 69bcc0b1..8c307da6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -61,7 +61,7 @@ install: build
chmod 1733 debian/alternc/var/alternc/sessions
chmod -R 644 debian/alternc/var/alternc/bureau
chmod -R a+X debian/alternc/var/alternc/bureau
- chown -R www-data:www-data debian/alternc/var/alternc/html debian/alternc/var/run/alternc debian/alternc/var/log/alternc debian/alternc/var/alternc/tmp
+ chown -R www-data:www-data debian/alternc/var/alternc/html debian/alternc/var/log/alternc debian/alternc/var/alternc/tmp
chmod a+x debian/alternc/usr/share/alternc/install/alternc.install debian/alternc/usr/share/alternc/install/dopo.sh debian/alternc/usr/share/alternc/install/mysql.sh debian/alternc/usr/share/alternc/install/newone.php debian/alternc/usr/share/alternc/install/reset_root.php debian/alternc/usr/share/alternc/install/upgrade_check.sh debian/alternc/usr/share/alternc/install/upgrades/*.php debian/alternc/usr/share/alternc/install/upgrades/*.sh
for sub in mail html ; do \
@@ -76,6 +76,8 @@ install: build
chown 1999:1999 debian/alternc/var/alternc/logs
# Group and user 1999 reference alterncpanel
chown 1999:1999 debian/alternc/var/alternc/html/*
+ mkdir -p debian/alternc/var/run/alternc/
+ chown 1999:1999 debian/alternc/var/run/alternc/
# Ex old alternc-admintools
install tools/top_http_users debian/alternc/usr/bin
diff --git a/etc/alternc/templates/incron.d/alternc b/etc/alternc/templates/incron.d/alternc
new file mode 100644
index 00000000..9ad1ca93
--- /dev/null
+++ b/etc/alternc/templates/incron.d/alternc
@@ -0,0 +1,2 @@
+/var/run/alternc/ IN_CREATE,IN_ATTRIB,IN_NO_LOOP /usr/lib/alternc/inotify_update_domains.sh
+
diff --git a/install/alternc.install b/install/alternc.install
index cf8e3ee6..e5e87d8e 100644
--- a/install/alternc.install
+++ b/install/alternc.install
@@ -64,7 +64,7 @@ TEMPLATE_DIR="/etc/alternc/templates"
# Find needed configuration files (without the initial '/')
# replace this one unconditionnally
-CONFIG_FILES="etc/alternc/bureau.conf"
+CONFIG_FILES="etc/alternc/bureau.conf etc/incron.d/alternc"
if [ -e /etc/bind/named.conf ]; then
CONFIG_FILES="$CONFIG_FILES etc/bind/templates/zone.template
@@ -228,6 +228,10 @@ done
# also backup main.cf since we're doing major changes to it
BACKUPS="$BACKUPS etc/postfix/main.cf"
+
+# also backup /etc/incron.allow
+BACKUPS="$BACKUPS etc/incron.allow"
+
tar -zcf "$BACKUP_FILE" -C / $BACKUPS 2>/dev/null || true
#######################################################################
@@ -342,6 +346,16 @@ done
# Bug #1215: configure mydestination when $FQDN is not in
OLDDESTINATION=`postconf mydestination | awk -F '=' '{print $2}'`
echo "$OLDDESTINATION" | grep -q -v "$FQDN" && postconf -e "mydestination = $FQDN, $OLDDESTINATION"
+
+if [ ! -f "/etc/incron.allow" ]
+then
+ echo "Missing /etc/incron.allow ."
+ echo "Did you install incron ?"
+ exit 1
+fi
+
+grep -q ^root /etc/incron.allow || echo "root" >> /etc/incron.allow
+SERVICES="$SERVICES incron"
if [ -e /etc/proftpd.conf ] ; then
chmod 640 /etc/proftpd/proftpd.conf
diff --git a/install/upgrades/3.0.sh b/install/upgrades/3.0.sh
new file mode 100755
index 00000000..a86eb22f
--- /dev/null
+++ b/install/upgrades/3.0.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. /etc/alternc/local.sh
+
+# Add INOTIFY_UPDATE_DOMAIN var to local.sh
+if [ -z "$INOTIFY_UPDATE_DOMAIN" ] ; then
+echo -e '
+# File to look at for forced launch of update_domain (use incron)
+INOTIFY_UPDATE_DOMAIN="/var/run/alternc/inotify_update_domain.lock"
+' >> /etc/alternc/local.sh
+fi
+
+chown alterncpanel /var/run/alternc/
+
diff --git a/src/Makefile b/src/Makefile
index ef29814d..aa1a9047 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -19,7 +19,7 @@
# ----------------------------------------------------------------------
# Purpose of file: Makefile des binaires de /usr/lib/alternc
# ----------------------------------------------------------------------
-SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh
+SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh inotify_update_domains.sh
LIBS=functions.sh functions_hosting.sh functions_dns.sh
BIN=$(DESTDIR)/usr/lib/alternc/
diff --git a/src/inotify_update_domains.sh b/src/inotify_update_domains.sh
new file mode 100755
index 00000000..85982f0c
--- /dev/null
+++ b/src/inotify_update_domains.sh
@@ -0,0 +1,8 @@
+#!/bin/bash -x
+
+# Launch update_domains.sh if $INOTIFY_UPDATE_DOMAIN exist
+
+. /etc/alternc/local.sh
+
+test -e "$INOTIFY_UPDATE_DOMAIN" && /usr/lib/alternc/update_domains.sh
+
diff --git a/src/update_domains.sh b/src/update_domains.sh
index 6e1799fa..85ccb802 100644
--- a/src/update_domains.sh
+++ b/src/update_domains.sh
@@ -166,7 +166,7 @@ for slave in $ALTERNC_SLAVES; do
fi
done
-rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART"
+rm -f "$LOCK_FILE" "$RELOAD_ZONES" "$RELOAD_WEB" "$DNS_DO_RESTART" "$INOTIFY_UPDATE_DOMAIN"
exit 0
|