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']);
}
$webroot = isDev()
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$uploadsDir = $webroot . '/uploads/users';
$uploadsDir = luceeWebroot() . '/uploads/users';
$avatarUrl = baseUrl() . '/uploads/users/';
// 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';
}
function luceeWebroot(): string {
return '/opt/lucee/tomcat/webapps/ROOT';
}
// ============================================
// PHONE HELPERS
// ============================================

View file

@ -292,10 +292,7 @@ try {
// Build items lookup by CategoryID
$itemsByCategory = [];
$webroot = isDev()
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$uploadsDir = $webroot . '/uploads/items';
$uploadsDir = luceeWebroot() . '/uploads/items';
foreach ($qItemRows as $item) {
$catID = (int) $item['CategoryItemID'];
$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']);
}
$webroot = isDev()
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$headersDir = $webroot . '/uploads/headers';
$headersDir = luceeWebroot() . '/uploads/headers';
if (!is_dir($headersDir)) {
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)
$webroot = isDev()
? '/opt/lucee/tomcat/webapps/ROOT'
: '/var/www/biz.payfrit.com';
$itemsDir = $webroot . '/uploads/items';
$itemsDir = luceeWebroot() . '/uploads/items';
if (!is_dir($itemsDir)) {
mkdir($itemsDir, 0755, true);
}

View file

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