78% maintenance-switch

Code Review | Maintenance Switch

WordPress plugin Maintenance Switch scored 78% from 54 tests.

About plugin

  • Plugin page: maintenance-switch
  • Plugin version: 1.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9
  • WordPress version: 5.9.2
  • First release: Jul 24, 2015
  • Latest release: Jan 21, 2018
  • Number of updates: 58
  • Update frequency: every 15.7 days
  • Top authors: fugudesign (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

1,000+ active / 33,513 total downloads

Benchmarks

Plugin footprint 82% 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.22MB] [CPU: ▼294.40ms] Passed 4 tests

A check of server-side resources used by Maintenance Switch
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.2259.55 ▲9.51
Dashboard /wp-admin3.64 ▲0.2343.01 ▲9.92
Posts /wp-admin/edit.php3.86 ▲0.2239.57 ▲1.47
Add New Post /wp-admin/post-new.php7.17 ▲0.1996.51 ▼1,191.34
Media Library /wp-admin/upload.php3.58 ▲0.2927.16 ▲2.77
Maintenance Switch /wp-admin/options-general.php?page=maintenance-switch3.5626.10

Server storage [IO: ▲0.25MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Please fix the following
  • There were 1 file (1.61KB) illegally modified outside of "wp-content/plugins/maintenance-switch/" and "wp-content/uploads/"
    • (new file) wp-content/maintenance.php
Filesystem: 35 new files
Database: no new tables, 3 new options
New WordPress options
maintenance_switch_status
maintenance_switch_settings
maintenance_switch_version

Browser metrics Passed 4 tests

An overview of browser requirements for Maintenance Switch
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,942 ▲18816.59 ▲0.8110.17 ▲4.252.80 ▲0.29
Dashboard /wp-admin2,907 ▲466.09 ▼0.13118.83 ▼21.39156.27 ▼9.13
Posts /wp-admin/edit.php2,710 ▲253.25 ▲0.0163.96 ▼2.21141.55 ▼4.56
Add New Post /wp-admin/post-new.php1,681 ▲2016.43 ▲0.40432.15 ▲11.17154.65 ▼3.39
Media Library /wp-admin/upload.php1,721 ▲235.56 ▲0.04139.07 ▼12.34180.75 ▼3.27
Maintenance Switch /wp-admin/options-general.php?page=maintenance-switch1,8435.09122.49147.24

Uninstaller [IO: ▲0.00MB] [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 does not fully uninstall, leaving 3 options in the database
    • maintenance_switch_status
    • maintenance_switch_settings
    • maintenance_switch_version

Smoke tests 50% 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 | 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 take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/maintenance-switch/public/views/maintenance-switch-public-display.php
    • > /wp-content/plugins/maintenance-switch/templates/maintenance.php
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_bloginfo() in wp-content/plugins/maintenance-switch/includes/config.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Please fix the following attributes:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

maintenance-switch/maintenance-switch.php Passed 13 tests

The main PHP script in "Maintenance Switch" version 1.5.2 is automatically included on every request by WordPress
100 characters long description:
Customize easily and switch in one-click to (native) maintenance mode from your backend or frontend.

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
No dangerous file extensions were detected5,396 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
JSON2004,103
PHP153661,026887
Sass2452176
PO File15881131
JavaScript4263997
CSS3042

PHP code Passed 2 tests

This is a very shot review 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.33
Average class complexity15.00
▷ Minimum class complexity1.00
▷ Maximum class complexity71.00
Average method complexity2.35
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods83
▷ Static methods22.41%
▷ Public methods7893.98%
▷ Protected methods00.00%
▷ Private methods56.02%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
PNG images were not found in this plugin