89% prevent-file-access

Code Review | Prevent files / folders access

WordPress plugin Prevent files / folders access scored89%from 54 tests.

About plugin

  • Plugin page: prevent-file-access
  • Plugin version: 2.5.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.3
  • WordPress version: 6.3.1
  • First release: Sep 10, 2019
  • Latest release: Oct 10, 2023
  • Number of updates: 33
  • Update frequency: every 45.2 days
  • Top authors: cyberlord92 (66.67%)cyberorange (33.33%)karnisingh123 (6.06%)

Code review

54 tests

User reviews

29 reviews

Install metrics

1,000+ active /21,654 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.38MB] [CPU: ▼3.06ms] Passed 4 tests

Analyzing server-side resources used by Prevent files / folders access
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3843.79 ▲2.73
Dashboard /wp-admin3.68 ▲0.3756.10 ▲4.14
Posts /wp-admin/edit.php3.80 ▲0.4450.45 ▲0.07
Add New Post /wp-admin/post-new.php6.26 ▲0.3789.29 ▼15.33
Media Library /wp-admin/upload.php3.61 ▲0.3739.05 ▲0.30

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 50 new files
Database: no new tables, 8 new options
New WordPress options
host_name
mo_enable_media_restriction
db_upgraded
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Prevent files / folders access: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4314.24 ▼0.112.02 ▲0.4046.52 ▲5.26
Dashboard /wp-admin2,210 ▲305.69 ▲0.0391.43 ▲5.5583.58 ▲39.94
Posts /wp-admin/edit.php2,118 ▲151.99 ▼0.0435.43 ▼6.9837.47 ▲0.95
Add New Post /wp-admin/post-new.php1,559 ▲3323.16 ▼0.40668.53 ▲24.80141.78 ▲89.52
Media Library /wp-admin/upload.php1,418 ▲244.24 ▼0.0399.47 ▼13.3870.58 ▲23.03

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • db_upgraded
    • mo_enable_media_restriction
    • widget_recent-comments
    • widget_recent-posts
    • host_name
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
7 plugin tags: content-restriction, secure-files, media management, protect-folders, download logs...

prevent-file-access/media-restriction.php 85% from 13 tests

The principal PHP file in "Prevent files / folders access" v. 2.5.3 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 195 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("prevent-file-access.php" instead of "media-restriction.php")

Code Analysis 97% from 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
Everything looks great! No dangerous files found in this plugin4,371 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP132667393,136
SVG100685
CSS6840544
JavaScript50116

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 108)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity23.12
▷ Minimum class complexity1.00
▷ Maximum class complexity158.00
Average method complexity4.93
▷ Minimum method complexity1.00
▷ Maximum method complexity108.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods45
▷ Static methods36.67%
▷ Public methods3680.00%
▷ Protected methods00.00%
▷ Private methods920.00%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
15 PNG files occupy 0.41MB with 0.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/paidmember.png6.00KB2.61KB▼ 56.54%
admin/images/logo.png2.84KB1.59KB▼ 44.03%
admin/images/trials-icon.png4.33KB2.63KB▼ 39.22%
admin/images/tick.png28.84KB12.74KB▼ 55.81%
admin/images/addon-icon.png2.43KB1.63KB▼ 32.78%