78% wp-spatial-capabilities-check

Code Review | WP Spatial Capabilities Check

WordPress plugin WP Spatial Capabilities Check scored78%from 54 tests.

About plugin

  • Plugin page: wp-spatial-capabi...
  • Plugin version: 0.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.7.2
  • WordPress version: 6.3.1
  • First release: Jun 15, 2016
  • Latest release: Mar 4, 2017
  • Number of updates: 11
  • Update frequency: every 24.3 days
  • Top authors: stuporglue (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,023 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.54ms] Passed 4 tests

An overview of server-side resources used by WP Spatial Capabilities Check
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0238.18 ▼0.22
Dashboard /wp-admin3.32 ▲0.0245.95 ▼2.90
Posts /wp-admin/edit.php3.37 ▲0.0248.13 ▲3.35
Add New Post /wp-admin/post-new.php5.90 ▲0.0291.98 ▼11.52
Media Library /wp-admin/upload.php3.24 ▲0.0233.05 ▼3.53
Spatial Capabilites /wp-admin/tools.php?page=spatial-capabilites3.55193.82

Server storage [IO: ▲2.06MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 123 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
can_compress_scripts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Spatial Capabilities Check
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4713.65 ▼0.631.73 ▼0.3044.75 ▼4.16
Dashboard /wp-admin2,210 ▲195.83 ▼0.05100.99 ▲1.0338.74 ▼5.03
Posts /wp-admin/edit.php2,093 ▲42.04 ▲0.0340.21 ▲0.7736.56 ▲2.54
Add New Post /wp-admin/post-new.php1,522 ▼1123.26 ▼0.01585.09 ▼55.6765.73 ▲12.25
Media Library /wp-admin/upload.php1,386 ▼24.24 ▲0.0498.76 ▼4.2441.81 ▼2.01
Spatial Capabilites /wp-admin/tools.php?page=spatial-capabilites1,6772.0524.6536.06

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 20× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/wp-geometa-lib.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/wp-geometa-lib-loader.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/LoadDataTest.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/UnloadDataTest.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/wp-geoquery.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/geoPHP/tests/postgis.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/QueryOrderByTest.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/PopulateTable.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/TablesCreatedTest.php
    • > /wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/LoadLatLng.php
  • 262× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (24) made by wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (77) made by require('/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/UnloadDataTest.php'), wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta
    • > PHP Fatal error
      Uncaught Error: Class 'WKT' not found in wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/geoPHP/lib/adapters/EWKT.class.php:5
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (98,99) made by require('/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/UnloadDataTest.php'), wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta
    • > PHP Warning
      require_once(../geoPHP.inc): failed to open stream: No such file or directory in wp-content/plugins/wp-spatial-capabilities-check/wp-geometa-lib/geoPHP/tests/tests/methodsTest.php on line 2
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (67) made by require('/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/UnloadDataTest.php'), wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query SELECT Dimension(meta_value) FROM wp_postmeta_geo WHERE meta_key='wpgeometa_test' AND post_id='44' made by require('/plugins/wp-spatial-capabilities-check/wp-geometa-lib/test/tests/QueryOrderByTest.php')
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (50) made by wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query INSERT INTO wp_postmeta_geo \t\t\t\t(\t\tpost_id,\t\tfk_meta_id,\t\tmeta_key,\t\tmeta_value\t) VALUES (\t\t14,\t\t51,\t\t'myplugin_geo',\t\tGeomFromText('MULTIPOINT (-93 44)',4326)\t) ON DUPLICATE KEY UPDATE meta_value=GeomFromText('MULTIPOINT (-93 44)',4326) made by update_post_meta, update_metadata, add_metadata, do_action('added_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->upsert_meta
    • > WordPress database error Table 'potrivit.wp_postmeta_geo' doesn't exist for query DELETE FROM wp_postmeta_geo WHERE fk_meta_id IN (27) made by wp_delete_post, delete_metadata_by_mid, do_action('deleted_post_meta'), WP_Hook->do_action, WP_Hook->apply_filters, WP_GeoMeta->__call, WP_GeoMeta->deleted_meta

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 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
6 plugin tags: mysql, gis, spatial, mapping, geography...

wp-spatial-capabilities-check/wp-spatial-capabilities-check.php Passed 13 tests

The entry point to "WP Spatial Capabilities Check" version 0.0.4 is a PHP file that has certain tags in its header comment area
76 characters long description:
Check what spatial functions your version of MySQL or MariaDB has available.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin26,254 lines of code in 87 files:
LanguageFilesBlank linesComment linesLines of code
XML122018,393
PHP521,1321,6555,835
Markdown83280908
HTML1150720
SQL47620130
Pascal14316295
PO File1284390
JSON40040
Bourne Shell313525
YAML16518

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity32.13
▷ Minimum class complexity1.00
▷ Maximum class complexity166.00
Average method complexity4.02
▷ Minimum method complexity1.00
▷ Maximum method complexity83.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes31
▷ Abstract classes39.68%
▷ Concrete classes2890.32%
▷ Final classes00.00%
Methods348
▷ Static methods4813.79%
▷ Public methods26576.15%
▷ Protected methods4212.07%
▷ Private methods4111.78%
Functions18
▷ Named functions1688.89%
▷ Anonymous functions211.11%
Constants21
▷ Global constants628.57%
▷ Class constants1571.43%
▷ Public constants15100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
7 PNG files occupy 0.76MB with 0.51MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png11.90KB4.21KB▼ 64.59%
assets/banner-1544x500.png340.68KB158.58KB▼ 53.45%
assets/screenshot-1.png185.61KB47.35KB▼ 74.49%
assets/icon-256x256.png22.90KB7.53KB▼ 67.10%
assets/screenshot-2.png15.36KB4.31KB▼ 71.91%