From a6413da67a4579866f0fd0323ddb23a7b6b9654a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 18 Sep 2026 17:00:53 +0000
Subject: [PATCH] =Cleaning up the Integrations setup a bit, started the Helcim integration work too
---
inc/managers/UploadManager.php | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/inc/managers/UploadManager.php b/inc/managers/UploadManager.php
index 4889dbc..bb39c39 100644
--- a/inc/managers/UploadManager.php
+++ b/inc/managers/UploadManager.php
@@ -2,6 +2,7 @@
namespace JVBase\managers;
use JVBase\base\Site;
+use JVBase\inc\managers\ErrorHelper;
use JVBase\Instance;
use Exception;
use Imagick;
@@ -41,7 +42,7 @@
*/
class UploadManager
{
- use Instance;
+ use Instance, ErrorHelper;
protected array $allowedTypes = [
// Images
'image/jpeg' => 'image',
@@ -310,7 +311,7 @@
'stored_at' => current_time('mysql')
];
} catch (Exception $e) {
- Errors::getInstance()->log('UploadManager','Failed to store uploaded file: ' . print_r($e->getMessage(), true));
+ $this->logError('Failed to store uploaded file', 'secureUploadedFile', ['error' => $e->getMessage()]);
return [];
}
}
@@ -350,11 +351,7 @@
};
} catch (Exception $e) {
- Errors::getInstance()->log(
- '[UploadManager]:processUpload',
- $e->getMessage(),
- ['temp_path' => $temp_path, 'context' => $context]
- );
+ $this->logError($e->getMessage(), 'processUpload');
return new WP_Error('upload_failed', $e->getMessage());
}
@@ -548,7 +545,7 @@
);
} catch (Exception $e) {
- Errors::getInstance()->log('Uploader', 'Image conversion failed: ' . print_r($e->getMessage(), true));
+ $this->logError($e->getMessage(), 'processImage');
// Fallback to original
$ext = pathinfo($original_path, PATHINFO_EXTENSION);
$final_path = "{$full_dir}/{$filename}.{$ext}";
@@ -604,7 +601,7 @@
try {
$attachment_id = $this->createAttachment($final_path, $filename, $context, $post_id);
} catch (Exception $e) {
- Errors::getInstance()->log('Uploader', 'Attachment creation failed: '.print_r($e->getMessage(), true));
+ $this->logError($e->getMessage(), 'processVideo');
return ['success' => false];
}
@@ -642,7 +639,7 @@
try {
$attachment_id = $this->createAttachment($final_path, $filename, $context, $post_id);
} catch (Exception $e) {
- Errors::getInstance()->log('Uploader','Conversion failed: '.print_r($e->getMessage(), true));
+ $this->logError($e->getMessage(), 'processDocument');
return ['success' => false];
}
--
Gitblit v1.10.0