Example #1
0
 /**
  * Function constructs a core object of type kBulkUploadJobData
  * @param int $conversionProfileId
  * @param string $filePath
  * @param string $userId
  * @param int $bulkUploadType
  * @param string $uploadedBy
  * @param string $fileName
  * @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
  */
 protected function constructJobData($filePath, $fileName, Partner $partner, $puserId, $uploadedBy, $conversionProfileId = null, $coreBulkUploadType = null)
 {
     $data = KalturaPluginManager::loadObject('kBulkUploadJobData', $coreBulkUploadType);
     if (is_null($data)) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $coreBulkUploadType);
     }
     $data->setFilePath($filePath);
     $data->setUserId($puserId);
     $data->setUploadedBy($uploadedBy);
     $data->setFileName($fileName);
     if (!$conversionProfileId) {
         $conversionProfileId = $partner->getDefaultConversionProfileId();
     }
     $kmcVersion = $partner->getKmcVersion();
     $check = null;
     if ($kmcVersion < 2) {
         $check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
     } else {
         $check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
     }
     if (!$check) {
         throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
     }
     $objectData = new kBulkUploadEntryData();
     $objectData->setConversionProfileId($conversionProfileId);
     $data->setObjectData($objectData);
     return $data;
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $go = $this->getP("go");
     $filter = new ConversionProfileFilter();
     $this->list = array();
     $fields_set = $filter->fillObjectFromRequest($_REQUEST, "filter_", null);
     if ($go) {
         $c = new Criteria();
         // filter
         $filter->attachToCriteria($c);
         //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
         $this->list = ConversionProfilePeer::doSelect($c);
     }
     $the_conv = myConversionProfileUtils::getConversionProfile($filter->get("_eq_partner_id"), $filter->get("_eq_profile_type"));
     $selected = false;
     if ($the_conv) {
         foreach ($this->list as &$conv) {
             if ($conv->getId() == $the_conv->getId()) {
                 $selected = true;
                 $conv->selected = true;
             }
         }
     }
     // is none was selected - need to add the_conv to the list
     if (!$selected && $the_conv) {
         $the_conv->selected = true;
         $this->list[] = $the_conv;
     }
     $this->filter = $filter;
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // get the new properties for the ConversionProfile from the request
     $conv_profile = new ConversionProfile();
     $obj_wrapper = objectWrapperBase::getWrapperClass($conv_profile, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $conv_profile, "conversionProfile_", $obj_wrapper->getUpdateableFields(), BasePeer::TYPE_PHPNAME, true);
     // check that mandatory fields were set
     if (count($fields_modified) > 0) {
         // search if partner already has a conversionProfile similar to the one just added - if exists - use it
         // if not - create it and return it.
         $partner_conv_profile = ConversionProfilePeer::retrieveSimilar($partner_id, $conv_profile);
         if (!$partner_conv_profile) {
             $conv_profile->setPartnerId($partner_id);
             $conv_profile->setEnabled(1);
             $conv_profile->save();
             $partner_conv_profile = $conv_profile;
         }
         // TODO - remove - no need to playaround with the updatedAt for ordering (in the listconversionprofiles service
         //			$partner_conv_profile->setUpdatedAt( time() );
         //			$partner_conv_profile->save();
         $partner = $this->getPartner();
         $partner_current_conversion_profile = $partner->getCurrentConversionProfileType();
         if ($partner_conv_profile->getId() != $partner_current_conversion_profile) {
             $partner->setCurrentConversionProfileType($partner_conv_profile->getId());
             $partner->save();
         }
         $this->addMsg("conversionProfile", objectWrapperBase::getWrapperClass($partner_conv_profile, objectWrapperBase::DETAIL_LEVEL_DETAILED));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_CONVERSION_PROFILE);
     }
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $this->ok_to_save = $this->getP("oktosave");
     $conv_profile_id = $this->getP("convprofile_id");
     if ($conv_profile_id < 0) {
         $conv_profile_id = "";
     }
     $this->message = "";
     $this->display_disabled = $this->getP("display_disabled");
     $command = $this->getP("command");
     if ($command == "removeCache") {
     } elseif ($command == "save") {
         $conv_profile = new ConversionProfile();
         $wrapper = objectWrapperBase::getWrapperClass($conv_profile, 0);
         $extra_fields = array("partnerId", "enabled");
         // add fields that cannot be updated using the API
         $allowed_params = array_merge($wrapper->getUpdateableFields(), $extra_fields);
         $fields_modified = baseObjectUtils::fillObjectFromMap($_REQUEST, $conv_profile, "convprofile_", $allowed_params, BasePeer::TYPE_PHPNAME, true);
         if ($conv_profile_id) {
             $conv_profile_from_db = ConversionProfilePeer::retrieveByPK($conv_profile_id);
             if ($conv_profile_from_db) {
                 baseObjectUtils::fillObjectFromObject($allowed_params, $conv_profile, $conv_profile_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, true);
             }
             $conv_profile_from_db->save();
         } else {
             $conv_profile->save();
             $conv_profile_id = $conv_profile->getId();
         }
     }
     $this->conv_profile = ConversionProfilePeer::retrieveByPK($conv_profile_id);
     $this->conv_profile_id = $conv_profile_id;
     if ($this->conv_profile) {
         $this->conv_profile_type = $this->conv_profile->getProfileType();
         $this->fallback_mode = array();
         $this->conv_params_list = ConversionParamsPeer::retrieveByConversionProfile($this->conv_profile, $this->fallback_mode, false);
         // to see if there are any disabled params - call again with true
         $tmp_fallback = array();
         $tmp_conv_params_list = ConversionParamsPeer::retrieveByConversionProfile($this->conv_profile, $tmp_fallback, true);
         if ($tmp_fallback["mode"] == $this->fallback_mode["mode"]) {
             $this->fallback_mode = $tmp_fallback;
             $this->conv_params_list = $tmp_conv_params_list;
         } else {
             if ($this->display_disabled) {
                 $this->fallback_mode = $tmp_fallback;
                 $this->conv_params_list = $tmp_conv_params_list;
                 $this->message = "This display is missleading due to [dispaly disabled=true]<br>It shows params that are disabled for this profile and WOULD NOT be used at run-time";
             }
         }
     } else {
         $this->conv_profile_type = null;
         $this->conv_params_list = null;
     }
 }
Example #5
0
 /**
  * Add new bulk upload batch job
  * Conversion profile id can be specified in the API or in the CSV file, the one in the CSV file will be stronger.
  * If no conversion profile was specified, partner's default will be used
  * 
  * @action add
  * @param int $conversionProfileId Convertion profile id to use for converting the current bulk (-1 to use partner's default)
  * @param file $csvFileData CSV File
  * @return KalturaBulkUpload
  */
 function addAction($conversionProfileId, $csvFileData)
 {
     // first we copy the file to "content/batchfiles/[partner_id]/"
     $origFilename = $csvFileData["name"];
     $fileInfo = pathinfo($origFilename);
     $extension = strtolower($fileInfo["extension"]);
     if ($extension != "csv") {
         throw new KalturaAPIException(KalturaErrors::INVALID_FILE_EXTENSION);
     }
     $job = new BatchJob();
     $job->setPartnerId($this->getPartnerId());
     $job->save();
     $syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOADCSV);
     //		kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
     try {
         kFileSyncUtils::moveFromFile($csvFileData["tmp_name"], $syncKey, true);
     } catch (Exception $e) {
         throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
     }
     $csvPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     $data = new KalturaBulkUploadJobData();
     $data->csvFilePath = $csvPath;
     $data->userId = $this->getKuser()->getPuserId();
     $data->uploadedBy = $this->getKuser()->getScreenName();
     if ($conversionProfileId === -1) {
         $conversionProfileId = $this->getPartner()->getDefaultConversionProfileId();
     }
     $kmcVersion = $this->getPartner()->getKmcVersion();
     $check = null;
     if ($kmcVersion < 2) {
         $check = ConversionProfilePeer::retrieveByPK($conversionProfileId);
     } else {
         $check = conversionProfile2Peer::retrieveByPK($conversionProfileId);
     }
     if (!$check) {
         throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
     }
     $data->conversionProfileId = $conversionProfileId;
     $dbJob = kJobsManager::addJob($job, $data->toObject(), KalturaBatchJobType::BULKUPLOAD);
     $bulkUpload = new KalturaBulkUpload();
     $bulkUpload->fromObject($dbJob);
     return $bulkUpload;
 }
Example #6
0
 private function getConversionQuality($entry)
 {
     $conversionQuality = $entry->conversionQuality;
     if (parent::getConversionQualityFromRequest()) {
         $conversionQuality = parent::getConversionQualityFromRequest();
     }
     if (is_null($conversionQuality)) {
         return null;
     }
     $conversionProfile2 = conversionProfile2Peer::retrieveByPK($conversionQuality);
     if (!$conversionProfile2) {
         KalturaLog::debug("Maybe old conversion profile");
         $conversionProfile = ConversionProfilePeer::retrieveByPK($conversionQuality);
         if ($conversionProfile) {
             $conversionQuality = $conversionProfile->getConversionProfile2Id();
         }
     }
     return $conversionQuality;
 }
Example #7
0
 /**
  * Function adds bulk upload job to the queue
  * @param Partner $partner
  * @param kBulkUploadJobData $jobData
  * @param string $bulkUploadType
  * @throws APIException
  * @return BatchJob
  */
 public static function addBulkUploadJob(Partner $partner, kBulkUploadJobData $jobData, $bulkUploadType = null, $objectId = null, $objectType = null)
 {
     KalturaLog::debug("adding BulkUpload job");
     $job = new BatchJob();
     $job->setPartnerId($partner->getId());
     $job->setJobType(BatchJobType::BULKUPLOAD);
     $job->setJobSubType($bulkUploadType);
     if (!is_null($objectId) && !is_null($objectType)) {
         $job->setObjectId($objectId);
         $job->setObjectType($objectType);
     }
     if (is_null($jobData)) {
         throw new APIException(APIErrors::BULK_UPLOAD_BULK_UPLOAD_TYPE_NOT_VALID, $bulkUploadType);
     }
     $job->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
     $job = kJobsManager::addJob($job, $jobData, BatchJobType::BULKUPLOAD, $bulkUploadType);
     if (!is_null($jobData->getFilePath())) {
         $syncKey = $job->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD);
         //		kFileSyncUtils::file_put_contents($syncKey, file_get_contents($csvFileData["tmp_name"]));
         try {
             kFileSyncUtils::moveFromFile($jobData->getFilePath(), $syncKey, true);
         } catch (Exception $e) {
             KalturaLog::err($e);
             throw new APIException(APIErrors::BULK_UPLOAD_CREATE_CSV_FILE_SYNC_ERROR);
         }
         $filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
         $jobData->setFilePath($filePath);
     }
     if (!$jobData->getBulkUploadObjectType()) {
         $jobData->setBulkUploadObjectType(BulkUploadObjectType::ENTRY);
     }
     if ($jobData->getBulkUploadObjectType() == BulkUploadObjectType::ENTRY && !$jobData->getObjectData()->getConversionProfileId()) {
         $jobData->setConversionProfileId($partner->getDefaultConversionProfileId());
         $kmcVersion = $partner->getKmcVersion();
         $check = null;
         if ($kmcVersion < 2) {
             $check = ConversionProfilePeer::retrieveByPK($jobData->getConversionProfileId());
         } else {
             $check = conversionProfile2Peer::retrieveByPK($jobData->getConversionProfileId());
         }
         if (!$check) {
             throw new APIException(APIErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $jobData->getConversionProfileId());
         }
     }
     $job->setData($jobData);
     return kJobsManager::updateBatchJob($job, BatchJob::BATCHJOB_STATUS_PENDING);
 }
 public function createConversionCommandFromConverionProfileId($source_file, $target_file, $conv_profile_id, $entry = null)
 {
     $conv_profile = ConversionProfilePeer::retrieveByPK($conv_profile_id);
     return $this->createConversionCommandFromConverionProfile($source_file, $target_file, $conv_profile, $entry);
 }
 public function getFieldNameFromPeer($field_name)
 {
     $res = ConversionProfilePeer::translateFieldName($field_name, $this->field_name_translation_type, BasePeer::TYPE_COLNAME);
     return $res;
 }
 /**
  * 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(ConversionProfilePeer::DATABASE_NAME);
         $criteria->add(ConversionProfilePeer::ID, $pks, Criteria::IN);
         $objs = ConversionProfilePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ConversionProfilePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPartnerId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setEnabled($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setName($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setProfileType($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCommercialTranscoder($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setWidth($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setHeight($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setAspectRatio($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setBypassFlv($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setUseWithBulk($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setCreatedAt($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setUpdatedAt($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setProfileTypeSuffix($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setConversionProfile2Id($arr[$keys[14]]);
     }
 }
 public static function getConversionProfileById($partner_id, $conversion_profile_id)
 {
     if ($conversion_profile_id === null) {
         return null;
     }
     $conv_prof = ConversionProfilePeer::retrieveByPK($conversion_profile_id);
     if ($conv_prof) {
         if ($conv_prof->getPartnerId() == $partner_id || $conv_prof->getPartnerId() == ConversionProfile::GLOBAL_PARTNER_PROFILE) {
             return $conv_prof;
         }
     }
     return null;
 }
 public static function clearMemory()
 {
     accessControlPeer::clearInstancePool();
     kuserPeer::clearInstancePool();
     kshowPeer::clearInstancePool();
     entryPeer::clearInstancePool();
     //	    kvotePeer::clearInstancePool();
     //	    commentPeer::clearInstancePool();
     //	    flagPeer::clearInstancePool();
     //	    favoritePeer::clearInstancePool();
     //	    KshowKuserPeer::clearInstancePool();
     //	    MailJobPeer::clearInstancePool();
     SchedulerPeer::clearInstancePool();
     SchedulerWorkerPeer::clearInstancePool();
     SchedulerStatusPeer::clearInstancePool();
     SchedulerConfigPeer::clearInstancePool();
     ControlPanelCommandPeer::clearInstancePool();
     BatchJobPeer::clearInstancePool();
     //	    PriorityGroupPeer::clearInstancePool();
     BulkUploadResultPeer::clearInstancePool();
     //	    blockedEmailPeer::clearInstancePool();
     //	    conversionPeer::clearInstancePool();
     //	    flickrTokenPeer::clearInstancePool();
     PuserKuserPeer::clearInstancePool();
     //	    PuserRolePeer::clearInstancePool();
     PartnerPeer::clearInstancePool();
     //	    WidgetLogPeer::clearInstancePool();
     //	    adminKuserPeer::clearInstancePool();
     //	    notificationPeer::clearInstancePool();
     moderationPeer::clearInstancePool();
     moderationFlagPeer::clearInstancePool();
     roughcutEntryPeer::clearInstancePool();
     //	    widgetPeer::clearInstancePool();
     uiConfPeer::clearInstancePool();
     //	    PartnerStatsPeer::clearInstancePool();
     //	    PartnerActivityPeer::clearInstancePool();
     ConversionProfilePeer::clearInstancePool();
     //	    ConversionParamsPeer::clearInstancePool();
     //	    KceInstallationErrorPeer::clearInstancePool();
     FileSyncPeer::clearInstancePool();
     accessControlPeer::clearInstancePool();
     mediaInfoPeer::clearInstancePool();
     assetParamsPeer::clearInstancePool();
     assetParamsOutputPeer::clearInstancePool();
     assetPeer::clearInstancePool();
     conversionProfile2Peer::clearInstancePool();
     flavorParamsConversionProfilePeer::clearInstancePool();
     categoryPeer::clearInstancePool();
     syndicationFeedPeer::clearInstancePool();
     TrackEntryPeer::clearInstancePool();
     //	    SystemUserPeer::clearInstancePool();
     StorageProfilePeer::clearInstancePool();
     //	    EmailIngestionProfilePeer::clearInstancePool();
     UploadTokenPeer::clearInstancePool();
     //	    invalidSessionPeer::clearInstancePool();
     DynamicEnumPeer::clearInstancePool();
     UserLoginDataPeer::clearInstancePool();
     PermissionPeer::clearInstancePool();
     UserRolePeer::clearInstancePool();
     PermissionItemPeer::clearInstancePool();
     PermissionToPermissionItemPeer::clearInstancePool();
     KuserToUserRolePeer::clearInstancePool();
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaMemoryCleaner');
     foreach ($pluginInstances as $pluginInstance) {
         $pluginInstance->cleanMemory();
     }
     if (function_exists('gc_collect_cycles')) {
         // php 5.3 and above
         gc_collect_cycles();
     }
 }
 public static function getConversionProfileForPartner($partner_id, $partner_convrsion_string = null, $partner_flv_conversion_string = mull)
 {
     $conv_prof = ConversionProfilePeer::retrieveByPK($conversion_profile_id);
 }
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     //		$this->applyPartnerFilterForClass( new ConversionProfilePeer() , $partner_id );
     // TODO -  verify permissions for viewing lists
     $detailed = $this->getP("detailed", false);
     $limit = $this->getP("page_size", 10);
     $page = $this->getP("page", 1);
     //$order_by = int( $this->getP ( "order_by" , -1 ) );
     $offset = ($page - 1) * $limit;
     $partner_current_conversion_profile = myPartnerUtils::getCurrentConversionProfile($partner_id);
     $c = new Criteria();
     // filter
     $filter = new ConversionProfileFilter();
     $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
     $filter->set("_order_by", null);
     // ignore the order_by for now
     $filter->attachToCriteria($c);
     // partner_id either the partner or partner_id=0
     $crit = $c->getNewCriterion(ConversionProfilePeer::PARTNER_ID, 0);
     $c->addAnd($crit->addOr($c->getNewCriterion(ConversionProfilePeer::PARTNER_ID, $partner_id)));
     // for now - only enabled profiles
     $c->addAnd(ConversionProfilePeer::ENABLED, 1);
     // make sure the partner's profiles will appear first ordered by id desc - last will come first
     $order_by = "(" . ConversionProfilePeer::PARTNER_ID . "<>{$partner_id})";
     // first take the patner_id and then the rest
     myCriteria::addComment($c, "Only Kaltura Network");
     $c->addAscendingOrderByColumn($order_by);
     //, Criteria::CUSTOM );
     $c->addDescendingOrderByColumn(ConversionProfilePeer::UPDATED_AT);
     //, Criteria::CUSTOM );
     $c->addDescendingOrderByColumn(ConversionProfilePeer::ID);
     //, Criteria::CUSTOM );
     //if ($order_by != -1) kshowPeer::setOrder( $c , $order_by );
     $count = ConversionProfilePeer::doCount($c);
     $offset = ($page - 1) * $limit;
     $c->setLimit($limit);
     if ($offset > 0) {
         $c->setOffset($offset);
     }
     $list = ConversionProfilePeer::doSelect($c);
     if (count($list) > 0) {
         // reorder the list so the first will always be the best default  for the partner
         $partner_list = array($partner_current_conversion_profile);
         // the first is always the partner's default
         //			$this->addDebug( "partner_current_conversion_profile" , objectWrapperBase::getWrapperClass( $partner_current_conversion_profile ) );
         $global_list = array();
         $default_prof = array();
         foreach ($list as $conv_profile) {
             if ($conv_profile->getPartnerId() == ConversionProfile::GLOBAL_PARTNER_PROFILE) {
                 if ($conv_profile->getProfileType() == ConversionProfile::DEFAULT_COVERSION_PROFILE_TYPE) {
                     $default_prof[] = $conv_profile;
                 } else {
                     $global_list[] = $conv_profile;
                 }
             } elseif ($conv_profile->getPartnerId() == $partner_id) {
                 $partner_list[] = $conv_profile;
             }
         }
         //			$level = objectWrapperBase::DETAIL_LEVEL_REGULAR ;
         //			$this->addMsg ( "par-list" , objectWrapperBase::getWrapperClass( $partner_list  , $level ) ) ;
         //			$this->addMsg ( "def-list" , objectWrapperBase::getWrapperClass( $default_prof  , $level ) ) ;
         //			$this->addMsg ( "rest-list" , objectWrapperBase::getWrapperClass( $global_list  , $level ) ) ;
         // this is the correct order - the partners , the default and all the rest of the globals
         $list = array_merge($partner_list, $default_prof, $global_list);
     }
     $level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     $wrapper = objectWrapperBase::getWrapperClass($list, $level);
     $this->addMsg("conversionProfiles", $wrapper);
 }
Example #16
0
        KalturaLog::debug("This was dry-run, exiting");
        die;
    } else {
        $partner->setKmcVersion('4');
        $partner->save();
        KalturaLog::debug("Partner was modified to KMC V4");
        die;
    }
}
$currentConversionProfileType = $partner->getCurrentConversionProfileType();
if ($currentConversionProfileType) {
    // convert old conversion profile to new (or check if has new)
    $criteria = new Criteria();
    $criteria->add(ConversionProfilePeer::PARTNER_ID, $partner_id);
    $criteria->addDescendingOrderByColumn(ConversionProfilePeer::UPDATED_AT);
    $oldCp = ConversionProfilePeer::doSelectOne($criteria);
    if ($oldCp && !$oldCp->getConversionProfile2Id()) {
        if (DEBUG) {
            KalturaLog::debug("This was dry-run, going to convert old conversion profile to new, existing");
            die;
        } else {
            KalturaLog::debug("Converting old conversion profile to new");
            myConversionProfileUtils::createConversionProfile2FromConversionProfile($oldCp);
        }
    }
    if (DEBUG) {
        KalturaLog::debug("This was dry-run, going to set partner with DefaultConversionProfileId: " . $partner->getDefaultConversionProfileId());
        die;
    } else {
        // set new id as defaultConversionProfileId
        $partner->setDefaultConversionProfileId($oldCp->getConversionProfile2Id());
Example #17
0
 public function getConversionProfile()
 {
     $conversion_profile = $this->getConversionQuality();
     if ($conversion_profile) {
         return ConversionProfilePeer::retrieveByPK($conversion_profile);
     }
     return null;
 }
Example #18
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(ConversionProfilePeer::DATABASE_NAME);
     $criteria->add(ConversionProfilePeer::ID, $this->id);
     if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(ConversionProfilePeer::UPDATED_AT)) {
         $theModifiedColumn = null;
         foreach ($this->modifiedColumns as $modifiedColumn) {
             if ($modifiedColumn != ConversionProfilePeer::UPDATED_AT) {
                 $theModifiedColumn = $modifiedColumn;
             }
         }
         $atomicColumns = ConversionProfilePeer::getAtomicColumns();
         if (in_array($theModifiedColumn, $atomicColumns)) {
             $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
         }
     }
     return $criteria;
 }