78% wpqiniu

Code Review | WPQiNiu七牛云对象存储

WordPress plugin WPQiNiu七牛云对象存储 scored78%from 54 tests.

About plugin

  • Plugin page: wpqiniu
  • Plugin version: 4.9
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-6.2
  • WordPress version: 6.3.1
  • First release: Jul 8, 2019
  • Latest release: May 13, 2023
  • Number of updates: 18
  • Update frequency: every 78.0 days
  • Top authors: laobuluo (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

1,000+ active /16,689 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.15MB] [CPU: ▼8.24ms] Passed 4 tests

A check of server-side resources used by WPQiNiu七牛云对象存储
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1742.21 ▼0.05
Dashboard /wp-admin3.46 ▲0.1247.73 ▼13.47
Posts /wp-admin/edit.php3.58 ▲0.2251.78 ▲5.50
Add New Post /wp-admin/post-new.php6.05 ▲0.1690.04 ▼20.39
Media Library /wp-admin/upload.php3.39 ▲0.1637.32 ▲0.96
七牛云存储设置 /wp-admin/options-general.php?page=wpqiniu/index.php3.3931.16

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 126 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
wpqiniu_options
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for WPQiNiu七牛云对象存储
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲714.38 ▲0.011.66 ▼0.5144.28 ▲0.61
Dashboard /wp-admin2,202 ▲255.63 ▼0.0785.92 ▼12.0342.73 ▼3.25
Posts /wp-admin/edit.php2,104 ▲12.06 ▲0.0242.54 ▲5.1441.10 ▲8.69
Add New Post /wp-admin/post-new.php1,551 ▲2523.43 ▲5.89680.47 ▼0.0256.04 ▼2.46
Media Library /wp-admin/upload.php1,398 ▲14.25 ▲0.0298.76 ▼4.6046.76 ▲2.11
七牛云存储设置 /wp-admin/options-general.php?page=wpqiniu/index.php1,2721.8437.32137.20

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Please fix the following
  • 43× PHP files perform the task of outputting text when accessed with GET requests (only 10 are shown):
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_batch_change_type.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_batch_stat.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_batch_delete.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_copy.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_download_urls.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/cdn_timestamp_antileech.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_batch_change_mime.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/rs_delete_after_days.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/cdn_refresh_urls_dirs.php
    • > /wp-content/plugins/wpqiniu/sdk/examples/pfop_watermark.php
  • 46× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, bool given in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Auth.php on line 41
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpqiniu/sdk/tests/Qiniu/Tests/FopTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wpqiniu/sdk/tests/Qiniu/Tests/CdnManagerTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Qiniu\\Config' not found in wp-content/plugins/wpqiniu/sdk/src/Qiniu/functions.php:8
    • > PHP Notice
      Trying to get property 'srcUpHosts' of non-object in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Config.php on line 45
    • > PHP Notice
      Undefined variable: maxUsers in wp-content/plugins/wpqiniu/sdk/docs/rtc/example.php on line 23
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, bool given in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Auth.php on line 38
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, bool given in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Auth.php on line 38
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Config.php on line 45
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wpqiniu/sdk/src/Qiniu/Config.php on line 45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

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
1 plugin tags: wordpress

wpqiniu/index.php 85% from 13 tests

The main file in "WPQiNiu七牛云对象存储" v. 4.9 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Description: The description should be shorter than 140 characters (currently 186 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("wpqiniu.php" instead of "index.php")

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 plugin5,163 lines of code in 108 files:
LanguageFilesBlank linesComment linesLines of code
PHP858971,1084,637
Markdown5770214
SVG13563195
YAML24054
JSON10026
XML11018
JavaScript6059
CSS6046
Bourne Shell1004

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.17
Average class complexity8.62
▷ Minimum class complexity1.00
▷ Maximum class complexity49.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes34
▷ Abstract classes00.00%
▷ Concrete classes34100.00%
▷ Final classes1750.00%
Methods226
▷ Static methods3917.26%
▷ Public methods17878.76%
▷ Protected methods73.10%
▷ Private methods4118.14%
Functions15
▷ Named functions1493.33%
▷ Anonymous functions16.67%
Constants10
▷ Global constants110.00%
▷ Class constants990.00%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.20MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
layui/images/logo.png24.44KB0.95KB▼ 96.10%
layui/css/modules/layer/default/icon.png11.22KB4.36KB▼ 61.19%
sdk/examples/php-logo.png63.54KB23.27KB▼ 63.37%
layui/css/modules/layer/default/icon-ext.png5.77KB2.91KB▼ 49.62%
layui/images/footer_logo.png24.87KB0.95KB▼ 96.18%