fix: Q&A 파일 업로드 권한 오류 수정
This commit is contained in:
@@ -62,16 +62,20 @@ if ($isEdit) {
|
||||
}
|
||||
|
||||
// === 파일 업로드 처리 공통 함수 ===
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = __DIR__ . '/../uploads/qa/';
|
||||
if (!is_dir($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
}
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = dirname(__DIR__) . '/uploads/qa';
|
||||
if (!is_dir($uploadDir)) {
|
||||
if (!mkdir($uploadDir, 0777, true) && !is_dir($uploadDir)) {
|
||||
$errors[] = '업로드 폴더를 생성할 수 없습니다.';
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
clearstatcache(true, $uploadDir);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
$errors[] = '업로드 폴더에 쓰기 권한이 없습니다.';
|
||||
return;
|
||||
|
||||
@@ -62,16 +62,20 @@ if ($isEdit) {
|
||||
}
|
||||
|
||||
// === 파일 업로드 처리 공통 함수 ===
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = __DIR__ . '/../uploads/qa/';
|
||||
if (!is_dir($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
}
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = dirname(__DIR__) . '/uploads/qa';
|
||||
if (!is_dir($uploadDir)) {
|
||||
if (!mkdir($uploadDir, 0777, true) && !is_dir($uploadDir)) {
|
||||
$errors[] = 'Upload folder could not be created.';
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
clearstatcache(true, $uploadDir);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
$errors[] = 'Upload folder is not writable.';
|
||||
return;
|
||||
|
||||
@@ -69,9 +69,16 @@ mkdir -p \
|
||||
egbim/data/cache \
|
||||
egbim/data/session \
|
||||
egbim/data/log \
|
||||
egbim/uploads/qa \
|
||||
eng/data/cache \
|
||||
eng/data/session \
|
||||
eng/data/log
|
||||
eng/data/log \
|
||||
eng/uploads/qa
|
||||
|
||||
# uploads/qa 는 Git이 디렉터리 권한을 보존하지 않으며, app 컨테이너의
|
||||
# Apache(www-data)가 bind mount 된 호스트 디렉터리에 파일을 저장해야 한다.
|
||||
# 배포 직후에도 Q&A 첨부파일을 저장할 수 있도록 권한을 명시한다.
|
||||
chmod 0777 egbim/uploads/qa eng/uploads/qa
|
||||
|
||||
mkdir -p docker/mysql/init
|
||||
|
||||
@@ -111,4 +118,4 @@ if [[ -f "$db_dump_path" && ! -f "$db_import_marker" ]]; then
|
||||
docker compose exec -T db mariadb-admin ping -h localhost -uroot "-p${MARIADB_ROOT_PASSWORD}" >/dev/null 2>&1
|
||||
docker compose exec -T db mariadb -u"${G5_MYSQL_USER}" "-p${G5_MYSQL_PASSWORD}" "${G5_MYSQL_DB}" < "$db_dump_path"
|
||||
touch "$db_import_marker"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,7 @@ case "$remote_mode" in
|
||||
remote_url="https://gitea.hmac.kr/b24014/egbim_homepage.git"
|
||||
;;
|
||||
ssh)
|
||||
remote_url="ssh://git@172.16.10.175:22/b24014/egbim_homepage.git"
|
||||
remote_url="ssh://git@10.13.10.4:22/b24014/egbim_homepage.git"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [https|ssh]" >&2
|
||||
|
||||
Reference in New Issue
Block a user