At this moment, features.ctools.inc contains this function:

function ctools_component_features_revert($component, $module = 'foo') {
  $info = _ctools_features_get_info();
  $objects = module_invoke($module, $info[$component]['default_hook']);
  if (!empty($objects)) {
    $schema = ctools_export_get_schema($component);
    $export = $schema['export'];
    $names = db_placeholders(array_keys($objects), $schema['fields'][$export['key']]['type']);
    db_query("DELETE FROM {{$component}} WHERE {$export['key']} IN ({$names})", array_keys($objects));
  }
}

But, recently, ctools allows to use joins in exports, and there is an issue to use this joins objects are removed from tables: see #853114: Delete objects from tables considering joins

I think this function should only call to ctools_export_crud_delete() instead to call to DELETE FROM directly.

CommentFileSizeAuthor
#5 853120_ctools_crud.patch1.35 KByhahn
#2 features-853120.patch1.77 KBdagmar

Comments

yhahn’s picture

I agree, I suppose we'll have to support both methods for a while with a check as this is a very recent addition to CTools Export API?

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new1.77 KB

Yes, those functions were included few weeks ago, and are available in the last development version of ctools. (Ctools API 1.7)

Here is the patch.

damienmckenna’s picture

If developers are going to update to the newest Features release to get this improvement then I don't think it's too unfair to increase the CTools dependency to the latest v6.x-1.7 release (never mind the other great improvements in that release of CTools).

dagmar’s picture

Status: Needs review » Needs work

Anyway it isn't working properly, I will provide a new patch soon.

yhahn’s picture

Status: Needs work » Needs review
StatusFileSize
new1.35 KB

Here is a rerolled patch, it gets a bit simpler from some of the features refactoring.

It's working for me locally with non-join based exportables, would love some review from someone using (and familiar with) joins in export.inc.

yhahn’s picture

Status: Fixed » Closed (fixed)

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