SILENT KILLERPanel

Current Path: > > usr > src > litespeed-wp-plugin > 6.0.0.1 > > litespeed-cache > src >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //usr/src/litespeed-wp-plugin/6.0.0.1//litespeed-cache/src/

NameTypeSizeLast ModifiedActions
cdn Directory - -
data_structure Directory - -
activation.cls.php File 15319 bytes December 16 2023 04:27:20.
admin-display.cls.php File 33901 bytes December 16 2023 04:27:20.
admin-settings.cls.php File 9750 bytes December 16 2023 04:27:20.
admin.cls.php File 4548 bytes December 16 2023 04:27:20.
api.cls.php File 11341 bytes December 16 2023 04:27:20.
avatar.cls.php File 6208 bytes December 16 2023 04:27:20.
base.cls.php File 30732 bytes December 16 2023 04:27:20.
cdn-setup.cls.php File 10030 bytes December 16 2023 04:27:20.
cdn.cls.php File 13283 bytes December 16 2023 04:27:20.
cloud.cls.php File 41024 bytes December 16 2023 04:27:20.
conf.cls.php File 19024 bytes December 16 2023 04:27:20.
control.cls.php File 20956 bytes December 16 2023 04:27:20.
core.cls.php File 20072 bytes December 16 2023 04:27:20.
crawler-map.cls.php File 13627 bytes December 16 2023 04:27:20.
crawler.cls.php File 33387 bytes December 16 2023 04:27:20.
css.cls.php File 13085 bytes December 16 2023 04:27:20.
data.cls.php File 17246 bytes December 16 2023 04:27:20.
data.upgrade.func.php File 21885 bytes December 16 2023 04:27:20.
db-optm.cls.php File 9397 bytes December 16 2023 04:27:20.
debug2.cls.php File 12112 bytes December 16 2023 04:27:20.
doc.cls.php File 4851 bytes December 16 2023 04:27:20.
error.cls.php File 6559 bytes December 16 2023 04:27:20.
esi.cls.php File 27200 bytes December 16 2023 04:27:20.
file.cls.php File 10378 bytes December 16 2023 04:27:20.
gui.cls.php File 27703 bytes December 16 2023 04:27:20.
health.cls.php File 2962 bytes December 16 2023 04:27:20.
htaccess.cls.php File 24892 bytes December 16 2023 04:27:20.
img-optm.cls.php File 59114 bytes December 16 2023 04:27:20.
import.cls.php File 4247 bytes December 16 2023 04:27:20.
instance.cls.php File 154 bytes December 16 2023 04:27:20.
lang.cls.php File 15913 bytes December 16 2023 04:27:20.
localization.cls.php File 3470 bytes December 16 2023 04:27:20.
media.cls.php File 28278 bytes December 16 2023 04:27:20.
metabox.cls.php File 4306 bytes December 16 2023 04:27:20.
object-cache.cls.php File 15860 bytes December 16 2023 04:27:20.
object.lib.php File 34784 bytes December 16 2023 04:27:20.
optimize.cls.php File 37336 bytes December 16 2023 04:27:20.
optimizer.cls.php File 8899 bytes December 16 2023 04:27:20.
placeholder.cls.php File 14412 bytes December 16 2023 04:27:20.
preset.cls.php File 5558 bytes December 16 2023 04:27:20.
purge.cls.php File 30499 bytes December 16 2023 04:27:20.
report.cls.php File 5419 bytes December 16 2023 04:27:20.
rest.cls.php File 7918 bytes December 16 2023 04:27:20.
root.cls.php File 12893 bytes December 16 2023 04:27:20.
router.cls.php File 17774 bytes December 16 2023 04:27:20.
str.cls.php File 1198 bytes December 16 2023 04:27:20.
tag.cls.php File 8789 bytes December 16 2023 04:27:20.
task.cls.php File 5379 bytes December 16 2023 04:27:20.
tool.cls.php File 3370 bytes December 16 2023 04:27:20.
ucss.cls.php File 14734 bytes December 16 2023 04:27:20.
utility.cls.php File 21126 bytes December 16 2023 04:27:20.
vary.cls.php File 19628 bytes December 16 2023 04:27:20.
vpi.cls.php File 7585 bytes December 16 2023 04:27:20.

Reading File: //usr/src/litespeed-wp-plugin/6.0.0.1//litespeed-cache/src//preset.cls.php

<?php
/**
 * The preset class.
 *
 * @since  5.3.0
 */
namespace LiteSpeed;

defined('WPINC') || exit();

class Preset extends Import
{
	protected $_summary;

	const MAX_BACKUPS = 10;

	const TYPE_APPLY = 'apply';
	const TYPE_RESTORE = 'restore';

	const STANDARD_DIR = LSCWP_DIR . 'data/preset';
	const BACKUP_DIR = LITESPEED_STATIC_DIR . '/auto-backup';

	/**
	 * Returns sorted backup names
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public static function get_backups()
	{
		self::init_filesystem();
		global $wp_filesystem;

		$backups = array_map(
			function ($path) {
				return self::basename($path['name']);
			},
			$wp_filesystem->dirlist(self::BACKUP_DIR) ?: array()
		);
		rsort($backups);

		return $backups;
	}

	/**
	 * Removes extra backup files
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public static function prune_backups()
	{
		$backups = self::get_backups();
		global $wp_filesystem;

		foreach (array_slice($backups, self::MAX_BACKUPS) as $backup) {
			$path = self::get_backup($backup);
			$wp_filesystem->delete($path);
			Debug2::debug('[Preset] Deleted old backup from ' . $backup);
		}
	}

	/**
	 * Returns a settings file's extensionless basename given its filesystem path
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public static function basename($path)
	{
		return basename($path, '.data');
	}

	/**
	 * Returns a standard preset's path given its extensionless basename
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public static function get_standard($name)
	{
		return path_join(self::STANDARD_DIR, $name . '.data');
	}

	/**
	 * Returns a backup's path given its extensionless basename
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public static function get_backup($name)
	{
		return path_join(self::BACKUP_DIR, $name . '.data');
	}

	/**
	 * Initializes the global $wp_filesystem object and clears stat cache
	 *
	 * @since  5.3.0
	 */
	static function init_filesystem()
	{
		require_once ABSPATH . '/wp-admin/includes/file.php';
		\WP_Filesystem();
		clearstatcache();
	}

	/**
	 * Init
	 *
	 * @since  5.3.0
	 */
	public function __construct()
	{
		Debug2::debug('[Preset] Init');
		$this->_summary = self::get_summary();
	}

	/**
	 * Applies a standard preset's settings given its extensionless basename
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public function apply($preset)
	{
		$this->make_backup($preset);

		$path = self::get_standard($preset);
		$result = $this->import_file($path) ? $preset : 'error';

		$this->log($result);
	}

	/**
	 * Restores settings from the backup file with the given timestamp, then deletes the file
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public function restore($timestamp)
	{
		$backups = array();
		foreach (self::get_backups() as $backup) {
			if (preg_match('/^backup-' . $timestamp . '(-|$)/', $backup) === 1) {
				$backups[] = $backup;
			}
		}

		if (empty($backups)) {
			$this->log('error');
			return;
		}

		$backup = $backups[0];
		$path = self::get_backup($backup);

		if (!$this->import_file($path)) {
			$this->log('error');
			return;
		}

		self::init_filesystem();
		global $wp_filesystem;

		$wp_filesystem->delete($path);
		Debug2::debug('[Preset] Deleted most recent backup from ' . $backup);

		$this->log('backup');
	}

	/**
	 * Saves current settings as a backup file, then prunes extra backup files
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public function make_backup($preset)
	{
		$backup = 'backup-' . time() . '-before-' . $preset;
		$data = $this->export(true);

		$path = self::get_backup($backup);
		File::save($path, $data, true);
		Debug2::debug('[Preset] Backup saved to ' . $backup);

		self::prune_backups();
	}

	/**
	 * Tries to import from a given settings file
	 *
	 * @since  5.3.0
	 */
	function import_file($path)
	{
		$debug = function ($result, $name) {
			$action = $result ? 'Applied' : 'Failed to apply';
			Debug2::debug('[Preset] ' . $action . ' settings from ' . $name);
			return $result;
		};

		$name = self::basename($path);
		$contents = file_get_contents($path);

		if (false === $contents) {
			Debug2::debug('[Preset] ❌ Failed to get file contents');
			return $debug(false, $name);
		}

		$parsed = array();
		try {
			// Check if the data is v4+
			if (strpos($contents, '["_version",') === 0) {
				$contents = explode("\n", $contents);
				foreach ($contents as $line) {
					$line = trim($line);
					if (empty($line)) {
						continue;
					}
					list($key, $value) = json_decode($line, true);
					$parsed[$key] = $value;
				}
			} else {
				$parsed = json_decode(base64_decode($contents), true);
			}
		} catch (\Exception $ex) {
			Debug2::debug('[Preset] ❌ Failed to parse serialized data');
			return $debug(false, $name);
		}

		if (empty($parsed)) {
			Debug2::debug('[Preset] ❌ Nothing to apply');
			return $debug(false, $name);
		}

		$this->cls('Conf')->update_confs($parsed);

		return $debug(true, $name);
	}

	/**
	 * Updates the log
	 *
	 * @since  5.3.0
	 */
	function log($preset)
	{
		$this->_summary['preset'] = $preset;
		$this->_summary['preset_timestamp'] = time();
		self::save_summary();
	}

	/**
	 * Handles all request actions from main cls
	 *
	 * @since  5.3.0
	 * @access public
	 */
	public function handler()
	{
		$type = Router::verify_type();

		switch ($type) {
			case self::TYPE_APPLY:
				$this->apply(!empty($_GET['preset']) ? $_GET['preset'] : false);
				break;

			case self::TYPE_RESTORE:
				$this->restore(!empty($_GET['timestamp']) ? $_GET['timestamp'] : false);
				break;

			default:
				break;
		}

		Admin::redirect();
	}
}

SILENT KILLER Tool