When running the update.php script it loops forever with the following message:
Division by zero panelizer.install:1203 [warning]
Performed update: panelizer_update_7300 [ok]

This loops forever until I close the terminal.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rvargas_iica created an issue. See original summary.

ret5’s picture

same :(

ret5’s picture

Status: Needs work » Active
DamienMcKenna’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Component: Revisions » Code
Issue tags: -update
DamienMcKenna’s picture

Title: Updating to version 7.x-3.2 » panelizer_update_7300 runs forever, doesn't finish
DamienMcKenna’s picture

Title: panelizer_update_7300 runs forever, doesn't finish » panelizer_update_7300 throws error if no records found

Oh, now I see what the problem is. Duh, Damien.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
648 bytes

Please test this out, it should solve the problem.

ret5’s picture

#7 Worked! Thx!

rvargas_iica’s picture

#7 Worked

Going to mark issue as fixed. Thank you very much!!

DamienMcKenna’s picture

Please don't change the issue status to "fixed", I haven't committed the change yet :)

DamienMcKenna’s picture

Thank you both for reviewing the patch, I've committed the fix and it'll be available in the -dev snapshot shortly, and the v3.3 release.

DamienMcKenna’s picture

Status: Needs review » Fixed

  • DamienMcKenna committed 746eb4d on 7.x-3.x
    Issue #2762351 by DamienMcKenna: Skip update 7300 if there are no...

Status: Fixed » Closed (fixed)

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

Dru18’s picture

foreach ($entity_types as $entity_type) {
    // Get the default panelizer names for the entity type.
    $default_names = array();
    $entity_info = entity_get_info($entity_type);
    if (!empty($entity_info) && !empty($entity_info['bundles'])) {
      foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
        $var_name = 'panelizer_defaults_' . $entity_type . '_' . $bundle;
        $settings = variable_get($var_name);
        if (!empty($settings) && !empty($settings['view modes'])) {
          foreach ($settings['view modes'] as $view_mode => $config) {
            $default_name = implode(':', array($entity_type, $bundle, 'default'));
            if ($view_mode != 'page_manager') {
              $default_name .= ':' . $view_mode;
            }
            $default_names[] = $default_name;
          }
        }
      }
    }

    // Delete panelizer records that have one of the default names.
    $deleted = db_delete('panelizer_entity')
      ->condition('name', $default_names, 'IN')
      ->condition('entity_type', $entity_type)
      ->execute();

I've faced the same error and obviously this isn't complete. I think the above code doesn't make sense. The delete process is supposed to be within for loop? On top of that, the error occurs when deleting panelizer_entity with empty default_names and/or null entity_type. I think type checking is necessary.