We have a custom install profile. We have our wysiwyg profiles in a feature.

We found recently that when installing the site with Drush, after the installation is complete, the wysiwyg profiles are not enabled. The wysiwyg table is empty. If we clear the cache, the profiles are restored and it works. This only occurs when installing via Drush, installing via browser works fine.

We tried adding in a features_revert at the end of our hook_install, but it did not fix the issue.

Some things I noted from investigating:

- During the installation I can see that the imported wysiwyg profiles are inserted into the database correctly.
- At some point later, the table is emptied. Also the cache item for wysiwyg_profiles is empty.
- I noted that wysiwyg implements its own static cache and at some point it is returning nothing from entity load. It seems like possibly its returning nothing, this is being written to the database and clearing the profiles.

I was wondering if someone with more knowledge of the module might be able to point us in the right direction. I understand that this could be related to something other than wysiwyg, but if there is something obvious for me to look at please let me know.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

I've also had problems if I don't clear the caches after installing modules (several ones, not just Wysiwyg) using Drush. I don't know why and I've not had time to dig through it. (I've dug through Drush several times already, but looking for the cause of other oddities, it's quite complicated and sometimes invokes itself in response to PHP timeouts or to do "threading").

For now, I've just made it a habit to issue drush cc all after doing anything critical with Drush.

I've not done many installations with existing profiles as features so I can't tell now where this could go wrong.

If you find out more about what happens, I'd be glad to hear it.

tim-e’s picture

Category: support » bug
Status: Active » Needs review
FileSize
373 bytes

I narrowed this issue down to the fact that when installing via Drush and doing a features_revert, we always got a FALSE return from module_hook for wysiwyg_default_profiles. Specifically in the function_exists condition. It seems that Drush wasnt properly loading the inc files for the feature.

We resolved it by implementing hook_hook_info_alter and adding a group to the hook "wysiwyg_default_profiles". It seems that the Wysiwyg module doesn't implement hook_hook_info so I have attached a patch for it.

tim-e’s picture

Extra line in that first patch, here's a correct version

tim-e’s picture

Apologies, the last patch I missed a line at the end. Fixing for coding standards. Patch attached.

TwoD’s picture

Umm, that makes no sense. Wysiwyg does create a hook called hook_wysiwyg_default_profiles(), only a callback from hook_features_api() named wysiwyg_default_profiles.

That hook_hook_info() implementation would suggest other modules can implement hook_wysiwyg_default_profiles() by placing their hook implementation functions in $module.features.wysiwyg.inc, again making no sense.

Our wysiwyg_default_profiles() function is declared in wysiwyg.features.inc, as declared in wysiwyg_features_api(). If Features doesn't load the file given by the 'file' key before calling the function given by the 'default_hook' key, that's a major bug on their part.

jmcoimbra’s picture

Hello.
I am installing a custom profile via drush and I've got this:

jcoimbra@cit007995cps:/var/www/tests$ drush site-install nx_distro_client --db-url=mysql://root:root@localhost/test --site-name=Site for tests --account-name=admin --account-pass=admin
You are about to DROP all tables in your 'test' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ...                                                                        [ok]
WD php: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null: INSERT INTO           [error]
{role_permission} (rid, permission, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2);
Array
(
    [:db_insert_placeholder_0] => 4
    [:db_insert_placeholder_1] => customize ckeditor
    [:db_insert_placeholder_2] => 
)
 in user_role_grant_permissions() (line 3076 of /var/www/tests/modules/user/user.module).
WD php: Warning: Cannot modify header information - headers already sent by (output started at                                    [warning]
/usr/share/drush/includes/output.inc:37) in drupal_send_headers() (line 1220 of /var/www/tests/includes/bootstrap.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null: INSERT INTO {role_permission} (rid, permission, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
    [:db_insert_placeholder_0] => 4
    [:db_insert_placeholder_1] => customize ckeditor
    [:db_insert_placeholder_2] => 
)
 in user_role_grant_permissions() (line 3076 of /var/www/tests/modules/user/user.module).
Drush command terminated abnormally due to an unrecoverable error.                                                                [error]

I also tried the installation via a browser and the last message before breaking the installation was "Installed Wysiwyg module.", then I get the message in the image attached.

WYSIWYG breaking installation profile

The final result is finding the tables "wysiwyg" and "wysiwyg_user" both empties. And no help for me flushing all caches.

The bad news is that when I comment the line dependencies[] = wysiwyg in my profile's .info, it will have no issues.

Let me know if you need more tests.

jmcoimbra’s picture

Hello again!

I feel like making a big noise here. My issue is in my own custom profile. I've been studying wysiwyg module and I could not find any issue for its installation.

I agree that features module may have a issue on their part.

TwoD’s picture

Is your profile complicated with lots of dependencies or could you perhaps attach it here so I can try replicating the exact conditions?

Those SQL errors in user module are a bit worrying, but I'm not sure if/how they are related to this problem.

jmcoimbra’s picture

If you don't mind I think it is a good idea to give us your profile, so it can help us understand your issue.
It is complicated to attach my profile here, because we have our own repositories. Basically, we've copied the ideas of Spark and Panopoly.
We don't have modules generated by features being used.

TwoD’s picture

Status: Needs review » Postponed (maintainer needs more info)

@tim-e, Can we please have an update on this? How did you arrive at the solution used in your last patch and how does it work?
Is it possible to post your profile here since the one used by jmcoimbra seems too complex to isolate the issue?

EDIT: @jmcoimbra, just to make sure... Does tim-e's patch fix your problem?

jmcoimbra’s picture

Hello.
I didn't use tim-e's patch, so it seems to be an specific fix for his issue.
What I could see is that when something breaks the profile's installation, Wysiwyg will have the state described here.
I've missed a debug, or better Drupal messages when it comes to profiles installation.