function hackedProject::locate_local_project in Hacked! 7.2
Same name and namespace in other branches
- 6.2 includes/hacked_project.inc \hackedProject::locate_local_project()
Locate the base directory of the local project.
1 call to hackedProject::locate_local_project()
- hackedProject::hash_local_project in includes/
hackedProject.inc - Hash the local version of the project.
File
- includes/
hackedProject.inc, line 179
Class
- hackedProject
- Encapsulates a Hacked! project.
Code
function locate_local_project() {
// we need a remote project to do this :(
$this
->hash_remote_project();
// Do we have at least some modules to check for:
if (!is_array($this->project_info['includes']) || !count($this->project_info['includes'])) {
return FALSE;
}
// If this project is drupal it, we need to handle it specially
if ($this->project_type != 'core') {
$includes = array_keys($this->project_info['includes']);
$include = array_shift($includes);
$include_type = $this->project_info['project_type'];
}
else {
// Just use the system module to find where we've installed drupal
$include = 'system';
$include_type = 'module';
}
//$include = 'image_captcha';
$path = drupal_get_path($include_type, $include);
// Now we need to find the path of the info file in the downloaded package:
$temp = '';
foreach ($this->remote_files->files as $file) {
if (preg_match('@(^|.*/)' . $include . '.info$@', $file)) {
$temp = $file;
break;
}
}
// How many '/' were in that path:
$slash_count = substr_count($temp, '/');
$back_track = str_repeat('/..', $slash_count);
return realpath($path . $back_track);
}