Fatal error: Class name must be a valid object or a string in/sites/all/modules/ds/includes/ds.display.inc on line 236

Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/cck/theme/theme.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /sites/all/modules/cck/content.module on line 177

Comments

swentel’s picture

Status: Active » Fixed

make sure you upgrade, nd and nd_contrib as well - you'll also need to go to the plugins screen and resave that screen since we made a small API chance there.

ManyNancy’s picture

Status: Fixed » Active

Thanks, but after I upgrade, and saved the plugins screen, all my custom fields, block and code, have disappeared. None of my 50 custom fields work anymore???

swentel’s picture

you have 50 custom fields already ? damn, that might pose a problem indeed since properties of the custom fields have indeed changed (instead of a code key that changed to a properties key) - mmm are these fields in code or in your database ? If it's in your database, I'll write a small conversion script which you can put temporarily in ds.install to upgrade. If it's in code, you'll need to change 'code' to 'properties', ie

'code' => '<?php echo l(t("Read more"), "node/$object->nid"); ?>',
// to
'properties' => array('code' => '<?php echo l(t("Read more"), "node/$object->nid"); ?>'),
ManyNancy’s picture

To be honest, since I've restored a backup I'm really leery of trying this, especially if a release is coming soon. Please put a migrate path in the beta.

Do you think that's a reasonable choice? Thanks for making this great great module. I'm having lots of fun with it. Thanks!

Edit: I have about 15 block fields and 35 code fields.

swentel’s picture

Well, to be honest, we haven't had an official alpha, beta or 1.0 release yet, so including an upgrade path is something that shouldn't be done. However, it was our fault to introduce such an API change pretty late in the process and I don't want to waste all the effort you have done so far. I'm going to post an update function here which you can use to update your code and block fields (there are still in the database right ?). I'll post this code probably today or tomorrow!

swentel’s picture

Ok here goes. Paste this code in ds.install file and run the database updates. Of course, make sure to create a backup first :)
There is one thing I can't track though. Since the latest commit, it is necessary to toggle a checkbox if you are using tokens in custom fields. You'll need to re-update those if you have used tokens. Function underneath is untested, but should work normally, let me know of course if something went wrong.

function ds_update_1() {
  foreach (module_implements('ds_api') as $module) {
    $fields = variable_get($module .'_fields', array());
    foreach ($fields as $key => $field) {

      // Block field.
      if (isset($field['block'])) {
        $fields[$key]['type'] = DS_FIELD_TYPE_CODE;
        $fields[$key]['status'] = DS_FIELD_STATUS_CUSTOM;
        $fields[$key]['properties']['block'] = $field['block'];
        $fields[$key]['properties']['render'] = $field['render'];
      }

      // Code field.
      if (isset($field['code'])) {
        $fields[$key]['type'] = DS_FIELD_TYPE_BLOCK;
        $fields[$key]['status'] = DS_FIELD_STATUS_CUSTOM;
        $fields[$key]['properties']['code'] = $field['code'];
        // Let's also add the token property.
        $fields[$key]['properties']['token'] = FALSE;
      }

      // Unset code & block key.
      unset($fields[$key]['block']);
      unset($fields[$key]['code']);
    }

    // Save.
    variable_set($module .'_fields', $fields);
  }

  $ret = array();
  return $ret;
}

swentel’s picture

Ok please wait a bit with running this - we're probably doing another API update, I'll let you know when you can run!

ManyNancy’s picture

Thanks for all your help!

swentel’s picture

Status: Active » Fixed

Ok, you may update. Make sure you have the latest version of DS, ND & ND_contrib.

function ds_update_1() {
  foreach (module_implements('ds_api') as $module) {
    $fields = variable_get($module .'_fields', array());
    foreach ($fields as $key => $field) {

      // Block field.
      if (isset($field['block'])) {
        $fields[$key]['type'] = DS_FIELD_TYPE_CODE;
        $fields[$key]['status'] = DS_FIELD_STATUS_CUSTOM;
        $fields[$key]['properties']['block'] = $field['block'];
        $fields[$key]['properties']['render'] = $field['render'];
      }

      // Code field.
      if (isset($field['code'])) {
        $fields[$key]['type'] = DS_FIELD_TYPE_BLOCK;
        $fields[$key]['status'] = DS_FIELD_STATUS_CUSTOM;
        $fields[$key]['properties']['code'] = $field['code'];
        // Let's also add the token property.
        $fields[$key]['properties']['token'] = FALSE;
        $fields[$key]['properties']['formatters'] = array('ds_eval_code' => t('Default'));
      }

      // Unset code & block key.
      unset($fields[$key]['block']);
      unset($fields[$key]['code']);
    }

    // Save.
    variable_set($module .'_fields', $fields);
  }

  $ret = array();
  return $ret;
}

After running the update should be back. It's likely you'll just have to resave some displays. Let me know if things went wrong. Marking as fixed for now.

ManyNancy’s picture

Status: Fixed » Active

Hi, I don't think it worked.

All of my fields are still empty.

During the update I got this:

warning: Invalid argument supplied for foreach() in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 296.
warning: Invalid argument supplied for foreach() in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 296.
warning: asort() expects parameter 1 to be array, null given in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 326.
warning: key() [function.key]: Passed variable is not an array or object in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 142.

Thanks!

swentel’s picture

Can you give me a dump of your variables table ? (not everything, I dont need all the rest). If I have your data, it 'll probably be easier to see what goes wrong on my screen.

ManyNancy’s picture

Hi, I'm not sure how to give you only the relevant selection of my data. I sent you an email through d.o contact with a link to my variables table though.

swentel’s picture

Status: Active » Fixed

Ok, fixing this offline than.

ManyNancy’s picture

Thanks, it worked.

But I'm still getting these errors every time I update:

* warning: Invalid argument supplied for foreach() in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 296.
* warning: Invalid argument supplied for foreach() in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 296.
* warning: asort() expects parameter 1 to be array, null given in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 326.
* warning: key() [function.key]: Passed variable is not an array or object in /vol/www/pressflow/sites/all/modules/ds/includes/ds.registry.inc on line 142.

Thank you so much once again!

swentel’s picture

Ok ,that problems is related with build modes. So either a module defining hook_content_build_modes isn't up to date (if you coded your own hook, you'll need to update that function) or resave any custom buildmodes from the UI. Can't do much more than that.

ManyNancy’s picture

Gotcha, I think it's from heartbeat status. Thanks!

Status: Fixed » Closed (fixed)

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