Fix production webroot path — both servers use /opt/lucee/tomcat/webapps/ROOT

Added luceeWebroot() helper to avoid repeating the path. The previous
fix incorrectly used /var/www/biz.payfrit.com for production, but both
dev and biz use the same Lucee webroot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-14 22:19:10 -07:00
parent 4a4a098551
commit 28d86ba6e5
6 changed files with 9 additions and 20 deletions

View file

@ -15,10 +15,7 @@ if ($userId <= 0) {
apiAbort(['OK' => false, 'ERROR' => 'not_logged_in', 'MESSAGE' => 'Authentication required']); apiAbort(['OK' => false, 'ERROR' => 'not_logged_in', 'MESSAGE' => 'Authentication required']);
} }
$webroot = isDev() $uploadsDir = luceeWebroot() . '/uploads/users';
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$uploadsDir = $webroot . '/uploads/users';
$avatarUrl = baseUrl() . '/uploads/users/'; $avatarUrl = baseUrl() . '/uploads/users/';
// Find existing avatar (check multiple extensions) // Find existing avatar (check multiple extensions)

View file

@ -191,6 +191,10 @@ function baseUrl(): string {
return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com'; return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com';
} }
function luceeWebroot(): string {
return '/opt/lucee/tomcat/webapps/ROOT';
}
// ============================================ // ============================================
// PHONE HELPERS // PHONE HELPERS
// ============================================ // ============================================

View file

@ -292,10 +292,7 @@ try {
// Build items lookup by CategoryID // Build items lookup by CategoryID
$itemsByCategory = []; $itemsByCategory = [];
$webroot = isDev() $uploadsDir = luceeWebroot() . '/uploads/items';
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$uploadsDir = $webroot . '/uploads/items';
foreach ($qItemRows as $item) { foreach ($qItemRows as $item) {
$catID = (int) $item['CategoryItemID']; $catID = (int) $item['CategoryItemID'];
$itemID = (int) $item['ID']; $itemID = (int) $item['ID'];

View file

@ -22,10 +22,7 @@ if (!isset($_FILES['header']) || $_FILES['header']['error'] !== UPLOAD_ERR_OK) {
jsonResponse(['OK' => false, 'ERROR' => 'no_file', 'MESSAGE' => 'No file was uploaded']); jsonResponse(['OK' => false, 'ERROR' => 'no_file', 'MESSAGE' => 'No file was uploaded']);
} }
$webroot = isDev() $headersDir = luceeWebroot() . '/uploads/headers';
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$headersDir = $webroot . '/uploads/headers';
if (!is_dir($headersDir)) { if (!is_dir($headersDir)) {
mkdir($headersDir, 0755, true); mkdir($headersDir, 0755, true);
} }

View file

@ -26,10 +26,7 @@ if (!in_array($ext, $allowedExtensions)) {
} }
// Determine uploads directory (must be in Lucee webroot, not PHP docroot) // Determine uploads directory (must be in Lucee webroot, not PHP docroot)
$webroot = isDev() $itemsDir = luceeWebroot() . '/uploads/items';
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$itemsDir = $webroot . '/uploads/items';
if (!is_dir($itemsDir)) { if (!is_dir($itemsDir)) {
mkdir($itemsDir, 0755, true); mkdir($itemsDir, 0755, true);
} }

View file

@ -68,12 +68,9 @@ try {
$customerPhotoUrl = ''; $customerPhotoUrl = '';
$customerUserID = (int) ($qTask['CustomerUserID'] ?? 0); $customerUserID = (int) ($qTask['CustomerUserID'] ?? 0);
if ($customerUserID > 0) { if ($customerUserID > 0) {
$webroot = isDev()
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$baseDir = '/uploads/users/'; $baseDir = '/uploads/users/';
foreach (['jpg', 'png', 'PNG'] as $ext) { foreach (['jpg', 'png', 'PNG'] as $ext) {
$checkPath = $webroot . $baseDir . $customerUserID . '.' . $ext; $checkPath = luceeWebroot() . $baseDir . $customerUserID . '.' . $ext;
if (file_exists($checkPath)) { if (file_exists($checkPath)) {
$customerPhotoUrl = baseUrl() . $baseDir . $customerUserID . '.' . $ext; $customerPhotoUrl = baseUrl() . $baseDir . $customerUserID . '.' . $ext;
break; break;