78% adv-geoip-redirect

Code Review | Advanced GeoIP Redirect

WordPress plugin Advanced GeoIP Redirect scored 78% from 54 tests.

About plugin

  • Plugin page: adv-geoip-redirect
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.4
  • WordPress version: 5.9.2
  • First release: Apr 29, 2020
  • Latest release: Aug 13, 2020
  • Number of updates: 10
  • Update frequency: every 10.6 days
  • Top authors: sajjad67 (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

60+ active / 789 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.00MB] [CPU: ▼288.85ms] Passed 4 tests

Server-side resources used by Advanced GeoIP Redirect
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0552.67 ▲0.48
Dashboard /wp-admin3.43 ▲0.0338.14 ▲3.55
Posts /wp-admin/edit.php3.66 ▲0.0235.67 ▼1.13
Add New Post /wp-admin/post-new.php6.90 ▼0.0795.21 ▼1,156.40
Media Library /wp-admin/upload.php3.31 ▲0.0225.28 ▲1.66

Server storage [IO: ▲4.38MB] [DB: ▲0.00MB] Passed 3 tests

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 96 new files
Database: no new tables, 1 new option
New WordPress options
geoipr_redirect_options

Browser metrics Passed 4 tests

Checking browser requirements for Advanced GeoIP Redirect
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,790 ▲6815.84 ▼0.166.23 ▲0.662.39 ▼0.02
Dashboard /wp-admin2,897 ▲366.11 ▼0.05116.78 ▼13.38155.10 ▼5.11
Posts /wp-admin/edit.php2,690 ▲53.23 ▼0.0361.91 ▲0.75140.23 ▲0.02
Add New Post /wp-admin/post-new.php1,720 ▲8120.81 ▲0.84459.18 ▲33.05155.31 ▲9.94
Media Library /wp-admin/upload.php1,706 ▲55.47 ▼0.01135.14 ▼3.50190.97 ▲5.31
GeoIP Redirect /wp-admin/geoip-redirect.php260.940.0319.80

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 1 option in the database
    • geoipr_redirect_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 36× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'MaxMind\\WebService\\Http\\Request' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/Traits.php:105
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/Subdivision.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\AbstractModel' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Model/Country.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Exception/AddressNotFoundException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/Record/Continent.php:22
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/examples/benchmark.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'GeoIp2\\ProviderInterface' not found in wp-content/plugins/adv-geoip-redirect/includes/vendor/geoip2/geoip2/src/WebService/Client.php:44

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following browser errors
    • > GET request to /wp-admin/geoip-redirect.php
    • > Network (severe)
    wp-admin/geoip-redirect.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
4 plugin tags: redirect, wpml redirect, redirect visitor, redirect by country

adv-geoip-redirect/adv-geoip-redirect.php 92% from 13 tests

The main PHP script in "Advanced GeoIP Redirect" version 1.0.1 is automatically included on every request by WordPress
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 146 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin12,631 lines of code in 86 files:
LanguageFilesBlank linesComment linesLines of code
CSS31,03787,685
PHP648171,7662,933
Markdown73700875
C19718589
JSON600389
JavaScript2411980
Bourne Shell120040
m418032
C/C++ Header14128

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity7.35
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.89
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces13
Interfaces2
Traits0
Classes53
▷ Abstract classes35.66%
▷ Concrete classes5094.34%
▷ Final classes00.00%
Methods171
▷ Static methods2715.79%
▷ Public methods12472.51%
▷ Protected methods10.58%
▷ Private methods4626.90%
Functions10
▷ Named functions220.00%
▷ Anonymous functions880.00%
Constants21
▷ Global constants314.29%
▷ Class constants1885.71%
▷ Public constants18100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin