You are here

function hackedProjectWebDownloader::get_destination in Hacked! 7.2

Same name and namespace in other branches
  1. 6.2 includes/hacked_project.inc \hackedProjectWebDownloader::get_destination()

Returns a directory to save the downloaded project into.

4 calls to hackedProjectWebDownloader::get_destination()
hackedProjectWebDevDownloader::download in includes/hackedProjectWebDevDownloader.inc
Download the version of the project to compare.
hackedProjectWebDevDownloader::get_final_destination in includes/hackedProjectWebDevDownloader.inc
Returns the final destination of the unpacked project.
hackedProjectWebDownloader::get_final_destination in includes/hackedProjectWebDownloader.inc
Returns the final destination of the unpacked project.
hackedProjectWebFilesDownloader::download in includes/hackedProjectWebFilesDownloader.inc
Download the remote files to the local filesystem.

File

includes/hackedProjectWebDownloader.inc, line 42

Class

hackedProjectWebDownloader
Base class for downloading remote versions of projects.

Code

function get_destination() {
  $type = $this->project->project_type;
  $name = $this->project->name;
  $version = $this->project->existing_version;
  $dir = $this
    ->get_temp_directory() . "/{$type}/{$name}";

  // Build the destination folder tree if it doesn't already exists.
  if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY) && !mkdir($dir, 0775, TRUE)) {
    watchdog('hacked', 'Failed to create temp directory: %dir', array(
      '%dir' => $dir,
    ), WATCHDOG_ERROR);
    return FALSE;
  }
  return "{$dir}/{$version}";
}