81% w3-total-cache

Code Review | W3 Total Cache

WordPress plugin W3 Total Cache scored 81% from 54 tests.

About plugin

  • Plugin page: w3-total-cache
  • Plugin version: 2.2.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.9
  • WordPress version: 5.9.2
  • First release: Jul 29, 2009
  • Latest release: Jan 24, 2022
  • Number of updates: 383
  • Update frequency: every 11.9 days
  • Top authors: fredericktownes (88.51%)joemoto (9.66%)boldgrid (2.09%)

Code review

54 tests

User reviews

4952 reviews

Install metrics

1,000,000+ active / 34,418,341 total downloads

Benchmarks

Plugin footprint 99% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.51MB] [CPU: ▼293.26ms] 75% from 4 tests

A check of server-side resources used by W3 Total Cache
Please take the time to fix the following items
  • CPU: The total CPU usage must kept under 500.00ms (currently 659.13ms on /wp-admin/admin.php?page=w3tc_dashboard)
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.2559.70 ▲6.55
Dashboard /wp-admin3.92 ▲0.5238.17 ▲3.36
Posts /wp-admin/edit.php4.35 ▲0.7143.75 ▲6.79
Add New Post /wp-admin/post-new.php7.79 ▲0.8298.42 ▼1,178.66
Media Library /wp-admin/upload.php3.84 ▲0.5424.10 ▼4.29
Database Cache /wp-admin/admin.php?page=w3tc_dbcache4.4957.96
Extensions /wp-admin/admin.php?page=w3tc_extensions3.9931.49
Statistics /wp-admin/admin.php?page=w3tc_stats3.9026.68
Page Cache /wp-admin/admin.php?page=w3tc_pgcache4.1733.40
Support /wp-admin/admin.php?page=w3tc_support3.9028.64
Dashboard /wp-admin/admin.php?page=w3tc_dashboard4.17659.13
User Experience /wp-admin/admin.php?page=w3tc_userexperience3.9327.89
Object Cache /wp-admin/admin.php?page=w3tc_objectcache3.9590.53
Fragment Cache /wp-admin/admin.php?page=w3tc_fragmentcache3.9630.90
Minify /wp-admin/admin.php?page=w3tc_minify4.2549.11

Server storage [IO: ▲28.76MB] [DB: ▲0.01MB] 33% from 3 tests

Input-output and database impact of this plugin
Please try to fix the following items
  • Illegal file modification detected: 7 files (41.90KB) outside of "wp-content/plugins/w3-total-cache/" and "wp-content/uploads/"
    • (modified) wp-config.php
    • (new file) wp-content/cache/index.html
    • (new file) wp-content/w3tc-config/index.html
    • (new file) wp-content/advanced-cache.php
    • (new file) wp-content/cache/tmp/.empty
    • (modified) .htaccess
    • (new file) wp-content/w3tc-config/master.php
  • Try to limit filesystem usage to 25MB (currently using 28.76MB)
Filesystem: 2,736 new files
Database: no new tables, 1 new option
New WordPress options
w3tc_extensions_hooks

Browser metrics Passed 4 tests

Checking browser requirements for W3 Total Cache
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,082 ▲36015.98 ▲0.366.53 ▲0.932.63 ▲0.52
Dashboard /wp-admin3,121 ▲2606.09 ▼0.06116.93 ▼16.02154.87 ▼4.64
Posts /wp-admin/edit.php2,923 ▲2323.30 ▲0.0766.01 ▲1.74141.45 ▼2.45
Add New Post /wp-admin/post-new.php1,830 ▲7015.56 ▼1.58459.54 ▲25.13159.92 ▼6.20
Media Library /wp-admin/upload.php1,930 ▲2385.60 ▲0.10144.94 ▲6.39188.01 ▼14.11
Database Cache /wp-admin/admin.php?page=w3tc_dbcache2,1392.8862.80130.48
Extensions /wp-admin/admin.php?page=w3tc_extensions2,1392.8362.63129.79
Statistics /wp-admin/admin.php?page=w3tc_stats2,1702.7965.26128.41
Page Cache /wp-admin/admin.php?page=w3tc_pgcache2,1742.8164.07129.43
Support /wp-admin/admin.php?page=w3tc_support2,1742.9164.28130.32
Dashboard /wp-admin/admin.php?page=w3tc_dashboard2,1702.8662.35129.01
User Experience /wp-admin/admin.php?page=w3tc_userexperience2,1392.8363.00129.99
Object Cache /wp-admin/admin.php?page=w3tc_objectcache2,1742.8162.10130.37
Fragment Cache /wp-admin/admin.php?page=w3tc_fragmentcache2,1742.9061.09128.58
Minify /wp-admin/admin.php?page=w3tc_minify2,1722.8762.97135.22

Uninstaller [IO: ▲0.03MB] [DB: ▲0.01MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 6× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/w3-total-cache/inc/email/minify_error_notification.php
    • > /wp-content/plugins/w3-total-cache/inc/popup/common/footer.php
    • > /wp-content/plugins/w3-total-cache/inc/options/common/footer.php
    • > /wp-content/plugins/w3-total-cache/vendor/mtdowling/jmespath.php/bin/jp.php
    • > /wp-content/plugins/w3-total-cache/inc/lightbox/purchase.php
    • > /wp-content/plugins/w3-total-cache/Support_Page_View_PageContent.php
  • 939× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/KinesisVideoMedia/KinesisVideoMediaClient.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/NimbleStudio/NimbleStudioClient.php:99
    • > PHP Fatal error
      Uncaught Error: Class 'MicrosoftAzure\\Storage\\Blob\\Models\\BlobServiceOptions' not found in wp-content/plugins/w3-total-cache/lib/Azure/MicrosoftAzureStorage/Blob/Models/CommitBlobBlocksOptions.php:39
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Exception\\AwsException' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/CodeBuild/Exception/CodeBuildException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'W3TC\\Enterprise_SnsBase' not found in wp-content/plugins/w3-total-cache/Enterprise_CacheFlush_MakeSnsEvent.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'W3TC\\CdnEngine_Base' not found in wp-content/plugins/w3-total-cache/CdnEngine_Mirror.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\Api\\Serializer\\RestSerializer' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Api/Serializer/RestJsonSerializer.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'MicrosoftAzure\\Storage\\Common\\Internal\\Authentication\\StorageAuthScheme' not found in wp-content/plugins/w3-total-cache/lib/Azure/MicrosoftAzureStorage/Common/Internal/Authentication/TableSharedKeyLiteAuthScheme.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'Aws\\AwsClient' not found in wp-content/plugins/w3-total-cache/vendor/aws/aws-sdk-php/src/Swf/SwfClient.php:84
    • > 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

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
  • 9 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=w3tc_minify
    • > Intervention (severe) in unknown
    /wp-admin/admin.php?page=w3tc_setup_guide - Blocked attempt to show a 'beforeunload' confirmation panel for a frame that never had a user gesture since its load. https://www.chromestatus.com/feature/5082396709879808

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% 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:
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === w3-total-cache === )
  • Tags: Please delete some tags, you are using 18 tag instead of maximum 10
You can take inspiration from this readme.txt

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

The main file in "W3 Total Cache" v. 2.2.1 serves as a complement to information provided in readme.txt and as the entry point to the 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 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin195,327 lines of code in 2,607 files:
LanguageFilesBlank linesComment linesLines of code
PHP2,49129,20382,486166,020
PO File45,2866,74315,592
JavaScript451,2345546,047
Markdown181,18803,638
CSS204311192,500
JSON1060989
Java17477231
YAML425087
INI6151684
reStructuredText1352959
XML10457
Dockerfile18010
make1409
SVG4004

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity12.62
▷ Minimum class complexity1.00
▷ Maximum class complexity387.00
Average method complexity3.29
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces595
Interfaces64
Traits26
Classes1,538
▷ Abstract classes261.69%
▷ Concrete classes1,51298.31%
▷ Final classes312.05%
Methods8,534
▷ Static methods1,29415.16%
▷ Public methods7,02182.27%
▷ Protected methods2683.14%
▷ Private methods1,24514.59%
Functions696
▷ Named functions21330.60%
▷ Anonymous functions48369.40%
Constants1,043
▷ Global constants29228.00%
▷ Class constants75172.00%
▷ Public constants751100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
46 compressed PNG files occupy 0.12MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
pub/img/transparent-comet.png17.16KB18.56KB0.00%
pub/img/google-logo.png1.19KB1.22KB0.00%
pub/img/white-grad.png0.08KB0.18KB0.00%
pub/img/overlay/lock.png0.29KB0.29KB▼ 2.65%
pub/img/w3tc_w3tc-logo-retina.png1.16KB1.22KB0.00%