Download & Extend

Integrate with profiles which define their hook_install_tasks

Project:Profiler
Version:7.x-2.x-dev
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

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

#1

Yep, that looks right to me. It might be worth documenting it, although I'd rather not murk up README.txt with it. Hmm..

#2

Maybe a line in the REAME mentioning hook_install_tasks() and which refers to this issue?
See the attached patch.

Thanks,
Antonio

AttachmentSize
0001-Issue-1203786-by-ao2-document-how-to-integrate-with-.patch 1.54 KB

#3

I 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.

#4

Status:active» needs work

I'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

nobody click here