1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

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

This commit is contained in:
zhengkunwang 2023-09-18 21:52:20 +08:00 committed by GitHub
parent 9f0f3fa6cd
commit 06f6a45289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 15 deletions

View File

@ -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 { if err := files.NewFileOp().WriteFile(configPath, strings.NewReader(req.Content), 0755); err != nil {
return err return err
} }
if _, err := compose.Restart(runtimeInstall.GetComposePath()); err != nil {
return err
}
return nil return nil
} }

View File

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

View File

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