94% clean-unused-medias

Code Review | Clean Unused Medias

WordPress plugin Clean Unused Medias scored 94% from 54 tests.

About plugin

  • Plugin page: clean-unused-medias
  • Plugin version: 1.10
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6.1-5.8
  • WordPress version: 5.9.2
  • First release: Sep 27, 2016
  • Latest release: Jul 20, 2021
  • Number of updates: 23
  • Update frequency: every 76.4 days
  • Top authors: xuxu.fr (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

300+ active / 5,229 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼311.97ms] Passed 4 tests

Server-side resources used by Clean Unused Medias
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0356.14 ▲2.04
Dashboard /wp-admin3.44 ▲0.0433.55 ▼1.88
Posts /wp-admin/edit.php3.67 ▲0.0340.62 ▲0.73
Add New Post /wp-admin/post-new.php6.91 ▼0.0698.00 ▼1,245.44
Media Library /wp-admin/upload.php3.33 ▲0.0325.89 ▼1.30
Clean Unused Medias /wp-admin/upload.php?page=clean-unused-medias3.3021.25

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 16 new files
Database: no new tables, 10 new options
New WordPress options
lnjcm_medias_in_option_ids
lnjcm_medias_in_content_completed
lnjcm_medias_in_content_last_check
lnjcm_medias_in_content_ids
lnjcm_medias_in_content_pause
lnjcm_medias_in_usermeta_ids
lnjcm_medias_in_content_completed_date
lnjcm_medias_in_content_index
lnjcm_medias_in_postmeta_ids
lnjcm_medias_in_content_processing

Browser metrics Passed 4 tests

Clean Unused Medias: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,768 ▲2315.78 ▲0.195.67 ▼0.842.20 ▼1.25
Dashboard /wp-admin2,893 ▲326.13 ▼0.10113.09 ▼19.95152.83 ▼8.05
Posts /wp-admin/edit.php2,695 ▲43.24 ▲0.0165.39 ▲0.44137.01 ▼13.81
Add New Post /wp-admin/post-new.php1,763 ▲10222.58 ▲6.56405.73 ▼23.60156.98 ▼4.01
Media Library /wp-admin/upload.php1,758 ▲605.65 ▲0.20144.20 ▲7.90187.33 ▲0.84
Clean Unused Medias /wp-admin/upload.php?page=clean-unused-medias1,3133.1583.12173.37

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=clean-unused-medias
    • > POST request to /wp-admin/admin-ajax.php
    • > Warning in wp-content/plugins/clean-unused-medias/ws/crawl.medias.php+103
    Division by zero

SRP Passed 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The SRP test was a success

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: advanced custom fields, media, clean, attachment, acf

clean-unused-medias/clean-unused-medias.php Passed 13 tests

The entry point to "Clean Unused Medias" version 1.10 is a PHP file that has certain tags in its header comment area
84 characters long description:
Clean Unused Medias : Simple way to delete medias not attached to any posts or pages

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
No dangerous file extensions were detected1,842 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP91912851,243
JavaScript12359268
PO File17693224
CSS19099
Markdown1708

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
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%
Functions40
▷ Named functions40100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.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 images were found in this plugin