The Apps module currently makes an assumption through several $_SESSION values that there is only one app server as part of the install profile process, but what if I want to be appscrazy and have more than one? This patch moves the setting of the $_SESSION values further down in the load order and, instead, stores app server information by server name which it then picks up on later.

As you can see, I am getting the server name again in the apps_profile_apps_select_form() using some string replacement on the active task in the form state which seems like the only way to figure out what app server we are currently working with. Although not ideal, the active task is set in a consistent pattern ('apps_profile_apps_select_form_' . $apps_server_name) so this might be our ticket to ride.

Members fund testing for the Drupal project. Drupal Association Learn more


febbraro’s picture

I like the idea, how would I go about testing this?

populist’s picture

To test this feature you need to do three things:

1.) In your hook_appstore_stores_info() function define 2 or more different app servers from which your profile will need to install apps.

2.) In your hook_install_task() add the apps_profile_install_tasks() for each server you want to support. For example:

$app_server_one = array(APPSMAGIC);
$tasks = $tasks + apps_profile_install_tasks($install_state, $app_server_one);
$tasks['apps_profile_apps_select_form_app_server_one']['display_name'] = t('Install apps for App Server One');

$app_server_two = array(APPSMAGIC);
$tasks = $tasks + apps_profile_install_tasks($install_state, $app_server_two);
$tasks['apps_profile_apps_select_form_app_server_two']['display_name'] = t('Install apps for App Server Two');

3.) I think you also need #1480912: Wierd things can happen when install tasks modify the conditions that decide when they are run to make this work completely since I was seeing weird issues with stringing together batch operations right after another.

febbraro’s picture

Status: Needs review » Needs work
2.72 KB

So here is a re-roll. I added the ability to have a name with each of the app servers steps so "Install OpenPublic Apps" instead of multiple steps with "Install Apps".

I ran into a problem when testing it though. On the first Install Apps screen, if I click "Skip this step" it finishes the installation without taking me to the next Install Apps screen. Both "Install Apps" items were in the task like on the left, so it knew the tasks were eligible.

febbraro’s picture

Another quick reroll to add a default value or two to prevent a warning when you select no apps but then click "Install Apps"

jec006’s picture

Status: Needs work » Fixed

Committed with minor changes - looks good, works good etc. :)

Status: Fixed » Closed (fixed)

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