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
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2540.08 ▼2.76
Dashboard /wp-admin3.83 ▲0.4949.06 ▼12.54
Posts /wp-admin/edit.php4.37 ▲1.0154.36 ▲7.19
Add New Post /wp-admin/post-new.php6.55 ▲0.6692.57 ▼2.25
Media Library /wp-admin/upload.php3.79 ▲0.5635.27 ▼0.64
Google PageSpeed /wp-admin/admin.php?page=w3tc_pagespeed4.5967.32
Cache Groups /wp-admin/admin.php?page=w3tc_cachegroups4.1046.22
Page Cache /wp-admin/admin.php?page=w3tc_pgcache4.2346.05
FAQ /wp-admin/admin.php?page=w3tc_faq3.9138.41
General Settings /wp-admin/admin.php?page=w3tc_general4.3058.29
Dashboard /wp-admin/admin.php?page=w3tc_dashboard3.9647.41
Support /wp-admin/admin.php?page=w3tc_support3.9139.49
Object Cache /wp-admin/admin.php?page=w3tc_objectcache3.9540.94
Extensions /wp-admin/admin.php?page=w3tc_extensions4.0042.03
About /wp-admin/admin.php?page=w3tc_about3.9741.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
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,055 ▲30814.74 ▲0.021.91 ▲0.2337.44 ▼6.58
Dashboard /wp-admin2,392 ▲2145.68 ▼0.0895.38 ▼19.4443.64 ▼0.05
Posts /wp-admin/edit.php2,300 ▲2002.06 ▲0.1042.40 ▲3.3936.83 ▼0.22
Add New Post /wp-admin/post-new.php1,678 ▲15123.47 ▲0.35628.58 ▲35.0953.70 ▼6.48
Media Library /wp-admin/upload.php1,594 ▲1914.12 ▼0.1995.91 ▼5.4640.94 ▼4.96
Google PageSpeed /wp-admin/admin.php?page=w3tc_pagespeed1,8202.1438.9744.84
Cache Groups /wp-admin/admin.php?page=w3tc_cachegroups1,8662.0840.1442.14
Page Cache /wp-admin/admin.php?page=w3tc_pgcache1,8662.0836.8137.63
FAQ /wp-admin/admin.php?page=w3tc_faq1,8692.0837.5334.66
General Settings /wp-admin/admin.php?page=w3tc_general1,8672.0537.5137.28
Dashboard /wp-admin/admin.php?page=w3tc_dashboard1,8662.0733.1935.69
Support /wp-admin/admin.php?page=w3tc_support1,8632.0537.6937.21
Object Cache /wp-admin/admin.php?page=w3tc_objectcache1,8662.0434.3437.61
Extensions /wp-admin/admin.php?page=w3tc_extensions1,8692.0437.4938.68
About /wp-admin/admin.php?page=w3tc_about1,8632.0936.8837.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:
LanguageFilesBlank linesComment linesLines of code
PHP2,51129,48886,632179,870
JavaScript471,2947706,821
CSS228781404,699
Markdown231,35203,984
JSON11601,250
YAML113616292
Java17477231
INI6151684
XML22470
SVG50166
reStructuredText1352959
Dockerfile18010

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 code0.38
Average class complexity12.91
▷ Minimum class complexity1.00
▷ Maximum class complexity388.00
Average method complexity3.32
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces595
Interfaces64
Traits26
Classes1,555
▷ Abstract classes261.67%
▷ Concrete classes1,52998.33%
▷ Final classes322.09%
Methods8,697
▷ Static methods1,34015.41%
▷ Public methods7,18182.57%
▷ Protected methods2683.08%
▷ Private methods1,24814.35%
Functions701
▷ Named functions21430.53%
▷ Anonymous functions48769.47%
Constants1,049
▷ Global constants29528.12%
▷ Class constants75471.88%
▷ Public constants754100.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
FileSize - originalSize - compressedSavings
pub/img/overlay/wordpress-logo-simplified-rgb.png0.39KB0.40KB0.00%
pub/img/w3tc_google-logo-retina.png2.28KB2.36KB0.00%
pub/img/cdn-highwinds-logo.png1.35KB1.40KB0.00%
pub/img/overlay/lite-gray-check.png0.19KB0.19KB▼ 1.53%
pub/img/w3tc_swarmify-logo.png1.74KB1.79KB0.00%