You are here

function hacked_reports_hacked_diff in Hacked! 6

Same name and namespace in other branches
  1. 5 hacked.diff.inc \hacked_reports_hacked_diff()
  2. 6.2 hacked.diff.inc \hacked_reports_hacked_diff()
  3. 7.2 hacked.diff.inc \hacked_reports_hacked_diff()
1 string reference to 'hacked_reports_hacked_diff'
hacked_menu in ./hacked.module
Implementation of hook_menu().

File

./hacked.diff.inc, line 4

Code

function hacked_reports_hacked_diff($project, $file) {
  if (!module_exists('diff')) {
    return t('The diff module is required to use this feature.');
  }

  // Find a better way to do this:
  $breadcrumb = array(
    l('Home', '<front>'),
    l('Administer', 'admin'),
    l('Reports', 'admin/reports'),
    l('Hacked', 'admin/reports/hacked'),
    l($project['title'], 'admin/reports/hacked/' . $project['short_name']),
  );
  drupal_set_breadcrumb($breadcrumb);
  $local_file = hacked_find_local_project_directory($project) . '/' . $file;
  $this_release = $project['releases'][$project['existing_version']];

  // Let's see if there's a download link:
  $dir = hacked_download_release($this_release['download_link'], $project['project_type'], $project['short_name'], $project['existing_version']);

  // Special handling for core:
  if ($project['project_type'] == 'core') {
    $original_file = $dir . '/' . $project['short_name'] . '-' . $project['existing_version'] . '/' . $file;
  }
  else {
    $original_file = $dir . '/' . $project['short_name'] . '/' . $file;
  }
  if (!hacked_file_is_binary($original_file) && !hacked_file_is_binary($local_file)) {
    return hacked_diff_changed($local_file, $original_file);
  }

  //
  return t('Cannot hash binary file or file not found: %file', array(
    '%file' => $file,
  ));
}