403Webshell
Server IP : 185.252.147.100  /  Your IP : 216.73.217.33
Web Server : nginx/1.27.3
System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
User : mitr ( 1000)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/html/tour.mitrofanov.ru/public/wp-content/plugins/mihdan-index-now/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/html/tour.mitrofanov.ru/public/wp-content/plugins/mihdan-index-now/src/Cron.php
<?php
namespace Mihdan\IndexNow;

use Mihdan\IndexNow\Logger\Logger;
use Mihdan\IndexNow\Views\WPOSA;

class Cron {
	public const EVENT_NAME = 'mihdan-index-now__clear-log';

	/**
	 * Logger instance.
	 *
	 * @var Logger $logger
	 */
	private $logger;

	/**
	 * WPOSA instance.
	 *
	 * @var WPOSA $wposa
	 */
	private $wposa;

	/**
	 * Cron constructor.
	 *
	 * @param Logger $logger Logger instance.
	 * @param WPOSA  $wposa
	 */
	public function __construct( Logger $logger, WPOSA $wposa ) {
		$this->logger = $logger;
		$this->wposa  = $wposa;
	}
	public function setup_hooks() {
		add_action( 'admin_init', [ $this, 'add_task' ] );
		add_action( self::EVENT_NAME, [ $this, 'clear_log' ] );
	}

	public function add_task() {
		if ( ! wp_next_scheduled( self::EVENT_NAME ) ) {
			wp_schedule_event( time(), 'hourly', self::EVENT_NAME );
		}
	}

	/**
	 * Clear log table.
	 *
	 * @return bool
	 */
	public function clear_log(): bool {
		global $wpdb;

		$lifetime   = $this->wposa->get_option( 'lifetime', 'logs', 7 );
		$table_name = $this->logger->get_logger_table_name();

		$wpdb->query(
			$wpdb->prepare( "DELETE FROM {$table_name} WHERE DATEDIFF(NOW(), created_at)>=%d", $lifetime )
		);

		return true;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit