Skip to content

Commit

Permalink
2.1.0 sentry sdk 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Höchtl committed Sep 1, 2021
1 parent a1db3f2 commit 840cec1
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 315 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.is_patched
/vendor
8 changes: 7 additions & 1 deletion Subscriber/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(ContainerInterface $container)
{
$this->pluginDirectory = $container->getParameter('od_sentry.plugin_dir');
// Hot fix the ClientBuilder of the sentry sdk if the SDK is not installed via composer but bundled in the plugin
if (class_exists('\PackageVersions\Versions') && !isset(Versions::VERSIONS['sentry/sdk']) && is_dir($this->pluginDirectory . '/vendor')) {
if (class_exists('\PackageVersions\Versions') && !isset(Versions::VERSIONS['sentry/sdk']) && is_dir($this->pluginDirectory . '/vendor') && !file_exists($this->pluginDirectory . '/.is_patched')) {
$composerLock = json_decode(file_get_contents($this->pluginDirectory . '/composer.lock'), true);
$sentryPackage = current(array_filter($composerLock['packages'], function(array $package) {
return $package['name'] === 'sentry/sentry';
Expand All @@ -56,11 +56,17 @@ public function __construct(ContainerInterface $container)
'PrettyVersions::getVersion(\'sentry/sentry\')->getPrettyVersion()',
"'" . $sentryVersion . "'"
);
$this->replaceFileContent(
$this->pluginDirectory . '/vendor/sentry/sentry/src/Client.php',
'PrettyVersions::getVersion(\'sentry/sentry\')->getPrettyVersion()',
"'" . $sentryVersion . "'"
);
$this->replaceFileContent(
$this->pluginDirectory . '/vendor/sentry/sentry/src/Event.php',
'PrettyVersions::getVersion(\'sentry/sentry\')->getPrettyVersion()',
"'" . $sentryVersion . "'"
);
touch($this->pluginDirectory . '/.is_patched');
}
// Use composer autoloader if dependencies are bundles within the plugin (non-composer mode)
if (file_exists($this->pluginDirectory . '/vendor/autoload.php')) {
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
}
],
"require": {
"composer/installers": "~1.6",
"sentry/sdk": "^2.0"
"composer/installers": "^2.0",
"sentry/sdk": "^3.0"
},
"config": {
"platform": {
"php": "7.2.0"
"php": "7.4.0"
}
},
"extra": {
Expand Down
Loading

0 comments on commit 840cec1

Please sign in to comment.