Compare commits

...

8 Commits

5 changed files with 42 additions and 22 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# Do not index node.js modules that are used for building
node_modules
package-lock.json
# Do not index composer components
vendor

View File

@ -103,11 +103,11 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
: $record->city->name;
return array(
'country_name' => $country_name,
'country_code' => $record->country->isoCode,
'city' => $city,
'latitude' => $record->location->latitude,
'longitude' => $record->location->longitude,
'country_name' => $country_name ?: 'Unknown',
'country_code' => $record->country->isoCode ?: false,
'city' => $city ?: 'Unknown',
'latitude' => $record->location->latitude ?: 0,
'longitude' => $record->location->longitude ?: 0,
);
}
@ -126,7 +126,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
*/
public static function getVersion()
{
return '1.0.0';
return '1.0.2';
}
/**
@ -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.
*

View File

@ -2,10 +2,11 @@
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
1. Get the archive with the plugin sources. At the moment the only option is to build the plugin from sources.
1. Get the archive with the plugin sources. You can download it from the [official site](https://mibew.org/plugins#mibew-geoip) or build the plugin from sources.
2. Untar/unzip the plugin's archive.

View File

@ -9,6 +9,11 @@ var fs = require('fs'),
gzip = require('gulp-gzip'),
rename = require('gulp-rename');
var config = {
getComposerUrl: 'https://getcomposer.org/installer',
phpBin: 'php -d "suhosin.executor.include.whitelist = phar" -d "memory_limit=512M"'
}
// Get and install PHP Composer
gulp.task('get-composer', function(callback) {
// Check if Composer already in place
@ -19,9 +24,9 @@ gulp.task('get-composer', function(callback) {
}
// Get installer from the internet
https.get('https://getcomposer.org/installer', function(response) {
https.get(config.getComposerUrl, function(response) {
// Run PHP to install Composer
var php = exec('php', function(error, stdout, stderr) {
var php = exec(config.phpBin, function(error, stdout, stderr) {
callback(error ? stderr : null);
});
// Pass installer code to PHP via STDIN
@ -30,13 +35,13 @@ gulp.task('get-composer', function(callback) {
});
// Install Composer dependencies
gulp.task('composer-install', ['get-composer'], function(callback) {
exec('php -d "suhosin.executor.include.whitelist = phar" composer.phar install --no-dev', function(error, stdout, stderr) {
gulp.task('composer-install', gulp.series('get-composer', function(callback) {
exec(config.phpBin + ' composer.phar install --no-dev', function(error, stdout, stderr) {
callback(error ? stderr : null);
});
});
}));
gulp.task('prepare-release', ['composer-install'], function() {
gulp.task('prepare-release', gulp.series('composer-install', function() {
var version = require('./package.json').version;
return eventStream.merge(
@ -48,12 +53,10 @@ gulp.task('prepare-release', ['composer-install'], function() {
)
.pipe(chmod(0644))
.pipe(gulp.dest('release'));
});
}));
// Builds and packs plugins sources
gulp.task('default', ['prepare-release'], function() {
// The "default" task is just an alias for "prepare-release" task.
});
gulp.task('default', gulp.series('prepare-release'));
/**
* Returns files stream with the plugin sources.

View File

@ -1,12 +1,12 @@
{
"version": "1.0.0",
"version": "1.0.2",
"devDependencies": {
"gulp": "~3.8.10",
"gulp": "^4.0.0",
"event-stream": "~3.1.7",
"gulp-zip": "~2.0.2",
"gulp-tar": "~1.3.1",
"gulp-tar": "~3.1.0",
"gulp-gzip": "~0.0.8",
"gulp-chmod": "~1.2.0",
"gulp-chmod": "~3.0.0",
"gulp-rename": "~1.2.0"
}
}
}