Fatal error: Call to undefined function db_fetch_object() in /home/daikinco/public_html/sites/all/modules/videojs/includes/videojs_style_plugin.inc on line 94

Comments

positivedm’s picture

I'm also getting this error when trying to use the VideoJS format in Views.

db_fetch_object is deprecated in Drupal 7. Does anyone know what line 94 of videojs_style_plugin.inc should be replaced with?:
$file = db_fetch_object(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fileid));

ThoughtProcess’s picture

Disclaimer: I've been programming PHP for all of about 10 minutes.

Here's what I came up with:

$fileResult = db_query("SELECT uri FROM {file_managed} WHERE fid = :fileid", array(':fileid' => $fileid));
$file = $fileResult->fetchObject();
$filepath = $file->uri;

With that fix, I get some interesting errors (maybe someone else can pick it up from here?):

Notice: Undefined index: field_video in videojs_style_plugin->render() (line 88 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs_style_plugin.inc).
Notice: Trying to get property of non-object in videojs_style_plugin->render() (line 88 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs_style_plugin.inc).
Notice: Trying to get property of non-object in videojs_style_plugin->render() (line 104 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs_style_plugin.inc).
Notice: Undefined index: filemime in template_preprocess_videojs() (line 38 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs.theme.inc).
Notice: Trying to get property of non-object in videojs_style_plugin->render() (line 104 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs_style_plugin.inc).
Notice: Undefined index: filemime in template_preprocess_videojs() (line 38 of /Users/ThoughtProcess/Sites/drupal/sites/all/modules/videojs/includes/videojs.theme.inc).

philosurfer’s picture

This whole views implementation needs to be upgraded to views 3.

I will see what i can commit over the next couple days.. because i need this to work myself

ThoughtProcess’s picture

Priority: Normal » Major

Has anyone made progress on this issue?

I am trying to teach myself more about the Views API (and Drupal programming in general) but it's proving to be a very involved task.

This weekend if I have the time I'll really read up on it and try to draft up a Views 3 implementation.

philosurfer’s picture

I am almost done with a views module right now. When I complete it , I will shift focus to this one. I got around dealing with this using a views list and then programmatically loading JS when necessary for the video.... messy.. but it worked. The Views API change quite a few things and will need almost a whole new rework of this plugin.

If anyone else willing to commit code time we can sprint on this in the near future. One thing we have to keep in mind is Media is almost ready for primetime and this should really be a plugin that works with media wrappers

any thoughts?

Serotonine’s picture

Is someone found where is the pb ?? this sounds very close to solution only some changes on "fid = :fileid", array(':fileid' => $fileid)"
I think...

$fileResult = db_query("SELECT uri FROM {file_managed} WHERE fid = :fileid", array(':fileid' => $fileid));
$file = $fileResult->fetchObject();
$filepath = $file->uri;

bart3d’s picture

Subscribing

Jorrit’s picture

Status: Active » Postponed (maintainer needs more info)

This file has never been updated to Drupal 7. The problem is, I have no idea what this styles plugin should do. Beyond the db_fetch_object() bug, there are other bugs, because I can't get it to work. If someone explains to me what this plugin should do, I can probably fix it.

Jorrit’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Closed because of lack of response. The views plugin has been removed in 7.x-2.x, by the way.