Reviewed & tested by the community
Project:
Profiler
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2010 at 00:25 UTC
Updated:
9 Oct 2012 at 18:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yhahn commentedHm, good catch.
I'm wondering whether profiler should include the base profile's
.installand.profilefiles but only call the base profile'shook_install()only if the sub-profile does not implement the hook itself. This would allow the sub profile to "override" the hook much like a class method. It would also be simple enough to call the base profile's hook_install from the sub profile if it wants to inherent and then add to the routine, e.g.Comment #2
jhedstromI like the idea of an override. I think it is much more flexible than automatically running the base hook_install(). Here's a patch that checks for the base hook if the sub-profile doesn't define one.
Comment #3
q0rban commentedI'm not sure I like the idea of an override, as it's pretty unexpected. In this instance it would just be some black magic that only a handful of people would know about, and no-one would intuitively try. I would rather leave it as is, but include the base profile so implementers can call it manually if needed.
Comment #4
yhahn commented@q0rban: Not sure I understand your comment here? Isn't this what the patch does?
Comment #5
q0rban commentedOk, I think I misunderstood what you were suggesting then. I think this still may need work though. The base profile should be automatically included so that mybaseprofile_install(); can be called without having to include it manually. Also, this should loop through all base profiles, but I don't see that happening. For example, subsubprofile's base is subprofile who's base is baseprofile. If subsubprofile_install() exists, fine.. If not, check to see if subprofile_insall() exists. If not check to see if baseprofile_install exists. Does that make sense?
Comment #6
yhahn commentedAgreed, so basically:
Comment #7
jhedstromHow about something like this. I moved all the loading of .install and .profile files into
profiler_v2_load_config(), and added a function calledprofiler_run_hook_install()that gets called recursively for base profiles.Comment #8
jhedstromI just ran into an issue with including dependent .profile files. If the dependent profile directory doesn't have the libraries/profiler directory, these lines fail upon including the file:
since the
libraries/profiler/profiler.incis a relative path.Comment #9
jhedstromDisregard that last comment, it is a more general problem with Drupal including all .profile files on the very first part of install.php. So it is still a problem, just not as far as this patch is concerned.
Comment #10
dixon_subscribing
Comment #11
dixon_I can confirm that this patch works as described in #7.
hook_install()of the base profile now runs if the child profile haven't implemented the hook it self. Very useful.Here is just a reroll of the exact same patch from #7 that only adds the missing newline at end of file :) *code style fanatic*
Comment #12
q0rban commentedSorry, this patch and issue totally fell off my radar. Is this still something people are interested in?
Comment #13
jgraham commentedI'm definitely interested in this, but rather for drupal 7.
Comment #14
fabsor commentedThis is definitely still interesting. We are using this patch in NodeStream for Drupal 6.
Comment #15
q0rban commentedLet's get this for Drupal 7 first, and then backport to Drupal 6.
Comment #16
g76 commentedstill very interesting:) - not trying to negate the follow button, just giving input. thanks for all the hard work.
Comment #17
Anonymous (not verified) commentedMost definitely. Profiler is a great module but for me a patch for DP7 is really needed.
Comment #18
Anonymous (not verified) commentedA project that I am working on requires a production and a development installation profile. The production profile is setup as the main base profile and the development profile is simply an extension to the main base.
For this setup to work, I need everything within base_install() to execute in addition to the setup tasks in dev_install (as the development profile 'extends' the base profile).
I've resolved this issue by simply calling the base_install() function within dev_install() which ensures that the development profile extends the base profile instead of ignoring it.
I hope this helps anyone else faced with the same problem.
Comment #19
shrop commented@insparrow: Thanks so much for posting your method for running the base_install profile tasks. This worked great. I am also using a drush make include to pull in the base install profile's make file. Profiler's base declaration handles processing the base install profiles .info file.