By default, we load all objects which sometimes does not make sense at all. Real life use case: export everything from views which will suddenly make all disabled views enabled which is an odd default behavior.

Proposed changes: by default only load the enabled exportables. This can be overridden with the --status option being either 'all', 'enabled' or 'disabled'.

Patch coming up a little later.

Comments

swentel’s picture

Status: Active » Needs review
StatusFileSize
new5.74 KB

Ok, the patch does following things:

- add an option to the export command called filter, changing the original one to tables, making more sense
- add a helper function called _ctools_drush_filter_exportables() that filters
- add an 'all' filter that does nothing
- the export callback checks for the filter and defaults to enabled as that makes more sense

Haven't tested this fully through, only the export command, but I think we should be save.

swentel’s picture

StatusFileSize
new5.78 KB

Hrm, deleted the array_filter() function - new patch.

damiankloip’s picture

Status: Needs review » Needs work
+++ b/drush/ctools.drush.incundefined
@@ -366,7 +374,6 @@ function ctools_drush_export_info() {
-  $filter = drush_get_option('filter', FALSE);

This being removed from ctools_drush_export_info leaves the $load = ... below not working, also the filtering switch has been moved out of this function but now it's not called in here :)

I would still default the exportables in ctex to all, but I'm easy, if you think that is better, that's fine with me.

swentel’s picture

Status: Needs work » Needs review
StatusFileSize
new5.45 KB

This one should be better I think

swentel’s picture

StatusFileSize
new5.47 KB

Dropped the pass by ref and return the array_filter()

damiankloip’s picture

That looks much better! :) Committed to 7.x

I will also change the _ctools_drush_export_module_filter to return aswell, so they are consistant.

damiankloip’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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