Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
70d52ad
Moving fileProcessingGracePeriod configuration from a global server s…
yambenari24 Mar 5, 2026
d5eaf3b
update the custom data
yambenari24 Mar 5, 2026
143ef6c
Update ZoomDropFolder.php
yambenari24 Mar 5, 2026
61ba3d3
add new field in the drop folder configuration
yambenari24 Mar 10, 2026
dd988ef
Update DropFolderService.php
yambenari24 Mar 10, 2026
79eddac
delete debugs error
yambenari24 Mar 10, 2026
96f01b6
Update DropFolder.php
yambenari24 Mar 10, 2026
e58c923
Merge branch 'Venus-22.15.0' into Venus-22.14.0-SUP-51410
yambenari24 Mar 10, 2026
9fce4e9
Update kZoomDropFolderFlowManager.php
yambenari24 Mar 10, 2026
21f7fef
Update DropFolderConfigure.php
yambenari24 Mar 10, 2026
19d2d68
Update DropFolderConfigure.php
yambenari24 Mar 10, 2026
9ca208e
put the logic only for the zoom drop folder
yambenari24 Mar 15, 2026
289c0a8
move the fileProcessingGracePeriod from dropFolder to zoomDropFolder
yambenari24 Mar 15, 2026
75eda26
Update DropFolderConfigureAction.php
yambenari24 Mar 15, 2026
c9dca1b
Update DropFolderConfigureAction.php
yambenari24 Mar 15, 2026
b4eae25
Update KalturaDropFolder.php
yambenari24 Mar 15, 2026
43adf5c
Update KalturaZoomDropFolder.php
yambenari24 Mar 16, 2026
fe38809
Update KalturaZoomDropFolder.php
yambenari24 Mar 16, 2026
4954ed7
Update KalturaZoomDropFolder.php
yambenari24 Mar 16, 2026
987c280
Update ZoomDropFolder.php
yambenari24 Mar 16, 2026
4b933eb
remove comments
yambenari24 Mar 16, 2026
6f23e4a
Update KalturaZoomDropFolder.php
yambenari24 Mar 16, 2026
db0e47b
Update KalturaZoomDropFolder.php
yambenari24 Mar 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions plugins/drop_folder/admin/DropFolderConfigureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public function doAction(Zend_Controller_Action $action)
{
$partnerId = $this->_getParam('partnerId');
$dropFolderType = $this->_getParam('type');
$postData = $request->getPost();
$dropFolderForm = $this->getDropFolderConfigure($dropFolderType, $partnerId, $dropFolderType);
$action->view->formValid = $this->processForm($dropFolderForm, $request->getPost(), $partnerId, $dropFolderId);
$action->view->formValid = $this->processForm($dropFolderForm, $postData, $partnerId, $dropFolderId);
if(!is_null($dropFolderId))
{
$dropFolder = $dropFolderForm->getObject("Kaltura_Client_DropFolder_Type_DropFolder", $request->getPost(), false, true);
Expand Down Expand Up @@ -103,13 +104,14 @@ private function processForm(Form_DropFolderConfigure $form, $formData, $partner

$dropFolder = $form->getObject("Kaltura_Client_DropFolder_Type_DropFolder", $formData, false, true);
$this->validateConversionProfileId($dropFolder->conversionProfileId, $partnerId);

unset($dropFolder->id);

if($dropFolder->fileHandlerType === Kaltura_Client_DropFolder_Enum_DropFolderFileHandlerType::CONTENT)
$dropFolder->fileNamePatterns = '*';
if (is_null($dropFolderId)) {
$dropFolder->status = Kaltura_Client_DropFolder_Enum_DropFolderStatus::ENABLED;

$responseDropFolder = $dropFolderPluginClient->dropFolder->add($dropFolder);
}
else {
Expand Down
7 changes: 7 additions & 0 deletions plugins/drop_folder/admin/forms/DropFolderConfigure.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ public function init()
'filters' => array('StringTrim'),
));

$this->addElement('text', 'fileProcessingGracePeriod', array(
'label' => 'File processing grace period (seconds):',
'description' => 'Time to wait before processing a file. Leave empty for default: 10800 (3 hours). Maximum: 21600 (6 hours).',
'required' => false,
'filters' => array('StringTrim'),
));

$fileDeletePolicies = new Kaltura_Form_Element_EnumSelect('fileDeletePolicy', array('enum' => 'Kaltura_Client_DropFolder_Enum_DropFolderFileDeletePolicy'));
$fileDeletePolicies->setLabel('File Deletion Policy:');
$fileDeletePolicies->setRequired(true);
Expand Down
49 changes: 45 additions & 4 deletions plugins/drop_folder/lib/api/types/KalturaDropFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ class KalturaDropFolder extends KalturaObject implements IFilterable
* @var int
*/
public $fileSizeCheckInterval;


/**
* The amount of time, in seconds, to wait before processing a drop folder file
* @var int
*/
public $fileProcessingGracePeriod;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is only relevant for Zoom, lets keep it only there

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to validate min max values you can use annotations


/**
* @var KalturaDropFolderFileDeletePolicy
*/
Expand Down Expand Up @@ -184,6 +190,7 @@ class KalturaDropFolder extends KalturaObject implements IFilterable
'dc',
'path',
'fileSizeCheckInterval',
'fileProcessingGracePeriod',
'fileDeletePolicy',
'fileDeleteRegex',
'autoFileDeleteDays',
Expand Down Expand Up @@ -213,21 +220,55 @@ public function toObject($dbObject = null, $skip = array())
{
if (is_null($dbObject))
$dbObject = new DropFolder();
$this->trimStringProperties(array ('path'));
$this->trimStringProperties(array ('path'));

// Set fileProcessingGracePeriod BEFORE calling parent to preserve user value
// (parent may not recognize this property due to reflection cache)
$fileProcessingGracePeriodValue = $this->fileProcessingGracePeriod;

// Convert to integer if it's a numeric string
if (is_string($fileProcessingGracePeriodValue) && is_numeric($fileProcessingGracePeriodValue)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coding convension - { in a new line

$fileProcessingGracePeriodValue = (int)$fileProcessingGracePeriodValue;
}

// Set default if empty
if (is_null($fileProcessingGracePeriodValue) || $fileProcessingGracePeriodValue === '' || $fileProcessingGracePeriodValue === 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validations are done in validateForInsert or validateForUpdate

$fileProcessingGracePeriodValue = DropFolder::FILE_PROCESSING_GRACE_PERIOD_DEFAULT_VALUE;
}

// Validate maximum value
if ($fileProcessingGracePeriodValue > DropFolder::FILE_PROCESSING_GRACE_PERIOD_MAX_VALUE) {
throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'fileProcessingGracePeriod');
}

parent::toObject($dbObject, $skip);

// Explicitly set fileProcessingGracePeriod to ensure it's saved
if (!is_null($fileProcessingGracePeriodValue) && !in_array('fileProcessingGracePeriod', $skip))
{
$dbObject->setFileProcessingGracePeriod($fileProcessingGracePeriodValue);
}

if ($this->fileHandlerConfig)
{
$dbFileHandlerConfig = $this->fileHandlerConfig->toObject();
$dbObject->setFileHandlerConfig($dbFileHandlerConfig);
}

return $dbObject;
}

public function doFromObject($source_object, KalturaDetachedResponseProfile $responseProfile = null)
{
parent::doFromObject($source_object, $responseProfile);


// Explicitly load fileProcessingGracePeriod from database object
// (parent may not recognize this property due to reflection cache)
if ($this->shouldGet('fileProcessingGracePeriod', $responseProfile))
{
$this->fileProcessingGracePeriod = $source_object->getFileProcessingGracePeriod();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed if the param fileProcessingGracePeriod is mapped to explicit core object function getFileProcessingGracePeriod()

}

if($this->shouldGet('fileHandlerConfig', $responseProfile))
{
$dbFileHandlerConfig = $source_object->getFileHandlerConfig();
Expand Down
27 changes: 25 additions & 2 deletions plugins/drop_folder/lib/model/DropFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class DropFolder extends BaseDropFolder implements IBaseObject
const AUTO_FILE_DELETE_DAYS_DEFAULT_VALUE = 0;
const FILE_SIZE_CHECK_INTERVAL_DEFAULT_VALUE = '600'; // 600 seconds = 10 minutes
const FILE_NAME_PATTERNS_DEFAULT_VALUE = '*';
const FILE_PROCESSING_GRACE_PERIOD_DEFAULT_VALUE = 10800; // 10800 seconds = 3 hours
const FILE_PROCESSING_GRACE_PERIOD_MAX_VALUE = 21600; // 21600 seconds = 6 hours
const INCREMENTAL = 'incremental';
const LAST_FILE_TIMESTAMP = 'last_file_timestamp';
const METADATA_PROFILE_ID = 'metadata_profile_id';
Expand Down Expand Up @@ -52,8 +54,13 @@ public function preInsert(PropelPDO $con = null)

if (is_null($this->getAutoFileDeleteDays())) {
$this->setAutoFileDeleteDays(DropFolder::AUTO_FILE_DELETE_DAYS_DEFAULT_VALUE);
}

}

$currentValue = $this->getFileProcessingGracePeriod();
if (is_null($currentValue)) {
$this->setFileProcessingGracePeriod(DropFolder::FILE_PROCESSING_GRACE_PERIOD_DEFAULT_VALUE);
}

return $ret;
}

Expand Down Expand Up @@ -135,6 +142,7 @@ public function setFileHandlerConfig($fileHandlerConfig)
const CUSTOM_DATA_IGNORE_FILE_NAME_PATTERNS = 'ignore_file_name_patterns';
const CUSTOM_DATA_LAST_ACCESSED_AT = 'last_accessed_at';
const CUSTOM_DATA_FILE_DELETE_REGEX = 'file_delete_regex';
const CUSTOM_DATA_FILE_PROCESSING_GRACE_PERIOD = 'file_processing_grace_period';


// File size check interval - value in seconds
Expand Down Expand Up @@ -169,6 +177,21 @@ public function setFileDeleteRegex($fileDeleteRegex)
$this->putInCustomData(self::CUSTOM_DATA_FILE_DELETE_REGEX, $fileDeleteRegex);
}

// File processing grace period

/**
* @return int
*/
public function getFileProcessingGracePeriod()
{
return $this->getFromCustomData(self::CUSTOM_DATA_FILE_PROCESSING_GRACE_PERIOD);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If value was not set return default value

}

public function setFileProcessingGracePeriod($seconds)
{
$this->putInCustomData(self::CUSTOM_DATA_FILE_PROCESSING_GRACE_PERIOD, $seconds);
}

// Automatic file delete days

/**
Expand Down
57 changes: 39 additions & 18 deletions plugins/drop_folder/services/DropFolderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function initService($serviceId, $serviceName, $actionName)

/**
* Allows you to add a new KalturaDropFolder object
*
*
* @action add
* @param KalturaDropFolder $dropFolder
* @return KalturaDropFolder
*
*
* @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
* @throws KalturaErrors::INGESTION_PROFILE_ID_NOT_FOUND
* @throws KalturaDropFolderErrors::DROP_FOLDER_ALREADY_EXISTS
Expand All @@ -43,28 +43,43 @@ public function addAction(KalturaDropFolder $dropFolder)
$dropFolder->validatePropertyNotNull('path');
$dropFolder->validatePropertyNotNull('partnerId');
$dropFolder->validatePropertyMinValue('fileSizeCheckInterval', 0, true);
$dropFolder->validatePropertyMinValue('fileProcessingGracePeriod', 0, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

$dropFolder->validatePropertyMinValue('autoFileDeleteDays', 0, true);
$dropFolder->validatePropertyNotNull('fileHandlerType');
$dropFolder->validatePropertyNotNull('fileHandlerConfig');

// validate values

if (is_null($dropFolder->fileSizeCheckInterval)) {
$dropFolder->fileSizeCheckInterval = DropFolder::FILE_SIZE_CHECK_INTERVAL_DEFAULT_VALUE;
}



// Convert to integer if it's a numeric string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The insertion / update login should not happen here but in KalturaZoomDropFolder toInsertableObject and toUpdatableObject .....

if (is_string($dropFolder->fileProcessingGracePeriod) && is_numeric($dropFolder->fileProcessingGracePeriod)) {
$dropFolder->fileProcessingGracePeriod = (int)$dropFolder->fileProcessingGracePeriod;
}

if (is_null($dropFolder->fileProcessingGracePeriod) || $dropFolder->fileProcessingGracePeriod === '' || $dropFolder->fileProcessingGracePeriod === 0) {
$dropFolder->fileProcessingGracePeriod = DropFolder::FILE_PROCESSING_GRACE_PERIOD_DEFAULT_VALUE;
}

if ($dropFolder->fileProcessingGracePeriod > DropFolder::FILE_PROCESSING_GRACE_PERIOD_MAX_VALUE) {
throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'fileProcessingGracePeriod');
}

if (is_null($dropFolder->fileNamePatterns)) {
$dropFolder->fileNamePatterns = DropFolder::FILE_NAME_PATTERNS_DEFAULT_VALUE;
}

if (!kDataCenterMgr::dcExists($dropFolder->dc)) {
throw new KalturaAPIException(KalturaErrors::DATA_CENTER_ID_NOT_FOUND, $dropFolder->dc);
}

if (!PartnerPeer::retrieveByPK($dropFolder->partnerId)) {
throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $dropFolder->partnerId);
}

if (!DropFolderPlugin::isAllowedPartner($dropFolder->partnerId))
{
throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, DropFolderPlugin::getPluginName(), $dropFolder->partnerId);
Expand All @@ -77,34 +92,34 @@ public function addAction(KalturaDropFolder $dropFolder)
throw new KalturaAPIException(KalturaDropFolderErrors::DROP_FOLDER_ALREADY_EXISTS, $dropFolder->path);
}
}

if (!is_null($dropFolder->conversionProfileId)) {
$conversionProfileDb = conversionProfile2Peer::retrieveByPK($dropFolder->conversionProfileId);
if (!$conversionProfileDb) {
throw new KalturaAPIException(KalturaErrors::INGESTION_PROFILE_ID_NOT_FOUND, $dropFolder->conversionProfileId);
}
}

// save in database
$dbDropFolder = $dropFolder->toInsertableObject();
$dbDropFolder->save();

// return the saved object
$dropFolder = KalturaDropFolder::getInstanceByType($dbDropFolder->getType());
$dropFolder->fromObject($dbDropFolder, $this->getResponseProfile());
return $dropFolder;

}

/**
* Retrieve a KalturaDropFolder object by ID
*
*
* @action get
* @param int $dropFolderId
* @param int $dropFolderId
* @return KalturaDropFolder
*
*
* @throws KalturaErrors::INVALID_OBJECT_ID
*/
*/
public function getAction($dropFolderId)
{
$dbDropFolder = DropFolderPeer::retrieveByPK($dropFolderId);
Expand Down Expand Up @@ -141,8 +156,14 @@ public function updateAction($dropFolderId, KalturaDropFolder $dropFolder)
}

$dropFolder->validatePropertyMinValue('fileSizeCheckInterval', 0, true);
$dropFolder->validatePropertyMinValue('fileProcessingGracePeriod', 0, true);
$dropFolder->validatePropertyMinValue('autoFileDeleteDays', 0, true);


// Validate fileProcessingGracePeriod does not exceed maximum value
if (!is_null($dropFolder->fileProcessingGracePeriod) && $dropFolder->fileProcessingGracePeriod > DropFolder::FILE_PROCESSING_GRACE_PERIOD_MAX_VALUE) {
throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'fileProcessingGracePeriod');
}

if (!is_null($dropFolder->path) && $dropFolder->path != $dbDropFolder->getPath() && $dropFolder->type == KalturaDropFolderType::LOCAL)
{
$existingDropFolder = DropFolderPeer::retrieveByPathDefaultFilter($dropFolder->path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public function init()
'label' => 'Last Handled Meeting Time:',
'filters' => array('StringTrim'),
));

$this->addElement('text', 'fileProcessingGracePeriod', array(
'label' => 'File Processing Grace Period:',
'filters' => array('StringTrim'),
));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function shouldAdvanceByDay($startRunTime, $fileInStatusProcessingExis

if($fileInStatusProcessingExists)
{
$fileProcessingGracePeriod = $this->getZoomParam('fileProcessingGracePeriod');
$fileProcessingGracePeriod = $this->dropFolder->fileProcessingGracePeriod;
if($secondsFromMidnight <= $fileProcessingGracePeriod)
{
KalturaLog::info("DropFolderId {$this->dropFolder->id}: A new day is here, but found files in status Processing. Waiting for status completed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class KalturaZoomDropFolder extends KalturaDropFolder
* @var time
*/
public $lastHandledMeetingTime;

/*
* mapping between the field on this object (on the left) and the setter/getter on the entry object (on the right)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class ZoomDropFolder extends RemoteDropFolder

const ZOOM_VENDOR_INTEGRATION_ID = 'zoom_vendor_integration_id';
const LAST_HANDLED_MEETING_TIME = 'last_handled_meeting_time';

/**
* @var string
*/
protected $zoomVendorIntegrationId;

/**
* @var time
*/
Expand Down Expand Up @@ -51,7 +51,7 @@ public function setLastHandledMeetingTime($v)
{
$this->putInCustomData(self::LAST_HANDLED_MEETING_TIME, $v);
}

public function getImportJobData()
{
return new kDropFolderImportJobData();
Expand All @@ -68,4 +68,4 @@ protected function getRemoteFileTransferMgrType()
{
return kFileTransferMgrType::ZOOM; /// TODO
}
}
}