Skip to content

Commit

Permalink
use composer/semver to ensure version is newer before advertising it …
Browse files Browse the repository at this point in the history
…to users
  • Loading branch information
Arcath committed Jun 21, 2018
1 parent 2bbb4f3 commit 5873b63
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "ed-itsolutions/wup-client",
"description": "WordPress Update Provider client for use in plugins / themes.",
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^5.3.3 || ^7.0",
"composer/semver": "^1.4"
},
"license": "MIT",
"authors": [
Expand All @@ -16,4 +17,4 @@
"autoload": {
"files": ["wup-client.php"]
}
}
}
82 changes: 82 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/wup-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function injectUpdate($updates){
&&
!empty($state->wupVersion)
&&
$state->wupVersion != $state->localVersion
Composer\Semver\Comparator::greaterThan($state->wupVersion, $state->localVersion)
){
$updates->response[$this->updateResponseKey()] = $this->updateResponse($state);
}
Expand Down

0 comments on commit 5873b63

Please sign in to comment.