Drush: commands/make/make.project.inc Source File

  1. 7.x doxygen/html/make_8project_8inc_source.html
  2. master doxygen/html/make_8project_8inc_source.html
Go to the documentation of this file.
1 <?php
2 /**
3  * @file
4  * Drush Make processing classes.
5  */
6 
7 /**
8  * The base project class.
9  */
11 
12  /**
13  * TRUE if make() has been called, otherwise FALSE.
14  */
15  protected $made = FALSE;
16 
17  /**
18  * TRUE if download() method has been called successfully, otherwise FALSE.
19  */
20  protected $downloaded = NULL;
21 
22  /**
23  * Download location to use.
24  */
25  protected $download_location = NULL;
26 
27  /**
28  * Keep track of instances.
29  *
31  */
32  protected static $self = array();
33 
34  /**
35  * Keeps track of projects being processed to prevent recursive conflicts.
36  *
37  * Simple array of machine names.
38  *
39  * @var array
40  */
41  protected $manifest = array();
42 
43  /**
44  * Default to overwrite to allow recursive builds to process properly.
45  *
46  * TODO refactor this to be more selective. Ideally a merge would take place
47  * instead of an overwrite.
48  */
49  protected $overwrite = TRUE;
50 
51  /**
52  * Recursively process any makefiles found in downloaded projects.
53  */
54  protected $do_recursion = TRUE;
55 
56  /**
57  * Set attributes and retrieve project information.
58  */
59  protected function __construct($project) {
60  $project['base_contrib_destination'] = $project['contrib_destination'];
61  foreach ($project as $key => $value) {
62  $this->{$key} = $value;
63  }
64  if (!empty($this->options['working-copy'])) {
65  $this->download['working-copy'] = TRUE;
66  }
67  }
68 
69  /**
70  * Get an instance for the type and project.
71  *
72  * @param string $type
73  * Type of project: core, library, module, profile, or translation.
74  * @param array $project
75  * Project information.
76  *
77  * @return mixed
78  * An instance for the project or FALSE if invalid type.
79  */
80  public static function getInstance($type, $project) {
81  if (!isset(self::$self[$type][$project['name']])) {
82  $class = 'DrushMakeProject_' . $type;
83  self::$self[$type][$project['name']] = class_exists($class) ? new $class($project) : FALSE;
84  }
85  return self::$self[$type][$project['name']];
86  }
87 
88  /**
89  * Set the manifest array.
90  *
91  * @param array $manifest
92  * An array of projects as generated by `make_projects`.
93  */
94  public function setManifest($manifest) {
95  $this->manifest = $manifest;
96  }
97 
98  /**
99  * Download a project.
100  */
101  function download() {
102  $this->downloaded = TRUE;
103 
104  // In some cases, make_download_factory() is going to need to know the
105  // full version string of the project we're trying to download. However,
106  // the version is a project-level attribute, not a download-level
107  // attribute. So, if we don't already have a full version string in the
108  // download array (e.g. if it was initialized via the release history XML
109  // for the PM case), we take the version info from the project-level
110  // attribute, convert it into a full version string, and stuff it into
111  // $this->download so that the download backend has access to it, too.
112  if (!empty($this->version) && empty($this->download['full_version'])) {
113  $full_version = '';
114  $matches = array();
115  // Core needs different conversion rules than contrib.
116  if (!empty($this->type) && $this->type == 'core') {
117  // Generally, the version for core is already set properly.
118  $full_version = $this->version;
119  // However, it might just be something like '7' or '7.x', in which
120  // case we need to turn that into '7.x-dev';
121  if (preg_match('/^\d+(\.x)?$/', $this->version, $matches)) {
122  // If there's no '.x' already, append it.
123  if (empty($matches[1])) {
124  $full_version .= '.x';
125  }
126  $full_version .= '-dev';
127  }
128  }
129  // Contrib.
130  else {
131  // If the version doesn't already define a core version, prepend it.
132  if (!preg_match('/^\d+\.x-\d+.*$/', $this->version)) {
133  // Just find the major version from $this->core so we don't end up
134  // with version strings like '7.12-2.0'.
135  $core_parts = explode('.', $this->core);
136  $full_version = $core_parts[0] . '.x-';
137  }
138  $full_version .= $this->version;
139  // If the project-level version attribute is just a number it's a major
140  // version.
141  if (preg_match('/^\d+(\.x)?$/', $this->version, $matches)) {
142  // If there's no '.x' already, append it.
143  if (empty($matches[1])) {
144  $full_version .= '.x';
145  }
146  $full_version .= '-dev';
147  }
148  }
149  $this->download['full_version'] = $full_version;
150  }
151 
152  if (make_download_factory($this->name, $this->type, $this->download, $this->download_location) === FALSE) {
153  $this->downloaded = FALSE;
154  }
155  return $this->downloaded;
156  }
157 
158  /**
159  * Build a project.
160  */
161  function make() {
162  if ($this->made) {
163  drush_log(dt('Attempt to build project @project more then once prevented.', array('@project' => $this->name)));
164  return TRUE;
165  }
166  $this->made = TRUE;
167 
168  if (!isset($this->download_location)) {
169  $this->download_location = $this->findDownloadLocation();
170  }
171  if ($this->download() === FALSE) {
172  return FALSE;
173  }
174  if (!$this->addLockfile($this->download_location)) {
175  return FALSE;
176  }
177  if (!$this->applyPatches($this->download_location)) {
178  return FALSE;
179  }
180  if (!$this->getTranslations($this->download_location)) {
181  return FALSE;
182  }
183  // Handle .info file re-writing (if so desired).
184  if (!drush_get_option('no-gitinfofile', FALSE) && isset($this->download['type']) && $this->download['type'] == 'git') {
185  $this->processGitInfoFiles();
186  }
187  // Clean-up .git directories.
188  if (!_get_working_copy_option($this->download)) {
189  $this->removeGitDirectory();
190  }
191  if (!$this->recurse($this->download_location)) {
192  return FALSE;
193  }
194  return TRUE;
195  }
196 
197  /**
198  * Determine the location to download project to.
199  */
200  function findDownloadLocation() {
201  $this->path = $this->generatePath();
202  $this->project_directory = !empty($this->directory_name) ? $this->directory_name : $this->name;
203  $this->download_location = $this->path . '/' . $this->project_directory;
204  // This directory shouldn't exist yet -- if it does, stop,
205  // unless overwrite has been set to TRUE.
206  if (is_dir($this->download_location) && !$this->overwrite) {
207  drush_set_error('MAKE_DIRECTORY_EXISTS', dt('Directory not empty: !directory', array('!directory' => $this->download_location)));
208  return FALSE;
209  }
210  elseif ($this->download['type'] === 'pm') {
211  // pm-download will create the final contrib directory.
212  drush_mkdir(dirname($this->download_location));
213  }
214  else {
215  drush_mkdir($this->download_location);
216  }
218  }
219 
220  /**
221  * Rewrite relative URLs and file:/// URLs
222  *
223  * relative path -> absolute path using the make_directory
224  * local file:/// urls -> local paths
225  *
226  * @param mixed &$info
227  * Either an array or a simple url string. The `$info` variable will be
228  * transformed into an array.
229  */
230  protected function preprocessLocalFileUrl(&$info) {
231  if (is_string($info)) {
232  $info = array('url' => $info, 'local' => FALSE);
233  }
234 
235  if (!_drush_is_url($info['url']) && !drush_is_absolute_path($info['url'])) {
236  $info['url'] = $this->make_directory . '/' . $info['url'];
237  $info['local'] = TRUE;
238  } elseif (substr($info['url'], 0, 8) == 'file:///') {
239  $info['url'] = substr($info['url'], 7);
240  $info['local'] = TRUE;
241  }
242  }
243 
244  /**
245  * Retrieve and apply any patches specified by the makefile to this project.
246  */
247  function applyPatches($project_directory) {
248  if (empty($this->patch)) {
249  return TRUE;
250  }
251 
252  $patches_txt = '';
253  $local_patches = array();
254  $ignore_checksums = drush_get_option('ignore-checksums');
255  foreach ($this->patch as $info) {
256  $this->preprocessLocalFileUrl($info);
257 
258  // Download the patch.
259  if ($filename = _make_download_file($info['url'])) {
260  $patched = FALSE;
261  $output = '';
262  // Test each patch style; -p1 is the default with git. See
264  $patch_levels = array('-p1', '-p0');
265  foreach ($patch_levels as $patch_level) {
266  $checked = drush_shell_exec('cd %s && GIT_DIR=. git apply --check %s %s --verbose', $project_directory, $patch_level, $filename);
267  if ($checked) {
268  // Apply the first successful style.
269  $patched = drush_shell_exec('cd %s && GIT_DIR=. git apply %s %s --verbose', $project_directory, $patch_level, $filename);
270  break;
271  }
272  }
273 
274  // In some rare cases, git will fail to apply a patch, fallback to using
275  // the 'patch' command.
276  if (!$patched) {
277  foreach ($patch_levels as $patch_level) {
278  // --no-backup-if-mismatch here is a hack that fixes some
279  // differences between how patch works on windows and unix.
280  if ($patched = drush_shell_exec("patch %s --no-backup-if-mismatch -d %s < %s", $patch_level, $project_directory, $filename)) {
281  break;
282  }
283  }
284  }
285 
286  if ($output = drush_shell_exec_output()) {
287  // Log any command output, visible only in --verbose or --debug mode.
288  drush_log(implode("\n", $output));
289  }
290 
291  // Set up string placeholders to pass to dt().
292  $dt_args = array(
293  '@name' => $this->name,
294  '@filename' => basename($filename),
295  );
296 
297  if ($patched) {
298  if (!$ignore_checksums && !_make_verify_checksums($info, $filename)) {
299  return FALSE;
300  }
301  $patch_url = $info['url'];
302 
303  // If this is a local patch, copy that into place as well.
304  if ($info['local']) {
305  $local_patches[] = $info['url'];
306  // Use a local path for the PATCHES.txt file.
307  $pathinfo = pathinfo($patch_url);
308  $patch_url = $pathinfo['basename'];
309  }
310  $patches_txt .= '- ' . $patch_url . "\n";
311 
312  drush_log(dt('@name patched with @filename.', $dt_args), 'ok');
313  }
314  else {
315  make_error('PATCH_ERROR', dt("Unable to patch @name with @filename.", $dt_args));
316  }
317  drush_op('unlink', $filename);
318  }
319  else {
320  make_error('DOWNLOAD_ERROR', 'Unable to download ' . $info['url'] . '.');
321  return FALSE;
322  }
323  }
324  if (!empty($patches_txt) && !drush_get_option('no-patch-txt') && !file_exists($project_directory . '/PATCHES.txt')) {
325  $patches_txt = "The following patches have been applied to this project:\n" .
326  $patches_txt .
327  "\nThis file was automatically generated by Drush Make (http://drupal.org/project/drush).";
328  file_put_contents($project_directory . '/PATCHES.txt', $patches_txt);
329  drush_log('Generated PATCHES.txt file for ' . $this->name, 'ok');
330 
331  // Copy local patches into place.
332  foreach ($local_patches as $url) {
333  $pathinfo = pathinfo($url);
334  drush_copy_dir($url, $project_directory . '/' . $pathinfo['basename']);
335  }
336  }
337  return TRUE;
338  }
339 
340  /**
341  * Process info files when downloading things from git.
342  */
343  function processGitInfoFiles() {
344  // Bail out if this isn't hosted on Drupal.org (unless --force-gitinfofile option was specified).
345  if (!drush_get_option('force-gitinfofile', FALSE) && isset($this->download['url']) && strpos($this->download['url'], 'drupal.org') === FALSE) {
346  return;
347  }
348 
349  // Figure out the proper version string to use based on the .make file.
350  // Best case is the .make file author told us directly.
351  if (!empty($this->download['full_version'])) {
352  $full_version = $this->download['full_version'];
353  }
354  // Next best is if we have a tag, since those are identical to versions.
355  elseif (!empty($this->download['tag'])) {
356  $full_version = $this->download['tag'];
357  }
358  // If we have a branch, append '-dev'.
359  elseif (!empty($this->download['branch'])) {
360  $full_version = $this->download['branch'] . '-dev';
361  }
362  // Ugh. Not sure what else we can do in this case.
363  elseif (!empty($this->download['revision'])) {
364  $full_version = $this->download['revision'];
365  }
366  // Probably can never reach this case.
367  else {
368  $full_version = 'unknown';
369  }
370 
371  // If the version string ends in '.x-dev' do the Git magic to figure out
372  // the appropriate 'rebuild version' string, e.g. '7.x-1.2+7-dev'.
373  $matches = array();
374  if (preg_match('/^(.+).x-dev$/', $full_version, $matches)) {
375  require_once dirname(__FILE__) . '/../pm/package_handler/git_drupalorg.inc';
376  $rebuild_version = drush_pm_git_drupalorg_compute_rebuild_version($this->download_location, $matches[1]);
377  if ($rebuild_version) {
378  $full_version = $rebuild_version;
379  }
380  }
381  require_once dirname(__FILE__) . '/../pm/pm.drush.inc';
382  drush_pm_inject_info_file_metadata($this->download_location, $this->name, $full_version);
383  }
384 
385  /**
386  * Remove the .git directory from a project.
387  */
388  function removeGitDirectory() {
389  if (isset($this->download['type']) && $this->download['type'] == 'git' && file_exists($this->download_location . '/.git')) {
390  drush_delete_dir($this->download_location . '/.git', TRUE);
391  }
392  }
393 
394  /**
395  * Add a lock file.
396  */
397  function addLockfile($project_directory) {
398  if (!empty($this->lock)) {
399  file_put_contents($project_directory . '/.drush-lock-update', $this->lock);
400  }
401  return TRUE;
402  }
403 
404  /**
405  * Retrieve translations for this project.
406  */
407  function getTranslations($project_directory) {
408  static $cache = array();
409  $langcodes = $this->translations;
410  if ($langcodes && in_array($this->type, array('core', 'module', 'profile', 'theme'), TRUE)) {
411  // Support the l10n_path, l10n_url keys from l10n_update. Note that the
412  // l10n_server key is not supported.
413  if (isset($this->l10n_path)) {
414  $update_url = $this->l10n_path;
415  }
416  else {
417  if (isset($this->l10n_url)) {
418  $l10n_server = $this->l10n_url;
419  }
420  else {
421  $l10n_server = FALSE;
422  }
423  if ($l10n_server) {
424  if (!isset($cache[$l10n_server])) {
425  $this->preprocessLocalFileUrl($l10n_server);
426  $l10n_server = $l10n_server['url'];
427  if ($filename = _make_download_file($l10n_server)) {
428  $server_info = simplexml_load_string(file_get_contents($filename));
429  $cache[$l10n_server] = !empty($server_info->update_url) ? $server_info->update_url : FALSE;
430  }
431  }
432  if ($cache[$l10n_server]) {
433  $update_url = $cache[$l10n_server];
434  }
435  else {
436  make_error('XML_ERROR', dt("Could not retrieve l10n update url for !project.", array('!project' => $project['name'])));
437  return FALSE;
438  }
439  }
440  }
441  if ($update_url) {
442  $failed = array();
443  foreach ($langcodes as $langcode) {
444  $variables = array(
445  '%project' => $this->name,
446  '%release' => $this->download['full_version'],
447  '%core' => $this->core,
448  '%language' => $langcode,
449  '%filename' => '%filename',
450  );
451  $url = strtr($update_url, $variables);
452 
453  // Download the translation file. Since its contents are volatile,
454  // cache for only 4 hours.
455  if ($filename = _make_download_file($url, 3600 * 4)) {
456  // If this is the core project type, download the translation file
457  // and place it in every profile and an additional copy in
458  // modules/system/translations where it can be detected for import
459  // by other non-default install profiles.
460  if ($this->type === 'core') {
461  $profiles = drush_scan_directory($project_directory . '/profiles', '/.*/', array(), 0, FALSE, 'filename', 0, TRUE);
462  foreach ($profiles as $profile) {
463  if (is_dir($project_directory . '/profiles/' . $profile->basename)) {
464  drush_mkdir($project_directory . '/profiles/' . $profile->basename . '/translations');
465  drush_copy_dir($filename, $project_directory . '/profiles/' . $profile->basename . '/translations/' . $langcode . '.po');
466  }
467  }
468  drush_mkdir($project_directory . '/modules/system/translations');
469  drush_copy_dir($filename, $project_directory . '/modules/system/translations/' . $langcode . '.po');
470  }
471  else {
472  drush_mkdir($project_directory . '/translations');
473  drush_copy_dir($filename, $project_directory . '/translations/' . $langcode . '.po', TRUE);
474  }
475  }
476  else {
477  $failed[] = $langcode;
478  }
479  }
480  if (empty($failed)) {
481  drush_log('All translations downloaded for ' . $this->name, 'ok');
482  }
483  else {
484  drush_log('Unable to download translations for ' . $this->name . ': ' . implode(', ', $failed), 'warning');
485  }
486  }
487  }
488  return TRUE;
489  }
490 
491  /**
492  * Generate the proper path for this project type.
493  *
494  * @param boolean $base
495  * Whether include the base part (tmp dir). Defaults to TRUE.
496  */
497  protected function generatePath($base = TRUE) {
498  $path = array();
499  if ($base) {
500  $path[] = make_tmp();
501  $path[] = '__build__';
502  }
503  if (!empty($this->contrib_destination)) {
504  $path[] = $this->contrib_destination;
505  }
506  if (!empty($this->subdir)) {
507  $path[] = $this->subdir;
508  }
509  return implode('/', $path);
510  }
511 
512  /**
513  * Return the proper path for dependencies to be placed in.
514  *
515  * @return string
516  * The path that dependencies will be placed in.
517  */
518  protected function buildPath($directory) {
519  return $this->base_contrib_destination;
520  }
521 
522  /**
523  * Recurse to process additional makefiles that may be found during
524  * processing.
525  */
526  function recurse($path) {
527  if (!$this->do_recursion || drush_get_option('no-recursion')) {
528  drush_log(dt("Preventing recursive makefile parsing for !project",
529  array("!project" => $this->name)), 'notice');
530  return TRUE;
531  }
532  $makefile = $this->download_location . '/' . $this->name . '.make';
533  if (!file_exists($makefile)) {
534  $makefile = $this->download_location . '/drupal-org.make';
535  if (!file_exists($makefile)) {
536  return TRUE;
537  }
538  }
539  drush_log(dt("Found makefile: !makefile", array("!makefile" => basename($makefile))), 'ok');
540 
541  // Save the original state of the 'custom' context.
542  $custom_context = &drush_get_context('custom');
543  $original_custom_context_values = $custom_context;
544 
545  $info = make_parse_info_file($makefile, TRUE, $this->options);
546  if (!($info = make_validate_info_file($info))) {
547  $result = FALSE;
548  }
549  else {
550  // Inherit the translations specified in the extender makefile.
551  if (!empty($this->translations)) {
552  $info['translations'] = $this->translations;
553  }
554  // Strip out any modules that have already been processed before this.
555  foreach ($this->manifest as $name) {
556  unset($info['projects'][$name]);
557  }
558  $build_path = $this->buildPath($this->name);
559  make_projects(TRUE, trim($build_path, '/'), $info, $this->build_path, $this->download_location);
560  make_libraries(TRUE, trim($build_path, '/'), $info, $this->build_path, $this->download_location);
561  $result = TRUE;
562  }
563  // Restore original 'custom' context so that any
564  // settings changes made are used.
565  $custom_context = $original_custom_context_values;
566 
567  return $result;
568  }
569 }
570 
571 /**
572  * For processing Drupal core projects.
573  */
575  /**
576  * Override constructor for core to adjust project info.
577  */
578  protected function __construct(&$project) {
579  parent::__construct($project);
580  // subdir and contrib_destination are not allowed for core.
581  $this->subdir = '';
582  $this->contrib_destination = '';
583  }
584 
585  /**
586  * Determine the location to download project to.
587  */
588  function findDownloadLocation() {
589  $this->path = $this->download_location = $this->generatePath();
590  $this->project_directory = '';
591  if (is_dir($this->download_location)) {
592  drush_set_error('MAKE_DIRECTORY_EXISTS', dt('Directory not empty: !directory', array('!directory' => $this->download_location)));
593  return FALSE;
594  }
595  elseif ($this->download['type'] === 'pm') {
596  // pm-download will create the final __build__ directory, so nothing to do
597  // here.
598  }
599  else {
600  drush_mkdir($this->download_location);
601  }
603  }
604 }
605 
606 /**
607  * For processing libraries.
608  */
610  /**
611  * Override constructor for libraries to properly set contrib destination.
612  */
613  protected function __construct(&$project) {
614  parent::__construct($project);
615  // Allow libraries to specify where they should live in the build path.
616  if (isset($project['destination'])) {
617  $project_path = $project['destination'];
618  }
619  else {
620  $project_path = 'libraries';
621  }
622 
623  $this->contrib_destination = ($this->base_contrib_destination != '.' ? $this->base_contrib_destination . '/' : '') . $project_path;
624  }
625 
626  /**
627  * No recursion for libraries, sorry :-(
628  */
629  function recurse($path) {
630  // Return TRUE so that processing continues in the make() method.
631  return TRUE;
632  }
633 
634  /**
635  * No translations for libraries.
636  */
638  // Return TRUE so that processing continues in the make() method.
639  return TRUE;
640  }
641 }
642 
643 /**
644  * For processing modules.
645  */
647  /**
648  * Override constructor for modules to properly set contrib destination.
649  */
650  protected function __construct(&$project) {
651  parent::__construct($project);
652  $this->contrib_destination = ($this->base_contrib_destination != '.' ? $this->base_contrib_destination . '/' : '') . 'modules';
653  }
654 }
655 
656 /**
657  * For processing installation profiles.
658  */
660  /**
661  * Override contructor for installation profiles to properly set contrib
662  * destination.
663  */
664  protected function __construct(&$project) {
665  parent::__construct($project);
666  $this->contrib_destination = (!empty($this->destination) ? $this->destination : 'profiles');
667  }
668 
669  /**
670  * Find the build path.
671  */
672  protected function buildPath($directory) {
673  return $this->generatePath(FALSE) . '/' . $directory;
674  }
675 }
676 
677 /**
678  * For processing themes.
679  */
681  /**
682  * Override contructor for themes to properly set contrib destination.
683  */
684  protected function __construct(&$project) {
685  parent::__construct($project);
686  $this->contrib_destination = ($this->base_contrib_destination != '.' ? $this->base_contrib_destination . '/' : '') . 'themes';
687  }
688 }
689 
690 /**
691  * For processing translations.
692  */
694  /**
695  * Override constructor for translations to properly set contrib destination.
696  */
697  protected function __construct(&$project) {
698  parent::__construct($project);
699  switch ($project['core']) {
700  case '5.x':
701  // Don't think there's an automatic place we can put 5.x translations,
702  // so we'll toss them in a translations directory in the Drupal root.
703  $this->contrib_destination = ($this->base_contrib_destination != '.' ? $this->base_contrib_destination . '/' : '') . 'translations';
704  break;
705 
706  default:
707  $this->contrib_destination = '';
708  break;
709  }
710  }
711 }

File

doxygen/html/make_8project_8inc_source.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Drush: commands/make/make.project.inc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Drush
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_afac61274991793aa7e9133a8f4f291e.html">commands</a></li><li class="navelem"><a class="el" href="dir_71080c12e208a9908650860bfe2a57f6.html">make</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">make.project.inc</div>  </div>
</div><!--header-->
<div class="contents">
<a href="make_8project_8inc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php<span class="comment"></span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * @file</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Drush Make processing classes.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * The base project class.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html">   10</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">   * TRUE if make() has been called, otherwise FALSE.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a313e2a2f7421adfcecdc04f985182763">   15</a></span>&#160;  <span class="keyword">protected</span> <a class="code" href="classDrushMakeProject.html#a313e2a2f7421adfcecdc04f985182763">$made</a> = FALSE;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">   * TRUE if download() method has been called successfully, otherwise FALSE.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a587bf0e79a999ae9198e3fef6d533a59">   20</a></span>&#160;  <span class="keyword">protected</span> <a class="code" href="classDrushMakeProject.html#a587bf0e79a999ae9198e3fef6d533a59">$downloaded</a> = NULL;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">   * Download location to use.</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a43efbf973ece5fbab01fb59b80267e3e">   25</a></span>&#160;  <span class="keyword">protected</span> <a class="code" href="classDrushMakeProject.html#a43efbf973ece5fbab01fb59b80267e3e">$download_location</a> = NULL;</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">   * Keep track of instances.</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">   * @see DrushMakeProject::getInstance()</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a01d8c7205aba8f1c8b1395102c2ea1d3">   32</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">static</span> <a class="code" href="classDrushMakeProject.html#a01d8c7205aba8f1c8b1395102c2ea1d3">$self</a> = array();</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">   * Keeps track of projects being processed to prevent recursive conflicts.</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">   * Simple array of machine names.</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">   * @var array</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;  <span class="keyword">protected</span> $manifest = array();</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">   * Default to overwrite to allow recursive builds to process properly.</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">   * TODO refactor this to be more selective. Ideally a merge would take place</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">   * instead of an overwrite.</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a1102ee27f914c4080acdaf2903db153b">   49</a></span>&#160;  <span class="keyword">protected</span> <a class="code" href="classDrushMakeProject.html#a1102ee27f914c4080acdaf2903db153b">$overwrite</a> = TRUE;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">   * Recursively process any makefiles found in downloaded projects.</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#ac5f1b8e82df2a5d3aacaec39461a9715">   54</a></span>&#160;  <span class="keyword">protected</span> <a class="code" href="classDrushMakeProject.html#ac5f1b8e82df2a5d3aacaec39461a9715">$do_recursion</a> = TRUE;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment">   * Set attributes and retrieve project information.</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#afb329c0cea11e16d977e30f22636194b">   59</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#afb329c0cea11e16d977e30f22636194b">__construct</a>($project) {</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    $project[<span class="stringliteral">&#39;base_contrib_destination&#39;</span>] = $project[<span class="stringliteral">&#39;contrib_destination&#39;</span>];</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keywordflow">foreach</span> ($project as $key =&gt; $value) {</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;      $this-&gt;{$key} = $value;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    }</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;options[<span class="stringliteral">&#39;working-copy&#39;</span>])) {</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;      $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;working-copy&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    }</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;  }</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">   * Get an instance for the type and project.</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="comment">   * @param string $type</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="comment">   *   Type of project: core, library, module, profile, or translation.</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="comment">   * @param array $project</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="comment">   *   Project information.</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment">   * @return mixed</span></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment">   *   An instance for the project or FALSE if invalid type.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#afedb73c8a81625f02d8c25fb81df295d">   80</a></span>&#160;  <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#afedb73c8a81625f02d8c25fb81df295d">getInstance</a>($type, $project) {</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="keywordflow">if</span> (!isset(self::$self[$type][$project[<span class="stringliteral">&#39;name&#39;</span>]])) {</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;      $class = <span class="stringliteral">&#39;DrushMakeProject_&#39;</span> . $type;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;      self::$self[$type][$project[<span class="stringliteral">&#39;name&#39;</span>]] = class_exists($class) ? <span class="keyword">new</span> $class($project) : FALSE;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="keywordflow">return</span> self::$self[$type][$project[<span class="stringliteral">&#39;name&#39;</span>]];</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;  }</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment">   * Set the manifest array.</span></div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="comment">   * @param array $manifest</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="comment">   *   An array of projects as generated by `make_projects`.</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#ab718bdc4ffa8964196fea1741189d9b3">   94</a></span>&#160;  <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#ab718bdc4ffa8964196fea1741189d9b3">setManifest</a>($manifest) {</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    $this-&gt;manifest = $manifest;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  }</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">   * Download a project.</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">  101</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>() {</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    $this-&gt;downloaded = TRUE;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="comment">// In some cases, make_download_factory() is going to need to know the</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="comment">// full version string of the project we&#39;re trying to download. However,</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="comment">// the version is a project-level attribute, not a download-level</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="comment">// attribute. So, if we don&#39;t already have a full version string in the</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="comment">// download array (e.g. if it was initialized via the release history XML</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="comment">// for the PM case), we take the version info from the project-level</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="comment">// attribute, convert it into a full version string, and stuff it into</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="comment">// $this-&gt;download so that the download backend has access to it, too.</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;version) &amp;&amp; empty($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;full_version&#39;</span>])) {</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      $full_version = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;      $matches = array();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;      <span class="comment">// Core needs different conversion rules than contrib.</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;      <span class="keywordflow">if</span> (!empty($this-&gt;type) &amp;&amp; $this-&gt;type == <span class="stringliteral">&#39;core&#39;</span>) {</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="comment">// Generally, the version for core is already set properly.</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        $full_version = $this-&gt;version;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        <span class="comment">// However, it might just be something like &#39;7&#39; or &#39;7.x&#39;, in which</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        <span class="comment">// case we need to turn that into &#39;7.x-dev&#39;;</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        <span class="keywordflow">if</span> (preg_match(<span class="stringliteral">&#39;/^\d+(\.x)?$/&#39;</span>, $this-&gt;version, $matches)) {</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;          <span class="comment">// If there&#39;s no &#39;.x&#39; already, append it.</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;          <span class="keywordflow">if</span> (empty($matches[1])) {</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;            $full_version .= <span class="stringliteral">&#39;.x&#39;</span>;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;          }</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;          $full_version .= <span class="stringliteral">&#39;-dev&#39;</span>;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        }</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;      }</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;      <span class="comment">// Contrib.</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <span class="comment">// If the version doesn&#39;t already define a core version, prepend it.</span></div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="keywordflow">if</span> (!preg_match(<span class="stringliteral">&#39;/^\d+\.x-\d+.*$/&#39;</span>, $this-&gt;version)) {</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;          <span class="comment">// Just find the major version from $this-&gt;core so we don&#39;t end up</span></div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;          <span class="comment">// with version strings like &#39;7.12-2.0&#39;.</span></div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;          $core_parts = explode(<span class="charliteral">&#39;.&#39;</span>, $this-&gt;core);</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;          $full_version = $core_parts[0] . <span class="stringliteral">&#39;.x-&#39;</span>;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        }</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        $full_version .= $this-&gt;version;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        <span class="comment">// If the project-level version attribute is just a number it&#39;s a major</span></div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <span class="comment">// version.</span></div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        <span class="keywordflow">if</span> (preg_match(<span class="stringliteral">&#39;/^\d+(\.x)?$/&#39;</span>, $this-&gt;version, $matches)) {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;          <span class="comment">// If there&#39;s no &#39;.x&#39; already, append it.</span></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;          <span class="keywordflow">if</span> (empty($matches[1])) {</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            $full_version .= <span class="stringliteral">&#39;.x&#39;</span>;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;          }</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;          $full_version .= <span class="stringliteral">&#39;-dev&#39;</span>;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        }</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;      }</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;      $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;full_version&#39;</span>] = $full_version;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    }</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="make_8download_8inc.html#aaa0817e712779645b563cfb8ddfd99cd">make_download_factory</a>($this-&gt;name, $this-&gt;type, $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>, $this-&gt;download_location) === FALSE) {</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;      $this-&gt;downloaded = FALSE;</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    }</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classDrushMakeProject.html#a587bf0e79a999ae9198e3fef6d533a59">$this-&gt;downloaded</a>;</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;  }</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="comment">   * Build a project.</span></div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#ad59196db4820ff959dd6088fb8293b75">  161</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#ad59196db4820ff959dd6088fb8293b75">make</a>() {</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordflow">if</span> ($this-&gt;made) {</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;      <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Attempt to build project @project more then once prevented.&#39;</span>, array(<span class="stringliteral">&#39;@project&#39;</span> =&gt; $this-&gt;name)));</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;      <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    $this-&gt;made = TRUE;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    <span class="keywordflow">if</span> (!isset($this-&gt;download_location)) {</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;      $this-&gt;download_location = $this-&gt;<a class="code" href="classDrushMakeProject.html#a8276ef71b946cf3ae13391c2216e51bd">findDownloadLocation</a>();</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    }</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="keywordflow">if</span> ($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>() === FALSE) {</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    <span class="keywordflow">if</span> (!$this-&gt;<a class="code" href="classDrushMakeProject.html#a5ea0e7fdb468e6b3c20ca7a5b2010966">addLockfile</a>($this-&gt;download_location)) {</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    }</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    <span class="keywordflow">if</span> (!$this-&gt;<a class="code" href="classDrushMakeProject.html#a86cb2ad32088f11522e027cd7e98c6ce">applyPatches</a>($this-&gt;download_location)) {</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    }</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <span class="keywordflow">if</span> (!$this-&gt;<a class="code" href="classDrushMakeProject.html#af6f9c98d13bb338237d8cc96566e59f8">getTranslations</a>($this-&gt;download_location)) {</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    }</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <span class="comment">// Handle .info file re-writing (if so desired).</span></div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;no-gitinfofile&#39;</span>, FALSE) &amp;&amp; isset($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>]) &amp;&amp; $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>] == <span class="stringliteral">&#39;git&#39;</span>) {</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;      $this-&gt;<a class="code" href="classDrushMakeProject.html#ae64371ebab222251d13f492bb1bf7549">processGitInfoFiles</a>();</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    }</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    <span class="comment">// Clean-up .git directories.</span></div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="make_8utilities_8inc.html#a4936fba59cad3feaaf82d602958af199">_get_working_copy_option</a>($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>)) {</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;      $this-&gt;<a class="code" href="classDrushMakeProject.html#a79be6b5aafd3dd119b5928e2dd2a7096">removeGitDirectory</a>();</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    }</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keywordflow">if</span> (!$this-&gt;<a class="code" href="classDrushMakeProject.html#a14e2e297d82eea0e5bd316255d092da8">recurse</a>($this-&gt;download_location)) {</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    }</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;  }</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="comment">   * Determine the location to download project to.</span></div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a8276ef71b946cf3ae13391c2216e51bd">  200</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a8276ef71b946cf3ae13391c2216e51bd">findDownloadLocation</a>() {</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    $this-&gt;path = $this-&gt;<a class="code" href="classDrushMakeProject.html#a825d48df1bdb0d0d0e46992e175909af">generatePath</a>();</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    $this-&gt;project_directory = !empty($this-&gt;directory_name) ? $this-&gt;directory_name : $this-&gt;name;</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    $this-&gt;download_location = $this-&gt;path . <span class="charliteral">&#39;/&#39;</span> . $this-&gt;project_directory;</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <span class="comment">// This directory shouldn&#39;t exist yet -- if it does, stop,</span></div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <span class="comment">// unless overwrite has been set to TRUE.</span></div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;    <span class="keywordflow">if</span> (is_dir($this-&gt;download_location) &amp;&amp; !$this-&gt;overwrite) {</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;      <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;MAKE_DIRECTORY_EXISTS&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Directory not empty: !directory&#39;</span>, array(<span class="stringliteral">&#39;!directory&#39;</span> =&gt; $this-&gt;download_location)));</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;    }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;    elseif ($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>] === <span class="stringliteral">&#39;pm&#39;</span>) {</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;      <span class="comment">// pm-download will create the final contrib directory.</span></div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;      <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>(dirname($this-&gt;download_location));</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    }</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;      <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($this-&gt;download_location);</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    }</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classDrushMakeProject.html#a43efbf973ece5fbab01fb59b80267e3e">$this-&gt;download_location</a>;</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;  }</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;<span class="comment">   * Rewrite relative URLs and file:/// URLs</span></div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;<span class="comment">   * relative path -&gt; absolute path using the make_directory</span></div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="comment">   * local file:/// urls -&gt; local paths</span></div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="comment">   * @param mixed &amp;$info</span></div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;<span class="comment">   *   Either an array or a simple url string. The `$info` variable will be</span></div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;<span class="comment">   *   transformed into an array.</span></div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a44714696c45b971da01dd29a529fd01b">  230</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a44714696c45b971da01dd29a529fd01b">preprocessLocalFileUrl</a>(&amp;$info) {</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;    <span class="keywordflow">if</span> (is_string($info)) {</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;      $info = array(<span class="stringliteral">&#39;url&#39;</span> =&gt; $info, <span class="stringliteral">&#39;local&#39;</span> =&gt; FALSE);</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    }</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="drush_8inc.html#a5d3c123a1d8fa15642f08ff635dbe2a1">_drush_is_url</a>($info[<span class="stringliteral">&#39;url&#39;</span>]) &amp;&amp; !<a class="code" href="group__filesystemfunctions.html#gafa80199035259ddf98fa300d6f646aa2">drush_is_absolute_path</a>($info[<span class="stringliteral">&#39;url&#39;</span>])) {</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;      $info[<span class="stringliteral">&#39;url&#39;</span>] = $this-&gt;make_directory . <span class="charliteral">&#39;/&#39;</span> . $info[<span class="stringliteral">&#39;url&#39;</span>];</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;      $info[<span class="stringliteral">&#39;local&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;    } elseif (substr($info[<span class="stringliteral">&#39;url&#39;</span>], 0, 8) == <span class="stringliteral">&#39;file:///&#39;</span>) {</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;      $info[<span class="stringliteral">&#39;url&#39;</span>] = substr($info[<span class="stringliteral">&#39;url&#39;</span>], 7);</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;      $info[<span class="stringliteral">&#39;local&#39;</span>] = TRUE;</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;    }</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;  }</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;<span class="comment">   * Retrieve and apply any patches specified by the makefile to this project.</span></div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00247"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a86cb2ad32088f11522e027cd7e98c6ce">  247</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a86cb2ad32088f11522e027cd7e98c6ce">applyPatches</a>($project_directory) {</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <span class="keywordflow">if</span> (empty($this-&gt;patch)) {</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;      <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    }</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    $patches_txt = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    $local_patches = array();</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    $ignore_checksums = <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;ignore-checksums&#39;</span>);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    <span class="keywordflow">foreach</span> ($this-&gt;patch as $info) {</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;      $this-&gt;<a class="code" href="classDrushMakeProject.html#a44714696c45b971da01dd29a529fd01b">preprocessLocalFileUrl</a>($info);</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;      <span class="comment">// Download the patch.</span></div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;      <span class="keywordflow">if</span> ($filename = <a class="code" href="make_8download_8inc.html#a6381bf72fa72152dd12f122dbca83d78">_make_download_file</a>($info[<span class="stringliteral">&#39;url&#39;</span>])) {</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;        $patched = FALSE;</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        $output = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        <span class="comment">// Test each patch style; -p1 is the default with git. See</span></div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="comment">// http://drupal.org/node/1054616</span></div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;        $patch_levels = array(<span class="stringliteral">&#39;-p1&#39;</span>, <span class="stringliteral">&#39;-p0&#39;</span>);</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;        <span class="keywordflow">foreach</span> ($patch_levels as $patch_level) {</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;          $checked = <a class="code" href="group__commandwrappers.html#gafd358ceac1286dbdd141ff2b8eb7d556">drush_shell_exec</a>(<span class="stringliteral">&#39;cd %s &amp;&amp; GIT_DIR=. git apply --check %s %s --verbose&#39;</span>, $project_directory, $patch_level, $filename);</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;          <span class="keywordflow">if</span> ($checked) {</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;            <span class="comment">// Apply the first successful style.</span></div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;            $patched = <a class="code" href="group__commandwrappers.html#gafd358ceac1286dbdd141ff2b8eb7d556">drush_shell_exec</a>(<span class="stringliteral">&#39;cd %s &amp;&amp; GIT_DIR=. git apply %s %s --verbose&#39;</span>, $project_directory, $patch_level, $filename);</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;            <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;          }</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;        }</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;        <span class="comment">// In some rare cases, git will fail to apply a patch, fallback to using</span></div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;        <span class="comment">// the &#39;patch&#39; command.</span></div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keywordflow">if</span> (!$patched) {</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;          <span class="keywordflow">foreach</span> ($patch_levels as $patch_level) {</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;            <span class="comment">// --no-backup-if-mismatch here is a hack that fixes some</span></div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;            <span class="comment">// differences between how patch works on windows and unix.</span></div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;            <span class="keywordflow">if</span> ($patched = <a class="code" href="group__commandwrappers.html#gafd358ceac1286dbdd141ff2b8eb7d556">drush_shell_exec</a>(<span class="stringliteral">&quot;patch %s --no-backup-if-mismatch -d %s &lt; %s&quot;</span>, $patch_level, $project_directory, $filename)) {</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;              <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;            }</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;          }</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;        }</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;        <span class="keywordflow">if</span> ($output = <a class="code" href="group__commandwrappers.html#gadba8c59ba260dd39f615bc22ca78e1af">drush_shell_exec_output</a>()) {</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;          <span class="comment">// Log any command output, visible only in --verbose or --debug mode.</span></div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;          <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(implode(<span class="stringliteral">&quot;\n&quot;</span>, $output));</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        }</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <span class="comment">// Set up string placeholders to pass to dt().</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;        $dt_args = array(</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;          <span class="stringliteral">&#39;@name&#39;</span> =&gt; $this-&gt;name,</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;          <span class="stringliteral">&#39;@filename&#39;</span> =&gt; basename($filename),</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;        );</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;        <span class="keywordflow">if</span> ($patched) {</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;          <span class="keywordflow">if</span> (!$ignore_checksums &amp;&amp; !<a class="code" href="make_8download_8inc.html#a5ca2e2fb1cf115e40b99acbfc79128fa">_make_verify_checksums</a>($info, $filename)) {</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;             <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;          }</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;          $patch_url = $info[<span class="stringliteral">&#39;url&#39;</span>];</div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;          <span class="comment">// If this is a local patch, copy that into place as well.</span></div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;          <span class="keywordflow">if</span> ($info[<span class="stringliteral">&#39;local&#39;</span>]) {</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;            $local_patches[] = $info[<span class="stringliteral">&#39;url&#39;</span>];</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;            <span class="comment">// Use a local path for the PATCHES.txt file.</span></div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;            $pathinfo = pathinfo($patch_url);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;            $patch_url = $pathinfo[<span class="stringliteral">&#39;basename&#39;</span>];</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;          }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;          $patches_txt .= <span class="stringliteral">&#39;- &#39;</span> . $patch_url . <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;          <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;@name patched with @filename.&#39;</span>, $dt_args), <span class="stringliteral">&#39;ok&#39;</span>);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        }</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;          <a class="code" href="make_8utilities_8inc.html#aa2a78298291b42502718822ed5b59969">make_error</a>(<span class="stringliteral">&#39;PATCH_ERROR&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Unable to patch @name with @filename.&quot;</span>, $dt_args));</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;        }</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;        <a class="code" href="drush_8inc.html#a903c36790dbe5525fe9369c8476780af">drush_op</a>(<span class="stringliteral">&#39;unlink&#39;</span>, $filename);</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;      }</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;      <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;        <a class="code" href="make_8utilities_8inc.html#aa2a78298291b42502718822ed5b59969">make_error</a>(<span class="stringliteral">&#39;DOWNLOAD_ERROR&#39;</span>, <span class="stringliteral">&#39;Unable to download &#39;</span> . $info[<span class="stringliteral">&#39;url&#39;</span>] . <span class="charliteral">&#39;.&#39;</span>);</div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;      }</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    }</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    <span class="keywordflow">if</span> (!empty($patches_txt) &amp;&amp; !<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;no-patch-txt&#39;</span>) &amp;&amp; !file_exists($project_directory . <span class="stringliteral">&#39;/PATCHES.txt&#39;</span>)) {</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;      $patches_txt = <span class="stringliteral">&quot;The following patches have been applied to this project:\n&quot;</span> .</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;        $patches_txt .</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;        <span class="stringliteral">&quot;\nThis file was automatically generated by Drush Make (http://drupal.org/project/drush).&quot;</span>;</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;      file_put_contents($project_directory . <span class="stringliteral">&#39;/PATCHES.txt&#39;</span>, $patches_txt);</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;      <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<span class="stringliteral">&#39;Generated PATCHES.txt file for &#39;</span> . $this-&gt;name, <span class="stringliteral">&#39;ok&#39;</span>);</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;      <span class="comment">// Copy local patches into place.</span></div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;      <span class="keywordflow">foreach</span> ($local_patches as $url) {</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;        $pathinfo = pathinfo($url);</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;        <a class="code" href="group__filesystemfunctions.html#ga1d86ac8e2e56a75acb0abcdc8e0dcf09">drush_copy_dir</a>($url, $project_directory . <span class="charliteral">&#39;/&#39;</span> . $pathinfo[<span class="stringliteral">&#39;basename&#39;</span>]);</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;      }</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    }</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;  }</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;<span class="comment">   * Process info files when downloading things from git.</span></div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00343"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#ae64371ebab222251d13f492bb1bf7549">  343</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#ae64371ebab222251d13f492bb1bf7549">processGitInfoFiles</a>() {</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    <span class="comment">// Bail out if this isn&#39;t hosted on Drupal.org (unless --force-gitinfofile option was specified).</span></div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;    <span class="keywordflow">if</span> (!<a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;force-gitinfofile&#39;</span>, FALSE) &amp;&amp; isset($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;url&#39;</span>]) &amp;&amp; strpos($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;url&#39;</span>], <span class="stringliteral">&#39;drupal.org&#39;</span>) === FALSE) {</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;      <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;    }</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;</div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;    <span class="comment">// Figure out the proper version string to use based on the .make file.</span></div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;    <span class="comment">// Best case is the .make file author told us directly.</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;full_version&#39;</span>])) {</div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;      $full_version = $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;full_version&#39;</span>];</div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    }</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    <span class="comment">// Next best is if we have a tag, since those are identical to versions.</span></div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    elseif (!empty($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;tag&#39;</span>])) {</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;      $full_version = $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;tag&#39;</span>];</div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;    }</div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;    <span class="comment">// If we have a branch, append &#39;-dev&#39;.</span></div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;    elseif (!empty($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;branch&#39;</span>])) {</div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;      $full_version = $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;branch&#39;</span>] . <span class="stringliteral">&#39;-dev&#39;</span>;</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;    }</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    <span class="comment">// Ugh. Not sure what else we can do in this case.</span></div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;    elseif (!empty($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;revision&#39;</span>])) {</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;      $full_version = $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;revision&#39;</span>];</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;    }</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;    <span class="comment">// Probably can never reach this case.</span></div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;      $full_version = <span class="stringliteral">&#39;unknown&#39;</span>;</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;    }</div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;</div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;    <span class="comment">// If the version string ends in &#39;.x-dev&#39; do the Git magic to figure out</span></div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;    <span class="comment">// the appropriate &#39;rebuild version&#39; string, e.g. &#39;7.x-1.2+7-dev&#39;.</span></div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;    $matches = array();</div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;    <span class="keywordflow">if</span> (preg_match(<span class="stringliteral">&#39;/^(.+).x-dev$/&#39;</span>, $full_version, $matches)) {</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;      require_once dirname(__FILE__) . <span class="stringliteral">&#39;/../pm/package_handler/git_drupalorg.inc&#39;</span>;</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;      $rebuild_version = <a class="code" href="git__drupalorg_8inc.html#a258fb6515d2a1d8f92e54c4278acb4cb">drush_pm_git_drupalorg_compute_rebuild_version</a>($this-&gt;download_location, $matches[1]);</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;      <span class="keywordflow">if</span> ($rebuild_version) {</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;        $full_version = $rebuild_version;</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;      }</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;    }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;    require_once dirname(__FILE__) . <span class="stringliteral">&#39;/../pm/pm.drush.inc&#39;</span>;</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;    <a class="code" href="pm_8drush_8inc.html#ae5c95f9279eaddddd401970d1065c023">drush_pm_inject_info_file_metadata</a>($this-&gt;download_location, $this-&gt;name, $full_version);</div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;  }</div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;<span class="comment">   * Remove the .git directory from a project.</span></div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00388"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a79be6b5aafd3dd119b5928e2dd2a7096">  388</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a79be6b5aafd3dd119b5928e2dd2a7096">removeGitDirectory</a>() {</div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;    <span class="keywordflow">if</span> (isset($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>]) &amp;&amp; $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>] == <span class="stringliteral">&#39;git&#39;</span> &amp;&amp; file_exists($this-&gt;download_location . <span class="stringliteral">&#39;/.git&#39;</span>)) {</div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;      <a class="code" href="group__filesystemfunctions.html#gabff54c630a451976fc121257f6efd960">drush_delete_dir</a>($this-&gt;download_location . <span class="stringliteral">&#39;/.git&#39;</span>, TRUE);</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;    }</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;  }</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;<span class="comment">   * Add a lock file.</span></div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00397"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a5ea0e7fdb468e6b3c20ca7a5b2010966">  397</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a5ea0e7fdb468e6b3c20ca7a5b2010966">addLockfile</a>($project_directory) {</div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;lock)) {</div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;      file_put_contents($project_directory . <span class="stringliteral">&#39;/.drush-lock-update&#39;</span>, $this-&gt;lock);</div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;    }</div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;  }</div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;<span class="comment">   * Retrieve translations for this project.</span></div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00407"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#af6f9c98d13bb338237d8cc96566e59f8">  407</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#af6f9c98d13bb338237d8cc96566e59f8">getTranslations</a>($project_directory) {</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;    <span class="keyword">static</span> $cache = array();</div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;    $langcodes = $this-&gt;translations;</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    <span class="keywordflow">if</span> ($langcodes &amp;&amp; in_array($this-&gt;type, array(<span class="stringliteral">&#39;core&#39;</span>, <span class="stringliteral">&#39;module&#39;</span>, <span class="stringliteral">&#39;profile&#39;</span>, <span class="stringliteral">&#39;theme&#39;</span>), TRUE)) {</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;      <span class="comment">// Support the l10n_path, l10n_url keys from l10n_update. Note that the</span></div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;      <span class="comment">// l10n_server key is not supported.</span></div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;      <span class="keywordflow">if</span> (isset($this-&gt;l10n_path)) {</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;        $update_url = $this-&gt;l10n_path;</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;      }</div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;      <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;        <span class="keywordflow">if</span> (isset($this-&gt;l10n_url)) {</div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;          $l10n_server = $this-&gt;l10n_url;</div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;        }</div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;        <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;          $l10n_server = FALSE;</div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;        }</div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;        <span class="keywordflow">if</span> ($l10n_server) {</div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;          <span class="keywordflow">if</span> (!isset($cache[$l10n_server])) {</div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;            $this-&gt;<a class="code" href="classDrushMakeProject.html#a44714696c45b971da01dd29a529fd01b">preprocessLocalFileUrl</a>($l10n_server);</div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;            $l10n_server = $l10n_server[<span class="stringliteral">&#39;url&#39;</span>];</div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;            <span class="keywordflow">if</span> ($filename = <a class="code" href="make_8download_8inc.html#a6381bf72fa72152dd12f122dbca83d78">_make_download_file</a>($l10n_server)) {</div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;              $server_info = simplexml_load_string(file_get_contents($filename));</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;              $cache[$l10n_server] = !empty($server_info-&gt;update_url) ? $server_info-&gt;update_url : FALSE;</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;            }</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;          }</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;          <span class="keywordflow">if</span> ($cache[$l10n_server]) {</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;            $update_url = $cache[$l10n_server];</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;          }</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;          <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;            <a class="code" href="make_8utilities_8inc.html#aa2a78298291b42502718822ed5b59969">make_error</a>(<span class="stringliteral">&#39;XML_ERROR&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Could not retrieve l10n update url for !project.&quot;</span>, array(<span class="stringliteral">&#39;!project&#39;</span> =&gt; $project[<span class="stringliteral">&#39;name&#39;</span>])));</div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;            <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;          }</div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;        }</div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;      }</div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;      <span class="keywordflow">if</span> ($update_url) {</div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;        $failed = array();</div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;        <span class="keywordflow">foreach</span> ($langcodes as $langcode) {</div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;          $variables = array(</div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;            <span class="stringliteral">&#39;%project&#39;</span> =&gt; $this-&gt;name,</div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;            <span class="stringliteral">&#39;%release&#39;</span> =&gt; $this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;full_version&#39;</span>],</div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;            <span class="stringliteral">&#39;%core&#39;</span> =&gt; $this-&gt;core,</div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;            <span class="stringliteral">&#39;%language&#39;</span> =&gt; $langcode,</div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;            <span class="stringliteral">&#39;%filename&#39;</span> =&gt; <span class="stringliteral">&#39;%filename&#39;</span>,</div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;          );</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;          $url = strtr($update_url, $variables);</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;          <span class="comment">// Download the translation file.  Since its contents are volatile,</span></div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;          <span class="comment">// cache for only 4 hours.</span></div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;          <span class="keywordflow">if</span> ($filename = <a class="code" href="make_8download_8inc.html#a6381bf72fa72152dd12f122dbca83d78">_make_download_file</a>($url, 3600 * 4)) {</div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;            <span class="comment">// If this is the core project type, download the translation file</span></div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;            <span class="comment">// and place it in every profile and an additional copy in</span></div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;            <span class="comment">// modules/system/translations where it can be detected for import</span></div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;            <span class="comment">// by other non-default install profiles.</span></div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;            <span class="keywordflow">if</span> ($this-&gt;type === <span class="stringliteral">&#39;core&#39;</span>) {</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;              $profiles = <a class="code" href="group__filesystemfunctions.html#ga1c545390a8890f6ea47385f79fbe2e82">drush_scan_directory</a>($project_directory . <span class="stringliteral">&#39;/profiles&#39;</span>, <span class="stringliteral">&#39;/.*/&#39;</span>, array(), 0, FALSE, <span class="stringliteral">&#39;filename&#39;</span>, 0, TRUE);</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;              <span class="keywordflow">foreach</span> ($profiles as $profile) {</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;                <span class="keywordflow">if</span> (is_dir($project_directory . <span class="stringliteral">&#39;/profiles/&#39;</span> . $profile-&gt;basename)) {</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;                  <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($project_directory . <span class="stringliteral">&#39;/profiles/&#39;</span> . $profile-&gt;basename . <span class="stringliteral">&#39;/translations&#39;</span>);</div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;                  <a class="code" href="group__filesystemfunctions.html#ga1d86ac8e2e56a75acb0abcdc8e0dcf09">drush_copy_dir</a>($filename, $project_directory . <span class="stringliteral">&#39;/profiles/&#39;</span> . $profile-&gt;basename . <span class="stringliteral">&#39;/translations/&#39;</span> . $langcode . <span class="stringliteral">&#39;.po&#39;</span>);</div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;                }</div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;              }</div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;              <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($project_directory . <span class="stringliteral">&#39;/modules/system/translations&#39;</span>);</div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;              <a class="code" href="group__filesystemfunctions.html#ga1d86ac8e2e56a75acb0abcdc8e0dcf09">drush_copy_dir</a>($filename, $project_directory . <span class="stringliteral">&#39;/modules/system/translations/&#39;</span> . $langcode . <span class="stringliteral">&#39;.po&#39;</span>);</div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;            }</div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;            <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;              <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($project_directory . <span class="stringliteral">&#39;/translations&#39;</span>);</div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;              <a class="code" href="group__filesystemfunctions.html#ga1d86ac8e2e56a75acb0abcdc8e0dcf09">drush_copy_dir</a>($filename, $project_directory . <span class="stringliteral">&#39;/translations/&#39;</span> . $langcode . <span class="stringliteral">&#39;.po&#39;</span>, TRUE);</div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160;            }</div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;          }</div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;          <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;            $failed[] = $langcode;</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;          }</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;        }</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;        <span class="keywordflow">if</span> (empty($failed)) {</div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;          <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<span class="stringliteral">&#39;All translations downloaded for &#39;</span> . $this-&gt;name, <span class="stringliteral">&#39;ok&#39;</span>);</div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;        }</div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;        <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;          <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<span class="stringliteral">&#39;Unable to download translations for &#39;</span> . $this-&gt;name . <span class="stringliteral">&#39;: &#39;</span> . implode(<span class="stringliteral">&#39;, &#39;</span>, $failed), <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;        }</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;      }</div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;    }</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;  }</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;<span class="comment">   * Generate the proper path for this project type.</span></div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;<span class="comment">   * @param boolean $base</span></div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;<span class="comment">   *   Whether include the base part (tmp dir). Defaults to TRUE.</span></div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00497"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a825d48df1bdb0d0d0e46992e175909af">  497</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a825d48df1bdb0d0d0e46992e175909af">generatePath</a>($base = TRUE) {</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;    $path = array();</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;    <span class="keywordflow">if</span> ($base) {</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;      $path[] = <a class="code" href="make_8utilities_8inc.html#ab3c72a6d8be958f40fc0cbcca29a183b">make_tmp</a>();</div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;      $path[] = <span class="stringliteral">&#39;__build__&#39;</span>;</div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;    }</div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;contrib_destination)) {</div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;      $path[] = $this-&gt;contrib_destination;</div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;    }</div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;    <span class="keywordflow">if</span> (!empty($this-&gt;subdir)) {</div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;      $path[] = $this-&gt;subdir;</div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;    }</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;    <span class="keywordflow">return</span> implode(<span class="charliteral">&#39;/&#39;</span>, $path);</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;  }</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;<span class="comment">   * Return the proper path for dependencies to be placed in.</span></div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;<span class="comment">   *</span></div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;<span class="comment">   * @return string</span></div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;<span class="comment">   *   The path that dependencies will be placed in.</span></div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00518"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#aa52bc2ea2b9c76a9564d78e7af48452a">  518</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#aa52bc2ea2b9c76a9564d78e7af48452a">buildPath</a>($directory) {</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;    <span class="keywordflow">return</span> $this-&gt;base_contrib_destination;</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;  }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;<span class="comment">   * Recurse to process additional makefiles that may be found during</span></div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;<span class="comment">   * processing.</span></div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00526"></a><span class="lineno"><a class="code" href="classDrushMakeProject.html#a14e2e297d82eea0e5bd316255d092da8">  526</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject.html#a14e2e297d82eea0e5bd316255d092da8">recurse</a>($path) {</div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;    <span class="keywordflow">if</span> (!$this-&gt;do_recursion || <a class="code" href="context_8inc.html#afe91fb3e5219ecb2208c3b036b1f0cb8">drush_get_option</a>(<span class="stringliteral">&#39;no-recursion&#39;</span>)) {</div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;      <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Preventing recursive makefile parsing for !project&quot;</span>,</div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;                array(<span class="stringliteral">&quot;!project&quot;</span> =&gt; $this-&gt;name)), <span class="stringliteral">&#39;notice&#39;</span>);</div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;      <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;    }</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;    $makefile = $this-&gt;download_location . <span class="charliteral">&#39;/&#39;</span> . $this-&gt;name . <span class="stringliteral">&#39;.make&#39;</span>;</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;    <span class="keywordflow">if</span> (!file_exists($makefile)) {</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;      $makefile = $this-&gt;download_location . <span class="stringliteral">&#39;/drupal-org.make&#39;</span>;</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;      <span class="keywordflow">if</span> (!file_exists($makefile)) {</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;        <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;      }</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;    }</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;    <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&quot;Found makefile: !makefile&quot;</span>, array(<span class="stringliteral">&quot;!makefile&quot;</span> =&gt; basename($makefile))), <span class="stringliteral">&#39;ok&#39;</span>);</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;    <span class="comment">// Save the original state of the &#39;custom&#39; context.</span></div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;    $custom_context = &amp;<a class="code" href="context_8inc.html#ad25559f8d7d753f636fbeac347c29fc5">drush_get_context</a>(<span class="stringliteral">&#39;custom&#39;</span>);</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;    $original_custom_context_values = $custom_context;</div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;</div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;    $info = <a class="code" href="make_8utilities_8inc.html#ac0c5ebc3f3671b4fe5723088000791fa">make_parse_info_file</a>($makefile, TRUE, $this-&gt;options);</div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;    <span class="keywordflow">if</span> (!($info = <a class="code" href="make_8utilities_8inc.html#a6be8755a0ea68b9198e1e8cebbccff89">make_validate_info_file</a>($info))) {</div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;      $result = FALSE;</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;    }</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;      <span class="comment">// Inherit the translations specified in the extender makefile.</span></div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;      <span class="keywordflow">if</span> (!empty($this-&gt;translations)) {</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;        $info[<span class="stringliteral">&#39;translations&#39;</span>] = $this-&gt;translations;</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;      }</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;      <span class="comment">// Strip out any modules that have already been processed before this.</span></div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;      <span class="keywordflow">foreach</span> ($this-&gt;manifest as $name) {</div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;        unset($info[<span class="stringliteral">&#39;projects&#39;</span>][$name]);</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;      }</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;      $build_path = $this-&gt;<a class="code" href="classDrushMakeProject.html#aa52bc2ea2b9c76a9564d78e7af48452a">buildPath</a>($this-&gt;name);</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;      <a class="code" href="make_8drush_8inc.html#a7f6c382e030da87fc401f133edd22f3b">make_projects</a>(TRUE, trim($build_path, <span class="charliteral">&#39;/&#39;</span>), $info, $this-&gt;build_path, $this-&gt;download_location);</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;      <a class="code" href="make_8drush_8inc.html#ae70f3ae23a4dcbb5f8816636d2adb4c2">make_libraries</a>(TRUE, trim($build_path, <span class="charliteral">&#39;/&#39;</span>), $info, $this-&gt;build_path, $this-&gt;download_location);</div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;      $result = TRUE;</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;    }</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;    <span class="comment">// Restore original &#39;custom&#39; context so that any</span></div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;    <span class="comment">// settings changes made are used.</span></div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    $custom_context = $original_custom_context_values;</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;</div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;    <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;  }</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;}</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;<span class="comment"> * For processing Drupal core projects.</span></div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00574"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Core.html">  574</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Core.html">DrushMakeProject_Core</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;<span class="comment">   * Override constructor for core to adjust project info.</span></div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00578"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Core.html#a463cd38dd5917f7ad59724a33149aa71">  578</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Core.html#a463cd38dd5917f7ad59724a33149aa71">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;    <a class="code" href="classDrushMakeProject__Core.html#a463cd38dd5917f7ad59724a33149aa71">parent::__construct</a>($project);</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;    <span class="comment">// subdir and contrib_destination are not allowed for core.</span></div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;    $this-&gt;subdir = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;    $this-&gt;contrib_destination = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;  }</div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;<span class="comment">   * Determine the location to download project to.</span></div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00588"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Core.html#aeeeab034aff41fb288b7cd03cdab50db">  588</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Core.html#aeeeab034aff41fb288b7cd03cdab50db">findDownloadLocation</a>() {</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;    $this-&gt;path = $this-&gt;download_location = $this-&gt;<a class="code" href="classDrushMakeProject.html#a825d48df1bdb0d0d0e46992e175909af">generatePath</a>();</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;    $this-&gt;project_directory = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;    <span class="keywordflow">if</span> (is_dir($this-&gt;download_location)) {</div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;      <a class="code" href="group__errorhandling.html#ga23fe9e1e8c1e5ade39256106044b6da4">drush_set_error</a>(<span class="stringliteral">&#39;MAKE_DIRECTORY_EXISTS&#39;</span>, <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Directory not empty: !directory&#39;</span>, array(<span class="stringliteral">&#39;!directory&#39;</span> =&gt; $this-&gt;download_location)));</div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;      <span class="keywordflow">return</span> FALSE;</div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160;    }</div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;    elseif ($this-&gt;<a class="code" href="classDrushMakeProject.html#adc718e2716fac54db68234aabb432e49">download</a>[<span class="stringliteral">&#39;type&#39;</span>] === <span class="stringliteral">&#39;pm&#39;</span>) {</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;      <span class="comment">// pm-download will create the final __build__ directory, so nothing to do</span></div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;      <span class="comment">// here.</span></div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;    }</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;      <a class="code" href="group__filesystemfunctions.html#ga6027285d97028ad3299d3aa262be8c2f">drush_mkdir</a>($this-&gt;download_location);</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;    }</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="classDrushMakeProject.html#a43efbf973ece5fbab01fb59b80267e3e">$this-&gt;download_location</a>;</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;  }</div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;}</div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;<span class="comment"> * For processing libraries.</span></div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00609"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Library.html">  609</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Library.html">DrushMakeProject_Library</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;<span class="comment">   * Override constructor for libraries to properly set contrib destination.</span></div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00613"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Library.html#a7ed83f5275292b1f10310b1cd8a8731a">  613</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Library.html#a7ed83f5275292b1f10310b1cd8a8731a">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    <a class="code" href="classDrushMakeProject__Library.html#a7ed83f5275292b1f10310b1cd8a8731a">parent::__construct</a>($project);</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    <span class="comment">// Allow libraries to specify where they should live in the build path.</span></div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;    <span class="keywordflow">if</span> (isset($project[<span class="stringliteral">&#39;destination&#39;</span>])) {</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;      $project_path = $project[<span class="stringliteral">&#39;destination&#39;</span>];</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;    }</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;      $project_path = <span class="stringliteral">&#39;libraries&#39;</span>;</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;    }</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;</div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;    $this-&gt;contrib_destination = ($this-&gt;base_contrib_destination != <span class="charliteral">&#39;.&#39;</span> ? $this-&gt;base_contrib_destination . <span class="charliteral">&#39;/&#39;</span> : <span class="stringliteral">&#39;&#39;</span>) . $project_path;</div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;  }</div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;<span class="comment">   * No recursion for libraries, sorry :-(</span></div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00629"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Library.html#acaaade1f2104694fbd741384e6b26677">  629</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Library.html#acaaade1f2104694fbd741384e6b26677">recurse</a>($path) {</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;    <span class="comment">// Return TRUE so that processing continues in the make() method.</span></div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;  }</div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;<span class="comment">   * No translations for libraries.</span></div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00637"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Library.html#a448567dd70e40d8ff0c266af5370b8c5">  637</a></span>&#160;  <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Library.html#a448567dd70e40d8ff0c266af5370b8c5">getTranslations</a>(<a class="code" href="classDrushMakeProject.html#a43efbf973ece5fbab01fb59b80267e3e">$download_location</a>) {</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;    <span class="comment">// Return TRUE so that processing continues in the make() method.</span></div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;    <span class="keywordflow">return</span> TRUE;</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;  }</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;}</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;<span class="comment"> * For processing modules.</span></div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00646"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Module.html">  646</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Module.html">DrushMakeProject_Module</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;<span class="comment">   * Override constructor for modules to properly set contrib destination.</span></div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00650"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Module.html#ab61b1d4cc96eab3eae4fbdb020fe6257">  650</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Module.html#ab61b1d4cc96eab3eae4fbdb020fe6257">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;    <a class="code" href="classDrushMakeProject__Module.html#ab61b1d4cc96eab3eae4fbdb020fe6257">parent::__construct</a>($project);</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;    $this-&gt;contrib_destination = ($this-&gt;base_contrib_destination != <span class="charliteral">&#39;.&#39;</span> ? $this-&gt;base_contrib_destination . <span class="charliteral">&#39;/&#39;</span> : <span class="stringliteral">&#39;&#39;</span>) . <span class="stringliteral">&#39;modules&#39;</span>;</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;  }</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;}</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;<span class="comment"> * For processing installation profiles.</span></div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00659"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Profile.html">  659</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Profile.html">DrushMakeProject_Profile</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;<span class="comment">   * Override contructor for installation profiles to properly set contrib</span></div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;<span class="comment">   * destination.</span></div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00664"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Profile.html#a30277a454441c4f87953baca9acee2d6">  664</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Profile.html#a30277a454441c4f87953baca9acee2d6">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;    <a class="code" href="classDrushMakeProject__Profile.html#a30277a454441c4f87953baca9acee2d6">parent::__construct</a>($project);</div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;    $this-&gt;contrib_destination = (!empty($this-&gt;destination) ? $this-&gt;destination : <span class="stringliteral">&#39;profiles&#39;</span>);</div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;  }</div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;<span class="comment">   * Find the build path.</span></div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00672"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Profile.html#a5f672c7364dddda78f966897a33a86ae">  672</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Profile.html#a5f672c7364dddda78f966897a33a86ae">buildPath</a>($directory) {</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;    <span class="keywordflow">return</span> $this-&gt;<a class="code" href="classDrushMakeProject.html#a825d48df1bdb0d0d0e46992e175909af">generatePath</a>(FALSE) . <span class="charliteral">&#39;/&#39;</span> . $directory;</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;  }</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;}</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;<span class="comment"> * For processing themes.</span></div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00680"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Theme.html">  680</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Theme.html">DrushMakeProject_Theme</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;<span class="comment">   * Override contructor for themes to properly set contrib destination.</span></div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00684"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Theme.html#ac5d43e70207c544020f56f5f81fabbc9">  684</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Theme.html#ac5d43e70207c544020f56f5f81fabbc9">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;    <a class="code" href="classDrushMakeProject__Theme.html#ac5d43e70207c544020f56f5f81fabbc9">parent::__construct</a>($project);</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;    $this-&gt;contrib_destination = ($this-&gt;base_contrib_destination != <span class="charliteral">&#39;.&#39;</span> ? $this-&gt;base_contrib_destination . <span class="charliteral">&#39;/&#39;</span> : <span class="stringliteral">&#39;&#39;</span>) . <span class="stringliteral">&#39;themes&#39;</span>;</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;  }</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;}</div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;<span class="comment"> * For processing translations.</span></div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00693"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Translation.html">  693</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDrushMakeProject__Translation.html">DrushMakeProject_Translation</a> <span class="keyword">extends</span> <a class="code" href="classDrushMakeProject.html">DrushMakeProject</a> {<span class="comment"></span></div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;<span class="comment">  /**</span></div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;<span class="comment">   * Override constructor for translations to properly set contrib destination.</span></div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;<span class="comment">   */</span></div>
<div class="line"><a name="l00697"></a><span class="lineno"><a class="code" href="classDrushMakeProject__Translation.html#a944f226bec6ee1adf1aa96f59eb4b69c">  697</a></span>&#160;  <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDrushMakeProject__Translation.html#a944f226bec6ee1adf1aa96f59eb4b69c">__construct</a>(&amp;$project) {</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;    <a class="code" href="classDrushMakeProject__Translation.html#a944f226bec6ee1adf1aa96f59eb4b69c">parent::__construct</a>($project);</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;    <span class="keywordflow">switch</span> ($project[<span class="stringliteral">&#39;core&#39;</span>]) {</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;      <span class="keywordflow">case</span> <span class="stringliteral">&#39;5.x&#39;</span>:</div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;        <span class="comment">// Don&#39;t think there&#39;s an automatic place we can put 5.x translations,</span></div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;        <span class="comment">// so we&#39;ll toss them in a translations directory in the Drupal root.</span></div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;        $this-&gt;contrib_destination = ($this-&gt;base_contrib_destination != <span class="charliteral">&#39;.&#39;</span> ? $this-&gt;base_contrib_destination . <span class="charliteral">&#39;/&#39;</span> : <span class="stringliteral">&#39;&#39;</span>) . <span class="stringliteral">&#39;translations&#39;</span>;</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;      <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;        $this-&gt;contrib_destination = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;        <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;    }</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;  }</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 8 2014 09:04:54 for Drush by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>