Hi!

I have already posted this as a support issue to the video project, but they asked me to post it here as well.

I'm using the video module with automatic video conversion done through ffmpeg. In my development site, everything works ok, but in my production site I am getting two errors in the Drupal logs everytime the cron job is run.

My cron job is set this way:
0 * * * * sh /home/mostmcom/public_html/mostreodom/converte_video.sh

converte_video.sh contains the following commands:
cd /home/mostmcom/public_html/mostreodom;
php -f video_scheduler.php

video_scheduler.php is a video conversion job provided by the video module.

The errors are the following:
- array_keys(): The first argument should be an array em /home/mostmcom/public_html/mostreodom/modules/logintoboggan/logintoboggan.module na linha 422.

in_array(): Wrong datatype for second argument em /home/mostmcom/public_html/mostreodom/modules/logintoboggan/logintoboggan.module na linha 422.

Can you help me on this?

Regards,
Carlos.

Comments

hunmonk’s picture

Status: Active » Fixed

here is the relevant code:

/**
 * Implementation of hook_init()
 *
 * @ingroup logintoboggan_core
 */
function logintoboggan_init() {

  global $user;

  // Make sure any user with pre-auth role doesn't have authenticated user role
  _logintoboggan_user_roles_alter($user);
}

/**
 * Alter user roles for loaded user account.
 *
 * If user is not an anonymous user, and the user has the pre-auth role, and the pre-auth role
 * isn't also the auth role, then unset the auth role for this user--they haven't validated yet.
 *
 * This alteration is required because sess_read() and user_load() automatically set the
 * authenticated user role for all non-anonymous users (see http://drupal.org/node/92361).
 *
 * @param &$account
 *    User account to have roles adjusted.
 */
function _logintoboggan_user_roles_alter(&$account) {
  $id = logintoboggan_validating_id();
  $in_pre_auth_role = in_array($id, array_keys($account->roles));
  if ($account->uid && $in_pre_auth_role) {
    if ($id != DRUPAL_AUTHENTICATED_RID) {
      unset($account->roles[DRUPAL_AUTHENTICATED_RID]);
    }
  }
}

it appears that the global $user object is not being populated. in a properly bootstrapped drupal page load, this should never be an issue, so the problem is with the video_scheduler.php script.

zottmann’s picture

Thanks!

I'll post this answer to the thread in the video project!

Regards,
Carlos.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.