HEX
Server: Apache
System: Linux server11 5.10.0-33-amd64 #1 SMP Debian 5.10.226-1 (2024-10-03) x86_64
User: web78 (5081)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/clients/client1/web78/web/wp-content/plugins/better-wp-security/core/lib/storage.php
<?php

final class ITSEC_Storage {
	private $option = 'itsec-storage';

	private static $instance = false;
	private $changed = false;
	private $cache;
	private $shutdown_done = false;

	private function __construct() {
		$this->load();

		register_shutdown_function( array( $this, 'shutdown' ) );
		add_action( 'shutdown', array( $this, 'shutdown' ), -10 );

		add_action( 'itsec-lib-clear-caches', array( $this, 'save' ), -20 );
		add_action( 'itsec-lib-clear-caches', array( $this, 'load' ), -10 );
	}

	private static function get_instance() {
		if ( false === self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	public static function get( $name ) {
		$data = self::get_instance();

		if ( isset( $data->cache[$name] ) ) {
			return $data->cache[$name];
		}

		return null;
	}

	public static function get_all() {
		$data = self::get_instance();

		return $data->cache;
	}

	public static function set( $name, $value ) {
		$data = self::get_instance();
		$data->cache[$name] = $value;
		$data->changed = true;

		if ( $data->shutdown_done ) {
			self::save();
		}
	}

	public static function set_all( $value ) {
		$data = self::get_instance();
		$data->cache = $value;
		$data->changed = true;

		if ( $data->shutdown_done ) {
			self::save();
		}
	}

	public static function save() {
		$data = self::get_instance();

		if ( ! $data->changed ) {
			return true;
		}

		$data->changed = false;

		if ( is_multisite() ) {
			return update_site_option( $data->option, $data->cache );
		} else {
			return update_option( $data->option, $data->cache );
		}
	}

	public static function reload() {
		$data = self::get_instance();
		$data->load();
	}

	public function load() {
		$this->cache = get_site_option( $this->option );

		if ( ! is_array( $this->cache ) ) {
			$this->cache = array();
		}
	}

	public function shutdown() {
		self::save();

		$this->shutdown_done = true;
	}

	public static function reset() {
		$data = self::get_instance();

		delete_site_option( $data->option );
		unset( $data->cache );
		$data->changed = false;
	}
}