Пример #1
0
/**
 * @param \PhpAmqpLib\Message\AMQPMessage $msg
*/
function process_message($msg)
{
    //  load content queue
    $content = json_decode($msg->body, TRUE);
    // echo "<pre>"; print_r($content); echo "/<pre>";
    if ($content['action'] === 'create' || $content['action'] === 'renew') {
        $renew = $content['action'] === 'renew';
        $infos = $content['infos'];
        $db = new VHFFS();
        $vh = $db->get_httpd_from_servername($infos['domain']);
        $vl = VHFFS_letsencrypt::get_from_httpd_id($vh->httpd_id);
        if (empty($vl)) {
            $vl = new VHFFS_letsencrypt($vh->httpd_id);
        }
        $error = create_cert($infos, $renew);
        if (isset($error)) {
            $vl->cert_error($error);
        } else {
            $vl->cert_ok();
        }
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    }
}