public static function fromDbArray($arr) { $newArr = new KalturaVirusScanProfileArray(); if ($arr == null) { return $newArr; } foreach ($arr as $obj) { $nObj = new KalturaVirusScanProfile(); $nObj->fromObject($obj); $newArr[] = $nObj; } return $newArr; }
$partnerId = null; // please enter a name for the profile: $profileName = 'virusScan'; // please entery profile's status (enabled/disabled): $profileStatus = KalturaVirusScanProfileStatus::ENABLED; // can be changed to KalturaVirusScanProfileStatus::DISABLED // please choose engine type: $engineType = SymantecScanEnginePlugin::getPluginName() . IKalturaEnumerator::PLUGIN_VALUE_DELIMITER . SymantecScanEngineVirusScanEngineType::SYMANTEC_SCAN_ENGINE; // Value from KalturaVirusScanEngineType // action if file is found infected: $actionIfInfected = KalturaVirusFoundAction::CLEAN_DELETE; // please enter required parameters for entry filter - only entries that suit the filter will be scanned by this profile $entryFilter = new KalturaBaseEntryFilter(); $entryFilter->typeIn = KalturaEntryType::MEDIA_CLIP . "," . KalturaEntryType::MIX; /************************************************** * DON'T TOUCH THE FOLLOWING CODE ***************************************************/ if (!$partnerId) { die('$partnerId cannot be empty'); } $profile = new KalturaVirusScanProfile(); $profile->name = $profileName; $profile->status = $profileStatus; $profile->engineType = $engineType; $profile->entryFilter = $entryFilter; $profile->actionIfInfected = $actionIfInfected; $dbProfile = null; $dbProfile = $profile->toObject($dbProfile); $dbProfile->setPartnerId($partnerId); $dbProfile->save(); die('Done!');
/** * Update exisitng virus scan profile, it is possible to update the virus scan profile id too * * @param int $virusScanProfileId * @param KalturaVirusScanProfile $virusScanProfile Id * @return KalturaVirusScanProfile */ function update($virusScanProfileId, KalturaVirusScanProfile $virusScanProfile) { $kparams = array(); $this->client->addParam($kparams, "virusScanProfileId", $virusScanProfileId); $this->client->addParam($kparams, "virusScanProfile", $virusScanProfile->toParams()); $this->client->queueServiceActionCall("virusscan_virusscanprofile", "update", $kparams); if ($this->client->isMultiRequest()) { return $this->client->getMultiRequestResult(); } $resultObject = $this->client->doQueue(); $this->client->throwExceptionIfError($resultObject); $this->client->validateObjectType($resultObject, "KalturaVirusScanProfile"); return $resultObject; }
/** * Mark the virus scan profile as deleted * * @action delete * @param int $virusScanProfileId * @return KalturaVirusScanProfile * * @throws KalturaErrors::INVALID_OBJECT_ID */ function deleteAction($virusScanProfileId) { $dbVirusScanProfile = VirusScanProfilePeer::retrieveByPK($virusScanProfileId); if (!$dbVirusScanProfile) { throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $virusScanProfileId); } $dbVirusScanProfile->setStatus(KalturaVirusScanProfileStatus::DELETED); $dbVirusScanProfile->save(); $virusScanProfile = new KalturaVirusScanProfile(); $virusScanProfile->fromObject($dbVirusScanProfile); return $virusScanProfile; }