wppaste
WordPress

WP_Debug_Data::get_wp_plugins_raw_data(): array<string,

Since
6.7.0
Source
wp-admin/includes/class-wp-debug-data.php:991
Gets the raw plugin data for the WordPress active and inactive sections of the debug data.

Compatibility

WordPress
since 6.7.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Return value

array<string,
array<string, array<string, string>>> The raw plugin debug data for active and inactive plugins.

Performance profile

How much work a call to WP_Debug_Data::get_wp_plugins_raw_data() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reads stored settings via get_site_option(), cached per request but not free on a cold cache.

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
20–27

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 195.

Plugin surface
1 hook

Third-party callbacks on 'plugin_auto_update_debug_string' run inside this call, and their cost is not bounded by anything here.

Called by
2

2 places in core call this, so the cost is paid more often than your own code shows.

What it touches

  • transienttransientget_site_transient()called directly
  • optionnetwork optionget_site_option()called directly
  • hookthird-party callbacksapply_filters()called directly
  • cacheobject cachewp_cache_get()one call below WP_Debug_Data::get_wp_plugins_raw_data()

Further down the call graph this can also reach serialize and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 2 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Debug_Data::get_wp_plugins_raw_data() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always20–21get_plugins(), get_plugin_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type()
always26–27get_plugins(), get_plugin_updates(), get_site_transient(), wp_is_auto_update_enabled_for_type(), get_site_option()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev19520–2714
8.519520–2714
8.419520–27149 fewer instructions than PHP 8.3
8.320420–2714
8.220420–2714
8.120420–2714
7.420420–2714

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Hooks and filters fired · 1

One hook fires while WP_Debug_Data::get_wp_plugins_raw_data() runs, in this order:

  1. apply_filters( plugin_auto_update_debug_string )filterline 1089 (+98 into the body)

    Filters the text string of the auto-updates setting for each plugin in the Site Health debug data.

Uses · 12

Used by · 2

Source code

	private static function get_wp_plugins_raw_data(): array {		// List all available plugins.		$plugins        = get_plugins();		$plugin_updates = get_plugin_updates();		$transient      = get_site_transient( 'update_plugins' ); 		$auto_updates = array();		$fields       = array(			'wp-plugins-active'   => array(),			'wp-plugins-inactive' => array(),		); 		$auto_updates_enabled = wp_is_auto_update_enabled_for_type( 'plugin' ); 		if ( $auto_updates_enabled ) {			$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );		} 		foreach ( $plugins as $plugin_path => $plugin ) {			$plugin_part = ( is_plugin_active( $plugin_path ) ) ? 'wp-plugins-active' : 'wp-plugins-inactive'; 			$plugin_version = $plugin['Version'];			$plugin_author  = $plugin['Author']; 			$plugin_version_string       = __( 'No version or author information is available.' );			$plugin_version_string_debug = 'author: (undefined), version: (undefined)'; 			if ( ! empty( $plugin_version ) && ! empty( $plugin_author ) ) {				/* translators: 1: Plugin version number. 2: Plugin author name. */				$plugin_version_string       = sprintf( __( 'Version %1$s by %2$s' ), $plugin_version, $plugin_author );				$plugin_version_string_debug = sprintf( 'version: %s, author: %s', $plugin_version, $plugin_author );			} else {				if ( ! empty( $plugin_author ) ) {					/* translators: %s: Plugin author name. */					$plugin_version_string       = sprintf( __( 'By %s' ), $plugin_author );					$plugin_version_string_debug = sprintf( 'author: %s, version: (undefined)', $plugin_author );				} 				if ( ! empty( $plugin_version ) ) {					/* translators: %s: Plugin version number. */					$plugin_version_string       = sprintf( __( 'Version %s' ), $plugin_version );					$plugin_version_string_debug = sprintf( 'author: (undefined), version: %s', $plugin_version );				}			} 			if ( array_key_exists( $plugin_path, $plugin_updates ) ) {				/* translators: %s: Latest plugin version number. */				$plugin_version_string       .= ' ' . sprintf( __( '(Latest version: %s)' ), $plugin_updates[ $plugin_path ]->update->new_version );				$plugin_version_string_debug .= sprintf( ' (latest version: %s)', $plugin_updates[ $plugin_path ]->update->new_version );			} 			if ( $auto_updates_enabled ) {				if ( isset( $transient->response[ $plugin_path ] ) ) {					$item = $transient->response[ $plugin_path ];				} elseif ( isset( $transient->no_update[ $plugin_path ] ) ) {					$item = $transient->no_update[ $plugin_path ];				} else {					$item = array(						'id'            => $plugin_path,						'slug'          => '',						'plugin'        => $plugin_path,						'new_version'   => '',						'url'           => '',						'package'       => '',						'icons'         => array(),						'banners'       => array(),						'banners_rtl'   => array(),						'tested'        => '',						'requires_php'  => '',						'compatibility' => new stdClass(),					);					$item = wp_parse_args( $plugin, $item );				} 				$auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); 				if ( ! is_null( $auto_update_forced ) ) {					$enabled = $auto_update_forced;				} else {					$enabled = in_array( $plugin_path, $auto_updates, true );

Changelog

Introduced in 6.7.0. One change between 6.7.7 and 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

7.0.4
Return type changed from array to array<string,.verified against source
6.7.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-admin/includes/class-wp-debug-data.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.