I had been receiving an error after running update.php regarding $description and $severity not being set;

I've changed the following lines in the imagecache_defaults_requirements() function (lines 37 - 40);

$requirements['imagecache_defaults'] = array(
'title' => $t('Image (Cache) Defaults'),
-- 'description' => $description,
-- 'severity' => $severity,
-- 'value' => $value,

++ 'description' => isset($description)?$description:'',
++ 'severity' => isset($severity)?$severity:'',
++ 'value' => isset($value)?$value:'',
);

Comments

jjmackow’s picture

<?php
/**
* @file
* Installation file for Image (Cache) Defaults module.
*/

/**
* Implements hook_uninstall().
*/
function imagecache_defaults_uninstall() {
variable_del('imagecache_defaults_broken_path_handling');
variable_del('imagecache_defaults_default_image_style');
variable_del('imagecache_defaults_watchdog_enabled');
}

/**
* Implements hook_requirements().
*/
function imagecache_defaults_requirements($phase) {
$requirements = array();
$t = get_t();

if ($phase == 'runtime') {
if ($path = _imagecache_defaults_image_search(FALSE)) {
$description = $t('Default image found at %path', array('%path' => $path));
$severity = REQUIREMENT_OK;
$value = $t('Default image found');
}
else {
$description = $t('Image (Cache) Defaults cannot find a default image to use when repairing broken image paths. Please read README.txt for more information.');
$severity = REQUIREMENT_ERROR;
$value = $t('Default image not found');
}
}

$requirements['imagecache_defaults'] = array(
'title' => $t('Image (Cache) Defaults'),
'description' => isset($description)?$description:'',
'severity' => isset($severity)?$severity:'',
'value' => isset($value)?$value:'',
);
return $requirements;
}

thedavidmeister’s picture

fair enough. I was trying to be too clever and screwed it up :P

thedavidmeister’s picture

I'm pushing something like this up to dev now, it should be simpler than sprinkling isset() around:

/**
 * Implements hook_requirements().
 */
function imagecache_defaults_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // We have no real requirements outside status reporting.
  if ($phase == 'runtime') {
    if ($path = _imagecache_defaults_get_default_image_uri(array('cache' => FALSE))) {
      $description = $t('Default image found at %path', array('%path' => $path));
      $severity = REQUIREMENT_OK;
      $value = $t('Default image found');
    }
    else {
      $description = $t('Image (Cache) Defaults cannot find a default image to use when repairing broken image paths. Please read README.txt for more information.');
      $severity = REQUIREMENT_ERROR;
      $value = $t('Default image not found');
    }

    $requirements['imagecache_defaults'] = array(
      'title' => $t('Image (Cache) Defaults'),
      'description' => $description,
      'severity' => $severity,
      'value' => $value,
    );
  }

  return $requirements;
}
thedavidmeister’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Assigned: jjmackow » Unassigned
Status: Active » Fixed

Pushed a fix for this to 6.x-1.x and 7.x-1.x

@jjmackow, I think I didn't receive any notifications of this bug because you assigned it to yourself when you first opened the issue. Please don't do that unless you're going to provide a patch.

thedavidmeister’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta3

I've rolled a beta3 version for both 6.x and 7.x with this fix included. If you could download 7.x-1.0-beta3 and let me know if you're having any more issues that would be great, thanks.

thedavidmeister’s picture

Sorry, use 7.x-1.0-beta4 (current release now). I accidentally rolled some badness into beta3.

thedavidmeister’s picture

Version: 7.x-1.0-beta3 » 7.x-1.0-beta4

Sorry, use beta4 as I accidentally rolled some badness into beta3 by not providing an upgrade path for the new cache schema.

Status: Fixed » Closed (fixed)

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