Hi,
In my installation profile (let's call it myprofile) I have a myprofile_install_tasks() defined and profiler is not working in this case.
Reading the code it looks like profiler is designed to define a new myprofile_install_tasks() which calls profiler_install_profile_complete() only when the former is not defined already.
I found a way to make my own myprofile_install_tasks() call profiler_install_profile_complete() with these changes:
diff --git a/myprofile.profile b/myprofile.profile
index aa164a4..e0fe0c8 100644
--- a/myprofile.profile
+++ b/myprofile.profile
@@ -13,17 +13,20 @@
function myprofile_install_tasks($install_state) {
// Determine whether translation import tasks will need to be performed.
$needs_translations = !empty($install_state['parameters']['locale']) &&
$install_state['parameters']['locale'] != 'en';
+ include_once('libraries/profiler/profiler_api.inc');
+
return array(
'_import_translation' => array(
'display_name' => st('Set up translations'),
'display' => $needs_translations,
'run' => $needs_translations ? INSTALL_TASK_RUN_IF_NOT_COMPLETED : INSTALL_TASK_SKIP,
'type' => 'batch',
),
+ 'profiler_install_profile_complete' => array(),
);
}
Is this the right way to do that? And if so, is it worth documenting it?
Thanks,
Antonio
Comments
Comment #1
q0rban commentedYep, that looks right to me. It might be worth documenting it, although I'd rather not murk up README.txt with it. Hmm..
Comment #2
ao2 commentedMaybe a line in the REAME mentioning hook_install_tasks() and which refers to this issue?
See the attached patch.
Thanks,
Antonio
Comment #3
mattyohe commentedI would also recommend including a url or a note referencing this issue as I too am defining my own task for my profile and arrived at the same solution.
Comment #4
q0rban commentedI'm okay with the README patch, but can you please reference the issue with a footnote that contains the URL? e.g.
Please see Integrate with profiles which define their hook_install_tasks[1].
[1] http://drupal.org/node/1203786
Comment #5
ashooner commentedI was having problems getting this to work, and I found this further example, which resolved them:
https://bitbucket.org/samheuck/drupal7_distro_starterkit/src/edddfbc4eee...
Specifically, this implements
hook_install_tasksbefore including Profiler and callingprofiler_v2().Comment #6
rbruhn commented@ashooner - Thanks for posting that link. Helped me out after getting errors about re-declaring myprofile_install_tasks().
As well, I used Profiler Builder so the profiler_v2() call was in the .install file. I moved it into the .profile like the blog post and things are working well.
Comment #7
TheBarnacle commentedThe link at #5 seems to be broken?
But the initial suggestion works wonderfully! Thanks for sharing!
Comment #8
ashooner commentedI don't recall exactly what was on that bitbucket page, but here is the beginning of my .profile file, which I wrote based on it (my profile is based on Panopoly):
Comment #9
ao2 commentedClosing as outdated to clean up my issue queue, feel free to reopen if you still need this.