Skip to content

Commit

Permalink
Merge branch '1.0' into 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Jul 26, 2018
2 parents ed08c18 + 0618b7a commit 063ebea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ composer require bringyourownideas/silverstripe-composer-update-checker ^1
php ./framework/cli-script.php dev/build flush=1
php ./framework/cli-script.php dev/tasks/UpdatePackageInfoTask
```

## Note for private repositories

Please note that if your project has modules that are stored in private repositories, the server running the BuildTask
will need to have the necessary permissions to access the private VCS repositories in order for the report to include
update information about necessary updates to the module.

If the process looking for available updates fails (for example, due to an authentication failure against a private
repository) the process will fail gracefully and allow the rest of the report generation to continue.

Users on the [Common Web Platform](https://cwp.govt.nz) will currently not be able to retrieve information about
updates to private repositories.

## Documentation

Please see the user guide section of the [SilverStripe Maintenance module](https://github.com/bringyourownideas/silverstripe-maintenance/tree/1/docs/en/userguide).
Expand Down
17 changes: 14 additions & 3 deletions src/Extensions/CheckComposerUpdatesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use BringYourOwnIdeas\UpdateChecker\UpdateChecker;
use Config;
use Extension;
use RuntimeException;
use SS_Log;
use UpdatePackageInfoTask;

/**
Expand Down Expand Up @@ -51,9 +53,18 @@ public function updatePackageInfo(array &$installedPackageList)
}
$packageData = $composerPackagesAndConstraints[$packageName];

// Check for a relevant update version to recommend returned as keyed array and add to existing package
// details array
$updates = $this->getUpdateChecker()->checkForUpdates($packageData['package'], $packageData['constraint']);
try {
// Check for a relevant update version to recommend returned as keyed array and add to existing package
// details array
$updates = $this->getUpdateChecker()
->checkForUpdates($packageData['package'], $packageData['constraint']);
} catch (RuntimeException $ex) {
// If exceptions are thrown during execution, fail gracefully and allow the rest of the report
// generation to continue
$updates = [];
SS_Log::log($ex->getMessage(), SS_Log::WARN);
}

$installedPackage = array_merge($installedPackage, $updates);
}
}
Expand Down

0 comments on commit 063ebea

Please sign in to comment.