HEX
Server: Apache
System: Linux web2213.uni5.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User: clinicamaciel (596848)
PHP: 7.3.33
Disabled: apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,eval,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
Upload Files
File: /home/clinicamaciel/www/site/wp-content/plugins/w3-total-cache/ObjectCache_Plugin_Admin.php
<?php
namespace W3TC;

class ObjectCache_Plugin_Admin {
	function run() {
		$config_labels = new ObjectCache_ConfigLabels();
		add_filter( 'w3tc_config_labels', array( $config_labels, 'config_labels' ) );

		$c = Dispatcher::config();
		if ( $c->get_boolean( 'objectcache.enabled' ) ) {
			add_filter( 'w3tc_errors', array( $this, 'w3tc_errors' ) );
			add_filter( 'w3tc_notes', array( $this, 'w3tc_notes' ) );
			add_filter( 'w3tc_usage_statistics_summary_from_history', array(
					$this, 'w3tc_usage_statistics_summary_from_history' ), 10, 2 );
		}
	}



	public function w3tc_errors( $errors ) {
		$c = Dispatcher::config();

		if ( $c->get_string( 'objectcache.engine' ) == 'memcached' ) {
			$memcached_servers = $c->get_array(
				'objectcache.memcached.servers' );

			if ( !Util_Installed::is_memcache_available( $memcached_servers ) ) {
				if ( !isset( $errors['memcache_not_responding.details'] ) )
					$errors['memcache_not_responding.details'] = array();

				$errors['memcache_not_responding.details'][] = sprintf(
					__( 'Object Cache: %s.', 'w3-total-cache' ),
					implode( ', ', $memcached_servers ) );
			}
		}

		return $errors;
	}



	public function w3tc_notes( $notes ) {
		$c = Dispatcher::config();
		$state = Dispatcher::config_state();
		$state_note = Dispatcher::config_state_note();

		/**
		 * Show notification when object cache needs to be emptied
		 */
		if ( $state_note->get( 'objectcache.show_note.flush_needed' ) &&
			!is_network_admin() /* flushed dont work under network admin */ &&
			!$c->is_preview() ) {
			$notes['objectcache_flush_needed'] = sprintf(
				__( 'The setting change(s) made either invalidate the cached data or modify the behavior of the site. %s now to provide a consistent user experience.',
					'w3-total-cache' ),
				Util_Ui::button_link(
					__( 'Empty the object cache', 'w3-total-cache' ),
					Util_Ui::url( array( 'w3tc_flush_objectcache' => 'y' ) ) ) );
		}

		return $notes;
	}



	public function w3tc_usage_statistics_summary_from_history( $summary, $history ) {
		// memcached servers
		$c = Dispatcher::config();
		if ( $c->get_string( 'objectcache.engine' ) == 'memcached' ) {
			$summary['memcached_servers']['objectcache'] = array(
				'servers' => $c->get_array( 'objectcache.memcached.servers' ),
				'username' => $c->get_boolean( 'objectcache.memcached.username' ),
				'password' => $c->get_boolean( 'objectcache.memcached.password' ),
				'name' => __( 'Object Cache', 'w3-total-cache' )
			);
		} elseif ( $c->get_string( 'objectcache.engine' ) == 'redis' ) {
			$summary['redis_servers']['objectcache'] = array(
				'servers' => $c->get_array( 'objectcache.redis.servers' ),
				'username' => $c->get_boolean( 'objectcache.redis.username' ),
				'dbid' => $c->get_boolean( 'objectcache.redis.dbid' ),
				'password' => $c->get_boolean( 'objectcache.redis.password' ),
				'name' => __( 'Object Cache', 'w3-total-cache' )
			);
		}

		// counters
		$objectcache_calls_total = Util_UsageStatistics::sum( $history,
			'objectcache_calls_total' );
		$objectcache_calls_hits = Util_UsageStatistics::sum( $history,
			'objectcache_calls_hits' );

		$summary['objectcache'] = array(
			'calls_total' => Util_UsageStatistics::integer(
				$objectcache_calls_total ),
			'calls_per_second' => Util_UsageStatistics::value_per_period_seconds(
				$objectcache_calls_total, $summary ),
			'hit_rate' => Util_UsageStatistics::percent(
				$objectcache_calls_total, $objectcache_calls_total )
		);

		return $summary;
	}
}