78% sanitize-db

Code Review | Sanitize DB

WordPress plugin Sanitize DB scored78%from 54 tests.

About plugin

  • Plugin page: sanitize-db
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-5.9
  • WordPress version: 6.3.1
  • First release: Mar 10, 2021
  • Latest release: Jul 23, 2022
  • Number of updates: 11
  • Update frequency: every 45.5 days
  • Top authors: anku1991 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /447 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼2.12ms] Passed 4 tests

This is a short check of server-side resources used by Sanitize DB
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0640.07 ▼1.42
Dashboard /wp-admin3.37 ▲0.0644.64 ▼2.08
Posts /wp-admin/edit.php3.42 ▲0.0646.75 ▼2.89
Add New Post /wp-admin/post-new.php6.01 ▲0.1294.80 ▲0.43
Media Library /wp-admin/upload.php3.29 ▲0.0634.64 ▼2.10
Sanitize History /wp-admin/admin.php?page=wpsdb-sanitize-history3.2632.04
History /wp-admin/edit.php?post_type=wpsdb_history3.3435.49
Add New /wp-admin/post-new.php?post_type=wpsdb_history5.9977.05
WP Sanitize DB /wp-admin/admin.php?page=wpsdb-dashboard3.2633.67

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 16 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Sanitize DB
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,908 ▲17313.87 ▼0.562.10 ▲0.2042.22 ▼5.12
Dashboard /wp-admin2,283 ▲955.30 ▲0.40116.10 ▲11.6643.12 ▲1.12
Posts /wp-admin/edit.php2,169 ▲802.50 ▲0.4943.34 ▲4.2935.44 ▲3.36
Add New Post /wp-admin/post-new.php1,572 ▲5317.62 ▼5.30616.38 ▼0.2453.98 ▼0.26
Media Library /wp-admin/upload.php1,466 ▲754.54 ▲0.3697.51 ▼3.5640.55 ▼4.07
Sanitize History /wp-admin/admin.php?page=wpsdb-sanitize-history1,0532.4549.0331.65
History /wp-admin/edit.php?post_type=wpsdb_history1,1422.6037.6428.74
Add New /wp-admin/post-new.php?post_type=wpsdb_history1,54317.08842.8926.67
WP Sanitize DB /wp-admin/admin.php?page=wpsdb-dashboard9112.0936.7145.00

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget

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)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sanitize-db/cpt/wpsdb_history.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sanitize-db/admin/admin.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sanitize-db/inc/functions.php:34

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=wpsdb_history
    • > Javascript (severe) in unknown
    /wp-content/plugins/sanitize-db/assets/loading-bar/loading-bar.min.js?ver=1 0:4236 Uncaught TypeError: Cannot read properties of null (reading 'ldBar')

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
6 plugin tags: sanitize, optimize, speedup, sanitization, database...

sanitize-db/wp-sanitize-db.php 92% from 13 tests

The main file in "Sanitize DB" v. 1.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("sanitize-db.php" instead of "wp-sanitize-db.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin1,403 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript421111,060
PHP45040250
CSS49193

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/logo.png1.30KB1.26KB▼ 2.56%