At the top of the profile.install file created is the following:

  !function_exists('profiler_v2') ? require_once('libraries/profiler/profiler.inc') : FALSE;
  profiler_v2('distros');

However, one can quite easily create an installation profile without the profiler library present. When attempting to install from the generated profile a white screen occurs with the error:

[Thu Mar 14 23:14:07.776399 2013] [:error] [pid 6197] [client 127.0.0.1:47201] PHP Fatal error:  require_once(): Failed opening required 'libraries/profiler/profiler.inc' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/sites/profile/profiles/test_distro/test_distro.install on line 2

There are a couple of ways I see to resolve this issue:

  1. The simplest is probably to change the require_once to an include. This would only raise E_WARNING instead of E_COMPILE_ERROR which would allow the installation to continue.
  2. Only include the above code if profiler is included in the drush.make file
  3. Ensure the profiler library is required by profiler_builder as either a dependency or a hook_requirements($phase == 'install')
  4. Rewrite some of the code in the _profiler_builder_drush_file function to forcibly download and install profiler if it is not installed on the original site. I would imagine merging the $libraries array with a set of defaults that defined profiler so if it's not present it will still be downloaded from the make file.

I'm aware the project page states that libraries requires Libraries API to work but at the same time if the code to require a library is inserted regardless of whether libraries API/profiler are present changes an optional addition into a mandatory one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

btopro’s picture

Status: Active » Needs work

The further developed this got the less it really *needed* profiler in order to operate so I see your point.

1. I'd gladly accept a patch for this, preferable is having an option in the profiler_builder settings to include profiler / require it / some combination of the two
2. also do-able but probably better if its tied to the UI or drush command option
3. I don't believe it's required for profiler to be installed in order to use profiler builder, just that what you eventually create, requires profiler when you used profiler builder to generate it (again, that's debatable at this point as settings could all be made one big feature and I currently don't implement a lot of the additional capabilities of profiler OOTB)
4. I don't know that I'd forcibly download it but it's not a bad idea.

I have started looking into how profiler_builder could be crafted to produce even more accurate builds by borrowing code from things like http://drupal.org/project/drush_ctex_bonus to export all exportables at the time you ask it to. This mega feature of everything currently NOT exported might make things work better as far as i9 compatability issues currently but also would more or less eliminate the dependency on profiler. If profiler is installed we could include it but it would no longer be required if a well-crafted feature was created.

I like where you are headed w/ this line of thinking, let's get some more input from others using the project or some potential patches to work in parts of this and go from there.

adammalone’s picture

Status: Needs work » Needs review
FileSize
9.33 KB

I've had a bit of time to look into this further and there are a couple of other issues I've addressed.

  1. WSOD if features is not included in the site (mitigated by additional module_exists check)
  2. Path to profiler libraries not correct (altered by coding to sites/all/libraries instead of just libraries

I've decided to take a combination of some of your suggestions so the user can opt to include the profiler module within the export config page. This decision is only displayed if the user does not already have the library installed (as then there would be two areas to select it). If the user decides to include profiler the module will include it in the drush file for the user.

You're probably right about rebuilding the module a bit and I've just sort of tacked this code onto the existing module whilst trying not to disrupt too much of the existing code.

btopro’s picture

Status: Needs review » Fixed

Didn't use this exact patch cause of other refactoring but thank you for getting features and profiler as optional components : http://drupalcode.org/project/profiler_builder.git/commit/687502e

Gona push a new RC as this with the other clean up I just did is pretty significant.

Status: Fixed » Closed (fixed)

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