74% media-download

Code Review | Media Library File Download

WordPress plugin Media Library File Download scored74%from 54 tests.

About plugin

  • Plugin page: media-download
  • Plugin version: 1.4
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.2
  • WordPress version: 6.3.1
  • First release: May 19, 2020
  • Latest release: Mar 29, 2023
  • Number of updates: 13
  • Update frequency: every 80.4 days
  • Top authors: calculabs (76.92%)andyabelow (30.77%)

Code review

54 tests

User reviews

6 reviews

Install metrics

2,000+ active /14,921 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲5.37MB] [CPU: ▲24.64ms] 75% from 4 tests

This is a short check of server-side resources used by Media Library File Download
The following require your attention
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 5.37MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.19 ▲5.7372.48 ▲29.68
Dashboard /wp-admin9.21 ▲5.9182.07 ▲29.81
Posts /wp-admin/edit.php9.21 ▲5.8575.46 ▲26.55
Add New Post /wp-admin/post-new.php9.88 ▲4.00113.60 ▲12.52
Media Library /wp-admin/upload.php9.21 ▲5.9875.13 ▲38.65
Media Library File Download /wp-admin/admin.php?page=media-download9.2174.59
Freemius Debug [v.2.5.5] /wp-admin/admin.php?page=freemius9.2162.02

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 267 new files
Database: no new tables, 9 new options
New WordPress options
can_compress_scripts
fs_accounts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
fs_active_plugins
widget_recent-comments
fs_debug_mode

Browser metrics Passed 4 tests

A check of browser resources used by Media Library File Download
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲4814.34 ▼0.191.74 ▲0.1131.64 ▼11.68
Dashboard /wp-admin2,209 ▲325.64 ▲0.0286.45 ▼15.3145.18 ▲1.68
Posts /wp-admin/edit.php2,118 ▲182.00 ▲0.0435.53 ▼1.2135.99 ▲1.25
Add New Post /wp-admin/post-new.php1,533 ▲523.55 ▲0.34696.51 ▲29.3557.16 ▲5.17
Media Library /wp-admin/upload.php1,484 ▲844.27 ▲0.07125.34 ▲7.9555.62 ▲5.80
Media Library File Download /wp-admin/admin.php?page=media-download9821.6529.2070.27
Freemius Debug [v.2.5.5] /wp-admin/admin.php?page=freemius1,0821.6926.1829.55

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/media-download/lib/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options detected upon uninstall: 9 options
    • fs_active_plugins
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • fs_accounts
    • fs_debug_mode
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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 fix the following items
  • 24× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'ZipStream\\Exception' not found in wp-content/plugins/media-download/lib/media/vendor/maennchen/zipstream-php/src/Exception/OverflowException.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/media-download/lib/media/vendor/psr/http-message/src/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'MyCLabs\\Enum\\Enum' not found in wp-content/plugins/media-download/lib/media/vendor/maennchen/zipstream-php/src/Option/Version.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/media-download/lib/media/vendor/maennchen/zipstream-php/test/BigintTest.php:11
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/image.php): failed to open stream: No such file or directory in wp-content/plugins/media-download/class-media-download.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'Stringable' not found in wp-content/plugins/media-download/lib/media/vendor/myclabs/php-enum/src/Enum.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'ZipStream\\Exception' not found in wp-content/plugins/media-download/lib/media/vendor/maennchen/zipstream-php/src/Exception/FileNotFoundException.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'ZipStream\\Exception' not found in wp-content/plugins/media-download/lib/media/vendor/maennchen/zipstream-php/src/Exception/FileNotReadableException.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'SebastianBergmann\\Comparator\\Comparator' not found in wp-content/plugins/media-download/lib/media/vendor/myclabs/php-enum/src/PHPUnit/Comparator.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/media-download/lib/media/vendor/psr/http-message/src/RequestInterface.php:24

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration Passed 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: file download, download image, easy file download, media library, export media library...

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

The main file in "Media Library File Download" v. 1.4 serves as a complement to information provided in readme.txt and as the entry point to the plugin
86 characters long description:
A lightweight plugin that adds one-click download functionality to your Media Library.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected53,180 lines of code in 214 files:
LanguageFilesBlank linesComment linesLines of code
PHP1618,84719,96336,719
PO File126,9608,45515,240
JSON400347
JavaScript46866274
Markdown51020266
reStructuredText9119243126
XML411198
CSS1418097
make12213

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,079)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity58.66
▷ Minimum class complexity1.00
▷ Maximum class complexity3,079.00
Average method complexity4.30
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces11
Interfaces8
Traits0
Classes75
▷ Abstract classes45.33%
▷ Concrete classes7194.67%
▷ Final classes34.23%
Methods1,550
▷ Static methods24916.06%
▷ Public methods1,13172.97%
▷ Protected methods362.32%
▷ Private methods38324.71%
Functions99
▷ Named functions9494.95%
▷ Anonymous functions55.05%
Constants164
▷ Global constants9859.76%
▷ Class constants6640.24%
▷ Public constants6598.48%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/download_icon.png6.00KB2.34KB▼ 60.94%
lib/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
lib/freemius/assets/img/media-download.png9.16KB5.26KB▼ 42.58%
lib/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
img/download_icon_hover.png6.04KB2.34KB▼ 61.26%