Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-Agent doesn't use composer.json as source #20

Open
ivan-section-io opened this issue Dec 12, 2016 · 0 comments
Open

User-Agent doesn't use composer.json as source #20

ivan-section-io opened this issue Dec 12, 2016 · 0 comments

Comments

@ivan-section-io
Copy link
Contributor

The hard-coded string used for the user-agent, is not always updated when it should be.
https://github.com/section-io/magento-metrics/blob/master/Helper/Aperture.php#L187

The user-agent shouldn't rely on a human updating source code to stay accurate.

Add something like:

$composerJson = file_get_contents(dirname(__FILE__) . "/../composer.json");
if ($composerJson === false) {
throw new Exception("Unable to read composer.json file!");
}
$composer = json_decode($composerJson);
if ($composer === null) {
throw new Exception("JSON parse error while reading composer.json!");
}
if (!isset($composer->version)) {
throw new Exception("Version field must be set in composer.json!");
}
$release = $composer->version;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant