견적서 시스템 업데이트 실행"; // SQL 파일 읽기 $sql_file = './update_for_new_features.sql'; if (!file_exists($sql_file)) { die('SQL 파일을 찾을 수 없습니다.'); } $sql_content = file_get_contents($sql_file); // SQL 문을 세미콜론으로 분리 $sql_statements = explode(';', $sql_content); $success_count = 0; $error_count = 0; $errors = array(); echo "
"; echo "

업데이트 진행 상황:

"; foreach ($sql_statements as $sql) { $sql = trim($sql); // 빈 문장이나 주석 건너뛰기 if (empty($sql) || strpos($sql, '--') === 0 || strpos($sql, '/*') === 0) { continue; } try { $result = sql_query($sql, false); if ($result) { $success_count++; echo "

✓ SQL 실행 성공: " . substr($sql, 0, 50) . "...

"; } else { $error_count++; $error_msg = sql_error(); $errors[] = "SQL: " . substr($sql, 0, 100) . "... | 오류: " . $error_msg; echo "

⚠ SQL 실행 건너뜀 (이미 존재하거나 무시): " . substr($sql, 0, 50) . "...

"; } } catch (Exception $e) { $error_count++; $errors[] = "SQL: " . substr($sql, 0, 100) . "... | 오류: " . $e->getMessage(); echo "

✗ SQL 실행 실패: " . substr($sql, 0, 50) . "... | 오류: " . $e->getMessage() . "

"; } } echo "
"; echo "

업데이트 결과:

"; echo "

성공: {$success_count}개

"; echo "

오류/건너뜀: {$error_count}개

"; if (!empty($errors)) { echo "

오류 상세:

"; echo ""; } // 테이블 생성 확인 echo "

테이블 생성 확인:

"; $tables_to_check = array('order_config', 'order_mail_templates', 'order_sms_templates'); foreach ($tables_to_check as $table) { $full_table_name = G5_TABLE_PREFIX . $table; $result = sql_query("SHOW TABLES LIKE '{$full_table_name}'", false); if ($result && sql_num_rows($result) > 0) { echo "

✓ {$table} 테이블 존재

"; // 데이터 개수 확인 $count_result = sql_query("SELECT COUNT(*) as cnt FROM {$full_table_name}", false); if ($count_result) { $count_row = sql_fetch_array($count_result); echo "

- 데이터 개수: {$count_row['cnt']}개

"; } } else { echo "

✗ {$table} 테이블 없음

"; } } echo "
"; echo "

설정 관리로 이동

"; echo "

전문가 방문 관리로 이동

"; echo "

메일 템플릿 관리로 이동

"; ?>