Browse Source

fix: 解决网站设置 PHP 源文之后没有立即生效的问题 (#2341)

pull/2346/head
zhengkunwang 1 year ago committed by GitHub
parent
commit
06f6a45289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      backend/app/service/website.go
  2. 10
      frontend/src/views/website/website/config/resource/nginx/index.vue
  3. 26
      frontend/src/views/website/website/config/resource/php-fpm/index.vue

3
backend/app/service/website.go

@ -1211,6 +1211,9 @@ func (w WebsiteService) UpdatePHPConfigFile(req request.WebsitePHPFileUpdate) er
if err := files.NewFileOp().WriteFile(configPath, strings.NewReader(req.Content), 0755); err != nil {
return err
}
if _, err := compose.Restart(runtimeInstall.GetComposePath()); err != nil {
return err
}
return nil
}

10
frontend/src/views/website/website/config/resource/nginx/index.vue

@ -5,7 +5,7 @@
:placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true"
:tabSize="4"
style="margin-top: 10px; max-height: 700px"
style="max-height: 700px"
:lineWrapping="true"
:matchBrackets="true"
theme="cobalt"
@ -13,11 +13,9 @@
:extensions="extensions"
v-model="content"
/>
<div style="margin-top: 10px">
<el-button type="primary" @click="submit()">
{{ $t('nginx.saveAndReload') }}
</el-button>
</div>
<el-button type="primary" @click="submit()" class="mt-2.5">
{{ $t('nginx.saveAndReload') }}
</el-button>
</div>
</template>
<script lang="ts" setup>

26
frontend/src/views/website/website/config/resource/php-fpm/index.vue

@ -5,7 +5,7 @@
:placeholder="$t('commons.msg.noneData')"
:indent-with-tab="true"
:tabSize="4"
style="margin-top: 10px; max-height: 700px"
style="max-height: 700px"
:lineWrapping="true"
:matchBrackets="true"
theme="cobalt"
@ -13,11 +13,10 @@
:extensions="extensions"
v-model="content"
/>
<div style="margin-top: 10px">
<el-button type="primary" @click="submit()">
{{ $t('nginx.saveAndReload') }}
</el-button>
</div>
<el-button type="primary" @click="openUpdate()" class="mt-2.5">
{{ $t('nginx.saveAndReload') }}
</el-button>
<ConfirmDialog ref="confirmDialogRef" @confirm="submit()"></ConfirmDialog>
</div>
</template>
<script lang="ts" setup>
@ -52,9 +51,10 @@ const id = computed(() => {
return props.id;
});
let data = ref<File.File>();
let loading = ref(false);
let content = ref('');
const data = ref<File.File>();
const loading = ref(false);
const content = ref('');
const confirmDialogRef = ref();
const get = () => {
loading.value = true;
@ -68,6 +68,14 @@ const get = () => {
});
};
const openUpdate = async () => {
confirmDialogRef.value!.acceptParams({
header: i18n.global.t('database.confChange'),
operationInfo: i18n.global.t('database.restartNowHelper'),
submitInputInfo: i18n.global.t('database.restartNow'),
});
};
const submit = async () => {
loading.value = true;
UpdatePHPFile({

Loading…
Cancel
Save