2015-02-11 15:29:54 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
function called as a hook during alternc update_domains.sh as follow:
|
2015-02-12 20:17:59 +00:00
|
|
|
(launched by functions_hosting.sh in launch_hook() shell function)
|
2015-02-11 15:29:54 +00:00
|
|
|
create a host: launch_hooks "create" "$1" "$2" "$3" "$4" (type domain mail value)
|
|
|
|
at the end of host creation: launch_hooks "postinst" "$1" "$2" "$3" "$4"
|
2015-02-12 20:17:59 +00:00
|
|
|
enable or disable a host: launch_hooks "enable|disable" "$1" "$2" "$3" (type domain value)
|
2015-02-11 15:29:54 +00:00
|
|
|
at host deletion: launch_hooks "delete" "$1" "$2" "$3" "$4" (type fqdn)
|
2014-09-20 17:23:57 +00:00
|
|
|
|
2015-02-11 15:29:54 +00:00
|
|
|
also, after reloading apache :
|
|
|
|
run-parts --arg=web_reload /usr/lib/alternc/reload.d
|
|
|
|
|
|
|
|
also, dns functions are:
|
|
|
|
after reconfiguring bind (rndc reconfig) : run-parts --arg=dns_reconfig /usr/lib/alternc/reload.d
|
|
|
|
(may need to *redo* rndc reconfig... a "before_dns_reconfig" would be better !)
|
|
|
|
before reloading a zone : run-parts --arg=dns_reload_zone --arg="$domain" /usr/lib/alternc/reload.d
|
|
|
|
*/
|
|
|
|
|
2015-02-12 20:17:59 +00:00
|
|
|
// Bootstrap
|
2015-02-11 15:29:54 +00:00
|
|
|
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
2014-09-20 17:23:57 +00:00
|
|
|
|
2015-02-12 20:17:59 +00:00
|
|
|
if (!isset($argv[1])) {
|
|
|
|
echo "FATAL: must be launched from functions_hosting.sh !\n";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if ( ($argv[1]=="create" || $argv[1]=="postinst" || $argv[1]=="delete") ) {
|
|
|
|
if (count($argv)<5) {
|
|
|
|
echo "FATAL: create/postinst/delete need 4 parameters: type domain mail value\n";
|
|
|
|
print_r($argv);
|
|
|
|
exit();
|
|
|
|
}
|
2015-02-13 10:38:27 +00:00
|
|
|
$ssl->updateDomain($argv[1], $argv[2], $argv[3], $argv[4]);
|
2015-02-12 20:17:59 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if ( ($argv[1]=="enable" || $argv[1]=="disable") ) {
|
|
|
|
if (count($argv)<4) {
|
|
|
|
echo "FATAL: enable/disable need 3 parameters: type domain value\n";
|
|
|
|
print_r($argv);
|
|
|
|
exit();
|
|
|
|
}
|
2015-02-13 10:38:27 +00:00
|
|
|
$ssl->updateDomain($argv[1], $argv[2], $argv[3] );
|
2015-02-12 20:17:59 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "FATAL: action unknown, must be launched from functions_hosting.sh !\n";
|
|
|
|
print_r($argv);
|
|
|
|
exit();
|
2014-09-20 17:23:57 +00:00
|
|
|
|