Skip to content

Commit c85ce0a

Browse files
committed
Convert from select to checkbox
1 parent ab7c326 commit c85ce0a

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

web/edit/web/index.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@
6868
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
6969
$v_backend_template = $data[$v_domain]['BACKEND'];
7070
$v_nginx_cache = $data[$v_domain]['FASTCGI_CACHE'];
71-
$v_nginx_cache_length = $data[$v_domain]['FASTCGI_CACHE_LENGTH'];
72-
if(empty($v_nginx_cache_length)){
71+
$v_nginx_cache_length = $data[$v_domain]['FASTCGI_DURATION'];
72+
$v_nginx_cache_check = ''
73+
if(empty($v_nginx_duration)){
7374
$v_nginx_cache_length = '30m';
75+
$v_nginx_cache_check = 'on';
7476
}
77+
;
7578
$v_proxy = $data[$v_domain]['PROXY'];
7679
$v_proxy_template = $data[$v_domain]['PROXY'];
7780
$v_proxy_ext = str_replace(',', ', ', $data[$v_domain]['PROXY_EXT']);
@@ -333,20 +336,20 @@
333336
}
334337

335338
// Enable/Disable nginx cache
336-
if (($_SESSION['WEB_SYSTEM'] == 'nginx') && ($v_nginx_cache != $_POST['v_nginx_cache'] ) && ($v_nginx_cache_length != $_POST['v_nginx_cache_length'] && $_POST['v_nginx_cache'] = "yes" ) && (empty($_SESSION['error_msg']))) {
337-
if ( $_POST['v_nginx_cache'] == 'yes' ) {
339+
if (($_SESSION['WEB_SYSTEM'] == 'nginx') && ($v_nginx_cache_check != $_POST['v_nginx_cache_check'] ) && ($v_nginx_cache_length != $_POST['v_nginx_cache_length'] && $_POST['v_nginx_cache'] = "yes" ) && (empty($_SESSION['error_msg']))) {
340+
if ( $_POST['v_nginx_cache_check'] == 'on' ) {
338341
if (!empty ($_POST['v_nginx_cache_length'])){
339-
echo $_POST['v_nginx_cache_length'] = "30m";
342+
echo $_POST['v_nginx_cache_length'] = "2m";
340343
}
341-
exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_cache_length']) , $output, $return_var);
344+
exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_duration']) , $output, $return_var);
342345
check_return_code($return_var,$output);
343346
unset($output);
344347
} else {
345348
exec (HESTIA_CMD."v-delete-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain), $output, $return_var);
346349
check_return_code($return_var,$output);
347350
unset($output);
348351
}
349-
$restart_proxy = 'yes';
352+
$restart_web = 'yes';
350353
}
351354

352355
// Delete proxy support
@@ -355,7 +358,7 @@
355358
check_return_code($return_var,$output);
356359
unset($output);
357360
unset($v_proxy);
358-
$restart_proxy = 'yes';
361+
$restart_web = 'yes';
359362
}
360363

361364
// Change proxy template / Update extension list

web/templates/admin/edit_web.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,20 @@
381381
</tr>
382382
<?php if($_SESSION['WEB_SYSTEM'] == 'nginx'){?>
383383
<tr>
384-
<td class="vst-text input-label">
385-
<?php print _('Enable Fast CGI Cache'); ?> <a href="https://docs.hestiacp.com/admin_docs/nginx_caching.html" target="_blank"><i class="fas fa-question-circle"></i></a>
384+
<td class="vst-text">
385+
<label><input type="checkbox" size="20" class="vst-checkbox" name="v_nginx_cache_check" <?php if (!empty($v_nginx_cache)) echo "checked=yes" ?> onclick="javascript:elementHideShow('v_nginx_duration');"><?php print _('Enable FastCGI Cache'); ?> <a href="https://docs.hestiacp.com/admin_docs/nginx_caching.html" target="_blank"><i class="fas fa-question-circle"></i></a></label>
386386
</td>
387387
</tr>
388388
<tr>
389-
<td>
390-
<select class="vst-list" name="v_nginx_cache">
391-
<option value="no"><?php echo _('No');?></option>
392-
<option value="yes" <?php if ( $v_nginx_cache == "yes") { echo 'selected'; }?>><?php echo _('Yes');?></option>
393-
</select>
389+
<td class="step-left">
390+
<table id="v_nginx_duration" style="display:<?php if ($v_nginx_cache != 'yes' ) { echo 'none';} else {echo 'block';}?> ;" >
391+
<td class="vst-text input-label">
392+
<?php print _('Cache Duration'); ?> <span class="optional"><?=_('For example: 30s, 10m or 1d');?>
393+
</td>
394+
<tr>
395+
<td><input type="text" size="20" class="vst-input" name="v_nginx_duration" value="<?=htmlentities(trim($v_nginx_duration, "'"))?>"></td>
396+
</tr>
397+
</table>
394398
</td>
395399
</tr>
396400
<?php } ?>

0 commit comments

Comments
 (0)