78% upload-directory-cleaner

Code Review | Upload Directory Cleaner

WordPress plugin Upload Directory Cleaner scored78%from 54 tests.

About plugin

  • Plugin page: upload-directory-...
  • Plugin version: 0.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.9-5.2.3
  • WordPress version: 6.3.1
  • First release: Sep 17, 2019
  • Latest release: Sep 18, 2019
  • Number of updates: 6
  • Update frequency: every 0.2 days
  • Top authors: 620eli (100%)

Code review

54 tests

User reviews

1 review

Install metrics

80+ active /1,488 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.10MB] [CPU: ▼5.45ms] Passed 4 tests

Analyzing server-side resources used by Upload Directory Cleaner
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0938.47 ▼2.44
Dashboard /wp-admin3.41 ▲0.1044.81 ▼8.73
Posts /wp-admin/edit.php3.52 ▲0.1652.11 ▼2.97
Add New Post /wp-admin/post-new.php5.99 ▲0.1094.49 ▼7.67
Media Library /wp-admin/upload.php3.33 ▲0.1036.82 ▲0.90
Upload Directory Cleaner /wp-admin/tools.php?page=upload-directory-cleaner3.2739.52

Server storage [IO: ▲0.05MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
Please fix the following
  • The plugin illegally modified 1 file (4.00KB) outside of "wp-content/plugins/upload-directory-cleaner/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 7 new files
Database: no new tables, 9 new options
New WordPress options
udc_ignore
widget_recent-posts
udc_keep_thumbnails
widget_recent-comments
udc_delete_empty_directories
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Upload Directory Cleaner
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,844 ▲8313.56 ▼0.811.80 ▲0.0542.15 ▼0.37
Dashboard /wp-admin2,228 ▲254.86 ▼1.02109.42 ▲4.2641.51 ▲0.86
Posts /wp-admin/edit.php2,104 ▲12.04 ▼0.0239.55 ▲0.6236.66 ▼1.46
Add New Post /wp-admin/post-new.php1,548 ▲1723.03 ▲1.95625.06 ▼51.6754.39 ▼0.62
Media Library /wp-admin/upload.php1,407 ▲134.21 ▼0.0197.34 ▼10.9543.25 ▼2.19
Upload Directory Cleaner /wp-admin/tools.php?page=upload-directory-cleaner9562.0226.0934.19

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
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 9 options
    • udc_keep_thumbnails
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • udc_delete_empty_directories
    • udc_ignore
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+177
    Undefined index: is_array
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: action
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+188
    Undefined offset: 1
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: excludes
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Warning in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+184
    Invalid argument supplied for foreach()
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: preg_excludes
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: unregistered_log
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: deletes
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: udc_keep_thumbnails
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: udc_delete_empty_directories
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+179
    Undefined index: udc_ignore
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=upload-directory-cleaner
    • > Notice in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php+557
    Undefined index: description

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/upload-directory-cleaner/upload-directory-cleaner.php:250

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

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
8 plugin tags: files, directory, clean, upload, images...

upload-directory-cleaner/upload-directory-cleaner.php Passed 13 tests

Analyzing the main PHP file in "Upload Directory Cleaner" version 0.2
105 characters long description:
The UDC plugin allows you to scan and delete all unregistered files from your Wordpress upload directory.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin597 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP110157568
CSS16029

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity72.00
▷ Minimum class complexity72.00
▷ Maximum class complexity72.00
Average method complexity3.19
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods33
▷ Static methods26.06%
▷ Public methods721.21%
▷ Protected methods00.00%
▷ Private methods2678.79%
Functions2
▷ Named functions00.00%
▷ Anonymous functions2100.00%
Constants6
▷ Global constants00.00%
▷ Class constants6100.00%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin