84% protect-uploads

Code Review | Protect uploads

WordPress plugin Protect uploads scored84%from 54 tests.

About plugin

  • Plugin page: protect-uploads
  • Plugin version: 0.5.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.0.1
  • WordPress version: 6.3.1
  • First release: Mar 31, 2015
  • Latest release: Sep 4, 2022
  • Number of updates: 19
  • Update frequency: every 142.8 days
  • Top authors: alticreation (100%)

Code review

54 tests

User reviews

28 reviews

Install metrics

30,000+ active /815,779 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.09MB] [CPU: ▼3.97ms] Passed 4 tests

This is a short check of server-side resources used by Protect uploads
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0940.97 ▼1.46
Dashboard /wp-admin3.39 ▲0.0947.42 ▼4.19
Posts /wp-admin/edit.php3.51 ▲0.1548.37 ▲0.94
Add New Post /wp-admin/post-new.php5.97 ▲0.0987.56 ▼11.18
Media Library /wp-admin/upload.php3.31 ▲0.0939.34 ▲3.09
Protect Uploads /wp-admin/upload.php?page=protect-uploads-settings-page3.3050.29

Server storage [IO: ▲0.08MB] [DB: ▲0.07MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 20 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Protect uploads
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲3414.27 ▼0.121.75 ▲0.0241.84 ▼2.07
Dashboard /wp-admin2,201 ▲275.61 ▲0.0884.96 ▼20.6741.74 ▼1.71
Posts /wp-admin/edit.php2,106 ▲62.02 ▲0.0340.02 ▲2.0737.50 ▲2.08
Add New Post /wp-admin/post-new.php1,537 ▲923.17 ▼0.02693.08 ▲11.8052.59 ▲0.55
Media Library /wp-admin/upload.php1,406 ▲64.11 ▼0.05109.05 ▼2.4247.96 ▲0.91
Protect Uploads /wp-admin/upload.php?page=protect-uploads-settings-page9142.0428.9831.29

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts

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 | 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
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Alti_ProtectUploads' not found in wp-content/plugins/protect-uploads/includes/class-protect-uploads-deactivator.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Alti_ProtectUploads' not found in wp-content/plugins/protect-uploads/includes/class-protect-uploads-activator.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
The official readme.txt is a good inspiration

protect-uploads/protect-uploads.php Passed 13 tests

The principal PHP file in "Protect uploads" v. 0.5.2 is loaded by WordPress automatically on each request
120 characters long description:
Protect your uploads directory. Avoid browsing of your uploads directory by adding a htaccess file or an index.php file.

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
Everything looks great! No dangerous files found in this plugin1,013 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP9123114627
PO File3102105386

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity9.29
▷ Minimum class complexity1.00
▷ Maximum class complexity56.00
Average method complexity2.29
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods45
▷ Static methods12.22%
▷ Public methods4191.11%
▷ Protected methods00.00%
▷ Private methods48.89%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin