debug_fclose

Definition:
function debug_fclose( $fp ) {}

Close the debugging file handle.
Technically, this can be used to close any file handle when the global $debug is set to 1 or true.

Parameters

  • resource $fp: Debug File handle.

Source code

function debug_fclose( $fp ) {

	global $debug;

	if ( 1 == $debug )

		fclose( $fp );

}

774

debug

Parameters

  • $msg

Source code

function debug($msg) {

	$args = func_get_args();



	$log = getLogger();

	$log->debug(implode(', ', $args));

}

772

dead_db

Definition:
function dead_db() {}

Load custom DB error or display WordPress DB error.
If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not found, then the WordPress DB error will be displayed instead.

Source code

function dead_db() {

	global $wpdb;



	// Load custom DB error template, if present.

	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {

		require_once( WP_CONTENT_DIR . '/db-error.php' );

		die();

	}



	// If installing or in the admin, provide the verbose message.

	if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )

		wp_die($wpdb->error);



	// Otherwise, be terse.

	status_header( 500 );

	nocache_headers();

	header( 'Content-Type: text/html; charset=utf-8' );

?>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) ) language_attributes(); ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title><?php echo /*WP_I18N_DB_ERROR*/'Database Error'/*/WP_I18N_DB_ERROR*/; ?></title>



</head>

<body>

	<h1><?php echo /*WP_I18N_DB_CONNECTION_ERROR*/'Error establishing a database connection'/*/WP_I18N_DB_CONNECTION_ERROR*/; ?></h1>

</body>

</html>

<?php

	die();

}

770

deactivate_sitewide_plugin

Definition:
function deactivate_sitewide_plugin( $plugin = false ) {}

Parameters

  • $plugin

Source code

function deactivate_sitewide_plugin( $plugin = false ) {

	_deprecated_function(__FUNCTION__, '3.0', 'deactivate_plugin()' );

	return;

}

768

deactivate_plugins

Definition:
function deactivate_plugins( $plugins, $silent = false ) {}

Deactivate a single plugin or multiple plugins.
The deactivation hook is disabled by the plugin upgrader by using the $silent parameter.

Parameters

  • string|array $plugins: Single plugin or list of plugins to deactivate.
  • bool $silent: Prevent calling deactivation hooks. Default is false.

Defined actions

  • deactivate_plugin
    do_action( 'deactivate_plugin', $plugin, $network_wide );
  • deactivate_’.$plugin
    do_action( 'deactivate_' . $plugin, $network_wide );
  • deactivated_plugin
    do_action( 'deactivated_plugin', $plugin, $network_wide );

Source code

function deactivate_plugins( $plugins, $silent = false ) {

	if ( is_multisite() )

		$network_current = get_site_option( 'active_sitewide_plugins', array() );

	$current = get_option( 'active_plugins', array() );

	$do_blog = $do_network = false;



	foreach ( (array) $plugins as $plugin ) {

		$plugin = plugin_basename( trim( $plugin ) );

		if ( ! is_plugin_active($plugin) )

			continue;



		$network_wide = is_plugin_active_for_network( $plugin );



		if ( ! $silent )

			do_action( 'deactivate_plugin', $plugin, $network_wide );



		if ( $network_wide ) {

			$do_network = true;

			unset( $network_current[ $plugin ] );

		} else {

			$key = array_search( $plugin, $current );

			if ( false !== $key ) {

				$do_blog = true;

				array_splice( $current, $key, 1 );

			}

		}



		if ( ! $silent ) {

			do_action( 'deactivate_' . $plugin, $network_wide );

			do_action( 'deactivated_plugin', $plugin, $network_wide );

		}

	}



	if ( $do_blog )

		update_option('active_plugins', $current);

	if ( $do_network )

		update_site_option( 'active_sitewide_plugins', $network_current );

}

766