94% upload-scanner

Code Review | Upload Scanner

WordPress plugin Upload Scanner scored 94% from 54 tests.

About plugin

  • Plugin page: upload-scanner
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-3.4
  • WordPress version: 5.8.1
  • First release: Mar 5, 2012
  • Latest release: May 19, 2012
  • Number of updates: 17
  • Update frequency: every 4.4 days
  • Top authors: kurtpayne (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active / 4,352 total downloads

Benchmarks

Plugin footprint Passed 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.04MB] [CPU: ▼142.55ms] Passed 4 tests

This is a short check of server-side resources used by Upload Scanner
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.88 ▲0.0443.05 ▲9.47
Dashboard /wp-admin3.11 ▲0.0543.05 ▼4.60
Posts /wp-admin/edit.php3.16 ▲0.0541.41 ▼2.11
Add New Post /wp-admin/post-new.php5.46 ▲0.0389.41 ▼565.26
Media Library /wp-admin/upload.php3.05 ▲0.0532.33 ▲1.77
Upload Scanner /wp-admin/options-general.php?page=upload-scanner-plugin3.0629.63

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 19 new files
Database: no new tables, 5 new options
New WordPress options
upload-scanner_command
upload-scanner_onfail_email
upload-scanner_version
upload-scanner_quarantine_folder
upload-scanner_onfail_log_file

Browser metrics Passed 4 tests

A check of browser resources used by Upload Scanner
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,694 ▲10016.28 ▲0.739.61 ▲0.9949.12 ▲4.99
Dashboard /wp-admin2,975 ▲446.10 ▼0.03138.87 ▲1.70106.99 ▼15.64
Posts /wp-admin/edit.php2,744 ▲82.71 ▼0.1364.07 ▲0.3496.13 ▼3.91
Add New Post /wp-admin/post-new.php1,679 ▲918.87 ▼0.29383.40 ▲10.59113.42 ▲4.95
Media Library /wp-admin/upload.php1,812 ▲25.03 ▲0.03140.71 ▲0.28120.57 ▲2.62
Upload Scanner /wp-admin/options-general.php?page=upload-scanner-plugin1,3062.1859.3489.91

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The plugin uninstalled completely, with no zombie files or tables

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
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/upload-scanner/upload-scanner.php:13

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 on the user side

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 your attention:
  • Screenshots: These screenshots do not have images: #1 (Options screen.), #2 (Log viewer.), #3 (Sample e-mail report.)
You can take inspiration from this readme.txt

upload-scanner/upload-scanner.php Passed 13 tests

The entry point to "Upload Scanner" version 1.2 is a PHP file that has certain tags in its header comment area
62 characters long description:
Scan all uploaded files with Clam AV or any arbitrary command.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected486 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP1290187486

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity10.17
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity3.62
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes116.67%
▷ Concrete classes583.33%
▷ Final classes00.00%
Methods21
▷ Static methods00.00%
▷ Public methods21100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.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
3 PNG files occupy 0.25MB with 0.16MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png62.19KB21.13KB▼ 66.03%
screenshot-1.png115.55KB41.12KB▼ 64.41%
screenshot-2.png73.24KB23.21KB▼ 68.31%