You are here

function hackedProject::compute_differences in Hacked! 8.2

Compute the differences between our version and the canonical version of the project.

1 call to hackedProject::compute_differences()
hackedProject::compute_report in src/hackedProject.php
Return a nice report, a simple overview of the status of this project.

File

src/hackedProject.php, line 246

Class

hackedProject
Encapsulates a Hacked! project.

Namespace

Drupal\hacked

Code

function compute_differences() {

  // Make sure we've hashed both remote and local files.
  $this
    ->hash_remote_project();
  $this
    ->hash_local_project();
  $results = [
    'same' => [],
    'different' => [],
    'missing' => [],
    'access_denied' => [],
  ];

  // Now compare the two file groups.
  foreach ($this->remote_files->files as $file) {
    if ($this->remote_files->files_hashes[$file] == $this->local_files->files_hashes[$file]) {
      $results['same'][] = $file;
    }
    elseif (!$this->local_files
      ->file_exists($file)) {
      $results['missing'][] = $file;
    }
    elseif (!$this->local_files
      ->is_readable($file)) {
      $results['access_denied'][] = $file;
    }
    else {
      $results['different'][] = $file;
    }
  }
  $this->result = $results;
}