84% dx-delete-attached-media

Code Review | DX Delete Attached Media

WordPress plugin DX Delete Attached Media scored84%from 54 tests.

About plugin

  • Plugin page: dx-delete-attache...
  • Plugin version: 2.0.5.1
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.2
  • WordPress version: 6.3.1
  • First release: Apr 11, 2012
  • Latest release: May 29, 2023
  • Number of updates: 26
  • Update frequency: every 156.4 days
  • Top authors: devrix (92.31%)nofearinc (11.54%)

Code review

54 tests

User reviews

28 reviews

Install metrics

4,000+ active /44,215 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.03MB] [CPU: ▼8.68ms] Passed 4 tests

Analyzing server-side resources used by DX Delete Attached Media
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0442.89 ▼3.34
Dashboard /wp-admin3.35 ▲0.0147.13 ▼19.16
Posts /wp-admin/edit.php3.41 ▲0.0553.17 ▲1.89
Add New Post /wp-admin/post-new.php5.96 ▲0.0797.67 ▼14.10
Media Library /wp-admin/upload.php3.28 ▲0.0539.54 ▲4.35
DX Delete Attached Media /wp-admin/admin.php?page=dx-dam-options3.3037.70
Help page /wp-admin/admin.php?page=dx_dam_help3.2527.49

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 19 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
dx_delete_attached_media_options
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for DX Delete Attached Media
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,865 ▲10414.36 ▲0.041.96 ▲0.2738.68 ▼4.32
Dashboard /wp-admin2,223 ▲435.63 ▼0.0193.53 ▲1.0739.37 ▼2.91
Posts /wp-admin/edit.php2,134 ▲342.07 ▲0.0542.08 ▲6.0737.24 ▲2.07
Add New Post /wp-admin/post-new.php1,552 ▲2423.20 ▲0.09677.06 ▼27.1253.13 ▼2.30
Media Library /wp-admin/upload.php1,431 ▲314.24 ▲0.04109.51 ▲2.5949.33 ▲2.38
DX Delete Attached Media /wp-admin/admin.php?page=dx-dam-options1,0052.0622.3538.63
Help page /wp-admin/admin.php?page=dx_dam_help1,1152.0623.8771.52

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • dx_delete_attached_media_options
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, 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 fix the following items
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/dx-delete-attached-media/dx-delete-attached-media.php:11
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/dx-delete-attached-media/dx-attachments-list.php on line 3
    • > 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/dx-delete-attached-media/dx-attachments-list.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/dx-delete-attached-media/templates/dx-dam-help-page.php:3
    • > 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/dx-delete-attached-media/dx-attachments-list.php on line 3

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

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: post, media, attachment

dx-delete-attached-media/dx-delete-attached-media.php Passed 13 tests

Analyzing the main PHP file in "DX Delete Attached Media" version 2.0.5.1
106 characters long description:
Delete attached media to all posts (if activated). Remove images assigned to a post to clear old archives.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected1,012 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP3100116570
CSS1310267
JavaScript160135
PO File14824
SVG12016

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity28.00
▷ Minimum class complexity28.00
▷ Maximum class complexity28.00
Average method complexity5.50
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods6
▷ Static methods00.00%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
9 PNG files occupy 1.02MB with 0.58MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/image5.png134.92KB46.18KB▼ 65.77%
images/image3.png138.84KB48.43KB▼ 65.12%
images/image2.png132.90KB45.39KB▼ 65.85%
images/plugin2.png3.08KB2.45KB▼ 20.40%
images/plugin1.png29.40KB9.84KB▼ 66.51%