I only recently found this method and am really happy that I can drop my poor custom method for doing this.

Unfortunately the module didn't work for me at all out of the box:

The AJAX methods for bootstrapping fail to discover my DRUPAL_ROOT properly.
The bootstrap cfg option doesn't work for me as I use a server architecture that includes symlinks and multiple implementation relying on the same contrib resources. I can't write a module level configuration to handle each site - and I don't want to.

I had two options for patching:

  1. FAIL: pass a root into the AJAX (hello security police)
  2. modify the ajax to run off a menu hook as many other ajax implementations do
  3. run the emit methods in-line instead of using ajax
  • The first options is too insecure to risk it.
  • For the second option, Dekita on #drual pointed out that drupal bootstrap used in the emit.php is quite thin, and that doing a full page includes module init()s (much slower). It does solves the problem or DRUPAL_ROOT
  • The third option has the potential to slow down page execution, it is uncertain if field data show would match the field data in the db.

So in order to examine it, I patched the module allowing for a METHOD to be selected amongst the three methods:

  • inline, or as the php executes, emit();
  • AJAX via emit.php;
  • AJAX via a menu hook.

There is a constant defined in the .module file that let's you pick the default mode. The system default is maintained as using the emit method, but the other methods work as well (in my light testing.)

NOTE THAT THE ORIGINAL emit METHOD IS LIKELY THE MOST EFFICIENT SYSTEM METHOD TO USE, but as there are plenty of bug reports on the bootstrap problems, the other methods are there to be used for testing etc.

This patch:

  • Adds the constants for the different methods
  • declares a default method
  • adds a menu callback to the radionactivity menu hook
  • adds a handler for the new callback
  • adds a switch to the existing emit handler (called from the existing page_alter) to allow for the three methods
  • adds the inline method
  • adds the path option for the new AJAX method (via menu callback)

Only the .module file and the .fields.inc are modified

CommentFileSizeAuthor
patch.radioactivity.methods.txt5.79 KBjaxxed

Comments

jaxxed’s picture

I should have mentioned that in order use patch, you'll need to implement the patch, and then change 'RADIOACTIVITY_EMIT_METHOD_DEFAULT' to one of the constants above it that matche the method that you want.

jaxxed’s picture

Issue tags: +Ajax, +radioactivity, +bootstrap.cfg

if anybody else finds this patch interesting then feel free to propose it for review

jaxxed’s picture

In discussion with one of the Module maintainers, I was informed that the AJAX system is required on systems that cache the page (varnish was mentioned in particular,) which may not fire any in-line solutions. For this reason, the in-line method that I added in my patch is not effective in the real world.

An alternative proposed was to rely on the rules implementation to trigger rules.

I have to confess, that my use-case for requiring a different approach was likely confined to development cases, and therefore not a high priority.

I am still in discussion about the overhead/functional issues with the Drupal Menu Callback solution. An alternative method may be usefull for devleopment (and debugging) purposes, and therefore a patch that allows for an alternative to the emit.php AJAX call may be an acceptable patch.

jaxxed’s picture

Issue summary: View changes

formatting edit and typos