/** * Will return the first virus scan profile of the entry's partner, that defines an entry filter suitable for the given entry. * @param int $entryId * @return VirusScanProfile the suitable profile object, or null if none found */ public static function getSuitableProfile($entryId) { $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { KalturaLog::err('Cannot find entry with id [' . $entryId . ']'); return null; } if ($entry->getSource() == entry::ENTRY_MEDIA_SOURCE_WEBCAM) { return null; } $cProfile = new Criteria(); $cProfile->addAnd(VirusScanProfilePeer::PARTNER_ID, $entry->getPartnerId()); $cProfile->addAnd(VirusScanProfilePeer::STATUS, VirusScanProfileStatus::ENABLED, Criteria::EQUAL); $profiles = VirusScanProfilePeer::doSelect($cProfile); if (!$profiles) { KalturaLog::debug('No virus scan profiles found for partner [' . $entry->getPartnerId() . ']'); return null; } foreach ($profiles as $profile) { $virusEntryFilter = $profile->getEntryFilterObject(); if ($virusEntryFilter->matches($entry)) { KalturaLog::debug('Returning profile with id [' . $profile->getId() . ']'); return $profile; } } return null; }
/** * List virus scan profile objects by filter and pager * * @action list * @param KalturaVirusScanProfileFilter $filter * @param KalturaFilterPager $pager * @return KalturaVirusScanProfileListResponse */ function listAction(KalturaVirusScanProfileFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaVirusScanProfileFilter(); } $virusScanProfileFilter = $filter->toObject(); $c = new Criteria(); $virusScanProfileFilter->attachToCriteria($c); $count = VirusScanProfilePeer::doCount($c); if ($pager) { $pager->attachToCriteria($c); } $list = VirusScanProfilePeer::doSelect($c); $response = new KalturaVirusScanProfileListResponse(); $response->objects = KalturaVirusScanProfileArray::fromDbArray($list); $response->totalCount = $count; return $response; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(VirusScanProfilePeer::DATABASE_NAME); $criteria->add(VirusScanProfilePeer::ID, $pks, Criteria::IN); $objs = VirusScanProfilePeer::doSelect($criteria, $con); } return $objs; }