Example #1
0
 public function clearMemory()
 {
     accessControlPeer::clearInstancePool();
     BatchJobPeer::clearInstancePool();
     BulkUploadResultPeer::clearInstancePool();
     categoryPeer::clearInstancePool();
     EmailIngestionProfilePeer::clearInstancePool();
     entryPeer::clearInstancePool();
     FileSyncPeer::clearInstancePool();
     flavorAssetPeer::clearInstancePool();
     flavorParamsConversionProfilePeer::clearInstancePool();
     flavorParamsOutputPeer::clearInstancePool();
     flavorParamsPeer::clearInstancePool();
     kshowPeer::clearInstancePool();
     mediaInfoPeer::clearInstancePool();
     moderationFlagPeer::clearInstancePool();
     moderationPeer::clearInstancePool();
     notificationPeer::clearInstancePool();
     roughcutEntryPeer::clearInstancePool();
     SchedulerConfigPeer::clearInstancePool();
     SchedulerPeer::clearInstancePool();
     SchedulerStatusPeer::clearInstancePool();
     SchedulerWorkerPeer::clearInstancePool();
     StorageProfilePeer::clearInstancePool();
     syndicationFeedPeer::clearInstancePool();
     TrackEntryPeer::clearInstancePool();
     uiConfPeer::clearInstancePool();
     UploadTokenPeer::clearInstancePool();
     // TODO clear default filters
     // TODO call all memory cleaner plugins
     if (function_exists('gc_collect_cycles')) {
         // php 5.3 and above
         gc_collect_cycles();
     }
 }
Example #2
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this kshow is new, it will return
  * an empty collection; or if this kshow has previously
  * been saved, it will retrieve related roughcutEntrys from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in kshow.
  */
 public function getroughcutEntrysJoinentryRelatedByEntryId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(kshowPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collroughcutEntrys === null) {
         if ($this->isNew()) {
             $this->collroughcutEntrys = array();
         } else {
             $criteria->add(roughcutEntryPeer::ROUGHCUT_KSHOW_ID, $this->id);
             $this->collroughcutEntrys = roughcutEntryPeer::doSelectJoinentryRelatedByEntryId($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(roughcutEntryPeer::ROUGHCUT_KSHOW_ID, $this->id);
         if (!isset($this->lastroughcutEntryCriteria) || !$this->lastroughcutEntryCriteria->equals($criteria)) {
             $this->collroughcutEntrys = roughcutEntryPeer::doSelectJoinentryRelatedByEntryId($criteria, $con, $join_behavior);
         }
     }
     $this->lastroughcutEntryCriteria = $criteria;
     return $this->collroughcutEntrys;
 }
Example #3
0
 /**
  * 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 = roughcutEntryPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setRoughcutId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setRoughcutVersion($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setRoughcutKshowId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setEntryId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setPartnerId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setOpType($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCreatedAt($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setUpdatedAt($arr[$keys[8]]);
     }
 }
 public static function getAllEntries($c, $roughcut_ids)
 {
     roughcutEntryPeer::retrievByRoughcutIds($c, $roughcut_ids);
 }
 /**
 	return array('status' => $status, 'message' => $message, 'objects' => $objects);
 		objects - array of
 				'thumb' 
 				'title'  
 				'description' 
 				'id' - unique id to be passed to getMediaInfo 
 
 	this service will first return the relevant kshows, then find the relevant roughcuts and finally fetch the entries
 */
 public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     // this bellow will bypass the partner filter - at the end of the code the filter will return to be as was before
     $kshow_criteria = kshowPeer::getCriteriaFilter()->getFilter();
     $original_kshow_partner_to_filter = $kshow_criteria->get(kshowPeer::PARTNER_ID);
     $kshow_criteria->remove(kshowPeer::PARTNER_ID);
     $entry_criteria = entryPeer::getCriteriaFilter()->getFilter();
     $original_entry_partner_to_filter = $entry_criteria->get(entryPeer::PARTNER_ID);
     $entry_criteria->remove(entryPeer::PARTNER_ID);
     $page_size = $pageSize > self::MAX_PAGE_SIZE ? self::MAX_PAGE_SIZE : $pageSize;
     $status = "ok";
     $message = '';
     $kshow_filter = $this->getKshowFilter($extraData);
     $limit = $pageSize;
     $offset = $pageSize * ($page - 1);
     // $page starts from 1
     //		$keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
     // TODO_ change mechanism !
     //$search_mechanism = self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW;
     $search_mechanism = self::KALTURA_SERVICE_CRITERIA_FROM_ROUGHCUT;
     // TODO - optimize the first part of the entry_id search
     // cache once we know the kshow_ids / roughcuts - this will make paginating much faster
     $kshow_crit = new Criteria();
     $kshow_crit->clearSelectColumns()->clearOrderByColumns();
     $kshow_crit->addSelectColumn(kshowPeer::ID);
     $kshow_crit->addSelectColumn(kshowPeer::SHOW_ENTRY_ID);
     $kshow_crit->setLimit(self::$s_default_count_limit);
     $kshow_filter->addSearchMatchToCriteria($kshow_crit, $searchText, kshow::getSearchableColumnName());
     if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
         $kshow_crit->add(kshowPeer::ENTRIES, 1, criteria::GREATER_EQUAL);
     }
     $rs = kshowPeer::doSelectStmt($kshow_crit);
     $kshow_arr = array();
     $roughcut_arr = array();
     $res = $rs->fetchAll();
     foreach ($res as $record) {
         $kshow_arr[] = $record[0];
         $roughcut_arr[] = $record[1];
     }
     //		// old code from doSelectRs
     //		while($rs->next())
     //		{
     //			$kshow_arr[] = $rs->getString(1);
     //			$roughcut_arr[] = $rs->getString(2);
     //		}
     $crit = new Criteria();
     $crit->setOffset($offset);
     $crit->setLimit($limit);
     $crit->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
     $crit->add(entryPeer::MEDIA_TYPE, $media_type);
     if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
         $crit->add(entryPeer::KSHOW_ID, $kshow_arr, Criteria::IN);
         $entry_results = entryPeer::doSelect($crit);
     } elseif ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_ROUGHCUT) {
         //			$entry_results  = roughcutEntryPeer::retrievByRoughcutIds ( $crit , $roughcut_arr , true );
         $entry_results = roughcutEntryPeer::retrievEntriesByRoughcutIds($crit, $roughcut_arr);
     }
     // after the query - return the filter to what it was before
     $entry_criteria->addAnd(entryPeer::PARTNER_ID, $original_entry_partner_to_filter);
     $kshow_criteria->addAnd(kshowPeer::PARTNER_ID, $original_kshow_partner_to_filter);
     $objects = array();
     // add thumbs when not image or video
     $should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
     foreach ($entry_results as $obj) {
         if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
             $entry = $obj;
         } else {
             //$entry = $obj->getEntry();
             $entry = $obj;
         }
         /* @var $entry entry */
         // use the id as the url - it will help using this entry id in addentry
         $object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getTags(), "flash_playback_type" => $entry->getMediaTypeName());
         if ($should_add_thumbs) {
             $object["thumb"] = $entry->getThumbnailUrl();
         }
         $objects[] = $object;
     }
     return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
 }
Example #6
0
 public static function retrievByKshowId($kshow_id, $join_all = false)
 {
     $c = new Criteria();
     //		myCriteria::addComment( $c , __METHOD__ );
     $c->addAnd(roughcutEntryPeer::ROUGHCUT_KSHOW_ID, $kshow_id);
     $c->addAscendingOrderByColumn(roughcutEntryPeer::ID);
     if ($join_all) {
         return roughcutEntryPeer::doSelectJoinAll($c);
     } else {
         return roughcutEntryPeer::doSelect($c);
     }
 }
 /**
  * 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(roughcutEntryPeer::DATABASE_NAME);
         $criteria->add(roughcutEntryPeer::ID, $pks, Criteria::IN);
         $objs = roughcutEntryPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #8
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(roughcutEntryPeer::DATABASE_NAME);
     $criteria->add(roughcutEntryPeer::ID, $this->id);
     if ($this->alreadyInSave && count($this->modifiedColumns) == 2 && $this->isColumnModified(roughcutEntryPeer::UPDATED_AT)) {
         $theModifiedColumn = null;
         foreach ($this->modifiedColumns as $modifiedColumn) {
             if ($modifiedColumn != roughcutEntryPeer::UPDATED_AT) {
                 $theModifiedColumn = $modifiedColumn;
             }
         }
         $atomicColumns = roughcutEntryPeer::getAtomicColumns();
         if (in_array($theModifiedColumn, $atomicColumns)) {
             $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
         }
     }
     return $criteria;
 }
 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();
     }
 }