[enh] moving hosting_vhost-ssl.sh to be launched systematically by update_domains.sh, and renamed to update_cert.sh

This commit is contained in:
Benjamin Sonntag 2018-06-23 14:59:38 +02:00
parent 9587ff1bfc
commit 8232c1a318
3 changed files with 9 additions and 4 deletions

View File

@ -82,6 +82,7 @@ class m_ssl {
* set expired certificates as such : * set expired certificates as such :
*/ */
function expire_certificates() { function expire_certificates() {
global $db;
$db->query("UPDATE certificates SET status=".self::STATUS_EXPIRED." WHERE status=".self::STATUS_OK." AND validend<NOW();"); $db->query("UPDATE certificates SET status=".self::STATUS_EXPIRED." WHERE status=".self::STATUS_OK." AND validend<NOW();");
} }
@ -91,6 +92,7 @@ class m_ssl {
* delete old certificates (expired for more than a year) * delete old certificates (expired for more than a year)
*/ */
function delete_old_certificates() { function delete_old_certificates() {
global $db;
$db->query("SELECT id FROM certificates WHERE status=".self::STATUS_EXPIRED." AND validend<DATE_SUB(NOW(), INTERVAL 12 MONTH) AND validend!='0000-00-00 00:00:00';"); $db->query("SELECT id FROM certificates WHERE status=".self::STATUS_EXPIRED." AND validend<DATE_SUB(NOW(), INTERVAL 12 MONTH) AND validend!='0000-00-00 00:00:00';");
while ($db->next_record()) { while ($db->next_record()) {
$CRTDIR = self::KEY_REPOSITORY . "/" . floor($db->Record["id"]/1000); $CRTDIR = self::KEY_REPOSITORY . "/" . floor($db->Record["id"]/1000);

View File

@ -18,15 +18,18 @@ launch_hooks() {
local VTYPE=$2 local VTYPE=$2
EXITCODE=0
if [ -x "$HOSTING_DIR/hosting_$VTYPE.sh" ] ; then if [ -x "$HOSTING_DIR/hosting_$VTYPE.sh" ] ; then
# If a specific script exist for this VTYPE, # If a specific script exist for this VTYPE,
# we launch it, and return his return code # we launch it, and return his return code
"$HOSTING_DIR/hosting_$VTYPE.sh" "$1" "$2" "$3" "$4" "$HOSTING_DIR/hosting_$VTYPE.sh" "$1" "$2" "$3" "$4"
return $? EXITCODE=$?
fi fi
# also launch ssl update domains hook
/usr/lib/alternc/update_certs.sh "$1" "$2" "$3" "$4"
# No specific script, return 0 # No specific script, return 0
return 0 return "$EXITCODE"
} }
host_conffile() { host_conffile() {

View File

@ -21,7 +21,7 @@
require_once("/usr/share/alternc/panel/class/config_nochk.php"); require_once("/usr/share/alternc/panel/class/config_nochk.php");
if (!isset($ssl)) { if (!isset($ssl)) {
echo "OUPS: hosting_vhost-ssl.sh launched, but ssl module not installed, exiting\n"; echo "OUPS: update_cert.sh launched, but ssl module not installed, exiting\n";
exit(); exit();
} }