As mentioned in #1548034: Show permissions defined by a module after pm-enable, and in pm-info, it would be desirable to add drush_role into core. I looked at this a while ago, and wondered about the use of classes in drush_role vis-a-vis our future idea to implement all drush commands as classes. Since the later is perhaps a ways off, I was wondering if we could bring drush_role in now, more or less as-is? I could role a patch with minor improvements if this is desired.

Comments

greg.1.anderson’s picture

psynaptic’s picture

This would be great. Please add drush_role to drush core, if you have time!

greg.1.anderson’s picture

Status: Active » Needs review
StatusFileSize
new8.75 KB

The example committed in #1649600: Adjust permissions after sql-sync does not work in Drupal 7. Here is a patch that brings Drush Role into core and uses it to add D7 support to the sync_enable example. If this code looks acceptable for Drush core, I'll improve the docs and add a test.

greg.1.anderson’s picture

StatusFileSize
new8.74 KB

Fixes for D6 postgres sites.

moshe weitzman’s picture

Status: Needs review » Needs work

This class hierarchy model is quite different from our current version engine model. Do we prefer this one? Is this really our way forward?

The command definition texts are lame as hell.

greg.1.anderson’s picture

Regarding #5, I had the same thought initially. I could re-implement it using the existing Drush version engine model, but don't know if that is worthwhile if we might switch to something else (e.g. symfony-based) soon.

I'll definitely fix up the docs once it's decided which direction to take the code.

jonhattan’s picture

A generalization of this approach will be of great benefit for 'drupal' engine (commands/core/drupal/environment*.inc has a lot of duplication) and other commands highly based on drupal version (search, pm-info, user-*)

greg.1.anderson’s picture

I was looking at converting this to the current engine model today. For engines where the specific instance can be selected by cli options, the Drush engine system is good and valuable. For engines where there is only one kind of engine, no options, and the only purpose of the engine is to provide code variants for different versions of Drupal, I don't see any value in declaring the php file that contains the class in the 'engines' record.

My recommendation would be to leave Drush_Role as it is; since there are no options, I like the current implementation better than the engines implementations. I think that it is okay for the D6 and D7 code to be in the same file, but if we move to a Symfony classloader in Drupal at some point in the future, we could migrate to use that at that time. I would also hold off on re-implementing existing optionless engine code until we decide what our final classloader strategy is going to be.

moshe weitzman’s picture

Status: Needs work » Reviewed & tested by the community

OK, makes sense to me. Lets fix up the command definition and commit.

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

Committed with tests, help text, --simulated support and some refactoring. Please re-open if any changes are needed.

Status: Fixed » Closed (fixed)

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

greg.1.anderson’s picture

Version: » 7.x-5.x-dev
Status: Closed (fixed) » Patch (to be ported)

Do we want these commands backported to Drush-5.x?

greg.1.anderson’s picture

Status: Patch (to be ported) » Fixed

I am now more interested in getting Drush 8.x-6.x released than porting this to 7.x-5.x; closing again.

Status: Fixed » Closed (fixed)

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