Browse Source

Call Certbot before adding to DB

Miraty 2 years ago
parent
commit
f3752163af
1 changed files with 2 additions and 2 deletions
  1. 2 2
      pg-act/ht/add-dns.php

+ 2 - 2
pg-act/ht/add-dns.php

@@ -30,12 +30,12 @@ checkAuthToken($matches[1], $matches[2]);
 
 rateLimit();
 
-addSite($_SESSION['id'], $_POST['dir'], $_POST['domain'], 'dns');
-
 exec('2>&1 ' . CONF['ht']['sudo_path'] . ' ' . CONF['ht']['certbot_path'] . ' certonly' . (($_SESSION['type'] === 'approved') ? '' : ' --test-cert') . ' --domain ' . $_POST['domain'], $output, $returnCode);
 if ($returnCode !== 0)
 	output(500, 'Certbot failed to get a Let\'s Encrypt certificate.', $output);
 
+addSite($_SESSION['id'], $_POST['dir'], $_POST['domain'], 'dns');
+
 htRelativeSymlink('../fs/' . $_SESSION['id'] . '/' . $_POST['dir'], CONF['ht']['ht_path'] . '/uri/' . $_POST['domain']);
 
 output(200, sprintf(_('%s added on this directory.'), PAGE_METADATA['title']));