Skip to content

Commit 1d8bb52

Browse files
author
Benjamin Pick
committed
Merge branch 'develop' into js_event
2 parents 609b2eb + 80ccf63 commit 1d8bb52

File tree

12 files changed

+786
-711
lines changed

12 files changed

+786
-711
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
php: 7.2
4949
env: WP_VERSION=5.9.9 CF7_VERSION=v5.1.6 PHPUNIT_VERSION=^8.0
5050
- name: bleeding edge
51-
php: 8.2
51+
php: 8.3
5252
dist: jammy
5353
env: CF7_VERSION=master
5454
addons:
@@ -62,7 +62,7 @@ install:
6262
- composer show
6363
- nvm install 16 && nvm use 16
6464
- yarn install
65-
- git clone --depth=50 --branch=${CF7_VERSION} https://github.com/takayukister/contact-form-7.git
65+
- git clone --depth=50 --branch=${CF7_VERSION} https://github.com/rocklobster-in/contact-form-7
6666

6767
before_script:
6868
- mysql -u root -e "CREATE USER ${WP_DB_USER} IDENTIFIED BY '${WP_DB_PASS}';"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Tests: [![Build Status](https://api.travis-ci.org/yellowtree/geoip-detect.svg?br
88

99
* **Donate Link:** https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BSYUZHS8FH3CL
1010

11+
Provides geographic information detected by an IP adress.
12+
1113
## Description ##
1214

1315
Provides geographic information detected by an IP adress. This can be used in themes or other plugins, as a shortcode, or via CSS body classes. The city & country names are translated in different languages ([supported languages](https://dev.maxmind.com/geoip/geoip2/web-services/#Languages-8)).
@@ -171,6 +173,8 @@ If you use Maxmind "Automatic download" then you need to upgrade to this plugin
171173

172174
= 5.4.0 =
173175
* NEW: Infos can be added to a mail sent by WPForms (with Smart Tag `{geoip_detect2_user_info}`)
176+
* FIX: Remove Fatal Error on uninstall ("Undefined constand GEOIP_DETECT_DEBUG")
177+
* Library updates
174178

175179
= 5.3.2 =
176180
* FIX: Some country codes such as "PT" were missing in the (deprecated) legacy API mapping.

data-sources/auto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected function download_url($url, $modified = 0) {
155155
$headers['If-Modified-Since'] = date('r', $modified);
156156
}
157157

158-
$response = wp_safe_remote_get( $url, [ 'timeout' => 300, 'stream' => true, 'filename' => $tmpfname, 'headers' => $headers ] );
158+
$response = wp_safe_remote_get( $url, [ 'timeout' => 300, 'stream' => true, 'filename' => $tmpfname, 'headers' => $headers, 'redirection' => 5 ] );
159159
$http_response_code = wp_remote_retrieve_response_code( $response );
160160
if (304 === $http_response_code) {
161161
return new \WP_Error( 'http_304', __('It has not changed since the last update.', 'geoip-detect') );

geoip-detect.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Description: Provides geographic information detected by an IP adress.
66
Author: Yellow Tree (Benjamin Pick)
77
Author URI: http://www.yellowtree.de
8-
Version: 5.4.0-beta2
8+
Version: 5.4.0
99
License: GPLv3 or later
1010
License URI: http://www.gnu.org/licenses/gpl-3.0.html
1111
Text Domain: geoip-detect
@@ -16,7 +16,7 @@
1616
Requires PHP: 7.2.5
1717
*/
1818

19-
define('GEOIP_DETECT_VERSION', '5.4.0-beta2');
19+
define('GEOIP_DETECT_VERSION', '5.4.0');
2020

2121
/*
2222
Copyright 2013-2023 Yellow Tree, Siegen, Germany
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
sphinx_rtd_theme
22
sphinx>=3.0.4 # not directly required, pinned by Snyk to avoid a vulnerability
33
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
4+
requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability
5+
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
},
2121
"private": false,
2222
"dependencies": {
23-
"@babel/runtime": "7.24.4",
23+
"@babel/runtime": "7.24.7",
2424
"emoji-flags": "1.3.0",
2525
"just-compare": "2.3.0",
2626
"just-intersect": "4.3.0",
2727
"just-safe-get": "4.2.0",
2828
"just-safe-set": "4.2.1"
2929
},
3030
"devDependencies": {
31-
"@babel/core": "7.24.4",
32-
"@babel/plugin-transform-runtime": "7.24.3",
33-
"@babel/preset-env": "7.24.4",
31+
"@babel/core": "7.24.7",
32+
"@babel/plugin-transform-runtime": "7.24.7",
33+
"@babel/preset-env": "7.24.7",
3434
"babel-jest": "29.7.0",
3535
"babel-plugin-transform-class-properties": "6.24.1",
36-
"eslint": "8.55.0",
36+
"eslint": "8.57.0",
3737
"jest": "29.7.0",
3838
"jest-environment-jsdom": "^29.4.2",
3939
"parcel": "2.9.3"

readme.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
Contributors: benjaminpick
33
Tags: geolocation, locator, geoip, maxmind, ipstack
44
Requires at least: 5.0
5-
Tested up to: 6.4
5+
Tested up to: 6.6
66
Requires PHP: 7.2
7-
Stable tag: 5.3.2
7+
Stable tag: 5.4.0
88
License: GPLv3 or later
99
License URI: http://www.gnu.org/licenses/gpl-3.0.html
1010
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BSYUZHS8FH3CL
1111

12+
Provides geographic information detected by an IP adress.
13+
1214
== Description ==
1315

1416
Provides geographic information detected by an IP adress. This can be used in themes or other plugins, as a shortcode, or via CSS body classes. The city & country names are translated in different languages ([supported languages](https://dev.maxmind.com/geoip/geoip2/web-services/#Languages-8)).

tests/GeoLite2-Country.mmdb.tar.gz

1.53 MB
Binary file not shown.

tests/test-updater.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ class UpdateTest extends WP_UnitTestCase_GeoIP_Detect {
55
function set_up() {
66
parent::set_up();
77

8-
add_filter('pre_option_geoip-detect-auto_license_key', [ $this, 'filter_set_user_secret' ], 101);
9-
108
// unlink uploads file if exists
119
if (function_exists('geoip_detect_get_database_upload_filename')) {
1210
$filename = geoip_detect_get_database_upload_filename();
@@ -17,10 +15,16 @@ function set_up() {
1715

1816
function tear_down() {
1917
remove_filter('pre_option_geoip-detect-auto_license_key', [ $this, 'filter_set_user_secret' ], 101);
18+
remove_filter('pre_option_geoip-detect-auto_license_key', [ $this, 'filter_set_invalid_user_secret' ], 100);
19+
remove_filter('geoip_detect2_download_url', [ $this, 'filter_set_test_file' ], 101);
2020

2121
parent::tear_down();
2222
}
2323

24+
function filter_set_invalid_user_secret() {
25+
return 'bla';
26+
}
27+
2428
function filter_set_user_secret() {
2529
$id = getenv('WP_MAXMIND_USER_SECRET');
2630
if ($id)
@@ -30,11 +34,21 @@ function filter_set_user_secret() {
3034
return 'asdfsadf';
3135
}
3236
}
37+
38+
function filter_set_test_file() {
39+
// Yes, use http instead of https to test redirect
40+
return 'http://github.com/yellowtree/geoip-detect/raw/develop/tests/GeoLite2-Country.mmdb.tar.gz';
41+
}
3342

3443
/**
3544
* @group external-http
3645
*/
3746
function testUpdate() {
47+
add_filter('pre_option_geoip-detect-auto_license_key', [ $this, 'filter_set_user_secret' ], 101);
48+
$this->assertUpdateWorks();
49+
}
50+
51+
function assertUpdateWorks() {
3852
$s = new \YellowTree\GeoipDetect\DataSources\Auto\AutoDataSource();
3953

4054
$this->assertTrue( $s->maxmindUpdate(true) );
@@ -43,4 +57,18 @@ function testUpdate() {
4357
$record = geoip_detect2_get_info_from_ip(GEOIP_DETECT_TEST_IP);
4458
$this->assertValidGeoIP2Record($record, GEOIP_DETECT_TEST_IP);
4559
}
60+
61+
/**
62+
* @group external-http
63+
*/
64+
function testUpdateWithTestFile() {
65+
add_filter('pre_option_geoip-detect-auto_license_key', [ $this, 'filter_set_invalid_user_secret' ], 100);
66+
add_filter('geoip_detect2_download_url', [ $this, 'filter_set_test_file' ], 101);
67+
$this->assertUpdateWorks();
68+
}
69+
70+
function testUrlConsideredSafe() {
71+
$url = 'https://mm-prod-geoip-databases.a2649acb697e2c09b632799562c076f2.r2.cloudflarestorage.com/bla.tar.gz';
72+
$this->assertSame(wp_http_validate_url($url), $url, 'URL ' . $url . ' is not considered safe by wordpress, update of Maxmind data will fail');
73+
}
4674
}

vendor/composer/autoload_real.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public static function getLoader()
2222
return self::$loader;
2323
}
2424

25+
require __DIR__ . '/platform_check.php';
26+
2527
spl_autoload_register(array('ComposerAutoloaderInit18fc54d84025f2e5d2b2ac2dd487f107', 'loadClassLoader'), true, true);
2628
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
2729
spl_autoload_unregister(array('ComposerAutoloaderInit18fc54d84025f2e5d2b2ac2dd487f107', 'loadClassLoader'));

0 commit comments

Comments
 (0)