public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
 {
     /* @var $object ExternalMediaEntry */
     $object->setStatus(entryStatus::READY);
     $object->save();
     return true;
 }
 public function save($connection = null)
 {
     parent::save($connection);
     // Save updated objectTermRelations
     foreach ($this->objectTermRelationsRelatedByobjectId as $relation) {
         $relation->setIndexOnSave(false);
         $relation->object = $this;
         try {
             $relation->save();
         } catch (PropelException $e) {
         }
     }
     // Save updated notes
     foreach ($this->notes as $note) {
         $note->setIndexOnSave(false);
         $note->object = $this;
         try {
             $note->save();
         } catch (PropelException $e) {
         }
     }
     // Save updated properties
     foreach ($this->propertys as $property) {
         $property->setIndexOnSave(false);
         $property->object = $this;
         try {
             $property->save();
         } catch (PropelException $e) {
         }
     }
     // Save updated object relations
     foreach ($this->relationsRelatedByobjectId as $relation) {
         $relation->setIndexOnSave(false);
         $relation->object = $this;
         try {
             $relation->save();
         } catch (PropelException $e) {
         }
     }
     // Save updated subject relations
     foreach ($this->relationsRelatedBysubjectId as $relation) {
         $relation->setIndexOnSave(false);
         $relation->subject = $this;
         try {
             $relation->save();
         } catch (PropelException $e) {
         }
     }
     // Save updated other namnes
     foreach ($this->otherNames as $otherName) {
         $otherName->object = $this;
         try {
             $otherName->save();
         } catch (PropelException $e) {
         }
     }
     return $this;
 }
 public function objectCreated(BaseObject $object)
 {
     /* @var $object entry */
     $partner = $object->getPartner();
     $velocixLiveParamsJSON = json_decode($partner->getLiveStreamProvisionParams());
     if (!isset($velocixLiveParamsJSON->velocix) || !isset($velocixLiveParamsJSON->velocix->userName) || !isset($velocixLiveParamsJSON->velocix->password)) {
         $object->setStatus(entryStatus::ERROR_IMPORTING);
         $object->save();
         return true;
     }
     if (isset($velocixLiveParamsJSON->velocix->streamNamePrefix)) {
         $object->setStreamName($velocixLiveParamsJSON->velocix->streamNamePrefix . '_' . $object->getId());
     } else {
         $object->setStreamName($object->getId());
     }
     $object->save();
     return true;
 }
 public function objectCreated(BaseObject $object)
 {
     /* @var $object entry */
     $partner = $object->getPartner();
     $limeLightLiveParamsJSON = $partner->getLiveStreamProvisionParams();
     $limeLightLiveParams = json_decode($limeLightLiveParamsJSON);
     if (!isset($limeLightLiveParams->Limelight) || !isset($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl) || !isset($limeLightLiveParams->Limelight->limelightStreamUrl)) {
         $object->setStatus(entryStatus::ERROR_IMPORTING);
         $object->save();
         return true;
     }
     $object->setPrimaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightPrimaryPublishUrl);
     $object->setSecondaryBroadcastingUrl($limeLightLiveParams->Limelight->limelightSecondaryPublishUrl);
     $object->setStreamUrl($limeLightLiveParams->Limelight->limelightStreamUrl);
     $object->setStreamName($object->getId() . '_%i');
     $object->setStatus(entryStatus::READY);
     $object->save();
     return true;
 }
 public function objectCopied(BaseObject $fromObject, BaseObject $toObject)
 {
     if ($fromObject instanceof asset) {
         self::mapIds('asset', $fromObject->getId(), $toObject->getId());
         $flavorParamsId = self::getMappedId('assetParams', $fromObject->getFlavorParamsId());
         if ($flavorParamsId) {
             $toObject->setFlavorParamsId($flavorParamsId);
             $toObject->save();
         }
     } elseif ($fromObject instanceof assetParams) {
         self::mapIds('assetParams', $fromObject->getId(), $toObject->getId());
     } elseif ($fromObject instanceof assetParamsOutput) {
         self::mapIds('assetParamsOutput', $fromObject->getId(), $toObject->getId());
         $flavorParamsId = self::getMappedId('assetParams', $fromObject->getFlavorParamsId());
         if ($flavorParamsId) {
             $toObject->setFlavorParamsId($flavorParamsId);
             $toObject->save();
         }
     } else {
         self::mapIds(get_class($fromObject), $fromObject->getId(), $toObject->getId());
     }
     if ($fromObject instanceof category && $fromObject->getParentId()) {
         $parentId = self::getMappedId('category', $fromObject->getParentId());
         if ($parentId) {
             $toObject->setParentId($parentId);
             $toObject->save();
         }
     }
     if ($fromObject instanceof entry) {
         $conversionProfileId = self::getMappedId('conversionProfile2', $fromObject->getConversionProfileId());
         if ($conversionProfileId) {
             $toObject->setConversionProfileId($conversionProfileId);
             $toObject->save();
         }
         $accessControlId = self::getMappedId('accessControl', $fromObject->getAccessControlId());
         if ($accessControlId) {
             $toObject->setAccessControlId($accessControlId);
             $toObject->save();
         }
     }
     return true;
 }
 /**
  * @param BaseObject $object
  * @return bool true if should continue to the next consumer
  */
 public function objectAdded(BaseObject $object)
 {
     if ($object instanceof flavorAsset && $object->getIsOriginal()) {
         $entry = $object->getentry();
         if ($entry->getType() == entryType::DOCUMENT) {
             if ($entry->getConversionQuality() > 0) {
                 $syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                 kJobsManager::addConvertProfileJob(null, $entry, $object->getId(), $path);
             } else {
                 // only for documents entry, make the source ready since no conversion profile will be executed by default
                 $object->setFlavorParamsId(flavorParams::SOURCE_FLAVOR_ID);
                 $object->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_READY);
                 $object->save();
                 $entry->setStatusReady();
                 $entry->save();
             }
         }
     }
     return true;
 }
 public function objectChanged(BaseObject $object, array $modifiedColumns)
 {
     // replacing the ismc file name in the ism file
     $ismPrevVersionFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $ismContents = kFileSyncUtils::file_get_contents($ismPrevVersionFileSyncKey);
     $ismcPrevVersionFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
     $ismcContents = kFileSyncUtils::file_get_contents($ismcPrevVersionFileSyncKey);
     $ismcPrevVersionFilePath = kFileSyncUtils::getLocalFilePathForKey($ismcPrevVersionFileSyncKey);
     $object->incrementVersion();
     $object->save();
     $ismcFileSyncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ISMC);
     kFileSyncUtils::moveFromFile($ismcPrevVersionFilePath, $ismcFileSyncKey);
     $ismcNewName = basename(kFileSyncUtils::getLocalFilePathForKey($ismcFileSyncKey));
     KalturaLog::debug("Editing ISM set content to [{$ismcNewName}]");
     $ismXml = new SimpleXMLElement($ismContents);
     $ismXml->head->meta['content'] = $ismcNewName;
     $tmpPath = kFileSyncUtils::getLocalFilePathForKey($ismPrevVersionFileSyncKey) . '.tmp';
     file_put_contents($tmpPath, $ismXml->asXML());
     kFileSyncUtils::moveFromFile($tmpPath, $object->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET));
     return true;
 }
 public function save()
 {
     parent::save();
     Definition::updateModDate($this->definitionId);
 }
Example #9
0
 public function save()
 {
     $this->modUserId = session_getUserId();
     return parent::save();
 }
Example #10
0
 public function save()
 {
     $this->formUtf8General = $this->formNoAccent;
     $this->reverse = StringUtil::reverse($this->formNoAccent);
     $this->charLength = mb_strlen($this->formNoAccent);
     $this->consistentAccent = strpos($this->form, "'") !== false ^ $this->noAccent;
     // It is important for empty fields to be null, not "".
     // This allows the admin report for lexems *with* comments to run faster.
     if ($this->comment == '') {
         $this->comment = null;
     }
     if (!$this->number) {
         $this->number = null;
     }
     parent::save();
 }
 public function save()
 {
     $this->formUtf8General = $this->formNoAccent;
     parent::save();
 }
 /**
  * Taggings removing logic, runned before the object himself has been deleted
  *
  * @param      BaseObject  $object
  */
 public function preDelete(BaseObject $object)
 {
     $object->removeAllTags();
     $object->save();
 }
Example #13
0
 public function objectCopied(BaseObject $fromObject, BaseObject $toObject)
 {
     if ($fromObject instanceof asset) {
         self::mapIds('asset', $fromObject->getId(), $toObject->getId());
         $flavorParamsId = self::getMappedId('assetParams', $fromObject->getFlavorParamsId());
         if ($flavorParamsId) {
             $toObject->setFlavorParamsId($flavorParamsId);
             $toObject->save();
         }
     } elseif ($fromObject instanceof assetParams) {
         self::mapIds('assetParams', $fromObject->getId(), $toObject->getId());
     } elseif ($fromObject instanceof assetParamsOutput) {
         self::mapIds('assetParamsOutput', $fromObject->getId(), $toObject->getId());
         $flavorParamsId = self::getMappedId('assetParams', $fromObject->getFlavorParamsId());
         if ($flavorParamsId) {
             $toObject->setFlavorParamsId($flavorParamsId);
             $toObject->save();
         }
     } else {
         self::mapIds(get_class($fromObject), $fromObject->getId(), $toObject->getId());
     }
     if ($fromObject instanceof uiConf) {
         $this->uiConfCopied($fromObject, $toObject);
     }
     if ($fromObject instanceof category && $fromObject->getParentId()) {
         $parentId = self::getMappedId('category', $fromObject->getParentId());
         if ($parentId) {
             $toObject->setParentId($parentId);
             $toObject->save();
         }
     }
     if ($fromObject instanceof entry) {
         $conversionProfileId = self::getMappedId('conversionProfile2', $fromObject->getConversionProfileId());
         if ($conversionProfileId) {
             $toObject->setConversionProfileId($conversionProfileId);
             $toObject->save();
         }
         $accessControlId = self::getMappedId('accessControl', $fromObject->getAccessControlId());
         if ($accessControlId) {
             $toObject->setAccessControlId($accessControlId);
             $toObject->save();
         }
         if ($toObject->getPartnerId() == $fromObject->getPartnerId()) {
             $categoryEntriesObjects = categoryEntryPeer::retrieveActiveByEntryId($fromObject->getId());
             $categoryIds = array();
             foreach ($categoryEntriesObjects as $categoryEntryObject) {
                 /* @var $categoryEntry categoryEntry */
                 $categoryIds[] = $categoryEntryObject->getCategoryId();
             }
             if (count($categoryIds)) {
                 $categories = categoryPeer::retrieveByPKs($categoryIds);
                 //which will return only the entiteled ones
                 foreach ($categories as $category) {
                     /* @var $category category */
                     $categoryEntry = new categoryEntry();
                     $categoryEntry->setEntryId($toObject->getId());
                     $categoryEntry->setCategoryId($category->getId());
                     $categoryEntry->setStatus(CategoryEntryStatus::ACTIVE);
                     $categoryEntry->setPartnerId($toObject->getPartnerId());
                     $categoryEntry->save();
                 }
             }
         }
     }
     return true;
 }
Example #14
0
 public function objectAdded(BaseObject $object, BatchJob $raisedJob = null)
 {
     $entry = $object->getentry();
     if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_QUEUED || $object->getStatus() == asset::FLAVOR_ASSET_STATUS_IMPORTING) {
         if (!$object instanceof flavorAsset) {
             $object->setStatus(asset::FLAVOR_ASSET_STATUS_READY);
             $object->save();
         } elseif ($object->getIsOriginal()) {
             if ($entry->getType() == entryType::MEDIA_CLIP) {
                 $syncKey = $object->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 if (kFileSyncUtils::fileSync_exists($syncKey)) {
                     // Get the asset fileSync.
                     // For URL typed sync - assume remote and use the relative file path.
                     // For the other types - use the ordinary kFileSyncUtils::getLocalFilePathForKey.
                     $fsArr = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
                     $fs = $fsArr[0];
                     if ($fs->getFileType() == FileSync::FILE_SYNC_FILE_TYPE_URL) {
                         $path = $fs->getFilePath();
                     } else {
                         $path = kFileSyncUtils::getLocalFilePathForKey($syncKey);
                     }
                     kJobsManager::addConvertProfileJob($raisedJob, $entry, $object->getId(), $path);
                 }
             }
         } else {
             $object->setStatus(asset::FLAVOR_ASSET_STATUS_VALIDATING);
             $object->save();
         }
     }
     if ($object->getStatus() == asset::FLAVOR_ASSET_STATUS_READY && $object instanceof thumbAsset) {
         if ($object->getFlavorParamsId()) {
             kFlowHelper::generateThumbnailsFromFlavor($object->getEntryId(), $raisedJob, $object->getFlavorParamsId());
         } else {
             if ($object->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
                 kBusinessConvertDL::setAsDefaultThumbAsset($object);
             }
         }
         return true;
     }
     if ($object->getIsOriginal() && $entry->getStatus() == entryStatus::NO_CONTENT) {
         $entry->setStatus(entryStatus::PENDING);
         $entry->save();
     }
     return true;
 }
Example #15
0
 /**
  * Creates a new KnownNode for node models
  * 
  * @param PropelPDO $con PDO connection object
  * @return TestModelKnownNode 
  */
 protected function createKnownNode(BaseObject $node, PropelPDO $con = null)
 {
     $this->initConnections();
     // Look up schema, and create an empty one if required
     $schema = MeshingSchemaQuery::create()->findOneByName($this->package, $this->conSystem);
     if (!$schema) {
         $schema = new MeshingSchema();
         $schema->setName($this->package);
         $schema->setInstalledAt(time());
         $schema->save($this->conSystem);
     }
     /* @var $node TestModelKnownNode */
     $node->setName('Us!');
     $node->setFqdn('http://example.com/path');
     $node->setSchemaId($schema->getId());
     $node->save($con);
     return $node;
 }