User login

A way to disable modules, functionality, and cron hooks in different environments

In on use case, feeds as nodes (with FeedAPI) causes issues with dbscripts approach to managing staging and deployment. Dev and live will pull the same content with a different IDs. In one solution, we'll have to disable aggregation on development.

Do we have a module for that? "if at this address, force this module to disabled." Not that we can find.

It is a shame this isn't part of settings.php

Kathleen Murtagh: yeah, you can only override the variables table in settings.php
Benjamin Melançon: though actually-- a patch to feedapi might be the way to go, just like there's an easy way to reroute mail
Kathleen Murtagh: someone's gotta found a solution
we have devel, right?
tons of people use it, but disable it on live. How do they do that?
or ability to REMOVE tasks from cron?
Benjamin Melançon: well, to disable on live, one approach is to put it in a site-specific directory -- sites/local.dev or whatever

Which I don't like much, and it's really really bad for going the other way (because your staging and demo site may have to be at a different domain).

Investigation of hook_cron indicates that the way it is called (in a module_invoke_all in drupal_cron_run) does not allow for anything resembling a drupal_alter of cron tasks. In short there is no way to hook into cron and remove a module.

For now, we don't run cron on our development environments.

This really may have to be a feature request to FeedAPI (simply to get an "off" setting into the variables table and can be overrode with settings.php– maybe the Cron time for FeedAPI [%] variable can just be set to zero!). However, it would be better to find a generalizable way to

Update: Yes, indeed, setting the variable feedapi_cron_percentage to zero in development settings.php files should effectively disable importation of new feeds (feedapi_cron_time() will return zero), however in a messy way that allows cron to do the part where FeedAPI deletes stats older than four weeks (the Drupal system variable cron_semaphore minus the FeedAPI defined constant FEEDAPI_CRON_STAT_LIFETIME).

This is very, very, very frightening to say, but this might be an almost legitimate use case of Kitten module (using runkit to override a PHP function, in this case feedapi_cron to not do anything at all).

(Please note, contrary to declarations of fear, Agaric is immensely honored to have been present at Kitten module's birth, hanging out with Palantiri at the District Hotel during DrupalConDC.)

See also

Issue about overriding variables with settings.php (an example in addition to the example already in settings.php)

disable/enable modules in settings.php ?? currently this or in a module is possible only in the most hacking ways imaginable, checking and disabling on each Drupal bootstrap.

In particular keep an eye on
http://drupal.org/project/warnme

Resolution

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.