You are here

function hosting_get_profile_platforms in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 package/hosting_package.module \hosting_get_profile_platforms()
  2. 7.3 package/hosting_package.module \hosting_get_profile_platforms()

@todo document this function

2 calls to hosting_get_profile_platforms()
hosting_site_available_options in site/hosting_site.form.inc
Pass in a site node and return an array of valid options for it's fields.
hosting_site_form in site/hosting_site.form.inc
Implements hook_form().

File

package/hosting_package.module, line 131
Defines package node types

Code

function hosting_get_profile_platforms($profile, $check_old_short_name = FALSE) {
  $defaults = array(
    'default',
    'standard',
    'minimal',
    'testing',
  );
  $platforms = array();
  $instances = hosting_package_instances_load(array(
    'i.package_id' => $profile,
    'n.status' => 1,
    'r.status' => 1,
    'r.type' => 'platform',
  ));
  if ($check_old_short_name) {
    $instances = array_merge($instances, hosting_package_instances_load(array(
      'p.old_short_name' => $instances[key($instances)]->short_name,
      'n.status' => 1,
      'r.status' => 1,
      'r.type' => 'platform',
    )));
  }
  foreach ($instances as $iid => $instance) {
    $platform = node_load($instance->rid);

    // this is one of the default profiles
    if (in_array($instance->short_name, $defaults) && sizeof(array_diff(array_values($platform->profiles), $defaults)) && variable_get('hosting_ignore_default_profiles', FALSE)) {

      // there are other profiles available on this platform. skip this.
      continue;
    }
    if ($platform->platform_status == HOSTING_PLATFORM_ENABLED) {
      $platforms[$instance->rid] = $platform->title;
    }
  }
  return $platforms;
}