Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Certman.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public function install() {
//return false;
}
}

//delete Cron deprecated since 15.0.12 -> https://sangomakb.atlassian.net/wiki/spaces/FP/pages/10518892/Cron
$this->removeCronJob();

//register Job with random timing
$this->FreePBX->Job()->addClass('certman', 'update', 'FreePBX\modules\Certman\Job', rand(0, 59) . ' ' . rand(0, 3) . ' * * *');

return true;
}

Expand All @@ -94,6 +101,7 @@ public function uninstall() {
$this->removeCSR();
$this->removeCA();
$this->removeCronJob();
//Jobs are automatically removed by freepbx
$certs = $this->getAllManagedCertificates();
foreach($certs as $cert) {
$this->removeCertificate($cert['cid']);
Expand Down
17 changes: 0 additions & 17 deletions install.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
<?php

$ampsbin = FreePBX::Config()->get("AMPSBIN");
foreach(FreePBX::Cron()->getAll() as $cron) {
$str = "fwconsole certificates updateall -q";
if(preg_match("/".$str."/i",$cron,$matches)) {
FreePBX::Cron()->remove($cron);
}
$str = "fwconsole certificates --updateall -q";
if(preg_match("/".$str."/i",$cron,$matches)) {
FreePBX::Cron()->remove($cron);
}
}
FreePBX::Cron()->add(array(
"command" => $ampsbin."/fwconsole certificates --updateall -q 2>&1 >/dev/null",
"hour" => rand(0,3),
"minute" => rand(0,59),
));

$freepbx_conf = freepbx_conf::create();
$set['value'] = '730';
$set['defaultval'] =& $set['value'];
Expand Down