diff --git a/modules/system/system.install b/modules/system/system.install index 6d80c43..8cd0371 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -28,21 +28,23 @@ function system_requirements($phase) { 'weight' => -10, ); - // Display the currently active install profile, if the site - // is not running the default install profile. + // Display the currently active install profile, if the site is not running + // the default install profile and the profile is enabled. $profile = drupal_get_profile(); if ($profile != 'standard') { - $info = system_get_info('module', $profile); - $requirements['install_profile'] = array( - 'title' => $t('Install profile'), - 'value' => $t('%profile_name (%profile-%version)', array( - '%profile_name' => $info['name'], - '%profile' => $profile, - '%version' => $info['version'] - )), - 'severity' => REQUIREMENT_INFO, - 'weight' => -9 - ); + $modules = module_list(); + if (isset($modules[$profile])) { + $info = system_get_info('module', $profile); + $requirements['install_profile'] = array( + 'title' => $t('Install profile'), + 'value' => $t('%profile_name (%profile)', array( + '%profile_name' => $info['name'], + '%profile' => $profile, + )), + 'severity' => REQUIREMENT_INFO, + 'weight' => -9 + ); + } } } diff --git a/modules/system/system.test b/modules/system/system.test index 9944619..36234c6 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -2466,3 +2466,28 @@ class SystemIndexPhpTest extends DrupalWebTestCase { } } +/** + * Test system_requirements(). + */ +class SystemRequirementsTest extends DrupalWebTestCase { + protected $profile = 'testing'; + + public static function getInfo() { + return array( + 'name' => 'System requirements', + 'description' => 'Test system requirements.', + 'group' => 'System', + ); + } + + /** + * Test install profile info when the install profile is disabled. + */ + function testDisabledInstallProfileInfo() { + db_update('system')->fields(array('status' => 0))->condition('type', 'profile')->execute(); + system_list_reset(); + module_load_install('system'); + $requirements = system_requirements('runtime'); + $this->assertFalse(isset($requirements['install_profile']), 'Disabled install profile does not appear in system requirements.'); + } +}