Remove all Lucee references — uploads now live under /opt/payfrit-api
- Moved uploads from Lucee webroot to /opt/payfrit-api/uploads/ - Updated nginx on both dev and biz to alias /uploads/ to new path - Replaced luceeWebroot() with uploadsRoot() helper - Temp files now use /opt/payfrit-api/temp/ - No more /opt/lucee or /var/www/biz.payfrit.com references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
28d86ba6e5
commit
aa986507fd
11 changed files with 20 additions and 34 deletions
|
|
@ -15,7 +15,7 @@ if ($userId <= 0) {
|
|||
apiAbort(['OK' => false, 'ERROR' => 'not_logged_in', 'MESSAGE' => 'Authentication required']);
|
||||
}
|
||||
|
||||
$uploadsDir = luceeWebroot() . '/uploads/users';
|
||||
$uploadsDir = uploadsRoot() . '/users';
|
||||
$avatarUrl = baseUrl() . '/uploads/users/';
|
||||
|
||||
// Find existing avatar (check multiple extensions)
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ function baseUrl(): string {
|
|||
return isDev() ? 'https://dev.payfrit.com' : 'https://biz.payfrit.com';
|
||||
}
|
||||
|
||||
function luceeWebroot(): string {
|
||||
return '/opt/lucee/tomcat/webapps/ROOT';
|
||||
function uploadsRoot(): string {
|
||||
return '/opt/payfrit-api/uploads';
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ try {
|
|||
|
||||
// Build items lookup by CategoryID
|
||||
$itemsByCategory = [];
|
||||
$uploadsDir = luceeWebroot() . '/uploads/items';
|
||||
$uploadsDir = uploadsRoot() . '/items';
|
||||
foreach ($qItemRows as $item) {
|
||||
$catID = (int) $item['CategoryItemID'];
|
||||
$itemID = (int) $item['ID'];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ if (!isset($_FILES['header']) || $_FILES['header']['error'] !== UPLOAD_ERR_OK) {
|
|||
jsonResponse(['OK' => false, 'ERROR' => 'no_file', 'MESSAGE' => 'No file was uploaded']);
|
||||
}
|
||||
|
||||
$headersDir = luceeWebroot() . '/uploads/headers';
|
||||
$headersDir = uploadsRoot() . '/headers';
|
||||
if (!is_dir($headersDir)) {
|
||||
mkdir($headersDir, 0755, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ if (!in_array($ext, $allowedExtensions)) {
|
|||
jsonResponse(['OK' => false, 'ERROR' => 'invalid_type', 'MESSAGE' => "Only image files are accepted (jpg, jpeg, gif, png, webp, heic). Got: $ext"]);
|
||||
}
|
||||
|
||||
// Determine uploads directory (must be in Lucee webroot, not PHP docroot)
|
||||
$itemsDir = luceeWebroot() . '/uploads/items';
|
||||
// Determine uploads directory
|
||||
$itemsDir = uploadsRoot() . '/items';
|
||||
if (!is_dir($itemsDir)) {
|
||||
mkdir($itemsDir, 0755, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ try {
|
|||
$imageResult = json_decode($responseText, true);
|
||||
if ($imageResult === null) {
|
||||
// Save debug file
|
||||
$uploadsPath = isDev() ? '/opt/lucee/tomcat/webapps/ROOT/uploads' : '/var/www/biz.payfrit.com/uploads';
|
||||
$uploadsPath = uploadsRoot();
|
||||
file_put_contents("$uploadsPath/debug_claude.json", $responseText);
|
||||
throw new Exception("JSON parse error for image " . ($imgIndex + 1) . ". Debug saved to /uploads/debug_claude.json");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -626,14 +626,13 @@ JSEOF;
|
|||
$targetUrl = '';
|
||||
$playwrightImages = [];
|
||||
|
||||
// Helper: webroot path
|
||||
$webroot = isDev()
|
||||
? '/opt/lucee/tomcat/webapps/ROOT'
|
||||
: '/var/www/biz.payfrit.com';
|
||||
|
||||
// Helper: expand a URL path to a local file path
|
||||
$expandPath = function(string $urlPath) use ($webroot): string {
|
||||
return $webroot . $urlPath;
|
||||
$expandPath = function(string $urlPath): string {
|
||||
// /uploads/items/123.jpg → /opt/payfrit-api/uploads/items/123.jpg
|
||||
if (str_starts_with($urlPath, '/uploads/')) {
|
||||
return uploadsRoot() . substr($urlPath, 8);
|
||||
}
|
||||
return '/opt/payfrit-api' . $urlPath;
|
||||
};
|
||||
|
||||
// Helper: convert 24h time to 12h format string
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@ try {
|
|||
throw new Exception('businessID is required');
|
||||
}
|
||||
|
||||
$uploadsPath = '/var/www/biz.payfrit.com/uploads';
|
||||
if (isDev()) {
|
||||
$uploadsPath = '/opt/lucee/tomcat/webapps/ROOT/uploads';
|
||||
}
|
||||
$uploadsPath = uploadsRoot();
|
||||
|
||||
$logosPath = "$uploadsPath/logos";
|
||||
$headersPath = "$uploadsPath/headers";
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ set_time_limit(300);
|
|||
|
||||
$response = ['OK' => false, 'steps' => [], 'errors' => []];
|
||||
|
||||
$uploadsPath = isDev()
|
||||
? '/opt/lucee/tomcat/webapps/ROOT/uploads'
|
||||
: '/var/www/biz.payfrit.com/uploads';
|
||||
$itemsDir = "$uploadsPath/items";
|
||||
$itemsDir = uploadsRoot() . '/items';
|
||||
|
||||
/**
|
||||
* Resize image maintaining aspect ratio, fitting within maxSize box.
|
||||
|
|
@ -691,10 +688,7 @@ try {
|
|||
// Clean up temp folder from ZIP upload
|
||||
$tempFolder = is_string($data['tempFolder'] ?? null) ? trim($data['tempFolder']) : '';
|
||||
if (strlen($tempFolder) && preg_match('/^[a-f0-9]{32}$/', $tempFolder)) {
|
||||
$webroot = isDev()
|
||||
? '/opt/lucee/tomcat/webapps/ROOT'
|
||||
: '/var/www/biz.payfrit.com';
|
||||
$tempFolderPath = "$webroot/temp/menu-import/$tempFolder";
|
||||
$tempFolderPath = "/opt/payfrit-api/temp/menu-import/$tempFolder";
|
||||
if (is_dir($tempFolderPath)) {
|
||||
exec("rm -rf " . escapeshellarg($tempFolderPath));
|
||||
$response['steps'][] = "Cleaned up temp folder: $tempFolder";
|
||||
|
|
|
|||
|
|
@ -12,10 +12,7 @@ runAuth();
|
|||
$response = ['OK' => false, 'MESSAGE' => '', 'URL' => ''];
|
||||
|
||||
try {
|
||||
$webroot = isDev()
|
||||
? '/opt/lucee/tomcat/webapps/ROOT'
|
||||
: '/var/www/biz.payfrit.com';
|
||||
$tempBaseDir = "$webroot/temp/menu-import";
|
||||
$tempBaseDir = "/opt/payfrit-api/temp/menu-import";
|
||||
|
||||
// Create temp directory if needed
|
||||
if (!is_dir($tempBaseDir)) {
|
||||
|
|
|
|||
|
|
@ -68,11 +68,10 @@ try {
|
|||
$customerPhotoUrl = '';
|
||||
$customerUserID = (int) ($qTask['CustomerUserID'] ?? 0);
|
||||
if ($customerUserID > 0) {
|
||||
$baseDir = '/uploads/users/';
|
||||
foreach (['jpg', 'png', 'PNG'] as $ext) {
|
||||
$checkPath = luceeWebroot() . $baseDir . $customerUserID . '.' . $ext;
|
||||
$checkPath = uploadsRoot() . '/users/' . $customerUserID . '.' . $ext;
|
||||
if (file_exists($checkPath)) {
|
||||
$customerPhotoUrl = baseUrl() . $baseDir . $customerUserID . '.' . $ext;
|
||||
$customerPhotoUrl = baseUrl() . '/uploads/users/' . $customerUserID . '.' . $ext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue