Add test upload feature for direct folder testing
New test upload panel in Upload workflow: - Upload directly to any folder ID (bypasses campaign selection) - Pre-filled with test folder: e96080ba0cd1427d253a28a87504b6665eaa02cb - Folder ID can be edited for testing different folders - Shows success/failure with full error details - Uses same upload mechanism as regular workflow Use case: - Test if specific folders allow uploads - Bypass campaign workflow for testing - Verify folder permissions - Isolate upload issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7f76129364
commit
c4eec014a4
1 changed files with 91 additions and 0 deletions
|
|
@ -340,6 +340,45 @@ if ($_POST && $testRunner) {
|
|||
$currentTab = 'upload';
|
||||
break;
|
||||
|
||||
case 'test_upload_to_folder':
|
||||
// Test upload to specific folder provided by Ferrero team
|
||||
$testFolderId = $_POST['test_folder_id'] ?? 'e96080ba0cd1427d253a28a87504b6665eaa02cb';
|
||||
|
||||
if (isset($_FILES['test_upload_file'])) {
|
||||
$tmpName = $_FILES['test_upload_file']['tmp_name'];
|
||||
$fileName = $_FILES['test_upload_file']['name'];
|
||||
$fileError = $_FILES['test_upload_file']['error'];
|
||||
|
||||
if ($fileError === UPLOAD_ERR_OK) {
|
||||
$apiClient = new ApiClient();
|
||||
$configV3 = new ConfigV3();
|
||||
$apiClient->setBaseUrl($configV3->getBaseUrl());
|
||||
|
||||
$oauth2Handler = new ReflectionProperty($testRunner, 'oauth2Handler');
|
||||
$oauth2Handler->setAccessible(true);
|
||||
$oauth2HandlerInstance = $oauth2Handler->getValue($testRunner);
|
||||
if ($oauth2HandlerInstance) {
|
||||
$apiClient->setHeader('Authorization', $oauth2HandlerInstance->getAuthHeader());
|
||||
}
|
||||
|
||||
$uploader = new AssetUploader($apiClient, $testFolderId);
|
||||
$result = $uploader->uploadFile($tmpName, $testFolderId, [], null, $testRunner);
|
||||
|
||||
$results['test_upload_result'] = $result;
|
||||
$results['test_folder_id'] = $testFolderId;
|
||||
|
||||
if ($result['success']) {
|
||||
$success = "✅ TEST UPLOAD SUCCESSFUL to folder {$testFolderId}!";
|
||||
} else {
|
||||
$error = "Test upload failed: " . $result['error'];
|
||||
}
|
||||
} else {
|
||||
$error = "File upload error: " . $fileError;
|
||||
}
|
||||
}
|
||||
$currentTab = 'upload';
|
||||
break;
|
||||
|
||||
case 'upload_files':
|
||||
if (isset($_FILES['upload_files']) && isset($results['upload_folder_id'])) {
|
||||
// Get selected master asset lightweight data
|
||||
|
|
@ -1758,6 +1797,58 @@ $envInfo = $configV3->getEnvironmentInfo();
|
|||
Load campaigns with status A2 (assets sent to agency), upload processed files, and update status to A3
|
||||
</p>
|
||||
|
||||
<!-- Test Upload Section -->
|
||||
<div style="background: #fff3cd; border: 2px solid #ffc107; border-radius: 8px; padding: 20px; margin-bottom: 30px;">
|
||||
<h3 style="color: #856404;">🧪 Test Upload to Specific Folder</h3>
|
||||
<p style="color: #856404; margin: 10px 0;">
|
||||
Upload directly to a folder ID for testing (bypasses campaign workflow)
|
||||
</p>
|
||||
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="tab" value="upload">
|
||||
<input type="hidden" name="action" value="test_upload_to_folder">
|
||||
|
||||
<div style="margin: 15px 0;">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: 600;">Target Folder ID:</label>
|
||||
<input type="text" name="test_folder_id"
|
||||
value="e96080ba0cd1427d253a28a87504b6665eaa02cb"
|
||||
style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; font-family: monospace;">
|
||||
</div>
|
||||
|
||||
<div style="margin: 15px 0;">
|
||||
<label style="display: block; margin-bottom: 5px; font-weight: 600;">Select file to upload:</label>
|
||||
<input type="file" name="test_upload_file" required
|
||||
style="padding: 10px; border: 2px solid #ffc107; border-radius: 6px; width: 100%; background: white;">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">🧪 Test Upload to This Folder</button>
|
||||
</form>
|
||||
|
||||
<?php if (isset($results['test_upload_result'])): ?>
|
||||
<?php $tr = $results['test_upload_result']; ?>
|
||||
<div class="alert alert-<?= $tr['success'] ? 'success' : 'error' ?>" style="margin-top: 20px;">
|
||||
<?php if ($tr['success']): ?>
|
||||
<strong>✅ TEST UPLOAD SUCCESSFUL!</strong><br>
|
||||
Filename: <?= htmlspecialchars($tr['filename']) ?><br>
|
||||
Asset ID: <?= htmlspecialchars($tr['asset_id'] ?? 'N/A') ?><br>
|
||||
Folder: <?= htmlspecialchars($results['test_folder_id']) ?>
|
||||
<?php else: ?>
|
||||
<strong>❌ Test Upload Failed:</strong> <?= htmlspecialchars($tr['error']) ?><br>
|
||||
HTTP Code: <?= $tr['http_code'] ?><br>
|
||||
Folder: <?= htmlspecialchars($results['test_folder_id']) ?>
|
||||
<?php if (isset($tr['response_body'])): ?>
|
||||
<details style="margin-top: 10px;">
|
||||
<summary style="cursor: pointer;">View API Response</summary>
|
||||
<pre style="font-size: 11px; background: white; padding: 10px; margin-top: 5px;"><?= htmlspecialchars($tr['response_body']) ?></pre>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<hr style="margin: 30px 0;">
|
||||
<!-- End Test Upload Section -->
|
||||
|
||||
<form method="POST" style="display: inline-block;">
|
||||
<input type="hidden" name="tab" value="upload">
|
||||
<input type="hidden" name="action" value="load_campaigns_a2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue