mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 11:27:24 +08:00
improve plugin checkMainApplicationVersion
This commit is contained in:
@@ -38,7 +38,7 @@ class Plugin extends Command
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
$mainClass->checkMainApplicationVersion();
|
||||
$mainClass->checkMainApplicationVersion(false);
|
||||
} catch (\Exception $exception) {
|
||||
$this->error($exception->getMessage());
|
||||
return 1;
|
||||
|
||||
Generated
+30
-29
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "52be7484aaea27bc7c5e7a9713f9e965",
|
||||
"content-hash": "784dd3fb3491bc979f55e3014d9010ae",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anourvalar/eloquent-serialize",
|
||||
@@ -2786,16 +2786,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v12.12.0",
|
||||
"version": "v12.14.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "8f6cd73696068c28f30f5964556ec9d14e5d90d7"
|
||||
"reference": "84b142958d1638a7e89de94ce75c2821c601d3d7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/8f6cd73696068c28f30f5964556ec9d14e5d90d7",
|
||||
"reference": "8f6cd73696068c28f30f5964556ec9d14e5d90d7",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/84b142958d1638a7e89de94ce75c2821c601d3d7",
|
||||
"reference": "84b142958d1638a7e89de94ce75c2821c601d3d7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2816,7 +2816,7 @@
|
||||
"guzzlehttp/uri-template": "^1.0",
|
||||
"laravel/prompts": "^0.3.0",
|
||||
"laravel/serializable-closure": "^1.3|^2.0",
|
||||
"league/commonmark": "^2.6",
|
||||
"league/commonmark": "^2.7",
|
||||
"league/flysystem": "^3.25.1",
|
||||
"league/flysystem-local": "^3.25.1",
|
||||
"league/uri": "^7.5.1",
|
||||
@@ -2908,7 +2908,7 @@
|
||||
"php-http/discovery": "^1.15",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpunit/phpunit": "^10.5.35|^11.5.3|^12.0.1",
|
||||
"predis/predis": "^2.3",
|
||||
"predis/predis": "^2.3|^3.0",
|
||||
"resend/resend-php": "^0.10.0",
|
||||
"symfony/cache": "^7.2.0",
|
||||
"symfony/http-client": "^7.2.0",
|
||||
@@ -2940,7 +2940,7 @@
|
||||
"pda/pheanstalk": "Required to use the beanstalk queue driver (^5.0).",
|
||||
"php-http/discovery": "Required to use PSR-7 bridging features (^1.15).",
|
||||
"phpunit/phpunit": "Required to use assertions and run tests (^10.5.35|^11.5.3|^12.0.1).",
|
||||
"predis/predis": "Required to use the predis connector (^2.3).",
|
||||
"predis/predis": "Required to use the predis connector (^2.3|^3.0).",
|
||||
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
|
||||
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
|
||||
"resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0).",
|
||||
@@ -2997,7 +2997,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2025-05-01T16:13:12+00:00"
|
||||
"time": "2025-05-13T17:50:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/horizon",
|
||||
@@ -3544,16 +3544,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/commonmark",
|
||||
"version": "2.6.2",
|
||||
"version": "2.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/commonmark.git",
|
||||
"reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94"
|
||||
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/06c3b0bf2540338094575612f4a1778d0d2d5e94",
|
||||
"reference": "06c3b0bf2540338094575612f4a1778d0d2d5e94",
|
||||
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
|
||||
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3590,7 +3590,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.7-dev"
|
||||
"dev-main": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3647,7 +3647,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-04-18T21:09:27+00:00"
|
||||
"time": "2025-05-05T12:20:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/config",
|
||||
@@ -5116,31 +5116,31 @@
|
||||
},
|
||||
{
|
||||
"name": "nunomaduro/termwind",
|
||||
"version": "v2.3.0",
|
||||
"version": "v2.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nunomaduro/termwind.git",
|
||||
"reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda"
|
||||
"reference": "dfa08f390e509967a15c22493dc0bac5733d9123"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nunomaduro/termwind/zipball/52915afe6a1044e8b9cee1bcff836fb63acf9cda",
|
||||
"reference": "52915afe6a1044e8b9cee1bcff836fb63acf9cda",
|
||||
"url": "https://api.github.com/repos/nunomaduro/termwind/zipball/dfa08f390e509967a15c22493dc0bac5733d9123",
|
||||
"reference": "dfa08f390e509967a15c22493dc0bac5733d9123",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": "^8.2",
|
||||
"symfony/console": "^7.1.8"
|
||||
"symfony/console": "^7.2.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/console": "^11.33.2",
|
||||
"laravel/pint": "^1.18.2",
|
||||
"illuminate/console": "^11.44.7",
|
||||
"laravel/pint": "^1.22.0",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"pestphp/pest": "^2.36.0",
|
||||
"phpstan/phpstan": "^1.12.11",
|
||||
"phpstan/phpstan-strict-rules": "^1.6.1",
|
||||
"symfony/var-dumper": "^7.1.8",
|
||||
"pestphp/pest": "^2.36.0 || ^3.8.2",
|
||||
"phpstan/phpstan": "^1.12.25",
|
||||
"phpstan/phpstan-strict-rules": "^1.6.2",
|
||||
"symfony/var-dumper": "^7.2.6",
|
||||
"thecodingmachine/phpstan-strict-rules": "^1.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
@@ -5183,7 +5183,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nunomaduro/termwind/issues",
|
||||
"source": "https://github.com/nunomaduro/termwind/tree/v2.3.0"
|
||||
"source": "https://github.com/nunomaduro/termwind/tree/v2.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5199,7 +5199,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-21T10:39:51+00:00"
|
||||
"time": "2025-05-08T08:14:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nyholm/psr7",
|
||||
@@ -12886,7 +12886,8 @@
|
||||
"ext-redis": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-zend-opcache": "*",
|
||||
"ext-zip": "*"
|
||||
"ext-zip": "*",
|
||||
"ext-sqlite3": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
|
||||
@@ -25,15 +25,24 @@ abstract class BasePlugin extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
public function checkMainApplicationVersion()
|
||||
public static function checkMainApplicationVersion($silent = true): bool
|
||||
{
|
||||
$constantName = "static::COMPATIBLE_NP_VERSION";
|
||||
if (defined($constantName) && version_compare(VERSION_NUMBER, constant($constantName), '<')) {
|
||||
throw new \RuntimeException(sprintf(
|
||||
"NexusPHP version: %s is too low, this plugin require: %s",
|
||||
VERSION_NUMBER, constant($constantName)
|
||||
));
|
||||
$constantNameArr = [
|
||||
"static::COMPATIBLE_NP_VERSION",
|
||||
"static::COMPATIBLE_VERSION", //before use
|
||||
];
|
||||
foreach ($constantNameArr as $constantName) {
|
||||
if (defined($constantName) && version_compare(VERSION_NUMBER, constant($constantName), '<')) {
|
||||
if ($silent) {
|
||||
return false;
|
||||
}
|
||||
throw new \RuntimeException(sprintf(
|
||||
"NexusPHP version: %s is too low, this plugin require: %s",
|
||||
VERSION_NUMBER, constant($constantName)
|
||||
));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getNexusView($name): string
|
||||
|
||||
@@ -65,6 +65,7 @@ class Plugin
|
||||
if (class_exists($className)) {
|
||||
$constantName = "$className::COMPATIBLE_NP_VERSION";
|
||||
if (defined($constantName) && version_compare(VERSION_NUMBER, constant($constantName), '<')) {
|
||||
do_log(sprintf("class: %s require NP_VERSION: %s > current: %s", $className, constant($constantName), VERSION_NUMBER), "error");
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user