has anyone implimented
http://www.kaltura.org/delete-files-kaltura-db-when-deleting-nodes
and willing to share the code?

thanks,
joseph

Comments

MaffooClock’s picture

FYI: looks like that link is broken now.

jacerider’s picture

Something like this should work:

function YOURMODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
	if($op == 'delete' && $node->type == 'YOUR KALTURA CONTENT TYPE NAME'){
		$session_user = KalturaHelpers::getSessionUser();
		$kaltura_client = KalturaHelpers::getKalturaClient(TRUE);  
  	        $result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);
	}
}
Apfel007’s picture

Hi JaceRider,
I tried to implement it in the kaltura.module. But I seems to work not in that way I did it.. is the "if" wrong implemented?

Cheers

...
/**
 * Implementation of hook_nodeapi().
 *
 * All we do here is to alter the body and teaser fields when a node goes to view mode
 * we call our functions to replcae the special "tags", which we create in theme_node_kaltura_*_entryId(), with the embed tag
 *
 */
function kaltura_nodeapi(&$node, $op, $teaser, $a3 = NULL, $a4 = NULL) {
switch ($op) {
    case "delete":
    if($node->type == 'blog_crossposting'){
      $session_user = KalturaHelpers::getSessionUser();
      $kaltura_client = KalturaHelpers::getKalturaClient(TRUE); 
      $result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);
    }
      break;

jacerider’s picture

I don't know bud, that looks like it should work to me.

Try doing a dsm($result); after the line "$result = $kaltura_client->deleteEntry($session_user, $node->kaltura_entryId);" and see what it returns. (Make sure you have the devel module installed, otherwise do print_r($result))

If I remember correctly, the message that is displayed should tell you what the issue is.

Apfel007’s picture

Hi JaceRider,
I got this:

Array ( [result] => Array ( [serverTime] => 1257865714 ) [error] => Array ( [0] => Array ( [code] => MANDATORY_PARAMETER_MISSING [desc] => Mandatory paramter missing [entry_id] ) ) [debug] => Array ( [sigtype] => 1 [signature] => d094f66cd60462b6ee2854ea055248b3 [execute_impl_time] => -1257865714.0101 [execute_time] => 0.067968130111694 [total_time] => 0.0689699649811 ) )

jacerider’s picture

Well, it would seem something is wrong with "$node->kaltura_entryId". I would do a dsm of $node and make sure that kaltura_entryId is listed in that object. If it isn't, that's why it isn't working and you will need to track down why it isn't there.

bentekwork’s picture

I get this message when trying the method listed above. Any ideas on what I need to add?

Fatal error: Call to undefined method KalturaClient::deleteEntry()

xurizaemon’s picture

Version: 6.x-1.4 » 6.x-2.x-dev
Category: support » feature
Status: Active » Needs work

At a guess, your node has Kaltura items attached via CCK and so $node->kaltura_entryId is not populated.

For this to go in you will need to provide UI for the user to *optionally* select whether the referenced item should be deleted when the node is deleted. You'll also need to extract the Kaltura entryId from the field values, and bear in mind that this may be a comma-separated list of entries.

For field_kaltura, you'll need to implement in hook_field() instead of hook_nodeapi(). $op will still be 'delete'.

xurizaemon’s picture

Title: delete node = delete kaltura media » Delete Kaltura media entries on node deletion

Looks like the Kaltura API code above is from the v2 API too. That will need to be updated for v3.

ramuchidambaram’s picture

I think it should be like this
<?php
require_once('lib/KalturaClient.php');
$config = new KalturaConfiguration();
$config->serviceUrl = 'http://www.kaltura.com/';
$client = new KalturaClient($config);
$entryId = null;
$result = $client->media->delete($entryId);

xurizaemon’s picture

Issue summary: View changes

@ramu_chidambaram - this is a six year old issue for Kaltura 6.x-2.x-dev.

If you plan on working on this, go ahead! But you probably want to target a current release :D