From aa6a289e1fdf0eb479e6814689fc6bf17b320c31 Mon Sep 17 00:00:00 2001 From: Ali Alam Date: Thu, 26 Feb 2026 12:17:31 +0800 Subject: [PATCH 1/3] System: added the latest file tracking feature --- Stream/posts_manage_addProcess.php | 15 +++++++++++++-- Stream/posts_manage_editProcess.php | 14 +++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Stream/posts_manage_addProcess.php b/Stream/posts_manage_addProcess.php index 454aa14..f3aa8cf 100644 --- a/Stream/posts_manage_addProcess.php +++ b/Stream/posts_manage_addProcess.php @@ -20,8 +20,8 @@ */ use Gibbon\FileUploader; -use Gibbon\Services\Format; use Gibbon\Domain\System\SettingGateway; +use Gibbon\Domain\System\FileGateway; use Gibbon\Module\Stream\Domain\PostGateway; use Gibbon\Module\Stream\Domain\PostTagGateway; use Gibbon\Module\Stream\Domain\PostAttachmentGateway; @@ -101,6 +101,8 @@ $attachment = $fileUploader->uploadAndResizeImage($file, 'streamPhoto', $maxImageSize, 90); if (!empty($attachment)) { + $fileMetaData = $fileUploader->getFileMetaData($attachment); + $thumbPath = $absolutePath.'/'.str_replace('streamPhoto', 'streamThumb', $attachment); $thumbnail = $fileUploader->resizeImage($absolutePath.'/'.$attachment, $thumbPath, 650); @@ -111,7 +113,16 @@ 'type' => 'Image', ]; - $postAttachmentGateway->insert($data); + $streamPostAttachmentID = $postAttachmentGateway->insert($data); + + // Record file tracking + if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) { + $gibbonFileID = $container->get(FileGateway::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); + + if (empty($gibbonFileID)) { + $partialFail = true; + } + } } else { $partialFail = true; } diff --git a/Stream/posts_manage_editProcess.php b/Stream/posts_manage_editProcess.php index 77aa9d3..93129d0 100644 --- a/Stream/posts_manage_editProcess.php +++ b/Stream/posts_manage_editProcess.php @@ -24,6 +24,7 @@ use Gibbon\Module\Stream\Domain\PostTagGateway; use Gibbon\Module\Stream\Domain\PostAttachmentGateway; use Gibbon\Domain\System\SettingGateway; +use Gibbon\Domain\System\FileGateway; use Gibbon\Data\Validator; require_once '../../gibbon.php'; @@ -95,6 +96,8 @@ $attachment = $fileUploader->uploadAndResizeImage($file, 'streamPhoto', $maxImageSize, 90); if (!empty($attachment)) { + $fileMetaData = $fileUploader->getFileMetaData($attachment); + $thumbPath = $absolutePath.'/'.str_replace('streamPhoto', 'streamThumb', $attachment); $thumbnail = $fileUploader->resizeImage($absolutePath.'/'.$attachment, $thumbPath, 650); @@ -105,7 +108,16 @@ 'type' => 'Image', ]; - $postAttachmentGateway->insert($data); + $streamPostAttachmentID = $postAttachmentGateway->insert($data); + + // Record file tracking + if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) { + $gibbonFileID = $container->get(FileGateway::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); + + if (empty($gibbonFileID)) { + $partialFail = true; + } + } } else { $partialFail = true; } From 7990769c36be38abf1e14ea77fdac399a4823c87 Mon Sep 17 00:00:00 2001 From: Ali Alam Date: Fri, 6 Mar 2026 14:28:42 +0800 Subject: [PATCH 2/3] integrated fileHandler class in Stream Module --- Stream/posts_manage_addProcess.php | 4 ++-- Stream/posts_manage_editProcess.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Stream/posts_manage_addProcess.php b/Stream/posts_manage_addProcess.php index f3aa8cf..677dd3d 100644 --- a/Stream/posts_manage_addProcess.php +++ b/Stream/posts_manage_addProcess.php @@ -21,7 +21,7 @@ use Gibbon\FileUploader; use Gibbon\Domain\System\SettingGateway; -use Gibbon\Domain\System\FileGateway; +use Gibbon\Contracts\Filesystem\FileHandler; use Gibbon\Module\Stream\Domain\PostGateway; use Gibbon\Module\Stream\Domain\PostTagGateway; use Gibbon\Module\Stream\Domain\PostAttachmentGateway; @@ -117,7 +117,7 @@ // Record file tracking if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) { - $gibbonFileID = $container->get(FileGateway::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); + $gibbonFileID = $container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); if (empty($gibbonFileID)) { $partialFail = true; diff --git a/Stream/posts_manage_editProcess.php b/Stream/posts_manage_editProcess.php index 93129d0..aca47f0 100644 --- a/Stream/posts_manage_editProcess.php +++ b/Stream/posts_manage_editProcess.php @@ -24,7 +24,7 @@ use Gibbon\Module\Stream\Domain\PostTagGateway; use Gibbon\Module\Stream\Domain\PostAttachmentGateway; use Gibbon\Domain\System\SettingGateway; -use Gibbon\Domain\System\FileGateway; +use Gibbon\Contracts\Filesystem\FileHandler; use Gibbon\Data\Validator; require_once '../../gibbon.php'; @@ -50,7 +50,7 @@ $data = [ 'post' => $_POST['post'] ?? '', - 'streamCategoryIDList' => (!empty($_POST['streamCategoryIDList']) &&(is_array($_POST['streamCategoryIDList'])) ? implode(",", $_POST['streamCategoryIDList']) : null) + 'streamCategoryIDList' => (!empty($_POST['streamCategoryIDList']) && (is_array($_POST['streamCategoryIDList'])) ? implode(",", $_POST['streamCategoryIDList']) : null) ]; // Validate the required values are present @@ -112,7 +112,7 @@ // Record file tracking if (!empty($fileMetaData) && !empty($streamPostAttachmentID)) { - $gibbonFileID = $container->get(FileGateway::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); + $gibbonFileID = $container->get(FileHandler::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); if (empty($gibbonFileID)) { $partialFail = true; From 2cd04af28afd391e601692dcc43c4e545a518e8a Mon Sep 17 00:00:00 2001 From: Ali Alam Date: Fri, 13 Mar 2026 13:47:43 +0800 Subject: [PATCH 3/3] Stream: Added comprehensive file upload tracking system to monitor and manage all file uploads across the system --- Stream/CHANGEDB.php | 5 +++++ Stream/CHANGELOG.txt | 5 +++++ Stream/manifest.php | 2 +- Stream/version.php | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Stream/CHANGEDB.php b/Stream/CHANGEDB.php index d3c1e24..e478567 100644 --- a/Stream/CHANGEDB.php +++ b/Stream/CHANGEDB.php @@ -87,3 +87,8 @@ ++$count; $sql[$count][0] = '1.2.00'; $sql[$count][1] = ""; + +//v1.2.01 +++$count; +$sql[$count][0] = '1.2.01'; +$sql[$count][1] = ""; diff --git a/Stream/CHANGELOG.txt b/Stream/CHANGELOG.txt index eac1174..7a0c64d 100644 --- a/Stream/CHANGELOG.txt +++ b/Stream/CHANGELOG.txt @@ -1,5 +1,10 @@ CHANGELOG ========= + +v1.2.01 +------- +Added comprehensive file upload tracking system to monitor and manage all file uploads across the system + v1.2.00 ------- Gibbon v28 compatibility diff --git a/Stream/manifest.php b/Stream/manifest.php index a2089d3..3b6bcf1 100644 --- a/Stream/manifest.php +++ b/Stream/manifest.php @@ -27,7 +27,7 @@ $entryURL = 'stream.php'; $type = 'Additional'; $category = 'Other'; -$version = '1.2.00'; +$version = '1.2.01'; $author = "Gibbon Foundation"; $url = "https://gibbonedu.org"; diff --git a/Stream/version.php b/Stream/version.php index 01a201b..8ccb9af 100644 --- a/Stream/version.php +++ b/Stream/version.php @@ -22,4 +22,4 @@ /** * Sets version information. */ -$moduleVersion = '1.2.00'; +$moduleVersion = '1.2.01';