From 001cb3598f4432848b8f489974737da93612a3fc Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Mon, 24 Sep 2018 16:58:38 +0300 Subject: [PATCH] Define system requirements (bcmath or gmp PHP extention) Fixes #5 --- Plugin.php | 15 +++++++++++++++ README.md | 1 + 2 files changed, 16 insertions(+) diff --git a/Plugin.php b/Plugin.php index 1fb47ab..36157b3 100644 --- a/Plugin.php +++ b/Plugin.php @@ -139,6 +139,21 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi return array(); } + /** + * Returns plugin's system requirements + * + * @return type + */ + public static function getSystemRequirements() + { + if (extension_loaded('gmp')) { + return array('ext-gmp' => '*'); + } + else { + return array('ext-bcmath' => '*'); + } + } + /** * Format locale name using "xx-XX" format. * diff --git a/README.md b/README.md index cac562f..9db811e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Provides Geo IP information for other plugins. +*Requires either [GMP (GNU Multiple Precision)](http://php.net/manual/en/book.gmp.php) or [BC Math (BCMath Arbitrary Precision Mathematics)](http://php.net/manual/en/book.bc.php) PHP extension.* ## Installation