73% b2-private-files

Code Review | B2 Private Files

WordPress plugin B2 Private Files scored73%from 54 tests.

About plugin

  • Plugin page: b2-private-files
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.0.1
  • WordPress version: 6.3.1
  • First release: Aug 18, 2022
  • Latest release: Aug 18, 2022
  • Number of updates: 3
  • Update frequency: every 0.7 days
  • Top authors: darwinbiler (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /232 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼3.84ms] Passed 4 tests

This is a short check of server-side resources used by B2 Private Files
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1336.66 ▼2.35
Dashboard /wp-admin3.44 ▲0.1447.37 ▼2.45
Posts /wp-admin/edit.php3.56 ▲0.2053.93 ▲2.19
Add New Post /wp-admin/post-new.php6.02 ▲0.1495.76 ▼12.16
Media Library /wp-admin/upload.php3.37 ▲0.1439.21 ▲1.60
Library (Private) /wp-admin/upload.php?page=b2-private-files-library-page3.3834.01
Add New (Private) /wp-admin/upload.php?page=b2-private-files-upload-page3.3434.46
Shortcodes /wp-admin/admin.php?page=b2-private-files-code-page3.3131.71
B2 Private Files /wp-admin/options-general.php?page=b2-private-files-settings-page3.3132.02

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 33 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by B2 Private Files
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,884 ▲9813.44 ▼0.957.31 ▲5.3740.16 ▼7.24
Dashboard /wp-admin2,207 ▲275.57 ▼0.0090.41 ▼0.8841.17 ▼1.03
Posts /wp-admin/edit.php2,112 ▲92.03 ▲0.0840.47 ▲6.1736.78 ▼0.24
Add New Post /wp-admin/post-new.php1,535 ▲923.59 ▲0.57620.16 ▼8.8648.04 ▼0.31
Media Library /wp-admin/upload.php1,409 ▲94.18 ▼0.0599.58 ▼5.6644.22 ▲0.70
Library (Private) /wp-admin/upload.php?page=b2-private-files-library-page9632.0022.1127.44
Add New (Private) /wp-admin/upload.php?page=b2-private-files-upload-page7992.0023.6930.03
Shortcodes /wp-admin/admin.php?page=b2-private-files-code-page7961.9926.3227.72
B2 Private Files /wp-admin/options-general.php?page=b2-private-files-settings-page8192.0023.3426.13

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=b2-private-files-settings-page
    • > Notice in wp-content/plugins/b2-private-files/admin/class-b2-private-files-admin.php+172
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/upload.php?page=b2-private-files-library-page
    • > Notice in wp-content/plugins/b2-private-files/includes/class-b2-library.php+210
    Undefined index: apiUrl
    • > GET request to /wp-admin/upload.php?page=b2-private-files-library-page
    • > Notice in wp-content/plugins/b2-private-files/includes/class-b2-library.php+211
    Undefined index: authorizationToken
    • > GET request to /wp-admin/upload.php?page=b2-private-files-library-page
    • > Notice in wp-content/plugins/b2-private-files/includes/class-b2-library.php+215
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/upload.php?page=b2-private-files-library-page
    • > Warning in wp-content/plugins/b2-private-files/includes/class-b2-library.php+215
    Invalid argument supplied for foreach()
    • > GET request to /wp-admin/admin.php?page=b2-private-files-code-page
    • > Notice in wp-content/plugins/b2-private-files/admin/class-b2-private-files-admin.php+367
    Undefined index: fileName

SRP 0% 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
Almost there! Just fix the following items
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/b2-private-files/public/partials/b2-private-files-public-display.php
    • > /wp-content/plugins/b2-private-files/admin/partials/b2-private-files-admin-display.php
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/b2-private-files/admin/partials/show_file.php:2
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/b2-private-files/admin/private-files-table.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'PrivateFiles_List_Table' not found in wp-content/plugins/b2-private-files/admin/partials/library_page.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/b2-private-files/admin/partials/code_page.php:2
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/b2-private-files/admin/private-files-table.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/b2-private-files/admin/partials/upload_page.php:8
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/b2-private-files/admin/private-files-table.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Listing the contents of your B2 Bucket.), #2 (New menu item added alongside with standard Library)
You can take inspiration from this readme.txt

b2-private-files/b2-private-files.php Passed 13 tests

The principal PHP file in "B2 Private Files" v. 1.0.2 is loaded by WordPress automatically on each request
59 characters long description:
Serve token-protected private files hosted in Backblaze B2.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin813 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP18301742804
JavaScript34549
CSS2080

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity5.00
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.59
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods62
▷ Static methods1117.74%
▷ Public methods5791.94%
▷ Protected methods00.00%
▷ Private methods58.06%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.23MB with 0.15MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png2.56KB1.45KB▼ 43.23%
assets/screenshot-2.png42.33KB11.94KB▼ 71.79%
assets/screenshot-1.png193.48KB52.90KB▼ 72.66%