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/posts_manage_addProcess.php b/Stream/posts_manage_addProcess.php index 454aa14..677dd3d 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\Contracts\Filesystem\FileHandler; 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(FileHandler::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..aca47f0 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\Contracts\Filesystem\FileHandler; use Gibbon\Data\Validator; require_once '../../gibbon.php'; @@ -49,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 @@ -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(FileHandler::class)->recordFileUpload($fileMetaData, 'streamPostAttachment', $streamPostAttachmentID, 'attachment'); + + if (empty($gibbonFileID)) { + $partialFail = true; + } + } } else { $partialFail = true; } 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';