| 1 |
<?php |
<?php |
| 2 |
// $Id: install.inc,v 1.70 2008/09/20 20:22:23 webchick Exp $ |
// $Id: install.inc,v 1.71 2008/09/27 20:03:35 webchick Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Indicates that a module has not been installed yet. |
* Indicates that a module has not been installed yet. |
| 415 |
} |
} |
| 416 |
|
|
| 417 |
/** |
/** |
| 418 |
|
* Get a list of modules required by an installation profile. |
| 419 |
|
* |
| 420 |
|
* @param profile |
| 421 |
|
* Name of profile. |
| 422 |
|
* @param locale |
| 423 |
|
* Name of locale used (if any). |
| 424 |
|
* @return |
| 425 |
|
* The list of modules to install. |
| 426 |
|
*/ |
| 427 |
|
function drupal_get_profile_modules($profile, $locale = 'en') { |
| 428 |
|
$profile_file = "./profiles/$profile/$profile.profile"; |
| 429 |
|
require_once($profile_file); |
| 430 |
|
|
| 431 |
|
// Get a list of modules required by this profile. |
| 432 |
|
$function = $profile . '_profile_modules'; |
| 433 |
|
return array_merge(drupal_required_modules(), $function(), ($locale != 'en' ? array('locale') : array())); |
| 434 |
|
} |
| 435 |
|
|
| 436 |
|
/** |
| 437 |
* Verify an install profile for installation. |
* Verify an install profile for installation. |
| 438 |
* |
* |
| 439 |
* @param $profile |
* @param $profile |
| 453 |
install_no_profile_error(); |
install_no_profile_error(); |
| 454 |
} |
} |
| 455 |
|
|
| 456 |
require_once $profile_file; |
$module_list = drupal_get_profile_modules($profile, $locale); |
|
|
|
|
// Get a list of modules required by this profile. |
|
|
$function = $profile . '_profile_modules'; |
|
|
$module_list = array_merge(drupal_required_modules(), $function(), ($locale != 'en' ? array('locale') : array())); |
|
| 457 |
|
|
| 458 |
// Get a list of modules that exist in Drupal's assorted subdirectories. |
// Get a list of modules that exist in Drupal's assorted subdirectories. |
| 459 |
$present_modules = array(); |
$present_modules = array(); |
| 463 |
|
|
| 464 |
// Verify that all of the profile's required modules are present. |
// Verify that all of the profile's required modules are present. |
| 465 |
$missing_modules = array_diff($module_list, $present_modules); |
$missing_modules = array_diff($module_list, $present_modules); |
| 466 |
|
|
| 467 |
|
$requirements = array(); |
| 468 |
|
|
| 469 |
if (count($missing_modules)) { |
if (count($missing_modules)) { |
| 470 |
|
$modules = array(); |
| 471 |
foreach ($missing_modules as $module) { |
foreach ($missing_modules as $module) { |
| 472 |
drupal_set_message(st('The %module module is required but was not found. Please move it into the <em>modules</em> subdirectory.', array('%module' => $module)), 'error'); |
$modules[] = '<span class="admin-missing">' . drupal_ucfirst($module) . '</span>'; |
| 473 |
} |
} |
| 474 |
|
$requirements['required_modules'] = array( |
| 475 |
|
'title' => st('Required modules'), |
| 476 |
|
'value' => st('Required modules not found.'), |
| 477 |
|
'severity' => REQUIREMENT_ERROR, |
| 478 |
|
'description' => st('The following modules are required but were not found. Please move them into the appropriate modules subdirectory, such as <em>sites/all/modules</em>. Missing modules: !modules', array('!modules' => implode(', ', $modules))), |
| 479 |
|
); |
| 480 |
} |
} |
| 481 |
else { |
return $requirements; |
|
return $module_list; |
|
|
} |
|
| 482 |
} |
} |
| 483 |
|
|
| 484 |
/** |
/** |