62% fantastic-elasticsearch

Code Review | Fantastic ElasticSearch

WordPress plugin Fantastic ElasticSearch scored62%from 54 tests.

About plugin

  • Plugin page: fantastic-elastic...
  • Plugin version: 4.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.5.1
  • WordPress version: 6.3.1
  • First release: Jan 23, 2013
  • Latest release: Jun 6, 2016
  • Number of updates: 87
  • Update frequency: every 14.2 days
  • Top authors: parisholley (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

50+ active /15,092 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.47MB] [CPU: ▼31.70ms] Passed 4 tests

A check of server-side resources used by Fantastic ElasticSearch
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4246.93 ▲2.67
Dashboard /wp-admin3.47 ▲0.1738.40 ▼17.84
Posts /wp-admin/edit.php3.47 ▲0.1227.16 ▼23.04
Add New Post /wp-admin/post-new.php3.47 ▼2.4229.34 ▼82.78
Media Library /wp-admin/upload.php3.47 ▲0.2431.80 ▼3.15
Field Mapping /wp-admin/admin.php?page=elastic_search&tab=field3.4732.67
Content Indexing /wp-admin/admin.php?page=elastic_search&tab=content3.4731.01
Manage Index /wp-admin/admin.php?page=elastic_search&tab=index3.4730.73
Wordpress Integration /wp-admin/admin.php?page=elastic_search&tab=integration3.4730.10
Result Scoring /wp-admin/admin.php?page=elastic_search&tab=scoring3.4729.25
Server Settings /wp-admin/admin.php?page=elastic_search&tab=server3.4732.28
/wp-admin/admin.php?page=elastic_search3.4726.83

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 1,007 new files
Database: no new tables, 10 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
recovery_mode_email_last_sent
widget_recent-posts
elasticsearch
widget_recent-comments
db_upgraded
widget_facetingoptionswidget
widget_theysaidso_widget
widget_factingselectedwidget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Fantastic ElasticSearch
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,836 ▲7514.22 ▼0.401.71 ▲0.0645.28 ▲1.79
Dashboard /wp-admin2,242 ▲625.64 ▼0.0385.88 ▼4.8870.67 ▲23.56
Posts /wp-admin/edit.php2,150 ▲471.97 ▼0.0436.32 ▼1.4435.08 ▼2.60
Add New Post /wp-admin/post-new.php45 ▼1,4810.42 ▼23.140.11 ▼714.649.41 ▼46.61
Media Library /wp-admin/upload.php1,444 ▲444.19 ▼0.03109.88 ▲7.1177.73 ▲34.71
Field Mapping /wp-admin/admin.php?page=elastic_search&tab=field1,3232.3330.9840.55
Content Indexing /wp-admin/admin.php?page=elastic_search&tab=content1,3412.4533.0539.58
Manage Index /wp-admin/admin.php?page=elastic_search&tab=index1,3232.3035.5135.51
Wordpress Integration /wp-admin/admin.php?page=elastic_search&tab=integration1,3232.3332.2739.75
Result Scoring /wp-admin/admin.php?page=elastic_search&tab=scoring1,3232.4531.5342.29
Server Settings /wp-admin/admin.php?page=elastic_search&tab=server1,3192.3232.8036.04
/wp-admin/admin.php?page=elastic_search1,3052.1125.8429.12

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/options.php+226
    Function create_function() is deprecated
  • Zombie WordPress options detected upon uninstall: 10 options
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_facetingoptionswidget
    • widget_theysaidso_widget
    • elasticsearch
    • can_compress_scripts
    • widget_factingselectedwidget
    • recovery_mode_email_last_sent

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 1176 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=elastic_search
    • > Deprecated in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/options.php+237
    Function create_function() is deprecated
  • 28 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=elastic_search
    • > Warning in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/fields/multi_checkbox/field_multi_checkbox.php+40
    Illegal string offset 'post_content'
  • 28 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=elastic_search
    • > Warning in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/fields/multi_checkbox/field_multi_checkbox.php+37
    Cannot assign an empty string to a string offset
  • 28 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=elastic_search
    • > Notice in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/fields/multi_checkbox/field_multi_checkbox.php+40
    Uninitialized string offset: 0
  • 28 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=elastic_search
    • > Warning in wp-content/plugins/fantastic-elasticsearch/wp/lib/nhp/options/fields/multi_checkbox/field_multi_checkbox.php+40
    Illegal string offset 'post_title'

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/fantastic-elasticsearch/vendor/jeremykendall/php-domain-parser/tests/bootstrap.php
    • > /wp-content/plugins/fantastic-elasticsearch/vendor/electrolinux/phpquery/demo.php
  • 424× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Param' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/lib/Elastica/AbstractUpdateAction.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Query\\AbstractQuery' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Query/SimpleQueryString.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function elasticsearch\\add_action() in wp-content/plugins/fantastic-elasticsearch/wp/admin/sections/manage-index.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Filter\\AbstractFilter' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Filter/BoolFilter.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Purl\\AbstractPart' not found in wp-content/plugins/fantastic-elasticsearch/vendor/jwage/purl/src/Purl/Url.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\Base' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/Query/ConstantScoreTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\Base' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/ClusterTest.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Elastica\\Exception\\ExceptionInterface' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/lib/Elastica/Exception/ClientException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/fantastic-elasticsearch/vendor/jeremykendall/php-domain-parser/tests/library/Pdp/PublicSuffixListTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Elastica\\Test\\Base' not found in wp-content/plugins/fantastic-elasticsearch/vendor/ruflin/elastica/test/lib/Elastica/Test/Cluster/Health/ShardTest.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
8 plugin tags: search, elasticsearch, facet, faceting, performance...

fantastic-elasticsearch/elasticsearch.php 92% from 13 tests

Analyzing the main PHP file in "Fantastic ElasticSearch" version 4.1.0
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("fantastic-elasticsearch.php" instead of "elasticsearch.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin124,104 lines of code in 606 files:
LanguageFilesBlank linesComment linesLines of code
PHP50638,84931,829103,354
HTML231,299014,142
JavaScript137155162,479
Markdown1249601,380
CSS41331701,067
XML17140582
JSON800312
Bourne Shell711116266
Ant2296232
make13622125
YAML83224121
Dockerfile4201843
Groovy1001

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity6.58
▷ Minimum class complexity1.00
▷ Maximum class complexity558.00
Average method complexity1.93
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces52
Interfaces11
Traits2
Classes477
▷ Abstract classes316.50%
▷ Concrete classes44693.50%
▷ Final classes00.00%
Methods2,938
▷ Static methods1906.47%
▷ Public methods2,77894.55%
▷ Protected methods1414.80%
▷ Private methods190.65%
Functions101
▷ Named functions6362.38%
▷ Anonymous functions3837.62%
Constants190
▷ Global constants105.26%
▷ Class constants18094.74%
▷ Public constants180100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
364 compressed PNG files occupy 0.11MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
wp/lib/nhp/options/img/glyphicons/glyphicons_196_circle_exclamation_mark.png0.26KB0.29KB0.00%
wp/lib/nhp/options/img/glyphicons/glyphicons_252_oxygen_bottle.png0.18KB0.21KB0.00%
wp/lib/nhp/options/img/glyphicons/glyphicons_321_twitter_t.png0.18KB0.21KB0.00%
wp/lib/nhp/options/img/glyphicons/glyphicons_265_electrical_plug.png0.21KB0.24KB0.00%
wp/lib/nhp/options/img/glyphicons/glyphicons_013_beach_umbrella.png0.41KB0.47KB0.00%