mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-17 02:46:49 +08:00
fix: Resolve command execution failures in the PHP runtime environmen… (#9299)
Refs https://github.com/1Panel-dev/1Panel/issues/9286
This commit is contained in:
parent
5b5a649589
commit
9fbb63df95
4 changed files with 20 additions and 3 deletions
|
@ -743,6 +743,7 @@ func (r *RuntimeService) InstallPHPExtension(req request.PHPExtensionInstallReq)
|
|||
}
|
||||
}
|
||||
}
|
||||
handlePHPDir(*runtime)
|
||||
if err = restartRuntime(runtime); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ func handlePHP(create request.RuntimeCreate, runtime *model.Runtime, fileOp file
|
|||
version, ok := create.Params["PHP_VERSION"]
|
||||
if ok {
|
||||
extensionsDir := path.Join(projectDir, "extensions", getExtensionDir(version.(string)))
|
||||
_ = fileOp.CreateDir(extensionsDir, 0644)
|
||||
_ = fileOp.CreateDir(extensionsDir, 0755)
|
||||
}
|
||||
|
||||
composeContent, envContent, forms, err := handleParams(create, projectDir)
|
||||
|
@ -401,6 +401,7 @@ func buildRuntime(runtime *model.Runtime, oldImageID string, oldEnv string, rebu
|
|||
if deleteImageID != "" {
|
||||
deleteImageByID(deleteImageID, runtime.Image, client)
|
||||
}
|
||||
handlePHPDir(*runtime)
|
||||
if out, err := compose.DownAndUp(composePath); err != nil {
|
||||
runtime.Status = constant.StatusStartErr
|
||||
runtime.Message = out
|
||||
|
@ -987,3 +988,17 @@ func handleRuntimeDTO(res *response.RuntimeDTO, runtime model.Runtime) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func handlePHPDir(runtime model.Runtime) {
|
||||
fileOp := files.NewFileOp()
|
||||
dirs := []string{
|
||||
path.Join(runtime.GetPath(), "conf"),
|
||||
path.Join(runtime.GetPath(), "extensions"),
|
||||
path.Join(runtime.GetPath(), "composer"),
|
||||
path.Join(runtime.GetPath(), "log"),
|
||||
}
|
||||
for _, dir := range dirs {
|
||||
_ = fileOp.ChmodR(dir, 0755, true)
|
||||
_ = fileOp.ChownR(dir, strconv.Itoa(1000), strconv.Itoa(1000), true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ const terminalRef = ref<InstanceType<typeof Terminal> | null>(null);
|
|||
interface DialogProps {
|
||||
containerID: string;
|
||||
container: string;
|
||||
user: string;
|
||||
}
|
||||
const acceptParams = async (params: DialogProps): Promise<void> => {
|
||||
terminalVisible.value = true;
|
||||
form.containerID = params.containerID;
|
||||
title.value = params.container;
|
||||
form.isCustom = false;
|
||||
form.user = '';
|
||||
form.user = params.user;
|
||||
form.command = '/bin/bash';
|
||||
initTerm();
|
||||
};
|
||||
|
|
|
@ -296,7 +296,7 @@ const openSupervisor = (row: Runtime.Runtime) => {
|
|||
|
||||
const openTerminal = (row: Runtime.Runtime) => {
|
||||
const container = row.params['CONTAINER_NAME'];
|
||||
terminalRef.value.acceptParams({ containerID: container, container: container });
|
||||
terminalRef.value.acceptParams({ containerID: container, container: container, user: 'www-data' });
|
||||
};
|
||||
|
||||
const openLog = (row: Runtime.RuntimeDTO) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue