78% media-deduper

Code Review | Media Deduper

WordPress plugin Media Deduper scored78%from 54 tests.

About plugin

  • Plugin page: media-deduper
  • Plugin version: 1.5.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.0
  • WordPress version: 6.3.1
  • First release: Oct 27, 2015
  • Latest release: Mar 21, 2023
  • Number of updates: 51
  • Update frequency: every 53.0 days
  • Top authors: drywallbmb (62.75%)kenjigarland (39.22%)

Code review

54 tests

User reviews

38 reviews

Install metrics

10,000+ active /103,938 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.13MB] [CPU: ▼2.01ms] Passed 4 tests

An overview of server-side resources used by Media Deduper
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1439.64 ▼3.50
Dashboard /wp-admin3.46 ▲0.1649.84 ▼1.06
Posts /wp-admin/edit.php3.51 ▲0.1648.55 ▼0.62
Add New Post /wp-admin/post-new.php6.00 ▲0.1183.11 ▼2.86
Media Library /wp-admin/upload.php3.32 ▲0.0939.09 ▲2.15
Manage Duplicates /wp-admin/upload.php?page=media-deduper3.4346.27
Media Deduper /wp-admin/options-general.php?page=mdd3.3435.41

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 24 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
mdd_version
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Media Deduper
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.55 ▲0.201.64 ▼0.1943.65 ▼4.56
Dashboard /wp-admin2,224 ▲505.62 ▲0.0886.38 ▼16.2341.96 ▼0.94
Posts /wp-admin/edit.php2,112 ▲122.00 ▼0.0336.83 ▲1.6634.93 ▼2.20
Add New Post /wp-admin/post-new.php1,545 ▲1718.37 ▼4.64632.66 ▼47.5764.99 ▲11.42
Media Library /wp-admin/upload.php1,451 ▲484.26 ▼0.00100.47 ▲0.5843.75 ▼0.99
Manage Duplicates /wp-admin/upload.php?page=media-deduper1,5673.1541.5826.76
Media Deduper /wp-admin/options-general.php?page=mdd8292.0122.5830.25

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
These items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • mdd_version
    • theysaidso_admin_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 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 10× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/media-deduper/inc/settings/fields/class-cshp-field-number.php
    • > /wp-content/plugins/media-deduper/admin/debug-info.php
    • > /wp-content/plugins/media-deduper/inc/settings/fields/class-cshp-field-textarea.php
    • > /wp-content/plugins/media-deduper/inc/settings/class-cshp-settings-page.php
    • > /wp-content/plugins/media-deduper/inc/settings/class-cshp-settings-setting.php
    • > /wp-content/plugins/media-deduper/inc/settings/class-cshp-settings-section.php
    • > /wp-content/plugins/media-deduper/admin/menu-settings.php
    • > /wp-content/plugins/media-deduper/inc/settings/fields/class-cshp-field-select.php
    • > /wp-content/plugins/media-deduper/inc/settings/class-cshp-field.php
    • > /wp-content/plugins/media-deduper/inc/settings/fields/class-cshp-field-checkbox.php
  • 12× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      require_once(MDD_INCLUDES_DIRvendor/wp-async-request.php): failed to open stream: No such file or directory in wp-content/plugins/media-deduper/inc/class-mdd-indexer.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/media-deduper/inc/class-media-deduper.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/media-deduper/media-deduper.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Async_Request' not found in wp-content/plugins/media-deduper/inc/vendor/wp-background-process.php:16
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/media-deduper/inc/class-mdd-media-list-table.php on line 5
    • > PHP Fatal error
      require_once(): Failed opening required 'MDD_INCLUDES_DIRvendor/wp-async-request.php' (include_path='.:/usr/share/php') in wp-content/plugins/media-deduper/inc/class-mdd-indexer.php on line 9
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/media-deduper/inc/class-mdd-media-list-table.php on line 5
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/media-deduper/inc/class-mdd-media-list-table.php on line 5
    • > PHP Warning
      Use of undefined constant MDD_INCLUDES_DIR - assumed 'MDD_INCLUDES_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/media-deduper/inc/class-mdd-async-test.php on line 9
    • > PHP Warning
      require_once(MDD_INCLUDES_DIRvendor/wp-async-request.php): failed to open stream: No such file or directory in wp-content/plugins/media-deduper/inc/class-mdd-async-test.php on line 9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Screenshots: These screenshots lack descriptions #1, #2, #3, #4 in media-deduper/assets to your readme.txt
The official readme.txt might help

media-deduper/media-deduper.php Passed 13 tests

This is the main PHP file of "Media Deduper" version 1.5.5, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
115 characters long description:
Save disk space and bring some order to the chaos of your media library by removing and preventing duplicate files.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin2,235 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP205501,3721,818
JavaScript26661270
CSS186147

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity13.25
▷ Minimum class complexity1.00
▷ Maximum class complexity110.00
Average method complexity2.63
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes212.50%
▷ Concrete classes1487.50%
▷ Final classes00.00%
Methods122
▷ Static methods43.28%
▷ Public methods8166.39%
▷ Protected methods2621.31%
▷ Private methods1512.30%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants342.86%
▷ Class constants457.14%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected