Skip to content

Commit 99f5095

Browse files
committed
Fix WebUI
Debig v-add-fastcgi
1 parent c85ce0a commit 99f5095

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

bin/v-add-fastcgi-cache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Argument definition
1717
user=$1
1818
domain=$2
19-
duration=${3-30m}
19+
duration=${3-2m}
2020
debug=${4-no}
2121
restart=${5-no}
2222

@@ -71,7 +71,7 @@ status='$upstream_cache_status'
7171

7272
cat << EOF > $fastcgi
7373
fastcgi_cache $domain;
74-
fastcgi_cache_valid 200 2m;
74+
fastcgi_cache_valid 200 $duration;
7575
fastcgi_cache_valid 301 302 10m;
7676
fastcgi_cache_valid 404 10m;
7777
fastcgi_cache_bypass $no_cache;
@@ -111,7 +111,7 @@ fi
111111

112112
# Set FastCGI cache flag to enabled
113113
update_object_value 'web' 'DOMAIN' "$domain" '$FASTCGI_CACHE' 'yes'
114-
update_object_value 'web' 'DOMAIN' "$domain" 'FASTCGI_DURATION' "$duration"
114+
update_object_value 'web' 'DOMAIN' "$domain" '$FASTCGI_DURATION' "$duration"
115115

116116
if [ "$restart" = "yes" ]; then
117117
# Restart web server

bin/v-list-web-domain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ json_list() {
4646
"PROXY": "'$PROXY'",
4747
"PROXY_EXT": "'$PROXY_EXT'",
4848
"FASTCGI_CACHE": "'$FASTCGI_CACHE'",
49+
"FASTCGI_DURATION": "'$FASTCGI_DURATION'",
4950
"REDIRECT": "'$REDIRECT'",
5051
"REDIRECT_CODE": "'$REDIRECT_CODE'",
5152
"CUSTOM_DOCROOT": "'$CUSTOM_DOCROOT'",

web/edit/web/index.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@
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_DURATION'];
72-
$v_nginx_cache_check = ''
73-
if(empty($v_nginx_duration)){
74-
$v_nginx_cache_length = '30m';
71+
$v_nginx_cache_duration = $data[$v_domain]['FASTCGI_DURATION'];
72+
$v_nginx_cache_check = '';
73+
if(empty($v_nginx_cache_duration)){
74+
$v_nginx_cache_duration = '2m';
75+
$v_nginx_cache_check = '';
76+
}else{
7577
$v_nginx_cache_check = 'on';
7678
}
77-
;
7879
$v_proxy = $data[$v_domain]['PROXY'];
7980
$v_proxy_template = $data[$v_domain]['PROXY'];
8081
$v_proxy_ext = str_replace(',', ', ', $data[$v_domain]['PROXY_EXT']);
@@ -336,12 +337,12 @@
336337
}
337338

338339
// Enable/Disable nginx cache
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 (($_SESSION['WEB_SYSTEM'] == 'nginx') && ($v_nginx_cache_check != $_POST['v_nginx_cache_check'] ) && ($v_nginx_cache_duration != $_POST['v_nginx_cache_duration'] && $_POST['v_nginx_cache'] = "yes" ) && (empty($_SESSION['error_msg']))) {
340341
if ( $_POST['v_nginx_cache_check'] == 'on' ) {
341-
if (!empty ($_POST['v_nginx_cache_length'])){
342-
echo $_POST['v_nginx_cache_length'] = "2m";
342+
if (empty ($_POST['v_nginx_cache_duration'])){
343+
echo $_POST['v_nginx_cache_duration'] = "2m";
343344
}
344-
exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_duration']) , $output, $return_var);
345+
exec (HESTIA_CMD."v-add-fastcgi-cache ".$v_username." ".escapeshellarg($v_domain).' '. escapeshellarg($_POST['v_nginx_cache_duration']) , $output, $return_var);
345346
check_return_code($return_var,$output);
346347
unset($output);
347348
} else {

web/templates/admin/edit_web.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
<?php print _('Cache Duration'); ?> <span class="optional"><?=_('For example: 30s, 10m or 1d');?>
393393
</td>
394394
<tr>
395-
<td><input type="text" size="20" class="vst-input" name="v_nginx_duration" value="<?=htmlentities(trim($v_nginx_duration, "'"))?>"></td>
395+
<td><input type="text" size="20" class="vst-input" name="v_nginx_cache_duration" value="<?=htmlentities(trim($v_nginx_cache_duration, "'"))?>"></td>
396396
</tr>
397397
</table>
398398
</td>

0 commit comments

Comments
 (0)