File ms.php
has 471 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Multisite administration functions.
*
* @package WordPress
Function wpmu_delete_blog
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb;
$switch = false;
if ( get_current_blog_id() != $blog_id ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method wpmu_delete_blog
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb;
$switch = false;
if ( get_current_blog_id() != $blog_id ) {
Function wpmu_delete_user
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function wpmu_delete_user( $id ) {
global $wpdb;
$id = (int) $id;
$user = new WP_User( $id );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method choose_primary_blog
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function choose_primary_blog() {
?>
<table class="form-table">
<tr>
<?php /* translators: My sites label */ ?>
Method send_confirmation_on_profile_email
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function send_confirmation_on_profile_email() {
global $errors, $wpdb;
$current_user = wp_get_current_user();
if ( ! is_object($errors) )
$errors = new WP_Error();
Function choose_primary_blog
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function choose_primary_blog() {
?>
<table class="form-table">
<tr>
<?php /* translators: My sites label */ ?>
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method wpmu_delete_user
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpmu_delete_user( $id ) {
global $wpdb;
$id = (int) $id;
$user = new WP_User( $id );
Method update_option_new_admin_email
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update_option_new_admin_email( $old_value, $value ) {
$email = get_option( 'admin_email' );
if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
return;
Function avoid_blog_page_permalink_collision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( is_subdomain_install() )
return $data;
if ( $data['post_type'] != 'page' )
return $data;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function check_upload_size
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function check_upload_size( $file ) {
if ( get_site_option( 'upload_space_check_disabled' ) )
return $file;
if ( $file['error'] != '0' ) // there's already an error
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if ( $file == '.' || $file == '..' )
continue;
Avoid deeply nested control flow statements. Open
else if ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) )
@unlink( $dir . DIRECTORY_SEPARATOR . $file );
Function send_confirmation_on_profile_email
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function send_confirmation_on_profile_email() {
global $errors, $wpdb;
$current_user = wp_get_current_user();
if ( ! is_object($errors) )
$errors = new WP_Error();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function upload_is_user_over_quota
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function upload_is_user_over_quota( $echo = true ) {
if ( get_site_option( 'upload_space_check_disabled' ) )
return false;
$space_allowed = get_space_allowed();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $data;
Function mu_dropdown_languages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
$flag = false;
$output = array();
foreach ( (array) $lang_files as $val ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sync_category_tag_slugs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function sync_category_tag_slugs( $term, $taxonomy ) {
if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
if ( is_object( $term ) ) {
$term->slug = sanitize_title( $term->name );
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"