71% w3-total-cache

Code Review | W3 Total Cache

WordPress plugin W3 Total Cache scored71%from 54 tests.

About plugin

  • Plugin page: w3-total-cache
  • Plugin version: 2.6.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4
  • WordPress version: 6.3.1
  • First release: Jul 29, 2009
  • Latest release: Nov 28, 2023
  • Number of updates: 478
  • Update frequency: every 11.0 days
  • Top authors: fredericktownes (70.92%)boldgrid (16.74%)joemoto (12.55%)

Code review

54 tests

User reviews

5298 reviews

Install metrics

1,000,000+ active /45,562,925 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.49MB] [CPU: ▼4.55ms] Passed 4 tests

An overview of server-side resources used by W3 Total Cache
Normal server usage
Page Memory (MB) CPU Time (ms)
Home / 3.71 ▲0.25 40.08 ▼2.76
Dashboard /wp-admin 3.83 ▲0.49 49.06 ▼12.54
Posts /wp-admin/edit.php 4.37 ▲1.01 54.36 ▲7.19
Add New Post /wp-admin/post-new.php 6.55 ▲0.66 92.57 ▼2.25
Media Library /wp-admin/upload.php 3.79 ▲0.56 35.27 ▼0.64
Google PageSpeed /wp-admin/admin.php?page=w3tc_pagespeed 4.59 67.32
Cache Groups /wp-admin/admin.php?page=w3tc_cachegroups 4.10 46.22
Page Cache /wp-admin/admin.php?page=w3tc_pgcache 4.23 46.05
FAQ /wp-admin/admin.php?page=w3tc_faq 3.91 38.41
General Settings /wp-admin/admin.php?page=w3tc_general 4.30 58.29
Dashboard /wp-admin/admin.php?page=w3tc_dashboard 3.96 47.41
Support /wp-admin/admin.php?page=w3tc_support 3.91 39.49
Object Cache /wp-admin/admin.php?page=w3tc_objectcache 3.95 40.94
Extensions /wp-admin/admin.php?page=w3tc_extensions 4.00 42.03
About /wp-admin/admin.php?page=w3tc_about 3.97 41.64

Server storage [IO: ▲28.65MB] [DB: ▲0.00MB] 33% from 3 tests

A short overview of filesystem and database impact
Please fix the following
  • Illegal file modification detected: 7 files (45.82KB) outside of "wp-content/plugins/w3-total-cache/" and "wp-content/uploads/"
    • (modified) wp-config.php
    • (new file) wp-content/w3tc-config/master.php
    • (new file) wp-content/cache/tmp/.empty
    • (new file) wp-content/w3tc-config/index.html
    • (new file) wp-content/cache/index.html
    • (new file) wp-content/advanced-cache.php
    • (modified) .htaccess
  • Filesystem usage must be lower than 25MB (currently using 28.65MB)
Filesystem: 2,764 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
w3tc_extensions_hooks
widget_recent-comments

Browser metrics Passed 4 tests

W3 Total Cache: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 3,055 ▲308 14.74 ▲0.02 1.91 ▲0.23 37.44 ▼6.58
Dashboard /wp-admin 2,392 ▲214 5.68 ▼0.08 95.38 ▼19.44 43.64 ▼0.05
Posts /wp-admin/edit.php 2,300 ▲200 2.06 ▲0.10 42.40 ▲3.39 36.83 ▼0.22
Add New Post /wp-admin/post-new.php 1,678 ▲151 23.47 ▲0.35 628.58 ▲35.09 53.70 ▼6.48
Media Library /wp-admin/upload.php 1,594 ▲191 4.12 ▼0.19 95.91 ▼5.46 40.94 ▼4.96
Google PageSpeed /wp-admin/admin.php?page=w3tc_pagespeed 1,820 2.14 38.97 44.84
Cache Groups /wp-admin/admin.php?page=w3tc_cachegroups 1,866 2.08 40.14 42.14
Page Cache /wp-admin/admin.php?page=w3tc_pgcache 1,866 2.08 36.81 37.63
FAQ /wp-admin/admin.php?page=w3tc_faq 1,869 2.08 37.53 34.66
General Settings /wp-admin/admin.php?page=w3tc_general 1,867 2.05 37.51 37.28
Dashboard /wp-admin/admin.php?page=w3tc_dashboard 1,866 2.07 33.19 35.69
Support /wp-admin/admin.php?page=w3tc_support 1,863 2.05 37.69 37.21
Object Cache /wp-admin/admin.php?page=w3tc_objectcache 1,866 2.04 34.34 37.61
Extensions /wp-admin/admin.php?page=w3tc_extensions 1,869 2.04 37.49 38.68
About /wp-admin/admin.php?page=w3tc_about 1,863 2.09 36.88 37.11

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • 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 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=w3tc_faq
    • > Warning in wp-content/plugins/w3-total-cache/Util_Ui.php+1507
    Illegal string offset 'page_name'
    • > GET request to /wp-admin/admin.php?page=w3tc_faq
    • > Notice in wp-content/plugins/w3-total-cache/Util_Ui.php+1507
    Uninitialized string offset: 0

SRP 0% 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
Please fix the following
  • 5× PHP files output text when accessed directly:
    • > /wp-content/plugins/w3-total-cache/inc/popup/common/footer.php
    • > /wp-content/plugins/w3-total-cache/Support_Page_View_PageContent.php
    • > /wp-content/plugins/w3-total-cache/inc/email/minify_error_notification.php
    • > /wp-content/plugins/w3-total-cache/vendor/bin/jp.php
    • > /wp-content/plugins/w3-total-cache/vendor/mtdowling/jmespath.php/bin/jp.php
  • 948× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Aws\\Crypto\\AesStreamInterface' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Crypto/AesGcmEncryptingStream.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Api\\Parser\\AbstractRestParser' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Api/Parser/RestXmlParser.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'W3TCG_Google_Signer_Abstract' not found in wp-content/plugins/w3-total-cache/lib/Google/Signer/P12.php:25
    • > PHP Fatal error
      require_once(): Failed opening required 'W3TC_LIB_DIR/OAuth/W3tcOAuth.php' (include_path='.:/usr/share/php') in wp-content/plugins/w3-total-cache/Cdn_StackPath_Api.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'W3TC\\DbCache_WpdbBase' not found in wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/ApplicationCostProfiler/Exception/ApplicationCostProfilerException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/FraudDetector/FraudDetectorClient.php:123
    • > PHP Fatal error
      Uncaught Error: Interface 'Aws\\MonitoringEventsInterface' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Exception/InvalidRegionException.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/ElasticLoadBalancingV2/ElasticLoadBalancingV2Client.php:77
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Pinpoint/Exception/PinpointException.php:9

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 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that need to be fixed:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === w3-total-cache === )
  • Tags: Please reduce the number of tags, currently 18 tag instead of maximum 10
You can look at the official readme.txt

w3-total-cache/w3-total-cache.php 92% from 13 tests

The main PHP file in "W3 Total Cache" ver. 2.6.1 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 244 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin197,436 lines of code in 2,641 files:
Language Files Blank lines Comment lines Lines of code
PHP 2,511 29,488 86,632 179,870
JavaScript 47 1,294 770 6,821
CSS 22 878 140 4,699
Markdown 23 1,352 0 3,984
JSON 11 6 0 1,250
YAML 11 36 16 292
Java 1 74 77 231
INI 6 15 16 84
XML 2 2 4 70
SVG 5 0 1 66
reStructuredText 1 35 29 59
Dockerfile 1 8 0 10

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
It is recommended to fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code 0.38
Average class complexity 12.91
▷ Minimum class complexity 1.00
▷ Maximum class complexity 388.00
Average method complexity 3.32
▷ Minimum method complexity 1.00
▷ Maximum method complexity 179.00
Code structure
Namespaces 595
Interfaces 64
Traits 26
Classes 1,555
▷ Abstract classes 26 1.67%
▷ Concrete classes 1,529 98.33%
▷ Final classes 32 2.09%
Methods 8,697
▷ Static methods 1,340 15.41%
▷ Public methods 7,181 82.57%
▷ Protected methods 268 3.08%
▷ Private methods 1,248 14.35%
Functions 701
▷ Named functions 214 30.53%
▷ Anonymous functions 487 69.47%
Constants 1,049
▷ Global constants 295 28.12%
▷ Class constants 754 71.88%
▷ Public constants 754 100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
44 compressed PNG files occupy 0.11MB
Potential savings
Compression of 5 random PNG files using pngquant
File Size - original Size - compressed Savings
pub/img/overlay/wordpress-logo-simplified-rgb.png 0.39KB 0.40KB 0.00%
pub/img/w3tc_google-logo-retina.png 2.28KB 2.36KB 0.00%
pub/img/cdn-highwinds-logo.png 1.35KB 1.40KB 0.00%
pub/img/overlay/lite-gray-check.png 0.19KB 0.19KB ▼ 1.53%
pub/img/w3tc_swarmify-logo.png 1.74KB 1.79KB 0.00%