diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a725465 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vendor/ \ No newline at end of file diff --git a/composer.json b/composer.json index 7cfeb8c..904dd7d 100644 --- a/composer.json +++ b/composer.json @@ -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": [ @@ -16,4 +17,4 @@ "autoload": { "files": ["wup-client.php"] } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..3f3aa86 --- /dev/null +++ b/composer.lock @@ -0,0 +1,82 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "505c37061316a34ee8b0db1cd5de8d89", + "packages": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.3.3 || ^7.0" + }, + "platform-dev": [] +} diff --git a/lib/wup-client.php b/lib/wup-client.php index 3a00c4d..a56dcff 100644 --- a/lib/wup-client.php +++ b/lib/wup-client.php @@ -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); }