1 install.inc | _install_find_profile_file($profile_name, $file_extension = 'profile') |
Searches for a profile directory and returns the profile path location.
This searches in both the root directory and underneath the core directory. The root directory takes precedence in the event a profile exists there. Site-specific directories are not searched (e.g. sites/my_site_name/profiles)
Parameters
string $profile_name: The profile name to be found.
bool $file_extension: The file type to find based on extension. May be one of the following:
- profile
- install
- info
Return value
bool|string: The full path to the profile .install file.
File
- core/
includes/ install.inc, line 1530 - API functions for installing modules and themes.
Code
function _install_find_profile_file($profile_name, $file_extension = 'profile') {
$profile_files = array(
BACKDROP_ROOT . '/profiles/' . $profile_name . '/' . $profile_name . '.profile',
BACKDROP_ROOT . '/core/profiles/' . $profile_name . '/' . $profile_name . '.profile',
);
foreach ($profile_files as $profile_file) {
if (file_exists($profile_file)) {
if ($file_extension === 'profile') {
return $profile_file;
}
else {
$profile_other_file = str_replace('.profile', '.' . $file_extension, $profile_file);
return file_exists($profile_other_file) ? $profile_other_file : FALSE;
}
}
}
return FALSE;
}