10% wp-qiniu

Code Review | WP-QINIU (WordPress连接到七牛云存储)

WordPress plugin WP-QINIU (WordPress连接到七牛云存储) scored10%from 54 tests.

About plugin

  • Plugin page: wp-qiniu
  • Plugin version: 2.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-4.9.8
  • WordPress version: 6.3.1
  • First release: Mar 21, 2017
  • Latest release: Oct 25, 2018
  • Number of updates: 20
  • Update frequency: every 29.0 days
  • Top authors: wishinlife (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

90+ active /14,911 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
These installer errors require your attention
  • Install procedure validation failed for this plugin
    • > User deprecated in wp-includes/functions.php+5643
    File upgrade-functions.php is deprecated since version 2.5.0! Use wp-admin/includes/upgrade.php instead.

Server metrics [RAM: ▲0.55MB] [CPU: ▲2.70ms] Passed 4 tests

Server-side resources used by WP-QINIU (WordPress连接到七牛云存储)
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.06 ▲0.6047.21 ▲7.88
Dashboard /wp-admin3.89 ▲0.5957.35 ▲6.97
Posts /wp-admin/edit.php3.94 ▲0.5955.60 ▲6.74
Add New Post /wp-admin/post-new.php6.41 ▲0.5290.76 ▼10.80
Media Library /wp-admin/upload.php3.75 ▲0.5246.12 ▲10.89
WP-QINIU /wp-admin/options-general.php?page=wp-qiniu/wp-qiniu.php3.7038.94
七牛云存储 /wp-admin/upload.php?page=wp_qiniu_storage3.7238.80

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 125 new files
Database: 1 new table, 6 new options
New tables
wp_wp_qiniu_files
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP-QINIU (WordPress连接到七牛云存储)
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,797 ▲3614.28 ▼0.111.72 ▼0.1942.96 ▲3.44
Dashboard /wp-admin2,200 ▲235.55 ▼0.1187.63 ▼3.7050.06 ▲7.66
Posts /wp-admin/edit.php2,108 ▲82.02 ▲0.0537.68 ▲1.7838.22 ▲1.50
Add New Post /wp-admin/post-new.php1,532 ▼523.31 ▲5.23643.82 ▼8.9752.70 ▼13.18
Media Library /wp-admin/upload.php1,402 ▼14.20 ▲0.05103.79 ▼1.3948.62 ▲2.77
WP-QINIU /wp-admin/options-general.php?page=wp-qiniu/wp-qiniu.php1,1182.0236.6981.55
七牛云存储 /wp-admin/upload.php?page=wp_qiniu_storage8662.4337.0037.84

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie tables were found after uninstall: 1 table
    • wp_wp_qiniu_files
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=wp-qiniu/wp-qiniu.php
    • > Notice in wp-content/plugins/wp-qiniu/wp-qiniu.php+416
    Trying to access array offset on value of type bool

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-qiniu/wp-qiniu-ajax.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-qiniu/wp-qiniu-backup.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-qiniu/wp-qiniu-insert-to-content.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/wp-qiniu/wp-qiniu-debug.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/wp-qiniu/wp-qiniu-shortcodes-audiojs-grindplayer.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-qiniu/wp-qiniu-file-manage.php:166
    • > PHP Fatal error
      Uncaught Error: Class 'Qiniu\\Config' not found in wp-content/plugins/wp-qiniu/lib/Qiniu/functions.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/wp-qiniu/wp-qiniu-shortcodes.php:53
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/wp-qiniu/wp-qiniu-shortcodes-ckplayer.php:46
    • > PHP Warning
      Use of undefined constant WP_QINIU_DEBUG - assumed 'WP_QINIU_DEBUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-qiniu/wp-qiniu-debug.php on line 9

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/upload.php?page=wp_qiniu_storage
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: a(...).live is not a function" "TypeError: a(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-qiniu/js/file-manage.min.js?ver=2.0.5:1:43)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/upload.php?page=wp_qiniu_storage
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: a(...).live is not a function

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: backup, sync, object cloud storage, qiniu, wp-qiniu

wp-qiniu/wp-qiniu.php 92% from 13 tests

Analyzing the main PHP file in "WP-QINIU (WordPress连接到七牛云存储)" version 2.0.5
It is important to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 750 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin11,558 lines of code in 107 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript637212,0805,749
PHP295691,0864,327
CSS1414371,368
SVG100114

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity12.76
▷ Minimum class complexity1.00
▷ Maximum class complexity41.00
Average method complexity2.49
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes17
▷ Abstract classes00.00%
▷ Concrete classes17100.00%
▷ Final classes1694.12%
Methods134
▷ Static methods3727.61%
▷ Public methods10175.37%
▷ Protected methods21.49%
▷ Private methods3123.13%
Functions94
▷ Named functions94100.00%
▷ Anonymous functions00.00%
Constants27
▷ Global constants1970.37%
▷ Class constants829.63%
▷ Public constants8100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
10 PNG files occupy 0.84MB with 0.53MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/cancel.png1.92KB0.79KB▼ 58.81%
screenshot-1.png146.69KB42.30KB▼ 71.16%
img/dir.png8.46KB3.64KB▼ 56.96%
screenshot-3.png145.24KB41.34KB▼ 71.54%
img/audio.png9.36KB4.14KB▼ 55.78%